Compare commits

..

2 Commits

Author SHA1 Message Date
fad66e6945 handle payload error 2024-05-20 14:14:55 -07:00
e3f39e37a1 add warnings 2024-05-20 14:06:46 -07:00

View File

@ -74,7 +74,9 @@ export async function pixivToPleroma(illust_id) {
try { try {
var {illust, images} = await downloadPixivIllust(illust_id); var {illust, images} = await downloadPixivIllust(illust_id);
await postStatus({ await postStatus({
status: `https://www.pixiv.net/en/artworks/${illust_id}`, status: `https://www.pixiv.net/en/artworks/${illust_id}`
+ ((images.length > 4) ? '\n⚠ >4 img' : '')
+ ((illust.illustType == 2) ? '\n⚠ ugoira conversion not implemented' : ''),
files: images, files: images,
visibility: "unlisted", visibility: "unlisted",
sensitive: Boolean(illust.xRestrict) sensitive: Boolean(illust.xRestrict)
@ -94,8 +96,9 @@ if (import.meta.main) Deno.serve({
hostname: "127.0.0.1" hostname: "127.0.0.1"
}, async (req, info) => { }, async (req, info) => {
var {pathname} = new URL(req.url); var {pathname} = new URL(req.url);
console.log(info.remoteAddr.hostname, pathname); console.log(info.remoteAddr.hostname, req.headers.get('x-forwarded-for'), pathname);
try {
switch (pathname) { switch (pathname) {
case "/ajax/illusts/bookmarks/add": case "/ajax/illusts/bookmarks/add":
var payload = await req.clone().json(); var payload = await req.clone().json();
@ -124,6 +127,10 @@ if (import.meta.main) Deno.serve({
} }
break; break;
} }
} catch (error) {
console.error("payload error:", error.stack);
}
return fetch("https://www.pixiv.net"+pathname, { return fetch("https://www.pixiv.net"+pathname, {
method: req.method, method: req.method,
headers: req.headers, headers: req.headers,