Browse Source

Fix loading new embeds on thread update

pull/53/head
coomdev 1 year ago
parent
commit
08b87fd252
  1. 6
      build-ff.js
  2. 39
      chrome/dist/background.js
  3. 51
      chrome/dist/main.js
  4. 2
      chrome/manifest.json
  5. 113
      dist/main.js
  6. 39
      firefox/dist/background.js
  7. 137
      firefox/dist/main.js
  8. 3
      firefox/manifest.json
  9. 2
      firefox_update.json
  10. 2
      main.meta.js
  11. 135
      main.user.js
  12. 4
      src/websites/index.ts

6
build-ff.js

@ -107,7 +107,7 @@ const manif = {
define: {
global: 'window',
execution_mode: '"ff_api"',
manifest: manif.manifest_version,
manifest: '' + manif.manifest_version,
isBackground: 'false',
BUILD_VERSION: JSON.stringify([0, rev])
},
@ -129,7 +129,7 @@ const manif = {
define: {
global: 'self',
execution_mode: '"worker"',
manifest: manif.manifest_version,
manifest: ''+manif.manifest_version,
isBackground: 'false',
BUILD_VERSION: JSON.stringify([0, rev])
},
@ -154,7 +154,7 @@ const manif = {
define: {
global: 'window',
execution_mode: '"ff_api"',
manifest: manif.manifest_version,
manifest: ''+manif.manifest_version,
isBackground: 'true',
BUILD_VERSION: JSON.stringify([0, rev])
},

39
chrome/dist/background.js

@ -1960,27 +1960,10 @@
return obj2.tabs.create({ active: opts.active, url: src, index: i });
}
static async getValue(key, def) {
const isinls = "__pee__" + key in localStorage;
let ret;
if (isinls) {
let it = localStorage.getItem("__pee__" + key);
if (it === "undefined")
it = null;
ret = { ...def, ...JSON.parse(it || "{}") };
} else
ret = def;
if (true) {
if (isinls) {
delete localStorage["__pee__" + key];
await chrome.storage.local.set({
[key]: JSON.stringify(ret)
});
} else {
const d = await chrome.storage.local.get([key]);
if (typeof d[key] == "string")
return { ...def, ...await JSON.parse("" + d[key] || "{}") };
}
}
const ret = def;
const d = await chrome.storage.local.get([key]);
if (typeof d[key] == "string")
return { ...def, ...await JSON.parse("" + d[key] || "{}") };
return ret;
}
static setValue(name, val) {
@ -1994,20 +1977,6 @@
// src/background.ts
var obj = true ? chrome : browser;
if (false)
obj.webRequest.onHeadersReceived.addListener((details) => {
if (details.url.startsWith("https://arch.b4k.co/") && details.type == "main_frame") {
const e = details.responseHeaders.findIndex((e2) => e2.name.toLowerCase() == "content-security-policy");
if (e >= 0)
details.responseHeaders[e].value = "";
return {
responseHeaders: [
...details.responseHeaders,
{ name: "access-control-allow-origin", value: "*" }
]
};
}
}, filts, ["blocking", "responseHeaders", ...true ? ["extraHeaders"] : []]);
async function bravedeserialize(src) {
if (typeof src != "object")
return src;

51
chrome/dist/main.js

File diff suppressed because one or more lines are too long

2
chrome/manifest.json

@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.326",
"version": "0.329",
"icons": {
"64": "1449696017588.png"
},

113
dist/main.js

File diff suppressed because one or more lines are too long

39
firefox/dist/background.js

@ -1960,27 +1960,10 @@
return obj2.tabs.create({ active: opts.active, url: src, index: i });
}
static async getValue(key, def) {
const isinls = "__pee__" + key in localStorage;
let ret;
if (isinls) {
let it = localStorage.getItem("__pee__" + key);
if (it === "undefined")
it = null;
ret = { ...def, ...JSON.parse(it || "{}") };
} else
ret = def;
if (true) {
if (isinls) {
delete localStorage["__pee__" + key];
await chrome.storage.local.set({
[key]: JSON.stringify(ret)
});
} else {
const d = await chrome.storage.local.get([key]);
if (typeof d[key] == "string")
return { ...def, ...await JSON.parse("" + d[key] || "{}") };
}
}
const ret = def;
const d = await chrome.storage.local.get([key]);
if (typeof d[key] == "string")
return { ...def, ...await JSON.parse("" + d[key] || "{}") };
return ret;
}
static setValue(name, val) {
@ -1994,20 +1977,6 @@
// src/background.ts
var obj = false ? chrome : browser;
if (false)
obj.webRequest.onHeadersReceived.addListener((details) => {
if (details.url.startsWith("https://arch.b4k.co/") && details.type == "main_frame") {
const e = details.responseHeaders.findIndex((e2) => e2.name.toLowerCase() == "content-security-policy");
if (e >= 0)
details.responseHeaders[e].value = "";
return {
responseHeaders: [
...details.responseHeaders,
{ name: "access-control-allow-origin", value: "*" }
]
};
}
}, filts, ["blocking", "responseHeaders", ...false ? ["extraHeaders"] : []]);
var bgCorsFetch = async (c, pendingFetches, id, input, init) => {
if (input.startsWith("//"))
input = "https:" + input;

137
firefox/dist/main.js

File diff suppressed because one or more lines are too long

3
firefox/manifest.json

@ -7,7 +7,7 @@
},
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.328",
"version": "0.329",
"icons": {
"64": "1449696017588.png"
},
@ -118,7 +118,6 @@
"*.js"
],
"background": {
"persistent": true,
"scripts": [
"bepis.js"
]

2
firefox_update.json

@ -1 +1 @@
{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.328","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.328.xpi"}]}}}
{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.329","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.329.xpi"}]}}}

2
main.meta.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.324
// @version 0.328
// @description uhh
// @author You
// @match https://boards.4channel.org/*

135
main.user.js

File diff suppressed because one or more lines are too long

4
src/websites/index.ts

@ -19,7 +19,7 @@ export type QueryProcessor = {
export const V4chan: QueryProcessor = {
getFileThumbnail: post => post.querySelector('div.file')!,
getPost: (post) => post.querySelector('.post')!,
getPost: (post) => post.classList.contains("post") ? post : post.querySelector('.post')!,
postsWithFiles: (h) => [...(h || document).querySelectorAll('.file')].map(e => e.closest('.postContainer')) as any,
settingsHost: () => document.getElementById("navtopright") as any,
catalogControlHost: () => document.getElementById("settings") as HTMLDivElement,
@ -45,7 +45,7 @@ export const V4chan: QueryProcessor = {
export const X4chan: QueryProcessor = {
getFileThumbnail: post => post.querySelector('div.file')!,
getPost: (post) => post.querySelector('.post')!,
getPost: (post) => V4chan.getPost(post),
postsWithFiles: (h) => [...(h || document).querySelectorAll('.postContainer:not([class*="noFile"])')] as HTMLElement[],
settingsHost: () => document.getElementById("shortcuts") as any,
catalogControlHost: () => document.getElementById("index-options") as HTMLDivElement,

Loading…
Cancel
Save