Can embed any file in a PNG/WebM/GIF/JPEG and upload it to a third-party host through 4chan
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

2 years ago
/* eslint-disable */
const { writeFileSync, readFileSync } = require('fs');
const extheader = `// ==UserScript==
// @name PNGFileEmbed
// @namespace https://tampermonkey.net/
// @version 0.1
// @description uhh
// @author You
// @match https://boards.4channel.org/*/thread/*
// @match https://boards.4chan.org/*/thread/*
2 years ago
// @icon https://www.google.com/s2/favicons?domain=4channel.org
// @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js
2 years ago
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
2 years ago
// @run-at document-start
// @connect 4chan.org
// @connect 4channel.org
// @connect i.4cdn.org
// ==/UserScript==
`;
(async () => {
let res = await require('esbuild').build({
2 years ago
entryPoints: ['src/main.ts'],
bundle: true,
outfile: 'dist/main.js',
define: {
global: 'window'
},
inject: ['./esbuild.inject.js'],
metafile: true
2 years ago
});
console.log(Object.entries(res.metafile.inputs).sort((a, b) => a[1].bytes - b[1].bytes).map(e => `${e[0]} -> ${e[1].bytes}`).join('\n'));
2 years ago
writeFileSync('./main.user.js', extheader + readFileSync('./dist/main.js'));
})();