Browse Source

Build and sign FF ext

pull/54/head
coomdev 2 years ago
parent
commit
e44df19941
  1. 2
      README.md
  2. 70
      chrome/dist/main.js
  3. 2
      chrome/manifest.json
  4. 70
      dist/main.js
  5. 70
      firefox/dist/main.js
  6. 2
      firefox/manifest.json
  7. 2
      firefox_update.json
  8. 2
      main.meta.js
  9. 72
      main.user.js
  10. BIN
      pngextraembedder-0.320.xpi

2
README.md

@ -26,7 +26,7 @@ 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.315.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.320.xpi) or Chrome-based (Down for "maintainance"))
For FF users, the extension is signed so you can just drag and drop it on your about:addons tab.

70
chrome/dist/main.js

@ -73,7 +73,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 315];
define_BUILD_VERSION_default = [0, 320];
}
});
@ -10939,7 +10939,52 @@
settings.subscribe((b) => {
csettings = b;
});
var generateUglyThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
let source;
let iw, ih;
if (f.type.startsWith("image")) {
const imgElem = document.createElement("img");
imgElem.src = url;
await new Promise((_) => imgElem.onload = _);
[iw, ih] = [imgElem.naturalWidth, imgElem.naturalHeight];
source = imgElem;
} else if (f.type.startsWith("video")) {
const vidElem = document.createElement("video");
vidElem.src = url;
await new Promise((_) => vidElem.onloadedmetadata = _);
vidElem.currentTime = 0;
await new Promise((_) => vidElem.onloadeddata = _);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
[iw, ih] = [vidElem.videoWidth, vidElem.videoHeight];
source = vidElem;
} else
return import_buffer2.Buffer.alloc(0);
const scale = Math.min(1, sw / iw, sh / ih);
const dims = [~~(iw * scale), ~~(ih * scale)];
can.width = dims[0];
can.height = dims[1];
const ctx = can.getContext("2d");
if (!ctx)
return import_buffer2.Buffer.alloc(0);
ctx.drawImage(source, 0, 0, dims[0], dims[1]);
const blob = await new Promise((_) => can.toBlob(_));
if (!blob)
return import_buffer2.Buffer.alloc(0);
return import_buffer2.Buffer.from(await blob.arrayBuffer());
};
var generateThumbnail = async (f) => {
try {
return await generateProperThumbnail(f);
} catch {
return await generateUglyThumbnail(f);
}
};
var generateProperThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
@ -15972,7 +16017,8 @@
t1 = text(ctx[0]);
t2 = space();
h4 = element("h4");
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022 <a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022
<a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
t6 = space();
hr = element("hr");
t7 = space();
@ -18631,7 +18677,12 @@
const content = await navigator.clipboard.readText();
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
try {
const content = prompt("Paste it in here") || "";
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
}
}
};
const boardname = location.pathname.match(/\/([^/]*)\//)[1];
@ -21847,6 +21898,15 @@ Use the WebExtension version of PEE if you want to use b4k!`);
if (init4)
return;
init4 = true;
window.addEventListener("securitypolicyviolation", (e) => {
if (e.blockedURI.startsWith("blob")) {
if (supportedMainDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, add blob: to the allowed JS whitelist in 4chanX in Advanced Settings");
} else if (supportedAltDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, use a CSP bypass extension like PEE-companion");
}
}
});
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -21956,9 +22016,9 @@ Use the WebExtension version of PEE if you want to use b4k!`);
cp = new CommandProcessor();
} catch {
if (false)
alert("The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
fireNotification("error", "The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
else
alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
fireNotification("error", "You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
return;
}
if (!is4chanX && location.host.startsWith("boards.4chan")) {

2
chrome/manifest.json

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

70
dist/main.js

@ -73,7 +73,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 315];
define_BUILD_VERSION_default = [0, 320];
}
});
@ -10751,7 +10751,52 @@
settings.subscribe((b) => {
csettings = b;
});
var generateUglyThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
let source;
let iw, ih;
if (f.type.startsWith("image")) {
const imgElem = document.createElement("img");
imgElem.src = url;
await new Promise((_) => imgElem.onload = _);
[iw, ih] = [imgElem.naturalWidth, imgElem.naturalHeight];
source = imgElem;
} else if (f.type.startsWith("video")) {
const vidElem = document.createElement("video");
vidElem.src = url;
await new Promise((_) => vidElem.onloadedmetadata = _);
vidElem.currentTime = 0;
await new Promise((_) => vidElem.onloadeddata = _);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
[iw, ih] = [vidElem.videoWidth, vidElem.videoHeight];
source = vidElem;
} else
return import_buffer2.Buffer.alloc(0);
const scale = Math.min(1, sw / iw, sh / ih);
const dims = [~~(iw * scale), ~~(ih * scale)];
can.width = dims[0];
can.height = dims[1];
const ctx = can.getContext("2d");
if (!ctx)
return import_buffer2.Buffer.alloc(0);
ctx.drawImage(source, 0, 0, dims[0], dims[1]);
const blob = await new Promise((_) => can.toBlob(_));
if (!blob)
return import_buffer2.Buffer.alloc(0);
return import_buffer2.Buffer.from(await blob.arrayBuffer());
};
var generateThumbnail = async (f) => {
try {
return await generateProperThumbnail(f);
} catch {
return await generateUglyThumbnail(f);
}
};
var generateProperThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
@ -15784,7 +15829,8 @@
t1 = text(ctx[0]);
t2 = space();
h4 = element("h4");
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022 <a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022
<a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
t6 = space();
hr = element("hr");
t7 = space();
@ -18443,7 +18489,12 @@
const content = await navigator.clipboard.readText();
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
try {
const content = prompt("Paste it in here") || "";
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
}
}
};
const boardname = location.pathname.match(/\/([^/]*)\//)[1];
@ -21747,6 +21798,15 @@ Use the WebExtension version of PEE if you want to use b4k!`);
if (init4)
return;
init4 = true;
window.addEventListener("securitypolicyviolation", (e) => {
if (e.blockedURI.startsWith("blob")) {
if (supportedMainDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, add blob: to the allowed JS whitelist in 4chanX in Advanced Settings");
} else if (supportedAltDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, use a CSP bypass extension like PEE-companion");
}
}
});
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -21856,9 +21916,9 @@ Use the WebExtension version of PEE if you want to use b4k!`);
cp = new CommandProcessor();
} catch {
if (true)
alert("The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
fireNotification("error", "The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
else
alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
fireNotification("error", "You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
return;
}
if (!is4chanX && location.host.startsWith("boards.4chan")) {

70
firefox/dist/main.js

@ -73,7 +73,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 315];
define_BUILD_VERSION_default = [0, 320];
}
});
@ -10892,7 +10892,52 @@
settings.subscribe((b) => {
csettings = b;
});
var generateUglyThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
let source;
let iw, ih;
if (f.type.startsWith("image")) {
const imgElem = document.createElement("img");
imgElem.src = url;
await new Promise((_) => imgElem.onload = _);
[iw, ih] = [imgElem.naturalWidth, imgElem.naturalHeight];
source = imgElem;
} else if (f.type.startsWith("video")) {
const vidElem = document.createElement("video");
vidElem.src = url;
await new Promise((_) => vidElem.onloadedmetadata = _);
vidElem.currentTime = 0;
await new Promise((_) => vidElem.onloadeddata = _);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
[iw, ih] = [vidElem.videoWidth, vidElem.videoHeight];
source = vidElem;
} else
return import_buffer2.Buffer.alloc(0);
const scale = Math.min(1, sw / iw, sh / ih);
const dims = [~~(iw * scale), ~~(ih * scale)];
can.width = dims[0];
can.height = dims[1];
const ctx = can.getContext("2d");
if (!ctx)
return import_buffer2.Buffer.alloc(0);
ctx.drawImage(source, 0, 0, dims[0], dims[1]);
const blob = await new Promise((_) => can.toBlob(_));
if (!blob)
return import_buffer2.Buffer.alloc(0);
return import_buffer2.Buffer.from(await blob.arrayBuffer());
};
var generateThumbnail = async (f) => {
try {
return await generateProperThumbnail(f);
} catch {
return await generateUglyThumbnail(f);
}
};
var generateProperThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
@ -15949,7 +15994,8 @@
t1 = text(ctx[0]);
t2 = space();
h4 = element("h4");
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022 <a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022
<a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
t6 = space();
hr = element("hr");
t7 = space();
@ -18608,7 +18654,12 @@
const content = await navigator.clipboard.readText();
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
try {
const content = prompt("Paste it in here") || "";
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
}
}
};
const boardname = location.pathname.match(/\/([^/]*)\//)[1];
@ -21824,6 +21875,15 @@ Use the WebExtension version of PEE if you want to use b4k!`);
if (init4)
return;
init4 = true;
window.addEventListener("securitypolicyviolation", (e) => {
if (e.blockedURI.startsWith("blob")) {
if (supportedMainDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, add blob: to the allowed JS whitelist in 4chanX in Advanced Settings");
} else if (supportedAltDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, use a CSP bypass extension like PEE-companion");
}
}
});
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -21933,9 +21993,9 @@ Use the WebExtension version of PEE if you want to use b4k!`);
cp = new CommandProcessor();
} catch {
if (false)
alert("The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
fireNotification("error", "The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
else
alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
fireNotification("error", "You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
return;
}
if (!is4chanX && location.host.startsWith("boards.4chan")) {

2
firefox/manifest.json

@ -7,7 +7,7 @@
},
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.315",
"version": "0.320",
"icons": {
"64": "1449696017588.png"
},

2
firefox_update.json

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

2
main.meta.js

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

72
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.315
// @version 0.320
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -109,7 +109,7 @@ const _DOMParser = DOMParser;
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 315];
define_BUILD_VERSION_default = [0, 320];
}
});
@ -10787,7 +10787,52 @@ const _DOMParser = DOMParser;
settings.subscribe((b) => {
csettings = b;
});
var generateUglyThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
let source;
let iw, ih;
if (f.type.startsWith("image")) {
const imgElem = document.createElement("img");
imgElem.src = url;
await new Promise((_) => imgElem.onload = _);
[iw, ih] = [imgElem.naturalWidth, imgElem.naturalHeight];
source = imgElem;
} else if (f.type.startsWith("video")) {
const vidElem = document.createElement("video");
vidElem.src = url;
await new Promise((_) => vidElem.onloadedmetadata = _);
vidElem.currentTime = 0;
await new Promise((_) => vidElem.onloadeddata = _);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
await new Promise(requestAnimationFrame);
[iw, ih] = [vidElem.videoWidth, vidElem.videoHeight];
source = vidElem;
} else
return import_buffer2.Buffer.alloc(0);
const scale = Math.min(1, sw / iw, sh / ih);
const dims = [~~(iw * scale), ~~(ih * scale)];
can.width = dims[0];
can.height = dims[1];
const ctx = can.getContext("2d");
if (!ctx)
return import_buffer2.Buffer.alloc(0);
ctx.drawImage(source, 0, 0, dims[0], dims[1]);
const blob = await new Promise((_) => can.toBlob(_));
if (!blob)
return import_buffer2.Buffer.alloc(0);
return import_buffer2.Buffer.from(await blob.arrayBuffer());
};
var generateThumbnail = async (f) => {
try {
return await generateProperThumbnail(f);
} catch {
return await generateUglyThumbnail(f);
}
};
var generateProperThumbnail = async (f) => {
const can = document.createElement("canvas");
const [sw, sh] = [125, 125];
const url = URL.createObjectURL(f);
@ -15820,7 +15865,8 @@ const _DOMParser = DOMParser;
t1 = text(ctx[0]);
t2 = space();
h4 = element("h4");
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022 <a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
h4.innerHTML = `<a href="https://2chen.moe/tech/">Join us on 2chen!</a> \u2022
<a href="https://git.coom.tech/araragi/JKCS/src/branch/master/README.md">Install JKCS!</a>`;
t6 = space();
hr = element("hr");
t7 = space();
@ -18479,7 +18525,12 @@ const _DOMParser = DOMParser;
const content = await navigator.clipboard.readText();
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
try {
const content = prompt("Paste it in here") || "";
set_store_value(settings, $settings.rsources = JSON.parse(content), $settings);
} catch {
alert("How can you fail so badly? pathetic...");
}
}
};
const boardname = location.pathname.match(/\/([^/]*)\//)[1];
@ -21783,6 +21834,15 @@ Use the WebExtension version of PEE if you want to use b4k!`);
if (init4)
return;
init4 = true;
window.addEventListener("securitypolicyviolation", (e) => {
if (e.blockedURI.startsWith("blob")) {
if (supportedMainDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, add blob: to the allowed JS whitelist in 4chanX in Advanced Settings");
} else if (supportedAltDomain(location.host)) {
fireNotification("error", "CSP is preventing PEE from running, use a CSP bypass extension like PEE-companion");
}
}
});
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -21892,9 +21952,9 @@ Use the WebExtension version of PEE if you want to use b4k!`);
cp = new CommandProcessor();
} catch {
if (true)
alert("The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
fireNotification("error", "The page you're on has a CSP that prevents PEE from functionning properly.\n\n If using 4chanX, Add 'blob:' to the JS whitelist. Else, install PEE-companion.");
else
alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
fireNotification("error", "You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list.");
return;
}
if (!is4chanX && location.host.startsWith("boards.4chan")) {

BIN
pngextraembedder-0.320.xpi

Binary file not shown.
Loading…
Cancel
Save