commit 725cae593c62b535ab2f60b2313008a2003f6ae7 Author: ewin Date: Mon Sep 22 10:07:11 2025 -0400 funny bit diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..b009dfb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/* diff --git a/README.md b/README.md new file mode 100644 index 0000000..4683b70 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +terrible terrible terrible do not use this diff --git a/fix.mjs b/fix.mjs new file mode 100644 index 0000000..d7b0347 --- /dev/null +++ b/fix.mjs @@ -0,0 +1,27 @@ +import {createServer} from 'node:http'; + +const sites = [ + { + pattern: /^(?:https?:\/\/)?(?:www\.)pixiv\.net\/\w+\/artworks\/(\d+)(?:#(\d+))?/i, + redirect: match => `https://pixiv.kmn5.li/${match[1]}${match[2] ? `_${parseInt(match[2], 10) - 1}` : ''}`, + }, + { + pattern: /^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)\/(.+)/, + redirect: match => `https://fxtwitter.com/${match[1]}`, + }, + // idk send me more of these +]; + +createServer(async (request, response) => { + const error = () => response.writeHead(400).end('whar'); + if (request.method !== 'GET') return error(); + const input = request.url.slice(1); + console.log(input); + for (const site of sites) { + let match = input.match(site.pattern); + if (!match) continue; + response.writeHead(302, {'Location': site.redirect(match)}).end(); + return; + } + return error(); +}).listen(process.env.PORT || 80);