Browse Source

Updooting stuff take 2

This time I know how to use branches
pull/53/head
Araragi 1 year ago
parent
commit
c95d0fcb9e
  1. 77
      README.md
  2. 2
      build-chrome.js
  3. 2
      build-ff.js
  4. 5357
      package-lock.json
  5. 44
      package.json
  6. 5
      src/Components/App.svelte
  7. 2
      src/background.ts
  8. 2
      src/filehosts.ts
  9. 3
      src/gif.ts
  10. 2
      src/platform.ts
  11. 2
      src/png.ts
  12. 10
      src/processor.worker.ts
  13. 46
      src/stores.ts
  14. 6
      tsconfig.json

77
README.md

@ -11,40 +11,33 @@ Also supports desuarchive.
Kohlchan support is being worked on. Right now works barely on Chrome.
There's no server-side caching for kohlchan. Buttons to embed will only be added to the quick reply form.
Supported boards:
- [x] 4chan
- [x] FoolFuuka (desuarchive, b4k, etc)
- [x] Kohlchan (WIP)
How to Install
==============
Note: 4chanX isn't a hard requirement, just recommended because it's overall a nicer experience. If you don't want to use 4chanX, make sure the native 4chan extension is enabled in your settings.
## Teh olde way
- Make sure you're using a decent Webkit-based browser (Chromium derivatives) or Firefox.
- [Install ViolentMonkey](https://violentmonkey.github.io/get-it/) (it is preferable to TamperMonkey(closed source) and GreaseMonkey(abandonned shit)), use [ViolentMonkey Beta](https://violentmonkey.github.io/get-it/#beta-release) if you want to spite the b4k meanie admin (based & redpilled). Be sure to read the trouble shooting section to know how to set this up.
- [Install 4chanX (recommended)](https://www.4chan-x.net/builds/4chan-X.user.js)
- Use the prebuilt [main.user.js](https://git.coom.tech/coomdev/PEE/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/main.user.js)
- Reorder PEE and 4chanX in the dashboard so that PEE runs BEFORE 4chanX (or add blob: to your 4chanX JS whitelist)
Note for 4chan: 4chanX isn't a hard requirement, just recommended because it's overall a nicer experience. If you don't want to use 4chanX, make sure the native 4chan extension is enabled in your settings.
## The newer way (WIP)
## PEE 4 Dummies
Please report any issue you have with those (only for mainstream browsers)
Also, use this if you plan to use b4k's archive.
- [Install 4chanX (recommended)](https://www.4chan-x.net/builds/4chan-X.user.js)
- [Install JKCS (recommended)](https://git.coom.tech/araragi/JKCS/src/branch/master/README.md)
- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.325.xpi) or Chrome-based (Down for "maintainance"))
- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.325.xpi) or Chrome-based (See "Side Loading")
For FF users, the extension is signed so you can just drag and drop it on your about:addons tab.
Chrom* users can now install directly from the chrome webstore.
Known bugs:
- JPEG embedding might not work with some very big files (> 1MB).
- GIFs and WebMs got patched :(
- 4chan: GIFs and WebMs got patched :(
### Side loading
Because publishing on the Chrome WebStore is slow, you should consider side loading the extension.
- [Download](https://git.coom.tech/fuckjannies/lolipiss/archive/%E4%B8%AD%E5%87%BA%E3%81%97.zip) this repo and extract it somewhere
- Type `chrome://extensions` in your address bar
- Enable **Developer Mode**
@ -52,51 +45,7 @@ Because publishing on the Chrome WebStore is slow, you should consider side load
- Select the `chrome` folder from the zip you extracted earlier.
- Optional: Do the same for the `pee-companion` folder instead of `chrome` if you plan to use b4k and/or desuarchive.
If none of the above works for you, switch back to the userscript version and open an issue here.
### Third Eye setup
For compliance with CWS rules, PEE doesn't come with preconfigured domains for Third Eye. Here are the old settings in case you want to reproduce them. This shouldn't concern old time users as you already have those in your settings, unless explicitely removed.
Copy paste this and click "bulk-import"
```
[
{"name": "Gelbooru",
"domain": "gelbooru.com",
"endpoint": "/index.php?page=dapi&s=post&q=index&json=1&tags=md5:",
"view": "https://gelbooru.com/index.php?page=post&s=view&id="
},
{"name": "Yandere",
"domain": "yande.re",
"endpoint": "/post.json?tags=md5:",
"view": "https://yande.re/post/show/"
},
{"name": "Sankaku",
"domain": "capi-v2.sankakucomplex.com",
"endpoint": "/posts/keyset?tags=md5:",
"view": "https://chan.sankakucomplex.com/post/show/"
},
{"name": "Rule34",
"domain": "api.rule34.xxx",
"endpoint": "/index.php?page=dapi&s=post&q=index&json=1&tags=md5:",
"view": "https://rule34.xxx/index.php?page=post&s=view&id="
},
{"name": "Danbooru",
"domain": "danbooru.donmai.us",
"endpoint": "/posts.json?tags=md5:",
"view": "https://danbooru.donmai.us/posts/"
},
{"name": "Lolibooru",
"domain": "lolibooru.moe",
"endpoint": "/post.json?tags=md5:",
"view": "https://lolibooru.moe/post/show/"
},
{"name": "ATFbooru",
"domain": "booru.allthefallen.moe",
"endpoint": "/posts.json?tags=md5:",
"view": "https://booru.allthefallen.moe/posts/"
}]
```
If none of the above works for you, open an issue here.
How to Build
============
@ -105,8 +54,10 @@ How to Build
`npm i` and
`npm run build` to build the userscript version.
`npm run build` to build the userscript version. (!!! DEPRECIATED !!!)
`npm run build_chrome` to build the chromium webextension.
`npm run build_ff` to build the firefox webextension. (You'll have to do the signing yourself, though)
How to use
@ -238,4 +189,4 @@ We reached 1000+ downloads on the Chrome WebStore.
![ack](842173-2.png)
Original character drawn by monmon.
Original character drawn by monmon.

2
build-chrome.js

@ -107,7 +107,7 @@ const manif3 = {
minify: false,
bundle: true,
treeShaking: true,
target: "es2021",
target: "es2022",
loader: {
'.css': 'text',
'.png': 'binary'

2
build-ff.js

@ -121,7 +121,7 @@ const manif = {
minify: false,
bundle: true,
treeShaking: true,
target: "es2021",
target: "es2022",
loader: {
'.css': 'text',
'.png': 'binary'

5357
package-lock.json

File diff suppressed because it is too large

44
package.json

@ -15,7 +15,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@astronautlabs/bitstream": "^4.1.2",
"@astronautlabs/bitstream": "^4.1.3",
"assert-browserify": "^2.0.0",
"base58": "^2.0.1",
"blockhash": "^0.2.0",
@ -23,41 +23,41 @@
"browserify-zlib": "^0.2.0",
"bs58": "^5.0.0",
"buffer": "^6.0.3",
"crc-32": "^1.2.0",
"crc-32": "^1.2.2",
"events": "^3.3.0",
"f5stegojs": "^0.1.2",
"file-type": "^17.0.2",
"hls.js": "^1.1.5",
"image-hash": "^5.0.1",
"jpeg-js": "^0.4.3",
"jsdom": "^19.0.0",
"linkify-string": "^3.0.4",
"file-type": "^18.0.0",
"hls.js": "^1.2.9",
"image-hash": "^5.3.1",
"jpeg-js": "^0.4.4",
"jsdom": "^20.0.3",
"linkify-string": "^4.0.2",
"lodash": "^4.17.21",
"mp4box": "^0.5.2",
"path-browserify": "^1.0.1",
"png-js": "^1.0.0",
"readable-stream": "^3.6.0",
"readable-stream": "^4.2.0",
"socks-proxy-agent": "^7.0.0",
"ts-ebml": "^2.0.2",
"util": "^0.12.4"
"util": "^0.12.5"
},
"devDependencies": {
"@tsconfig/svelte": "^3.0.0",
"@types/jsdom": "^16.2.14",
"@types/lodash": "^4.14.181",
"@types/jsdom": "^20.0.1",
"@types/lodash": "^4.14.191",
"@types/tampermonkey": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"crx": "^5.0.1",
"esbuild": "^0.14.48",
"esbuild-css-modules-plugin": "^2.0.9",
"esbuild": "^0.16.10",
"esbuild-css-modules-plugin": "^2.6.3",
"esbuild-plugin-inline-worker": "^0.1.1",
"esbuild-svelte": "^0.6.3",
"eslint": "^8.6.0",
"svelte": "^3.44.3",
"svelte-check": "^2.2.11",
"svelte-preprocess": "^4.10.1",
"typescript": "^4.5.4",
"web-ext": "^7.1.1",
"esbuild-svelte": "^0.7.3",
"eslint": "^8.30.0",
"svelte": "^3.55.0",
"svelte-check": "^2.10.3",
"svelte-preprocess": "^5.0.0",
"typescript": "^4.9.4",
"web-ext": "^7.4.0",
"web-ext-types": "^3.2.1"
},
"browser": {

5
src/Components/App.svelte

@ -134,10 +134,7 @@
<div class="content">
<h1>PEE Settings 0.{rev}</h1>
<h4>
<a href="https://2chen.moe/tech/">Join us on 2chen!</a>
<a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md"
>Install JKCS!</a
>
<a href="https://2chen.moe/tech/">Join us on 2chen!</a>
</h4>
<hr />
<Tabs>

2
src/background.ts

@ -112,7 +112,7 @@ const bgCorsFetch = async (c: MessagePort,
}
};
const reader = k.body?.getReader();
let res: ReadableStreamDefaultReadResult<Uint8Array>;
let res: ReadableStreamReadResult<Uint8Array>;
for (; ;) {
res = await reader!.read();
if (res.done) break;

2
src/filehosts.ts

@ -70,4 +70,4 @@ export const filehosts: API[] = [
catbox('pomf.moe', 'a.pomf.cat'),
lolisafe('take-me-to.space'),
lolisafe('zz.ht', 'z.zz.fo'),
];
];

3
src/gif.ts

@ -1,5 +1,6 @@
import { Buffer } from "buffer";
import type { EmbeddedFile, ImageProcessor } from "./main";
import type { EmbeddedFile } from "./main";
import type { ImageProcessor } from "./processor.worker";
import { BufferWriteStream } from "./png";
import { decodeCoom3Payload, uploadFiles } from "./utils";

2
src/platform.ts

@ -336,7 +336,7 @@ export const corsFetch = async (input: string, init?: RequestInit, lsn?: EventTa
const r = rs.getReader();
await sendCmd({ name: 'fullyRead', fid: id });
const abs: Uint8Array[] = [];
let res: ReadableStreamDefaultReadResult<Uint8Array>;
let res: ReadableStreamReadResult<Uint8Array>;
do {
res = await r.read();
if (res.done) break;

2
src/png.ts

@ -1,6 +1,6 @@
import { buf } from "crc-32";
import { Buffer } from "buffer";
import type { ImageProcessor } from "./main";
import type { ImageProcessor } from "./processor.worker";
export type PNGChunk = [
string, // name

10
src/processor.worker.ts

@ -1,4 +1,4 @@
/// <reference lib="ES2021" />
/// <reference lib="ES2022" />
/// <reference lib="webworker" />
import * as platform from './platform';
@ -127,13 +127,13 @@ const processImage = async (srcs: AsyncGenerator<string, void, void>, fn: string
return;
cumul = Buffer.alloc(0);
let found: boolean | undefined;
let chunk: ReadableStreamDefaultReadResult<Buffer> = { done: true };
let chunk: ReadableStreamReadResult<Buffer> = { done: true };
do {
const { value, done } = await iter.next(typeof found === "boolean");
if (done) {
chunk = { done: true } as ReadableStreamDefaultReadDoneResult;
chunk = { done: true } as ReadableStreamReadDoneResult<Buffer>;
} else {
chunk = { done: false, value } as ReadableStreamDefaultReadValueResult<Buffer>;
chunk = { done: false, value } as ReadableStreamReadValueResult<Buffer>;
cumul = Buffer.concat([cumul, value!]);
const v = await proc.has_embed(cumul);
if (typeof v == "string") {
@ -213,4 +213,4 @@ let init = false;
}
}
};
})();
})();

46
src/stores.ts

@ -49,7 +49,51 @@ export const initial_settings = {
conc: 8,
ho: false,
blacklist: [] as string[],
rsources: [] as (Omit<Booru, 'quirks'> & { view: string, disabled?: boolean })[],
rsources: [
{
name: 'Gelbooru',
domain: 'gelbooru.com',
endpoint: '/index.php?page=dapi&s=post&q=index&json=1&tags=md5:',
view: "https://gelbooru.com/index.php?page=post&s=view&id="
},
{
name: 'Yandere',
domain: 'yande.re',
endpoint: '/post.json?tags=md5:',
view: `https://yande.re/post/show/`
},
{
name: 'Sankaku',
domain: 'capi-v2.sankakucomplex.com',
endpoint: '/posts/keyset?tags=md5:',
view: `https://chan.sankakucomplex.com/post/show/`
},
{
name: 'Rule34',
domain: 'api.rule34.xxx',
endpoint: '/index.php?page=dapi&s=post&q=index&json=1&tags=md5:',
// note: rule34 do not seem to give source in their API
view: "https://rule34.xxx/index.php?page=post&s=view&id="
},
{
name: 'Danbooru',
domain: 'danbooru.donmai.us',
endpoint: '/posts.json?tags=md5:',
view: 'https://danbooru.donmai.us/posts/'
},
{
name: 'Lolibooru',
domain: 'lolibooru.moe',
endpoint: '/post.json?tags=md5:',
view: 'https://lolibooru.moe/post/show/'
},
{
name: "ATFbooru",
domain: "booru.allthefallen.moe",
endpoint: "/posts.json?tags=md5:",
view: 'https://booru.allthefallen.moe/posts/'
}
] as (Omit<Booru, 'quirks'> & { view: string, disabled?: boolean })[],
};
export const settings = writable<Awaited<typeof initial_settings>>();

6
tsconfig.json

@ -1,7 +1,6 @@
{
"compilerOptions": {
"moduleResolution": "node",
//"target": "es2017",
/**
Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript
to enforce using `import type` instead of `import` for Types.
@ -9,7 +8,8 @@
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"lib": [
"dom"
"dom",
"dom.iterable",
],
/**
To have warnings/errors of the Svelte compiler at the correct position,
@ -19,7 +19,7 @@
/** Requests the runtime types from the svelte modules by default. Needed for TS files or else you get errors. */
"types": ["svelte", "tampermonkey", "web-ext-types"],
"incremental": true, /* Enable incremental compilation */
"target": "es2021", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"target": "es2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
//"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"strict": true, /* Enable all strict type-checking options. */

Loading…
Cancel
Save