mirror of
https://git.coom.tech/fuckjannies/lolipiss.git
synced 2024-07-01 15:03:10 +00:00
Actually implement uploads for lolisafe-based hosts
This commit is contained in:
parent
986b687820
commit
0741db09e2
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name PNGExtraEmbed
|
||||
// @namespace https://coom.tech/
|
||||
// @version 0.143
|
||||
// @version 0.144
|
||||
// @description uhh
|
||||
// @author You
|
||||
// @match https://boards.4channel.org/*
|
||||
|
|
51
main.user.js
51
main.user.js
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name PNGExtraEmbed
|
||||
// @namespace https://coom.tech/
|
||||
// @version 0.143
|
||||
// @version 0.144
|
||||
// @description uhh
|
||||
// @author You
|
||||
// @match https://boards.4channel.org/*
|
||||
|
@ -11465,19 +11465,32 @@
|
|||
|
||||
// src/filehosts.ts
|
||||
init_esbuild_inject();
|
||||
var lolisafe = (domain) => ({
|
||||
domain,
|
||||
async uploadFile(f) {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
function parseForm(data) {
|
||||
const form = new FormData();
|
||||
Object.entries(data).filter(([key, value]) => value !== null).map(([key, value]) => form.append(key, value));
|
||||
return form;
|
||||
}
|
||||
var catbox = (domain) => ({
|
||||
var lolisafe = (domain, serving = domain) => ({
|
||||
domain,
|
||||
serving,
|
||||
async uploadFile(f) {
|
||||
const resp = await GM_fetch(`https://${domain}/api/upload`, {
|
||||
headers: {
|
||||
accept: "application/json"
|
||||
},
|
||||
"body": parseForm({
|
||||
reqtype: "fileupload",
|
||||
"files[]": new File([f], "f.pee")
|
||||
}),
|
||||
"method": "POST"
|
||||
});
|
||||
const res = await resp.json();
|
||||
return res.files.map((e) => e.url)[0];
|
||||
}
|
||||
});
|
||||
var catbox = (domain, serving) => ({
|
||||
domain,
|
||||
serving,
|
||||
async uploadFile(inj) {
|
||||
const resp = await GM_fetch(`https://${domain}/user/api.php`, {
|
||||
method: "POST",
|
||||
|
@ -11490,13 +11503,10 @@
|
|||
}
|
||||
});
|
||||
var filehosts = [
|
||||
catbox("catbox.moe"),
|
||||
lolisafe("zz.ht"),
|
||||
catbox("catbox.moe", "files.catbox.moe"),
|
||||
lolisafe("zz.ht", "z.zz.fo"),
|
||||
lolisafe("imouto.kawaii.su"),
|
||||
lolisafe("take-me-to.space"),
|
||||
lolisafe("loli.solutions"),
|
||||
lolisafe("loli.graphics"),
|
||||
lolisafe("sucks-to-b.eu")
|
||||
lolisafe("take-me-to.space")
|
||||
];
|
||||
|
||||
// src/utils.ts
|
||||
|
@ -11566,7 +11576,7 @@
|
|||
return new Blob([ret]);
|
||||
};
|
||||
var decodeCoom3Payload = async (buff) => {
|
||||
const allowed_domains = filehosts.map((e) => e.domain);
|
||||
const allowed_domains = filehosts.map((e) => e.serving.replaceAll(".", "\\."));
|
||||
const pees = buff.toString().split(" ").slice(0, csettings2.maxe).filter((e) => allowed_domains.some((v) => e.match(`https://(.*\\.)?${v}/`)));
|
||||
return (await Promise.all(pees.map(async (pee) => {
|
||||
try {
|
||||
|
@ -18765,17 +18775,6 @@
|
|||
}
|
||||
post.setAttribute("data-processed", "true");
|
||||
}
|
||||
if (window["pagemode"]) {
|
||||
onload = () => {
|
||||
document.body.innerHTML = "";
|
||||
new App_default({
|
||||
target: document.body
|
||||
});
|
||||
setTimeout(() => {
|
||||
document.dispatchEvent(new CustomEvent("penis"));
|
||||
}, 30);
|
||||
};
|
||||
}
|
||||
})();
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
import { GM_fetch } from "./requests";
|
||||
|
||||
const lolisafe = (domain: string) => ({
|
||||
domain,
|
||||
async uploadFile(f: Blob) {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
function parseForm(data: object) {
|
||||
const form = new FormData();
|
||||
|
||||
|
@ -17,8 +10,28 @@ function parseForm(data: object) {
|
|||
return form;
|
||||
}
|
||||
|
||||
const catbox = (domain: string) => ({
|
||||
export const lolisafe = (domain: string, serving = domain) => ({
|
||||
domain,
|
||||
serving,
|
||||
async uploadFile(f: Blob) {
|
||||
const resp = await GM_fetch(`https://${domain}/api/upload`, {
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
},
|
||||
"body": parseForm({
|
||||
reqtype: 'fileupload',
|
||||
'files[]': new File([f], 'f.pee')
|
||||
}),
|
||||
"method": "POST",
|
||||
});
|
||||
const res = (await resp.json()) as { success: boolean, files: { url: string, name: string, size: number }[] };
|
||||
return res.files.map(e => e.url)[0];
|
||||
}
|
||||
});
|
||||
|
||||
export const catbox = (domain: string, serving: string) => ({
|
||||
domain,
|
||||
serving,
|
||||
async uploadFile(inj: Blob) {
|
||||
const resp = await GM_fetch(`https://${domain}/user/api.php`, {
|
||||
method: 'POST',
|
||||
|
@ -33,15 +46,13 @@ const catbox = (domain: string) => ({
|
|||
|
||||
export type API = {
|
||||
domain: string;
|
||||
serving: string;
|
||||
uploadFile(f: Blob): Promise<string>;
|
||||
}
|
||||
|
||||
export const filehosts: API[] = [
|
||||
catbox('catbox.moe'),
|
||||
lolisafe('zz.ht'),
|
||||
catbox('catbox.moe', 'files.catbox.moe'),
|
||||
lolisafe('zz.ht', 'z.zz.fo'),
|
||||
lolisafe('imouto.kawaii.su'),
|
||||
lolisafe('take-me-to.space'),
|
||||
lolisafe('loli.solutions'),
|
||||
lolisafe('loli.graphics'),
|
||||
lolisafe('sucks-to-b.eu')
|
||||
];
|
15
src/main.ts
15
src/main.ts
|
@ -22,6 +22,7 @@ import NotificationsHandler from './Components/NotificationsHandler.svelte';
|
|||
import { buildPeeFile, fireNotification } from "./utils";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { getQueryProcessor, QueryProcessor } from "./websites";
|
||||
import { lolisafe } from "./filehosts";
|
||||
|
||||
export interface ImageProcessor {
|
||||
skip?: true;
|
||||
|
@ -484,16 +485,16 @@ function processAttachments(post: HTMLDivElement, ress: [EmbeddedFile, boolean][
|
|||
// const resbuf = async (s: EmbeddedFile['data']) => typeof s != "string" && (Buffer.isBuffer(s) ? s : await s());
|
||||
// const container = document.getElementById("container") as HTMLInputElement;
|
||||
// container.onchange = async () => {
|
||||
// const result = document.getElementById("result") as HTMLImageElement;
|
||||
// const output = await convertToPng(container.files![0]);
|
||||
// if (!output)
|
||||
// return;
|
||||
// result.src = URL.createObjectURL(output);
|
||||
// const api = lolisafe('zz.ht', 'z.zz.fo');
|
||||
// const file = container.files![0];
|
||||
// const blo = new Blob([file], {type: 'application/octet-stream'});
|
||||
// const link = await api.uploadFile(blo);
|
||||
// console.log(link);
|
||||
// };
|
||||
// };
|
||||
//}
|
||||
|
||||
//if ((window as any)['pagemode']) {
|
||||
//
|
||||
////if ((window as any)['pagemode']) {
|
||||
// onload = () => {
|
||||
// const extraction = document.getElementById("extraction") as HTMLInputElement;
|
||||
// extraction.onchange = async () => {
|
||||
|
|
10
src/utils.ts
10
src/utils.ts
|
@ -96,8 +96,14 @@ rest: [X bytes of thumbnail data])[file bytes]
|
|||
&4 => has thumbnail
|
||||
*/
|
||||
export const decodeCoom3Payload = async (buff: Buffer) => {
|
||||
const allowed_domains = filehosts.map(e => e.domain);
|
||||
const pees = buff.toString().split(' ').slice(0, csettings.maxe).filter(e => allowed_domains.some(v => e.match(`https://(.*\\.)?${v}/`)));
|
||||
const allowed_domains = filehosts.map(e => e.serving.replaceAll('.', '\\.'));
|
||||
const pees = buff
|
||||
.toString()
|
||||
.split(' ')
|
||||
.slice(0, csettings.maxe)
|
||||
.filter(e => allowed_domains
|
||||
.some(v => e.match(`https://(.*\\.)?${v}/`)));
|
||||
|
||||
return (await Promise.all(pees.map(async pee => {
|
||||
try {
|
||||
const headers = headerStringToObject(await GM_head(pee));
|
||||
|
|
Loading…
Reference in New Issue
Block a user