From 5a503e9e20d14ad524c3c2b297da9a8b4316b362 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 16 Aug 2024 23:03:11 +0300 Subject: [PATCH] Added SkunkyArt https://github.com/libredirect/browser_extension/issues/948 --- src/assets/images/deviantArt-icon.svg | 474 ++++++++++++++++++++++++++ src/assets/javascripts/services.js | 17 +- src/config.json | 20 ++ 3 files changed, 510 insertions(+), 1 deletion(-) create mode 100644 src/assets/images/deviantArt-icon.svg diff --git a/src/assets/images/deviantArt-icon.svg b/src/assets/images/deviantArt-icon.svg new file mode 100644 index 0000000..30836c1 --- /dev/null +++ b/src/assets/images/deviantArt-icon.svg @@ -0,0 +1,474 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index b319d46..94d8d98 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -547,10 +547,24 @@ function rewrite(url, frontend, randomInstance) { url.searchParams.delete("ie") return `${randomInstance}${url.pathname}${url.search}` case "shoelace": { - const reg = /\/(?:(?:(?:.*)?\/post)|t)\/(.*)(?:\/)?/.exec(url.pathname) + const reg = /^\/(?:(?:(?:[^\/])?\/post)|t)\/([^\/])/.exec(url.pathname) if (reg) return `${randomInstance}/t/${reg[1]}${url.search}` return `${randomInstance}${url.pathname}${url.search}` } + case "skunkyArt": { + if (url.pathname.startsWith('/search')) return `${randomInstance}${url.pathname}${url.search}&scope=all` + + const artReg = /^\/.*?\/art\/(.*)\/?/.exec(url.pathname) + if (artReg) return `${randomInstance}/post/art/${artReg[1]}${url.search}` + + const userReg = /^\/([^\/]+)$/.exec(url.pathname) + if (userReg) return `${randomInstance}/user/${userReg[1]}${url.search}` + + const galleryReg = /^\/.*?\/gallery(\/$|$)$/.exec(url.pathname) + if (galleryReg) return `${randomInstance}/user/${userReg[1]}?a=gallery` + + return `${randomInstance}${url.pathname}${url.search}` + } case "piped": case "pipedMaterial": case "cloudtube": @@ -804,6 +818,7 @@ const defaultInstances = { freetar: ["https://freetar.de"], ratAintTieba: ["https://rat.fis.land"], shoelace: ["https://shoelace.mint.lgbt"], + skunkyArt: ["https://skunky.bloat.cat/"], } function initDefaults() { diff --git a/src/config.json b/src/config.json index a42b7c7..a4abc44 100644 --- a/src/config.json +++ b/src/config.json @@ -1208,6 +1208,26 @@ }, "imageType": "svgMono", "url": "https://threads.net" + }, + "deviantArt": { + "frontends": { + "skunkyArt": { + "name": "SkunkyArt", + "instanceList": true, + "url": "https://git.sr.ht/~nixgoat/shoelace" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?deviantart\\.com" + ], + "name": "DeviantArt", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "skunkyArt" + }, + "imageType": "svg", + "url": "https://deviantart.com" } } } \ No newline at end of file