From 412fe200706fc9f8fe783bfa53293dc131f472b2 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 7 Feb 2023 20:46:39 +0300 Subject: [PATCH] Added PokeTube https://github.com/libredirect/libredirect/issues/623 --- .woodpecker.yml | 32 ------------------------------ README.md | 9 +++------ src/assets/javascripts/services.js | 14 +++++++++++++ src/config.json | 10 ++++++++++ 4 files changed, 27 insertions(+), 38 deletions(-) delete mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 6786fc51..00000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,32 +0,0 @@ -pipeline: - instancefetch: - image: python:bullseye - secrets: [token, mail] - when: - - event: cron - cron: instance_updater - commands: - - python -m pip install --upgrade pip - - pip install requests colorama - - python src/instances/get_instances.py - # SSH configuration - - mkdir ~/.ssh - - ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts - - eval `ssh-agent` - - echo "$TOKEN" | tr -d '\r' | ssh-add - - # Git configuration - - git config --global user.email $MAIL - - git config --global user.name "Woodpecker CI" - - git commit -am "updated instances" - - git remote set-url origin git@codeberg.org:libredirect/libredirect.git - - git push --set-upstream origin master - lint: - image: node:lts-alpine - when: - event: [push, pull_request] - path: - exclude: ["src/instances/**"] - include: ["src/**"] - commands: - - npm i - - npx web-ext lint --source-dir ./src/ diff --git a/README.md b/README.md index 427e060f..9a0b95ff 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,9 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati [![Matrix Badge](https://img.shields.io/matrix/libredirect:matrix.org?label=matrix%20chat)](https://matrix.to/#/#libredirect:matrix.org) [![Firefox users Badge](https://img.shields.io/amo/users/libredirect?label=Firefox%20users)](https://addons.mozilla.org/firefox/addon/libredirect/) [![LibrePay Badge](https://img.shields.io/liberapay/gives/libredirect?label=Liberapay)](https://liberapay.com/LibRedirect) - [![OpenCollective Badge](https://opencollective.com/libredirect/tiers/badge.svg)](https://opencollective.com/libredirect#category-CONTRIBUTE) - - [![Firefox Add-on](./img/badge-amo.png)](https://addons.mozilla.org/firefox/addon/libredirect/)  - @@ -20,7 +16,7 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati     -- Youtube [Invidious](https://github.com/iv-org/invidious), [Piped](https://github.com/TeamPiped/Piped), [Piped-Material](https://github.com/mmjee/Piped-Material), [CloudTube](https://sr.ht/~cadence/tube/), [FreeTube](https://github.com/FreeTubeApp/FreeTube), [Yattee](https://github.com/yattee/yattee) +- Youtube [Invidious](https://github.com/iv-org/invidious), [Piped](https://github.com/TeamPiped/Piped), [Piped-Material](https://github.com/mmjee/Piped-Material), [CloudTube](https://sr.ht/~cadence/tube/), [PokeTube](https://codeberg.org/Ashley/poketube/), [FreeTube](https://github.com/FreeTubeApp/FreeTube), [Yattee](https://github.com/yattee/yattee) - Youtube Music [Beatbump](https://github.com/snuffyDev/Beatbump), [Hyperpipe](https://codeberg.org/Hyperpipe/Hyperpipe) - Twitter [Nitter](https://github.com/zedeus/nitter) - TikTok [ProxiTok](https://github.com/pablouser1/ProxiTok) @@ -39,8 +35,9 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati - StackOverflow [AnonymousOverflow](https://github.com/httpjamesm/AnonymousOverflow) - Goodreads [BiblioReads](https://github.com/nesaku/BiblioReads) - Wikipedia [Wikiless](https://wikiless.org) +- Snopes [Suds](https://git.vern.cc/cobra/Suds) -# Please read the [FAQ](https://libredirect.github.io/faq.html) if you have any questions! +**Please read the [FAQ](https://libredirect.github.io/faq.html) if you have any questions!** We're now on Mastodon diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index cdf40b66..66dff154 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -148,6 +148,19 @@ function redirect(url, type, initiator, forceRedirection) { case "freetube": { return `freetube://https://youtu.be${url.pathname}${url.search}`.replace(/watch\?v=/, "") } + case "poketube": { + if (url.pathname.startsWith('/channel')) { + const reg = /\/channel\/(.*)\/?$/.exec(url.pathname) + if (reg) { + const id = reg[1] + return `${randomInstance}/channel?id=${id}${url.search}` + } + } + if (/\/@[a-z]+\//.exec(url.pathname)) { + return randomInstance + } + return `${randomInstance}${url.pathname}${url.search}` + } case "simplyTranslate": { return `${randomInstance}/${url.search}` } @@ -551,6 +564,7 @@ const defaultInstances = { 'piped': ['https://pipedapi-libre.kavin.rocks'], 'pipedMaterial': ['https://piped-material.xn--17b.net'], 'cloudtube': ['https://tube.cadence.moe'], + 'poketube': ['https://poketube.fun'], 'proxiTok': ['https://proxitok.pabloferreiro.es'], 'send': ['https://send.vis.ee'], 'nitter': ['https://nitter.net'], diff --git a/src/config.json b/src/config.json index fcd2f797..3a3ed06b 100644 --- a/src/config.json +++ b/src/config.json @@ -71,6 +71,16 @@ "embeddable": false, "instanceList": false, "url": "https://github.com/yattee/yattee" + }, + "poketube": { + "excludeTargets": [ + 2, + 3 + ], + "name": "PokeTube", + "embeddable": true, + "instanceList": true, + "url": "https://codeberg.org/Ashley/poketube/" } }, "targets": [