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