From 74560b14d82e54bbcf47603d66a795312c293622 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Thu, 15 Jun 2023 20:43:52 +0300 Subject: Added PixivFE https://github.com/libredirect/browser_extension/issues/735 --- src/assets/images/pixiv-icon.svg | 49 ++++++++++++++++++++++++++++++++++++++ src/assets/javascripts/services.js | 17 +++++++++---- src/config.json | 21 ++++++++++++++++ 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/assets/images/pixiv-icon.svg (limited to 'src') diff --git a/src/assets/images/pixiv-icon.svg b/src/assets/images/pixiv-icon.svg new file mode 100644 index 00000000..9460979a --- /dev/null +++ b/src/assets/images/pixiv-icon.svg @@ -0,0 +1,49 @@ + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 22b73f57..412c044a 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -554,9 +554,6 @@ function redirect(url, type, initiator, forceRedirection) { if (path == "/") path = "" return `${randomInstance}/${url.hostname}${path}${url.search}` } - default: { - return `${randomInstance}${url.pathname}${url.search}` - } case "quetre": { const regex = /([a-z]+)\.quora\.com/.exec(url.hostname) console.log(regex) @@ -567,6 +564,17 @@ function redirect(url, type, initiator, forceRedirection) { } return `${randomInstance}${url.pathname}${url.search}` } + case "pixivFe": { + const regex = /\/[a-z]{1,3}\/(.*)/.exec(url.pathname) + if (regex) { + const path = regex[1] + return `${randomInstance}/${path}${url.search}` + } + return `${randomInstance}${url.pathname}${url.search}` + } + default: { + return `${randomInstance}${url.pathname}${url.search}` + } } } @@ -711,7 +719,8 @@ const defaultInstances = { "laboratory": ['https://lab.vern.cc'], "libreSpeed": ['https://librespeed.org'], 'jitsi': ['https://meet.jit.si', 'https://8x8.vc'], - 'binternet': ['https://binternet.ahwx.org'] + 'binternet': ['https://binternet.ahwx.org'], + 'pixivFe': ['https://pixivfe.exozy.me'] } function initDefaults() { diff --git a/src/config.json b/src/config.json index a465f62e..878e9620 100644 --- a/src/config.json +++ b/src/config.json @@ -235,6 +235,27 @@ "embeddable": true, "url": "https://imgur.com" }, + "pixiv": { + "name": "Pixiv", + "frontends": { + "pixivFe": { + "name": "PixivFE", + "instanceList": true, + "url": "https://codeberg.org/VnPower/pixivfe" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?pixiv\\.net\\/" + ], + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "pixivFe" + }, + "imageType": "svg", + "embeddable": false, + "url": "https://www.pixiv.net" + }, "medium": { "frontends": { "scribe": { -- cgit 1.4.1