From 2e5b23c83fa0a1349c5b18b06732507088fa24c9 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 10 Dec 2023 04:45:13 +0300 Subject: [PATCH] Added Priviblur https://github.com/libredirect/browser_extension/issues/867 --- src/assets/images/tumblr-icon.svg | 52 ++++++++++++++++++++++++++++++ src/assets/javascripts/services.js | 16 +++++++++ src/config.json | 26 +++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 src/assets/images/tumblr-icon.svg diff --git a/src/assets/images/tumblr-icon.svg b/src/assets/images/tumblr-icon.svg new file mode 100644 index 0000000..8b985b3 --- /dev/null +++ b/src/assets/images/tumblr-icon.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d431369..4bcc761 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -571,6 +571,21 @@ function redirect(url, type, initiator, forceRedirection, incognito) { if (url.pathname == '/') return randomInstance return `${randomInstance}?url=${encodeURIComponent(url.href)}` } + case "priviblur": { + if (url.hostname.startsWith("blog")) + return `${randomInstance}/blog${url.pathname}${url.search}` + + if (url.hostname.startsWith("assets")) + return `${randomInstance}/assets${url.pathname}${url.search}` + + if (url.hostname.startsWith("static")) + return `${randomInstance}/static${url.pathname}${url.search}` + + const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname) + if (reg) + return `${randomInstance}/media/${reg[1]}${url.pathname}${url.search}` + return `${randomInstance}${url.pathname}${url.search}` + } default: { return `${randomInstance}${url.pathname}${url.search}` } @@ -742,6 +757,7 @@ const defaultInstances = { 'tuboSoundcloud': ['https://tubo.migalmoreno.com'], 'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'], 'skyview': ['https://skyview.social'], + 'priviblur': ['https://pb.bloat.cat'], } function initDefaults() { diff --git a/src/config.json b/src/config.json index 5235817..13d5dc3 100644 --- a/src/config.json +++ b/src/config.json @@ -994,6 +994,32 @@ }, "imageType": "svg", "url": "https://bsky.app/" + }, + "tumblr": { + "frontends": { + "priviblur": { + "name": "Priviblur", + "embeddable": true, + "instanceList": true, + "url": "https://github.com/syeopite/priviblur", + "localhost": true + } + }, + "targets": [ + "^https?:\\/{2}(media\\.|blog\\.|assets\\.|static\\.)?tumblr\\.com\\/", + "^https?:\\/{2}[0-9]+\\.media\\.tumblr\\.com\\/" + ], + "name": "Tumblr", + "options": { + "enabled": false, + "redirectType": "main_frame", + "unsupportedUrls": "bypass", + "frontend": "priviblur", + "instance": "public" + }, + "imageType": "svg", + "embeddable": true, + "url": "https://tumblr.com" } } } \ No newline at end of file