From b146ce07149c1920a273f85c23c8138632f89a8a Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 11 Nov 2023 17:02:42 +0100 Subject: [PATCH] Add TekstoLibre, frontend for Tekstowo.pl --- src/assets/javascripts/services.js | 7 +++++++ src/assets/javascripts/utils.js | 2 ++ src/config.json | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 1a1afa1..6da057f 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -539,6 +539,9 @@ function redirect(url, type, initiator, forceRedirection) { } return `${randomInstance}${url.pathname}${url.search}` } + case "tekstoLibre": { + return `${randomInstance}/?${url.pathname.slice(1)}`; + } default: { return `${randomInstance}${url.pathname}${url.search}` } @@ -641,6 +644,9 @@ async function reverse(url) { } return } + case "tekstowo": { + return `${config.services[service].url}/${url.search.slice(1)}` + } default: return } @@ -694,6 +700,7 @@ const defaultInstances = { 'proxigram': ['https://proxigram.privacyfrontends.repl.co'], 'tuboYoutube': ['https://tubo.migalmoreno.com'], 'tuboSoundcloud': ['https://tubo.migalmoreno.com'], + 'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'], } function initDefaults() { diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index e85b111..6a420ee 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -10,6 +10,8 @@ function camelCase(str) { function protocolHost(url) { if (url.username && url.password) return `${url.protocol}//${url.username}:${url.password}@${url.host}` + if (url.pathname == "/TekstoLibre/" && url.host.endsWith("github.io")) // workaround + return `${url.protocol}//${url.host}${url.pathname.slice(0, -1)}` return `${url.protocol}//${url.host}` } diff --git a/src/config.json b/src/config.json index 4c53537..2251cf2 100644 --- a/src/config.json +++ b/src/config.json @@ -943,6 +943,26 @@ }, "imageType": "svg", "url": "https://www.wolframalpha.com" + }, + "tekstowo": { + "frontends": { + "tekstoLibre": { + "name": "TekstoLibre", + "instanceList": true, + "url": "https://github.com/Davilarek/TekstoLibre" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?tekstowo\\.pl\\/" + ], + "name": "Tekstowo.pl", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "tekstoLibre" + }, + "imageType": "png", + "url": "https://www.tekstowo.pl" } } } \ No newline at end of file