diff options
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/images/ifunny-icon.svg | 56 | ||||
-rw-r--r-- | src/assets/images/knowyourmeme-icon.svg | 76 | ||||
-rw-r--r-- | src/assets/images/tenor-icon.svg | 51 | ||||
-rw-r--r-- | src/assets/javascripts/services.js | 123 |
4 files changed, 249 insertions, 57 deletions
diff --git a/src/assets/images/ifunny-icon.svg b/src/assets/images/ifunny-icon.svg new file mode 100644 index 00000000..b8f37515 --- /dev/null +++ b/src/assets/images/ifunny-icon.svg @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="31.75mm" + height="31.75mm" + viewBox="0 0 31.75 31.75" + version="1.1" + id="svg1" + xml:space="preserve" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" + sodipodi:docname="ifunny-icon.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview + id="namedview1" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:document-units="mm" + inkscape:zoom="1.1452094" + inkscape:cx="72.475827" + inkscape:cy="-17.027453" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="g1" /><defs + id="defs1" /><g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-89.006188,-132.625)"><g + id="g1" + transform="matrix(0.26458333,0,0,0.26458333,86.360355,129.97917)"><rect + width="116.94743" + height="116.94743" + fill="#000000" + rx="70" + id="rect1" + x="11.526287" + y="11.526287" + style="fill:#ffd10b;fill-opacity:1;stroke-width:1" + ry="70" /><path + fill="url(#svg_7ac8_a)" + d="M 130,70 C 130,36.863 103.137,10 70,10 36.863,10 10,36.863 10,70 c 0,33.137 26.863,60 60,60 33.137,0 60,-26.863 60,-60 z" + id="path1" /><path + fill="#000000" + d="M 70,98.073 C 55.556,98.071 42.724,88.725 37.462,76.173 l -0.008,0.003 a 2.236,2.236 0 0 0 -2.14,-1.56 c -1.235,0 -2.237,0.99 -2.237,2.212 0,0.084 0.005,0.167 0.014,0.25 h -0.014 c 0.016,0.44 0.105,0.869 0.245,1.211 6.11,15.052 19.149,28.632 36.678,28.634 z m 0,0 c 14.445,-0.002 27.277,-9.348 32.539,-21.9 l 0.007,0.003 a 2.237,2.237 0 0 1 2.14,-1.56 c 1.235,0 2.237,0.99 2.237,2.212 0,0.084 -0.004,0.167 -0.014,0.25 h 0.014 c -0.015,0.44 -0.105,0.869 -0.245,1.211 C 100.569,93.341 87.529,106.921 70,106.923 Z M 58.133,50.535 c 0,5.82 -2.352,10.531 -6.182,10.535 -3.893,0.003 -6.182,-4.716 -6.182,-10.535 0,-5.82 2.29,-10.535 6.182,-10.535 3.83,0.003 6.182,4.719 6.182,10.535 z m 35.963,0 c 0,5.82 -2.352,10.531 -6.182,10.535 -3.893,0.003 -6.182,-4.716 -6.182,-10.535 0,-5.82 2.29,-10.535 6.182,-10.535 3.83,0.003 6.181,4.719 6.181,10.535 z" + id="path2" /></g></g></svg> diff --git a/src/assets/images/knowyourmeme-icon.svg b/src/assets/images/knowyourmeme-icon.svg new file mode 100644 index 00000000..9f249b08 --- /dev/null +++ b/src/assets/images/knowyourmeme-icon.svg @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="116.947" + height="116.94743" + viewBox="0 0 3704.8809 3733.9645" + version="1.1" + id="svg4" + sodipodi:docname="knowyourmeme-icon.svg" + xml:space="preserve" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"><sodipodi:namedview + id="namedview4" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:zoom="2.7506454" + inkscape:cx="40.717717" + inkscape:cy="45.989207" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="TENOR_GREY" /><!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch --><title + id="title1">TENOR_VECTOR</title><desc + id="desc1">Created with Sketch.</desc><defs + id="defs1"><clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath2"><rect + style="fill:#ffffff;fill-opacity:1;stroke-width:140.586;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.53144" + id="rect3" + width="1239.6986" + height="1253.6278" + x="-2810.0535" + y="4927.0469" + rx="0" + ry="0" /></clipPath></defs><g + id="Page-1" + stroke="none" + stroke-width="1" + fill="none" + fill-rule="evenodd" + transform="translate(1743.8642,1673.0714)"><g + id="TENOR_VECTOR" + fill="#007add"><g + id="TENOR_GREY"><circle + style="fill:#13133e;stroke-width:140.586;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.53144;fill-opacity:1" + id="path2" + cx="108.57625" + cy="193.90395" + r="1866.9753" /><g + id="g1" + transform="matrix(31.928571,0,0,31.928571,-2118.0964,-2041.0893)"><path + fill="url(#svg_7ac8_a)" + d="M 130,70 C 130,36.863 103.137,10 70,10 36.863,10 10,36.863 10,70 c 0,33.137 26.863,60 60,60 33.137,0 60,-26.863 60,-60 z" + id="path1" /></g><path + style="fill:#000000" + id="path4" /><path + style="fill:#000000" + id="path3" /><path + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:31.9286px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M -743.18347,-600.25878 V 957.9208 h -191.00247 v 361.9007 H -79.70046 V 957.9208 h -231.2136 V 294.43881 L 342.51635,957.9208 H 161.56653 v 361.9007 H 1151.3384 V 957.9208 H 922.12713 L 136.43462,128.56704 922.12713,-600.25878 H 1151.3384 V -931.99982 H 282.19957 v 331.74104 H 382.72732 L -310.91406,58.198161 V -600.25878 h 231.2136 v -331.74104 h -854.48548 v 331.74104 z" + id="path5" + sodipodi:nodetypes="cccccccccccccccccccccccccccc" /></g></g></g><metadata + id="metadata2"><rdf:RDF><cc:Work + rdf:about=""><dc:title>TENOR_VECTOR</dc:title></cc:Work></rdf:RDF></metadata></svg> diff --git a/src/assets/images/tenor-icon.svg b/src/assets/images/tenor-icon.svg new file mode 100644 index 00000000..8cdc1214 --- /dev/null +++ b/src/assets/images/tenor-icon.svg @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="116.94743" + height="116.94743" + viewBox="0 0 3704.8947 3733.9645" + version="1.1" + id="svg4" + sodipodi:docname="TENOR_VECTOR.svg" + xml:space="preserve" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview + id="namedview4" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:zoom="3.89" + inkscape:cx="43.44473" + inkscape:cy="65.167095" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="g1" /><!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch --><title + id="title1">TENOR_VECTOR</title><desc + id="desc1">Created with Sketch.</desc><defs + id="defs1" /><g + id="Page-1" + stroke="none" + stroke-width="1" + fill="none" + fill-rule="evenodd" + transform="translate(1743.8642,1673.0714)"><g + id="TENOR_VECTOR" + fill="#007add"><g + id="TENOR_GREY"><g + id="g1" + transform="matrix(31.928571,0,0,31.928571,-2118.0964,-2041.0893)"><path + fill="url(#svg_7ac8_a)" + d="M 130,70 C 130,36.863 103.137,10 70,10 36.863,10 10,36.863 10,70 c 0,33.137 26.863,60 60,60 33.137,0 60,-26.863 60,-60 z" + id="path1" /></g><path + d="m 155.99793,-429.63835 h 36.64818 405.94906 c 60.89235,0 110.50835,19.73363 142.08217,74.424 52.43508,91.90236 -1.12764,202.97453 -105.99781,218.76144 -16.35073,2.25526 -33.82909,2.81908 -50.74364,2.81908 h -391.8536 -36.08436 v 31.57382 1006.41539 c 0,67.65818 10.71254,132.49722 56.38182,187.75142 37.21199,45.1055 87.3918,64.2753 142.08216,72.7326 81.75363,12.9677 162.94344,6.2019 242.4418,-18.606 75.55163,-24.2442 149.97562,9.5849 175.34745,80.0621 25.9356,71.6049 -10.71255,142.0822 -80.626,175.9113 -94.72145,46.2331 -193.95344,66.5305 -298.82361,72.1687 -271.76035,13.5316 -515.89359,-183.8047 -557.05232,-453.3098 -5.63818,-34.9567 -7.32963,-71.04107 -7.32963,-106.56163 -0.56383,-335.47178 -0.56383,-670.94357 -0.56383,-1006.415357 v -38.903453 c -12.404,-0.56381 -22.55272,-1.69145 -32.13763,-1.69145 -62.02,0 -124.03998,1.12764 -186.05998,-0.56382 -101.48727,-2.81909 -166.89017,-78.93454 -151.66708,-174.78362 10.71255,-67.65818 72.16872,-118.40181 149.41181,-120.65708 60.89236,-1.69145 122.34853,-0.56382 183.24089,-0.56382 37.21199,0 37.21199,0 37.21199,-38.90345 v -391.8536 c 0,-95.84906 69.34963,-169.14542 161.81581,-170.27302 92.466174,-1.1277 165.19872,72.73249 165.76253,169.70922 0.56382,131.36963 0,263.30305 0,394.67267 0.56382,10.71254 0.56382,21.98891 0.56382,36.08436 z" + id="path3" + style="stroke-width:0.999997" /></g></g></g></svg> diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 1a9c3f29..c7f12bc0 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -62,68 +62,21 @@ async function redirectAsync(url, type, initiator, forceRedirection) { } /** - * @param {URL} url - * @param {string} type - * @param {URL} initiator - * @param {boolean} forceRedirection - * @returns {string | undefined} + * @param url + * @param frontend + * @param randomInstance + * @returns {undefined|string} */ -function redirect(url, type, initiator, forceRedirection, incognito) { - if (type != "main_frame" && type != "sub_frame" && type != "image") return - let randomInstance - let frontend - if (!forceRedirection && options.redirectOnlyInIncognito == true && !incognito) return - for (const service in config.services) { - if (!forceRedirection && !options[service].enabled) continue - - frontend = options[service].frontend - - - if (config.services[service].frontends[frontend].desktopApp && type != "main_frame" && options[service].redirectType != "main_frame") - frontend = options[service].embedFrontend - - - if (!regexArray(service, url, config, frontend)) { - frontend = null - continue - } - - if ( - config.services[service].embeddable && - type != options[service].redirectType && options[service].redirectType != "both" - ) { - if (options[service].unsupportedUrls == 'block') return 'CANCEL' - return - } - - let instanceList = options[frontend] - if (instanceList === undefined) break - if (instanceList.length === 0) return null - - if ( - initiator - && - instanceList.includes(initiator.origin) - ) { - if (type != "main_frame") return null - else return "BYPASSTAB" - } - - randomInstance = utils.getRandomInstance(instanceList) - if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") { - randomInstance = `http://${frontend}.localhost:8080` - } - break - } - if (!frontend) return - +function rewrite(url, frontend, randomInstance) { + if (!frontend || !randomInstance) return switch (frontend) { case "hyperpipe": { return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) } case "searx": - case "searxng": + case "searxng": { return `${randomInstance}/${url.search}` + } case "whoogle": { return `${randomInstance}/search${url.search}` } @@ -149,7 +102,6 @@ function redirect(url, type, initiator, forceRedirection, incognito) { case "freetubePwa": { return 'freetube://' + url.href } - case "poketube": { if (url.pathname.startsWith('/channel')) { const reg = /\/channel\/(.*)\/?$/.exec(url.pathname) @@ -415,7 +367,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) { if (url.hostname.endsWith('bandcamp.com')) { const regex = /^(.*)\.bandcamp\.com/.exec(url.hostname) const artist = regex[1] - if (url.pathname == '/') { + if (url.pathname == '/' || url.pathname == '/music') { return `${randomInstance}/artist.php?name=${artist}` } else { const regex = /^\/(.*)\/(.*)/.exec(url.pathname) @@ -559,6 +511,60 @@ function redirect(url, type, initiator, forceRedirection, incognito) { /** * @param {URL} url + * @param {string} type + * @param {URL} initiator + * @param {boolean} forceRedirection + * @returns {string | undefined} + */ +function redirect(url, type, initiator, forceRedirection, incognito) { + if (type != "main_frame" && type != "sub_frame" && type != "image") return + let randomInstance + let frontend + if (!forceRedirection && options.redirectOnlyInIncognito == true && !incognito) return + for (const service in config.services) { + if (!forceRedirection && !options[service].enabled) continue + + frontend = options[service].frontend + + if (config.services[service].frontends[frontend].desktopApp && type != "main_frame" && options[service].redirectType != "main_frame") + frontend = options[service].embedFrontend + + if (!regexArray(service, url, config, frontend)) { + frontend = null + continue + } + + if ( + config.services[service].embeddable + && + type != options[service].redirectType && options[service].redirectType != "both" + ) { + if (options[service].unsupportedUrls == 'block') return 'CANCEL' + return + } + + let instanceList = options[frontend] + if (instanceList === undefined) break + if (instanceList.length === 0) return null + + if (initiator && instanceList.includes(initiator.origin)) { + if (type != "main_frame") return null + else return "BYPASSTAB" + } + + randomInstance = utils.getRandomInstance(instanceList) + if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") { + randomInstance = `http://${frontend}.localhost:8080` + } + break + } + if (!frontend) return + + return rewrite(url, frontend, randomInstance) +} + +/** + * @param {URL} url * @param {*} returnFrontend */ function computeService(url, returnFrontend) { @@ -711,6 +717,9 @@ const defaultInstances = { 'biblioReads': ['https://biblioreads.ml'], 'wikiless': ['https://wikiless.org'], 'suds': ['https://sd.vern.cc'], + 'unfunny': ['https://uf.vern.cc'], + 'soprano': ['https://sp.vern.cc'], + 'meme': ['https://mm.vern.cc'], 'waybackClassic': ['https://wayback-classic.net'], 'gothub': ['https://gh.odyssey346.dev'], 'mikuInvidious': ['https://mikuinv.resrv.org'], |