The captcha solver made by and for japanese high school girls!
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.
 
 
 

143 lines
3.5 KiB

/* eslint-disable */
import { spawnSync } from "child_process";
import { writeFileSync, readFileSync, copyFileSync } from "fs";
import esbuild from "esbuild";
import webExt from "web-ext";
let res = spawnSync("git", ["rev-list", "--count", "HEAD"]);
let rev = +res.stdout;
const domains = [
"https://*.4chan.org/*",
"https://*.4channel.org/*",
"https://sys.4chan.org/*",
];
const manif = {
manifest_version: 2,
browser_specific_settings: {},
name: "Joshi Koukousei Captcha Service",
description: "The captcha solver made by and for japanese high school girls",
version: "0." + rev,
icons: {
64: "1449696017588.png",
},
permissions: [...domains],
content_scripts: [
{
matches: domains,
css: [],
run_at: "document_end",
js: ["polyfill.min.js", "dist/main.js"],
},
],
web_accessible_resources: ["*.html", "*.js", "*.json", "*.bin", "*.wasm"],
// "background": {
// persistent: true,
// "scripts": [
// "polyfill.min.js",
// "browser-polyfill.min.js",
// "dist/background.js"
// ]
// }
};
(async () => {
let res;
res = await esbuild.build({
entryPoints: ["src/main.ts"],
bundle: true,
treeShaking: true,
outdir: "./firefox/dist",
// outfile: "./firefox/dist/main.js",
define: {
global: "window",
execution_mode: '"ff_api"',
manifest: manif.version,
isBackground: "false",
BUILD_VERSION: JSON.stringify([0, rev]),
},
// inject: ["./esbuild.inject.js"],
plugins: [],
loader: { ".bin": "binary", ".wasm": "binary" },
metafile: true,
});
console.log(res.metafile.inputs);
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")
);
/*
res = await esbuild.build({
entryPoints: ["src/background.ts"],
bundle: true,
treeShaking: true,
outfile: "./firefox/dist/background.js",
define: {
global: "window",
execution_mode: '"ff_api"',
manifest: manif.version,
isBackground: "true",
BUILD_VERSION: JSON.stringify([0, rev]),
},
inject: ["./esbuild.inject.js"],
metafile: true,
});
console.log(res.metafile.inputs);
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")
);
*/
writeFileSync("./firefox/manifest.json", JSON.stringify(manif, null, 2));
copyFileSync("./logo.png", "./firefox/1449696017588.png");
copyFileSync("./src/group1-shard1of1.bin", "./firefox/group1-shard1of1.bin");
copyFileSync(
"./src/tfjs-backend-wasm-threaded-simd.wasm",
"./firefox/tfjs-backend-wasm-threaded-simd.wasm"
);
copyFileSync(
"./src/tfjs-backend-wasm-simd.wasm",
"./firefox/tfjs-backend-wasm-simd.wasm"
);
copyFileSync(
"./src/tfjs-backend-wasm.wasm",
"./firefox/tfjs-backend-wasm.wasm"
);
res = await webExt.cmd.build({
sourceDir: "./firefox/",
artifactsDir: ".",
filename: `jkcs-${manif.version}.xpi`,
overwriteDest: true,
});
console.log(res);
/*
writeFileSync(
"./firefox_update.json",
JSON.stringify({
addons: {
"{[email protected]}": {
updates: [
{
version: manif.version,
update_link: `https://git.coom.tech/araragi/JKCS/raw/branch/master/jkcs-${manif.version}.xpi`,
},
],
},
},
})
);
*/
})();