Browse Source

Turn off all referrers for the entire page

pull/46/head
coomdev 2 years ago
parent
commit
ed73572165
  1. 2
      main.meta.js
  2. 41
      main.user.js
  3. 21
      src/Components/Embedding.svelte
  4. 3
      src/main.ts

2
main.meta.js

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

41
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.167
// @version 0.168
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -81,7 +81,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 167];
define_BUILD_VERSION_default = [0, 168];
}
});
@ -19596,28 +19596,32 @@
}
function create_if_block_5(ctx) {
let video;
let source;
let source_src_value;
let video_loop_value;
let video_src_value;
return {
c() {
video = element("video");
source = element("source");
attr(source, "referrerpolicy", "no-referrer");
if (!src_url_equal(source.src, source_src_value = ctx[15] || ctx[6]))
attr(source, "src", source_src_value);
attr(video, "referrerpolicy", "no-referrer");
video.loop = video_loop_value = ctx[20].loop;
if (!src_url_equal(video.src, video_src_value = ctx[15] || ctx[6]))
attr(video, "src", video_src_value);
attr(video, "class", "svelte-1uaoklw");
},
m(target, anchor) {
insert(target, video, anchor);
append(video, source);
ctx[30](video);
},
p(ctx2, dirty) {
if (dirty[0] & 32832 && !src_url_equal(source.src, source_src_value = ctx2[15] || ctx2[6])) {
attr(source, "src", source_src_value);
}
if (dirty[0] & 1048576 && video_loop_value !== (video_loop_value = ctx2[20].loop)) {
video.loop = video_loop_value;
}
if (dirty[0] & 32832 && !src_url_equal(video.src, video_src_value = ctx2[15] || ctx2[6])) {
attr(video, "src", video_src_value);
}
},
d(detaching) {
if (detaching)
@ -19759,7 +19763,6 @@
return {
c() {
img = element("img");
attr(img, "referrerpolicy", "no-referrer");
attr(img, "alt", img_alt_value = ctx[0].filename);
if (!src_url_equal(img.src, img_src_value = ctx[15] || ctx[6]))
attr(img, "src", img_src_value);
@ -19784,28 +19787,30 @@
}
function create_if_block_12(ctx) {
let video;
let source;
let source_src_value;
let video_loop_value;
let video_src_value;
return {
c() {
video = element("video");
attr(video, "referrerpolicy", "no-referrer");
source = element("source");
if (!src_url_equal(source.src, source_src_value = ctx[15] || ctx[6]))
attr(source, "src", source_src_value);
video.loop = video_loop_value = ctx[20].loop;
if (!src_url_equal(video.src, video_src_value = ctx[15] || ctx[6]))
attr(video, "src", video_src_value);
attr(video, "class", "svelte-1uaoklw");
},
m(target, anchor) {
insert(target, video, anchor);
append(video, source);
ctx[32](video);
},
p(ctx2, dirty) {
if (dirty[0] & 32832 && !src_url_equal(source.src, source_src_value = ctx2[15] || ctx2[6])) {
attr(source, "src", source_src_value);
}
if (dirty[0] & 1048576 && video_loop_value !== (video_loop_value = ctx2[20].loop)) {
video.loop = video_loop_value;
}
if (dirty[0] & 32832 && !src_url_equal(video.src, video_src_value = ctx2[15] || ctx2[6])) {
attr(video, "src", video_src_value);
}
},
d(detaching) {
if (detaching)
@ -19980,6 +19985,7 @@
}
if (!type)
return;
$$invalidate(9, ftype = type.mime);
$$invalidate(2, isVideo = type.mime.startsWith("video/"));
$$invalidate(4, isAudio = type.mime.startsWith("audio/"));
$$invalidate(3, isImage = type.mime.startsWith("image/"));
@ -21302,6 +21308,9 @@
var customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
document.documentElement.insertBefore(customStyles, null);
var meta = document.querySelector('meta[name="referrer"]');
meta.setAttribute("name", "referrer");
meta.setAttribute("content", "no-referrer");
function processAttachments(post, ress) {
if (ress.length == 0)
return;

21
src/Components/Embedding.svelte

@ -135,6 +135,7 @@
}
}
if (!type) return
ftype = type.mime;
isVideo = type.mime.startsWith('video/')
isAudio = type.mime.startsWith('audio/')
isImage = type.mime.startsWith('image/')
@ -301,8 +302,8 @@
<div
class:contract={contracted}
class="place"
on:click={(e) => e.preventDefault()}
on:auxclick={(e) => e.preventDefault()}
on:click={e => e.preventDefault()}
on:auxclick={e => e.preventDefault()}
on:mousedown={bepis}
on:mouseover={hoverStart}
on:mouseout={hoverStop}
@ -337,8 +338,9 @@
referrerpolicy="no-referrer"
loop={$settings.loop}
bind:this={videoElem}
src={furl || url}
/>
>
<source referrerpolicy="no-referrer" src={furl || url} />
</video>
<!-- assoom videos will never be loaded from thumbnails -->
{/if}
{#if isText}
@ -362,16 +364,13 @@
>{/if}
{#if isImage}
<img referrerpolicy="no-referrer" alt={file.filename} src={furl || url} />
<img alt={file.filename} src={furl || url} />
{/if}
{#if isVideo}
<!-- svelte-ignore a11y-media-has-caption -->
<video
referrerpolicy="no-referrer"
loop={$settings.loop}
bind:this={hoverVideo}
src={furl || url}
/>
<video loop={$settings.loop} bind:this={hoverVideo}>
<source src={furl || url} />
</video>
<!-- assoom videos will never be loaded from thumbnails -->
{/if}
</div>

3
src/main.ts

@ -408,6 +408,9 @@ document.addEventListener('QRDialogCreation', <any>((e: CustomEvent<HTMLElement>
const customStyles = document.createElement('style');
customStyles.appendChild(document.createTextNode(globalCss));
document.documentElement.insertBefore(customStyles, null);
const meta = document.querySelector('meta[name="referrer"]') as HTMLMetaElement;
meta.setAttribute('name', 'referrer');
meta.setAttribute('content', 'no-referrer');
function processAttachments(post: HTMLDivElement, ress: [EmbeddedFile, boolean][]) {
if (ress.length == 0)

Loading…
Cancel
Save