This commit is contained in:
ManeraKai 2024-03-23 07:23:34 +03:00
commit 8d73647ab9
11 changed files with 341 additions and 78 deletions

View File

@ -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>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -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>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -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>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -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)
@ -557,6 +509,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
@ -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'],

View File

@ -716,6 +716,66 @@
"imageType": "svg",
"url": "https://www.snopes.com"
},
"ifunny": {
"frontends": {
"unfunny": {
"name": "UNfunny",
"instanceList": true,
"url": "https://git.vern.cc/cobra/UNfunny"
}
},
"targets": [
"^https?:\\/{2}(www\\.)?ifunny\\.co\\/"
],
"name": "iFunny",
"options": {
"enabled": false,
"unsupportedUrls": "bypass",
"frontend": "unfunny"
},
"imageType": "svg",
"url": "https://ifunny.co"
},
"tenor": {
"frontends": {
"soprano": {
"name": "Soprano",
"instanceList": true,
"url": "https://git.vern.cc/cobra/Soprano"
}
},
"targets": [
"^https?:\\/{2}(www\\.)?tenor\\.com\\/"
],
"name": "Tenor",
"options": {
"enabled": false,
"unsupportedUrls": "bypass",
"frontend": "soprano"
},
"imageType": "svg",
"url": "https://tenor.com"
},
"knowyourmeme": {
"frontends": {
"meme": {
"name": "MeMe",
"instanceList": true,
"url": "https://git.vern.cc/cobra/MeMe"
}
},
"targets": [
"^https?:\\/{2}(www\\.)?knowyourmeme\\.com\\/"
],
"name": "KnowYourMeme",
"options": {
"enabled": false,
"unsupportedUrls": "bypass",
"frontend": "meme"
},
"imageType": "svg",
"url": "https://knowyourmeme.com"
},
"urbanDictionary": {
"frontends": {
"ruralDictionary": {

View File

@ -1,7 +1,7 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "2.8.2",
"version": "2.8.3",
"manifest_version": 2,
"browser_specific_settings": {
"gecko": {

View File

@ -112,13 +112,9 @@ redirectOnlyInIncognitoElement.addEventListener('change', event => {
const bookmarksMenuElement = document.getElementById('bookmarksMenu')
bookmarksMenuElement.addEventListener('change', async event => {
if (event.target.checked)
bookmarksMenuElement.checked = await browser.permissions.request({
permissions: ["bookmarks"]
})
browser.permissions.request({ permissions: ["bookmarks"] }, r => bookmarksMenuElement.checked = r)
else
bookmarksMenuElement.checked = !await browser.permissions.remove({
permissions: ["bookmarks"]
})
browser.permissions.remove({ permissions: ["bookmarks"] }, r => bookmarksMenuElement.checked = !r)
})
let themeElement = document.getElementById("theme")
@ -149,7 +145,7 @@ let options = await utils.getOptions()
themeElement.value = options.theme
fetchInstancesElement.value = options.fetchInstances
redirectOnlyInIncognitoElement.checked = options.redirectOnlyInIncognito
bookmarksMenuElement.checked = await browser.permissions.contains({ permissions: ["bookmarks"] })
browser.permissions.contains({ permissions: ["bookmarks"] }, r => bookmarksMenuElement.checked = r)
for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
instanceTypeElement.addEventListener("change", event => {

View File

@ -7,15 +7,17 @@ import utils from "../../assets/javascripts/utils.js"
document.getElementById("more-options").href = browser.runtime.getURL("pages/options/index.html")
document.getElementById("more-options").setAttribute('target', '_blank')
const os = (await browser.runtime.getPlatformInfo()).os
switch (os) {
case "fuchsia":
case "ios":
case "android": {
document.getElementsByTagName("html")[0].classList.add("mobile")
await browser.runtime.getPlatformInfo(r => {
switch (r.os) {
case "fuchsia":
case "ios":
case "android": {
document.getElementsByTagName("html")[0].classList.add("mobile")
}
}
}
)
const allSites = document.getElementById("all_sites")
const currSite = document.getElementById("current_site")
@ -68,10 +70,12 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
// Set visibility of control buttons
if (tabs[0].url) {
const hr = document.getElementById("hr")
url = new URL(tabs[0].url)
servicesHelper.switchInstance(url).then(r => {
if (r) {
document.getElementById("change_instance_div").style.display = ""
hr.style.display = ""
document.getElementById("change_instance").addEventListener("click", async () =>
browser.tabs.update({ url: await servicesHelper.switchInstance(url) })
)
@ -80,6 +84,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.copyRaw(url, true).then(r => {
if (r) {
document.getElementById("copy_original_div").style.display = ""
hr.style.display = ""
document.getElementById("copy_original").addEventListener("click", () =>
servicesHelper.copyRaw(url)
)
@ -88,6 +93,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.reverse(url).then(r => {
if (r) {
document.getElementById("redirect_to_original_div").style.display = ""
hr.style.display = ""
document.getElementById("redirect_to_original").addEventListener("click", () =>
browser.runtime.sendMessage("reverseTab")
)
@ -96,6 +102,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.redirectAsync(url, "main_frame", null, true).then(r => {
if (r) {
document.getElementById("redirect_div").style.display = ""
hr.style.display = ""
document.getElementById("redirect").addEventListener("click", () =>
browser.runtime.sendMessage("redirectTab")
)

View File

@ -30,7 +30,7 @@ html(lang="en")
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M 17,20 V 11 Q 17,10.175 16.412,9.587 15.825,9 15,9 H 6.8 L 8.4,7.4 7,6 3,10 7,14 8.4,12.6 6.8,11 H 15 v 9 z" id="path2")
hr
hr(id="hr" style="display: none")
div(id="current_site")
include /src/pages/popup/switches

View File

@ -131,7 +131,7 @@ section.links {
flex-wrap: wrap;
flex-direction: column;
width: 350px;
max-height: 930px;
max-height: 970px;
}
section.links div {
@ -375,19 +375,27 @@ input:disabled {
cursor: not-allowed;
}
@media (max-width: 1250px) {
body.option {
flex-direction: column;
width: 750px;
width: 95vw;
align-items: center;
padding: 40px 0px;
}
section.links {
flex-direction: row;
width: 750px;
width: 95vw;
padding: 0 55px;
}
section.block-option {
width: 95vw;
}
div.checklist div x {
overflow: hidden;
}
}
html.mobile img,

View File

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='oladmjdebphlnjjcnomfhhbfdldiimaf'>
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.8.2/libredirect-2.8.2.crx' version='2.8.2' />
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.8.3/libredirect-2.8.3.crx' version='2.8.3' />
</app>
</gupdate>