Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Aug 26, 2024
1 parent dfa6c8e commit 9e4c9cd
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 11 deletions.
44 changes: 44 additions & 0 deletions src/assets/images/coub-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 23 additions & 11 deletions src/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function all(service, frontend, options, config) {
* @param {string} service
* @param {URL} url
* @param {{}} config
* @param {{}} options
* @param {string} frontend
*/
function regexArray(service, url, config, options, frontend) {
Expand All @@ -49,17 +50,6 @@ function regexArray(service, url, config, options, frontend) {
return false
}

/**
* @param {URL} url
* @param {string} type
* @param {URL} originUrl
* @param {boolean} forceRedirection
*/
async function redirectAsync(url, type, originUrl, documentUrl, incognito, forceRedirection) {
await init()
return redirect(url, type, originUrl, documentUrl, incognito, forceRedirection)
}

/**
* @param {URL} url
* @param {string} frontend
Expand Down Expand Up @@ -554,6 +544,13 @@ function rewrite(url, originUrl, frontend, randomInstance) {
return `${randomInstance}/list?playlists=${encodeURIComponent(url.searchParams.get("list"))}`
return `${randomInstance}${url.pathname}${url.search}`
}
case "koub":
if (url.pathname.startsWith("/view/") || url.pathname.startsWith("/stories/")) {
return `${randomInstance}${url.pathname}${url.search}`
}
const accountReg = /^\/([^\/]+)\/?$/.exec(url.pathname)
if (accountReg) return `${randomInstance}/account${url.pathname}${url.search}`

case "piped":
case "pipedMaterial":
case "cloudtube":
Expand Down Expand Up @@ -632,6 +629,20 @@ function redirect(url, type, originUrl, documentUrl, incognito, forceRedirection
return rewrite(url, originUrl, frontend, randomInstance)
}

/**
* @param {URL} url
* @param {string} type
* @param {URL} originUrl
* @param {URL} documentUrl
* @param {boolean} incognito
* @param {boolean} forceRedirection
* @returns {string | undefined}
*/
async function redirectAsync(url, type, originUrl, documentUrl, incognito, forceRedirection) {
await init()
return redirect(url, type, originUrl, documentUrl, incognito, forceRedirection)
}

/**
* @param {URL} url
* @param {*} returnFrontend
Expand Down Expand Up @@ -821,6 +832,7 @@ const defaultInstances = {
skunkyArt: ["https://skunky.bloat.cat"],
ytify: ["https://ytify.netlify.app"],
nerdsForNerds: ["https://nn.vern.cc"],
koub: ["https://koub.clovius.club"],
}

async function getDefaults() {
Expand Down
21 changes: 21 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,27 @@
},
"imageType": "svg",
"url": "https://www.geeksforgeeks.org"
},
"coub": {
"frontends": {
"koub": {
"name": "Koub",
"instanceList": true,
"url": "https://codeberg.org/gospodin/koub"
}
},
"targets": [
"^https?:\\/{2}(www\\.)?coub\\.com"
],
"name": "Coub",
"options": {
"enabled": false,
"unsupportedUrls": "bypass",
"frontend": "koub",
"redirectOnlyInIncognito": false
},
"imageType": "svg",
"url": "https://coub.com"
}
}
}

0 comments on commit 9e4c9cd

Please sign in to comment.