diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/assets/images/about-icon-white.svg | 44 | ||||
-rw-r--r-- | src/assets/images/general-icon-white.svg | 41 | ||||
-rw-r--r-- | src/assets/images/instance-icon.svg | 3 | ||||
-rw-r--r-- | src/assets/images/maps-icon-white.svg | 40 | ||||
-rw-r--r-- | src/assets/images/medium-icon.svg | 65 | ||||
-rw-r--r-- | src/assets/images/search-icon-white.svg | 38 | ||||
-rw-r--r-- | src/assets/images/sendFiles-icon-white.svg | 40 | ||||
-rw-r--r-- | src/assets/images/textStorage-icon-white.svg | 40 | ||||
-rw-r--r-- | src/assets/images/translate-icon-white.svg | 40 | ||||
-rw-r--r-- | src/assets/javascripts/services.js | 140 | ||||
-rw-r--r-- | src/assets/javascripts/utils.js | 16 | ||||
-rw-r--r-- | src/config.json | 26 | ||||
-rwxr-xr-x | src/instances/get_instances.py | 25 | ||||
-rw-r--r-- | src/pages/background/background.js | 54 | ||||
-rw-r--r-- | src/pages/options/index.js | 154 | ||||
-rw-r--r-- | src/pages/options/widgets/general.js | 35 | ||||
-rw-r--r-- | src/pages/options/widgets/services.pug | 14 | ||||
-rw-r--r-- | src/pages/popup/popup.js | 2 | ||||
-rw-r--r-- | src/pages/widgets/head.pug | 2 | ||||
-rw-r--r-- | src/pages/widgets/links.pug | 5 | ||||
-rw-r--r-- | src/pages/widgets/switches.pug | 5 |
21 files changed, 503 insertions, 326 deletions
diff --git a/src/assets/images/about-icon-white.svg b/src/assets/images/about-icon-white.svg new file mode 100644 index 00000000..7c4ef3ca --- /dev/null +++ b/src/assets/images/about-icon-white.svg @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + height="24" + width="24" + fill="currentColor" + version="1.1" + id="svg4" + sodipodi:docname="about-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs8" /> + <sodipodi:namedview + id="namedview6" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="22.922045" + inkscape:cx="1.2651576" + inkscape:cy="10.383018" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg4" /> + <path + d="m 11,17 h 2 V 11 H 11 Z M 12,9 C 12.283333,9 12.521,8.904 12.713,8.712 12.904333,8.5206667 13,8.2833333 13,8 13,7.7166667 12.904333,7.479 12.713,7.287 12.521,7.0956667 12.283333,7 12,7 11.716667,7 11.479333,7.0956667 11.288,7.287 11.096,7.479 11,7.7166667 11,8 11,8.2833333 11.096,8.5206667 11.288,8.712 11.479333,8.904 11.716667,9 12,9 Z" + id="path2" + sodipodi:nodetypes="cccccssscssscs" + style="fill:#ffffff" /> + <path + id="path387" + d="M 12,2 C 10.616668,2 9.316275,2.2624432 8.099609,2.7871094 6.882944,3.3124421 5.82578,4.0257822 4.925781,4.9257812 4.025782,5.8257804 3.311776,6.8829439 2.787109,8.0996094 2.261777,9.3162749 2,10.616668 2,12 c 0,1.383332 0.261777,2.683725 0.787109,3.900391 0.524667,1.216665 1.238673,2.273829 2.138672,3.173828 0.899999,0.899999 1.957163,1.614005 3.173828,2.138672 C 9.316275,21.738223 10.616668,22 12,22 c 1.383332,0 2.683725,-0.261777 3.900391,-0.787109 1.216665,-0.524667 2.273829,-1.238673 3.173828,-2.138672 0.899999,-0.899999 1.614005,-1.957163 2.138672,-3.173828 C 21.738223,14.683725 22,13.383332 22,12 22,10.616668 21.738223,9.3162749 21.212891,8.0996094 20.688224,6.8829439 19.974218,5.8257804 19.074219,4.9257812 18.17422,4.0257822 17.117056,3.3124421 15.900391,2.7871094 14.683725,2.2624432 13.383332,2 12,2 Z m 0,2 c 2.233331,0 4.125783,0.7742203 5.675781,2.3242188 C 19.22578,7.8742172 20,9.7666689 20,12 20,14.233331 19.22578,16.125783 17.675781,17.675781 16.125783,19.22578 14.233331,20 12,20 9.766669,20 7.874217,19.22578 6.324219,17.675781 4.77422,16.125783 4,14.233331 4,12 4,9.7666689 4.77422,7.8742172 6.324219,6.3242188 7.874217,4.7742203 9.766669,4 12,4 Z" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/general-icon-white.svg b/src/assets/images/general-icon-white.svg new file mode 100644 index 00000000..9e4c8a06 --- /dev/null +++ b/src/assets/images/general-icon-white.svg @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + enable-background="new 0 0 24 24" + height="26px" + viewBox="0 0 24 24" + width="26px" + fill="currentColor" + version="1.1" + id="svg675" + sodipodi:docname="general-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs679" /> + <sodipodi:namedview + id="namedview677" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="29.923077" + inkscape:cx="9.7583548" + inkscape:cy="13" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg675" /> + <path + d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" + id="path673" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/instance-icon.svg b/src/assets/images/instance-icon.svg deleted file mode 100644 index 6b034c6f..00000000 --- a/src/assets/images/instance-icon.svg +++ /dev/null @@ -1,3 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> - <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"></path> -</svg> diff --git a/src/assets/images/maps-icon-white.svg b/src/assets/images/maps-icon-white.svg new file mode 100644 index 00000000..faefa200 --- /dev/null +++ b/src/assets/images/maps-icon-white.svg @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + height="24px" + viewBox="0 0 24 24" + width="24px" + fill="currentColor" + version="1.1" + id="svg933" + sodipodi:docname="maps-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs937" /> + <sodipodi:namedview + id="namedview935" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="32.416667" + inkscape:cx="9.0077121" + inkscape:cy="12" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg933" /> + <path + d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z" + id="path931" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/medium-icon.svg b/src/assets/images/medium-icon.svg index 72612486..f77ed5bb 100644 --- a/src/assets/images/medium-icon.svg +++ b/src/assets/images/medium-icon.svg @@ -1,5 +1,62 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> - <circle cx="500" cy="500" r="500"></circle> - <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> - <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + viewBox="0 0 2084.3154 2084.3154" + fill="currentColor" + version="1.1" + id="svg1324" + sodipodi:docname="medium-icon.svg" + width="2084.3154" + height="2084.3154" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs1328" /> + <sodipodi:namedview + id="namedview1326" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="0.34774011" + inkscape:cx="422.72949" + inkscape:cy="1233.6799" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg1324" /> + <circle + style="fill:#000000;fill-rule:evenodd;stroke-width:6.70974;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.411765;paint-order:stroke fill markers;stop-color:#000000" + id="path1499" + cx="1042.1577" + cy="1042.1577" + r="1042.1577" /> + <circle + cx="657.15771" + cy="1042.1577" + r="500" + id="circle1318" + style="fill:#ffffff" /> + <ellipse + ry="475" + rx="250" + cy="1043.1577" + cx="1453.1577" + id="ellipse1320" + style="fill:#ffffff" /> + <ellipse + cx="1839.1577" + cy="1044.1577" + rx="88" + ry="424" + id="ellipse1322" + style="fill:#ffffff" /> </svg> diff --git a/src/assets/images/search-icon-white.svg b/src/assets/images/search-icon-white.svg new file mode 100644 index 00000000..432fd136 --- /dev/null +++ b/src/assets/images/search-icon-white.svg @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + viewBox="0 0 24 24" + fill="currentColor" + version="1.1" + id="svg417" + sodipodi:docname="search-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs421" /> + <sodipodi:namedview + id="namedview419" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="32.416667" + inkscape:cx="9.0077121" + inkscape:cy="12" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg417" /> + <path + d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" + id="path415" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/sendFiles-icon-white.svg b/src/assets/images/sendFiles-icon-white.svg new file mode 100644 index 00000000..f2447a77 --- /dev/null +++ b/src/assets/images/sendFiles-icon-white.svg @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + height="24px" + viewBox="0 0 24 24" + width="24px" + fill="currentColor" + version="1.1" + id="svg546" + sodipodi:docname="sendFiles-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs550" /> + <sodipodi:namedview + id="namedview548" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="32.416667" + inkscape:cx="9.0077121" + inkscape:cy="12" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg546" /> + <path + d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z" + id="path544" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/textStorage-icon-white.svg b/src/assets/images/textStorage-icon-white.svg new file mode 100644 index 00000000..3ca7c595 --- /dev/null +++ b/src/assets/images/textStorage-icon-white.svg @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + height="24px" + viewBox="0 0 24 24" + width="24px" + fill="currentColor" + version="1.1" + id="svg1191" + sodipodi:docname="textStorage-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs1195" /> + <sodipodi:namedview + id="namedview1193" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="32.416667" + inkscape:cx="9.0077121" + inkscape:cy="12" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg1191" /> + <path + d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z" + id="path1189" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/images/translate-icon-white.svg b/src/assets/images/translate-icon-white.svg new file mode 100644 index 00000000..f884ee14 --- /dev/null +++ b/src/assets/images/translate-icon-white.svg @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + height="24px" + viewBox="0 0 24 24" + width="24px" + fill="currentColor" + version="1.1" + id="svg1062" + sodipodi:docname="translate-icon-white.svg" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + 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"> + <defs + id="defs1066" /> + <sodipodi:namedview + id="namedview1064" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="32.416667" + inkscape:cx="9.0077121" + inkscape:cy="12" + inkscape:window-width="1888" + inkscape:window-height="1060" + inkscape:window-x="32" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg1062" /> + <path + d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z" + id="path1060" + style="fill:#ffffff" /> +</svg> diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 598dd30e..4f3b6be3 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -8,7 +8,6 @@ function init() { return new Promise(async resolve => { browser.storage.local.get(["options", "redirects", "targets"], r => { options = r.options - redirects = r.redirects targets = r.targets fetch("/config.json") .then(response => response.text()) @@ -27,7 +26,7 @@ function fetchFrontendInstanceList(service, frontend, redirects, options, config let tmp = [] if (config.services[service].frontends[frontend].instanceList) { for (const network in config.networks) { - tmp.push(...redirects[network], ...options[frontend][network].custom) + tmp.push(...options[frontend]) } } return tmp @@ -82,7 +81,7 @@ function redirect(url, type, initiator, forceRedirection) { let instanceList = [] for (const network in options[frontend]) { - instanceList.push(...[...options[frontend][network].enabled, ...options[frontend][network].custom]) + instanceList.push(...options[frontend]) } if (instanceList.length === 0) return randomInstance = utils.getRandomInstance(instanceList) @@ -105,7 +104,6 @@ function redirect(url, type, initiator, forceRedirection) { } return [zoom, lon, lat] } - console.log(frontend) switch (frontend) { // This is where all instance-specific code must be ran to convert the service url to one that can be understood by the frontend. case "beatbump": @@ -189,7 +187,6 @@ function redirect(url, type, initiator, forceRedirection) { if (xmlhttp.status === 200) { const json = JSON.parse(xmlhttp.responseText)[0] if (json) { - console.log("json", json) return [`${json.lat},${json.lon}`, `${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`] } } @@ -280,9 +277,9 @@ function redirect(url, type, initiator, forceRedirection) { } let prefsEncoded = new URLSearchParams(prefs).toString() - console.log("mapCentre", mapCentre) - console.log("prefs", prefs) - console.log("prefsEncoded", prefsEncoded) + // console.log("mapCentre", mapCentre) + // console.log("prefs", prefs) + // console.log("prefsEncoded", prefsEncoded) return `${randomInstance}/${mapCentre}&${prefsEncoded}` } case "facil": { @@ -423,7 +420,6 @@ function computeService(url, returnFrontend) { .then(configData => { const config = JSON.parse(configData) browser.storage.local.get(["redirects", "options"], r => { - const redirects = r.redirects const options = r.options for (const service in config.services) { if (regexArray(service, url, config)) { @@ -456,12 +452,12 @@ function switchInstance(url) { if (Object.keys(config.services[service].frontends).length == 1) { const frontend = Object.keys(config.services[service].frontends)[0] for (const network in options[frontend]) { - instancesList.push(...[...options[frontend][network].enabled, ...options[frontend][network].custom]) + instancesList.push(...options[frontend]) } } else { const frontend = options[service].frontend for (const network in options[frontend]) { - instancesList.push(...[...options[frontend][network].enabled, ...options[frontend][network].custom]) + instancesList.push(...options[frontend]) } } @@ -523,106 +519,36 @@ function reverse(url, urlString) { }) } -function setRedirects(passedRedirects) { +function initDefaults() { return new Promise(resolve => { fetch("/config.json") .then(response => response.text()) .then(configData => { - browser.storage.local.get(/* [ */ "options" /* , "blacklists"] */, async r => { - let redirects = passedRedirects + browser.storage.local.get(["options"], r => { let options = r.options - const config = JSON.parse(configData) let targets = {} + let config = JSON.parse(configData) + const localstorage = {} for (const service in config.services) { - if (config.services[service].targets == "datajson") { - targets[service] = redirects[service] - delete redirects[service] + options[service] = {} + for (const defaultOption in config.services[service].options) { + options[service][defaultOption] = config.services[service].options[defaultOption] } for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { - for (const network in config.networks) { - for (const instance of options[frontend][network].enabled) { - let i = redirects[frontend][network].indexOf(instance) - if (i < 0) options[frontend][network].enabled.splice(i, 1) - } - } - } - } - /* - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList) { - for (const network in config.networks) { - options[frontend][network].enabled = redirects[frontend][network] - } - for (const blacklist in r.blacklists) { - for (const instance of blacklist) { - let i = options[frontend].clearnet.enabled.indexOf(instance) - if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) - } - } + options[frontend] = [] } } - */ - // The above will be implemented with https://github.com/libredirect/libredirect/issues/334 } - for (const frontend in redirects) { - let exists = false - for (const service in config.services) if (config.services[service].frontends[frontend]) exists = true - if (!exists) delete redirects[frontend] - else for (const network in redirects[frontend]) if (!config.networks[network]) delete redirects[frontend][network] - } - browser.storage.local.set({ redirects, targets, options }, () => resolve()) + browser.storage.local.set( + { options, targets, localstorage }, + () => resolve() + ) }) }) }) } -function initDefaults() { - return new Promise(resolve => { - fetch("/instances/data.json") - .then(response => response.text()) - .then(data => { - fetch("/config.json") - .then(response => response.text()) - .then(configData => { - browser.storage.local.get(["options", "blacklists"], r => { - let redirects = JSON.parse(data) - let options = r.options - let targets = {} - let config = JSON.parse(configData) - const localstorage = {} - for (const service in config.services) { - options[service] = {} - if (config.services[service].targets == "datajson") { - targets[service] = redirects[service] - delete redirects[service] - } - for (const defaultOption in config.services[service].options) options[service][defaultOption] = config.services[service].options[defaultOption] - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList) { - options[frontend] = {} - for (const network in config.networks) { - options[frontend][network] = {} - options[frontend][network].enabled = JSON.parse(data)[frontend][network] - options[frontend][network].custom = [] - } - for (const blacklist in r.blacklists) { - for (const instance of r.blacklists[blacklist]) { - let i = options[frontend].clearnet.enabled.indexOf(instance) - if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) - } - } - } - } - } - browser.storage.local.set({ redirects, options, targets, localstorage }) - resolve() - }) - }) - }) - }) -} - function upgradeOptions() { return new Promise(resolve => { fetch("/config.json") @@ -675,14 +601,6 @@ function upgradeOptions() { let protocol if (network == "clearnet") protocol = "normal" else protocol = network - if (r[frontend + utils.camelCase(protocol) + "RedirectsChecks"]) { - options[frontend][network].enabled = r[frontend + utils.camelCase(protocol) + "RedirectsChecks"] - options[frontend][network].custom = r[frontend + utils.camelCase(protocol) + "CustomRedirects"] - for (const instance of options[frontend][network].enabled) { - let i = r.redirects[frontend][network].indexOf(instance) - if (i < 0) options[frontend][network].enabled.splice(i, 1) - } - } } } } @@ -700,7 +618,7 @@ function processUpdate() { fetch("/config.json") .then(response => response.text()) .then(configData => { - browser.storage.local.get(["options", "blacklists", "targets"], r => { + browser.storage.local.get(["options", "targets"], r => { let redirects = JSON.parse(data) let options = r.options let targets = r.targets @@ -720,23 +638,16 @@ function processUpdate() { if (config.services[service].frontends[frontend].instanceList) { if (!options[frontend]) options[frontend] = {} for (const network in config.networks) { - if (!options[frontend][network]) { - options[frontend][network] = {} - options[frontend][network].enabled = JSON.parse(data)[frontend][network] - options[frontend][network].custom = [] + if (!options[frontend]) { + options[frontend] = [] if (network == "clearnet") { - for (const blacklist in r.blacklists) { - for (const instance of r.blacklists[blacklist]) { + for (const blacklist of getBlacklist()) { + for (const instance of blacklist) { let i = options[frontend].clearnet.enabled.indexOf(instance) if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) } } } - } else { - for (const instance of options[frontend][network].enabled) { - let i = redirects[frontend][network].indexOf(instance) - if (i < 0) options[frontend][network].enabled.splice(i, 1) - } } } } @@ -762,7 +673,7 @@ function modifyContentSecurityPolicy(details) { for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].embeddable) { for (const network in config.networks) { - instancesList.push(...options[frontend][network].enabled, ...options[frontend][network].custom) + instancesList.push(...options[frontend]) } } } @@ -793,7 +704,6 @@ export default { computeService, switchInstance, reverse, - setRedirects, initDefaults, upgradeOptions, processUpdate, diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index d6c5e300..6e6b6707 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -70,10 +70,26 @@ function switchInstance(test) { }) } +function getBlacklist() { + let http = new XMLHttpRequest() + http.open("GET", "https://codeberg.org/LibRedirect/libredirect/raw/branch/master/src/instances/blacklist.json", false) + http.send(null) + return JSON.parse(http.responseText) +} + +function getList() { + let http = new XMLHttpRequest() + http.open("GET", "https://codeberg.org/LibRedirect/libredirect/raw/branch/master/src/instances/data.json", false) + http.send(null) + return JSON.parse(http.responseText) +} + export default { getRandomInstance, protocolHost, switchInstance, copyRaw, + getList, + getBlacklist, camelCase, } diff --git a/src/config.json b/src/config.json index ae9a9f64..97e84f61 100644 --- a/src/config.json +++ b/src/config.json @@ -299,22 +299,6 @@ "embeddable": false, "url": "https://fandom.com" }, - "peertube": { - "frontends": { - "simpleertube": { - "name": "SimpleerTube", - "instanceList": true - } - }, - "targets": "datajson", - "name": "PeerTube", - "options": { - "enabled": false - }, - "imageType": "svg", - "embeddable": false, - "url": "https://joinpeertube.org" - }, "lbry": { "frontends": { "librarian": { @@ -369,7 +353,7 @@ "enabled": true, "frontend": "searxng" }, - "imageType": "svg", + "imageType": "svgMono", "embeddable": false, "url": "https://search.libredirect.invalid" }, @@ -397,7 +381,7 @@ "enabled": true, "frontend": "simplyTranslate" }, - "imageType": "svg", + "imageType": "svgMono", "embeddable": false, "url": "https://translate.libredirect.invalid" }, @@ -421,7 +405,7 @@ "enabled": false, "frontend": "osm" }, - "imageType": "svg", + "imageType": "svgMono", "embeddable": false, "url": "https://maps.libredirect.invalid" }, @@ -441,7 +425,7 @@ "options": { "enabled": true }, - "imageType": "svg", + "imageType": "svgMono", "embeddable": false, "url": "https://send.libredirect.invalid" }, @@ -459,7 +443,7 @@ "options": { "enabled": true }, - "imageType": "svg", + "imageType": "svgMono", "embeddable": false, "url": "https://paste.libredirect.invalid" } diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 248f719a..7ae8948a 100755 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -414,10 +414,6 @@ def librarian(): 'https://codeberg.org/librarian/librarian/raw/branch/main/instances.json', 'url', True) -def neuters(): - fetchFromFile('neuters', 'Neuters') - - def beatbump(): fetchFromFile('beatbump', 'Beatbump') @@ -449,23 +445,6 @@ def privateBin(): fetchJsonList('privateBin', 'PrivateBin', 'https://privatebin.info/directory/api?top=100&https_redirect=true&min_rating=A&csp_header=true&min_uptime=100&attachments=true', 'url', False) - -def peertube(): - try: - r = requests.get( - 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt', headers=headers) - rJson = json.loads(r.text) - - myList = ['https://search.joinpeertube.org'] - for k in rJson['data']: - myList.append('https://'+k['host']) - - mightyList['peertube'] = myList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'PeerTube') - except Exception: - fetchCache('peertube', 'PeerTube') - - def isValid(url): # This code is contributed by avanitrachhadiya2155 try: result = urlparse(url) @@ -495,7 +474,6 @@ whoogle() librex() rimgo() librarian() -neuters() beatbump() hyperpipe() facil() @@ -520,9 +498,6 @@ for k1, v1 in mightyList.items(): cloudflare.append(instance) if not instance.endswith('.onion') and not instance.endswith('.i2p') and not instance.endswith('.loki') and is_authenticate(instance): authenticate.append(instance) - -peertube() - blacklist = { 'cloudflare': cloudflare, 'authenticate': authenticate, diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 33f0d40b..77128612 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -6,40 +6,34 @@ import servicesHelper from "../../assets/javascripts/services.js" window.browser = window.browser || window.chrome -browser.runtime.onInstalled.addListener(details => { +browser.runtime.onInstalled.addListener(async details => { if (details.previousVersion != browser.runtime.getManifest().version) { // ^Used to prevent this running when debugging with auto-reload - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - switch (details.reason) { - case "install": - browser.storage.local.get("options", async r => { - if (!r.options) { - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - } - }) - break - case "update": - switch (details.previousVersion) { - case "2.2.0": - case "2.2.1": - browser.storage.local.get("options", async r => { - if (!r.options) { - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - await servicesHelper.upgradeOptions() - } - }) - break - default: - await servicesHelper.processUpdate() - } + switch (details.reason) { + case "install": + browser.storage.local.get("options", async r => { + if (!r.options) { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() } }) - }) + break + case "update": + switch (details.previousVersion) { + case "2.2.0": + case "2.2.1": + browser.storage.local.get("options", async r => { + if (!r.options) { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + await servicesHelper.upgradeOptions() + } + }) + break + default: + await servicesHelper.processUpdate() + } + } } }) diff --git a/src/pages/options/index.js b/src/pages/options/index.js index a735110a..6fb8e452 100644 --- a/src/pages/options/index.js +++ b/src/pages/options/index.js @@ -53,124 +53,86 @@ function loadPage(path) { let stateObj = { id: "100" } window.history.pushState(stateObj, "Page 2", `/pages/options/index.html#${path}`) - const service = path; - divs[service] = {} - for (const option in config.services[service].options) { - divs[service][option] = document.getElementById(`${service}-${option}`) - - if (typeof config.services[service].options[option] == "boolean") divs[service][option].checked = options[service][option] - else divs[service][option].value = options[service][option] - - divs[service][option].addEventListener("change", () => { - browser.storage.local.get("options", r => { - let options = r.options - if (typeof config.services[service].options[option] == "boolean") options[service][option] = divs[service][option].checked - else options[service][option] = divs[service][option].value - browser.storage.local.set({ options }) - changeFrontendsSettings(service) + if (path != 'general' && path != 'about') { + const service = path; + + divs[service] = {} + for (const option in config.services[service].options) { + divs[service][option] = document.getElementById(`${service}-${option}`) + if (typeof config.services[service].options[option] == "boolean") divs[service][option].checked = options[service][option] + else divs[service][option].value = options[service][option] + + divs[service][option].addEventListener("change", () => { + browser.storage.local.get("options", r => { + let options = r.options + if (typeof config.services[service].options[option] == "boolean") options[service][option] = divs[service][option].checked + else options[service][option] = divs[service][option].value + browser.storage.local.set({ options }) + changeFrontendsSettings(service) + }) }) - }) - } + } - if (Object.keys(config.services[service].frontends).length > 1) { - changeFrontendsSettings(service) - } + if (Object.keys(config.services[service].frontends).length > 1) { + changeFrontendsSettings(service) + } - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList) { - for (const network in config.networks) { - processDefaultCustomInstances(frontend, network, document) + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].instanceList) { + processDefaultCustomInstances(frontend, config.networks, document) } } } } -const r = window.location.href.match(/#(.*)/) -if (r) loadPage(r[1]) -else loadPage("general") -async function processDefaultCustomInstances(frontend, network, document) { - let networkElement = document.getElementById(frontend).getElementsByClassName(network)[0] +async function processDefaultCustomInstances(frontend, networks, document) { let customInstances = [] - let checkListElement = networkElement.getElementsByClassName("checklist")[0] - - let cloudflareBlackList = [] - let authenticateBlackList = [] - await new Promise(resolve => { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(data => { - cloudflareBlackList = JSON.parse(data).cloudflare - authenticateBlackList = JSON.parse(data).authenticate - resolve() - }) - }) - - let frontendDefaultRedirects - - let redirects, options - + let options await new Promise(async resolve => - browser.storage.local.get(["options", "redirects",], r => { - frontendDefaultRedirects = r.options[frontend][network].enabled - customInstances = r.options[frontend][network].custom + browser.storage.local.get(["options"], r => { + customInstances = r.options[frontend] options = r.options - redirects = r.redirects resolve() }) ) - function calcCheckBoxes() { - for (const element of checkListElement.getElementsByTagName("input")) { - element.checked = frontendDefaultRedirects.includes(element.className) - } - } - if (redirects[frontend][network].length > 0) - checkListElement.innerHTML = [ - ` + const blacklist = utils.getBlacklist() + const redirects = utils.getList() + + for (const network in networks) { + if (redirects[frontend][network].length > 0) { + document.getElementById(frontend).getElementsByClassName(network)[0].getElementsByClassName("checklist")[0].innerHTML = [ + ` <div class="some-block option-block"> <h4>${utils.camelCase(network)}</h4> </div> `, - ...redirects[frontend][network] - .sort((a, b) => - (cloudflareBlackList.includes(a) && !cloudflareBlackList.includes(b)) - || - (authenticateBlackList.includes(a) && !authenticateBlackList.includes(b)) - ) - .map(x => { - const cloudflare = cloudflareBlackList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : "" - const authenticate = authenticateBlackList.includes(x) ? ' <span style="color:orange;">authenticate</span>' : "" - - let warnings = [cloudflare, authenticate].join(" ") - return ` + ...redirects[frontend][network] + .sort((a, b) => + (blacklist.cloudflare.includes(a) && !blacklist.cloudflare.includes(b)) + || + (blacklist.authenticate.includes(a) && !blacklist.authenticate.includes(b)) + ) + .map(x => { + const cloudflare = blacklist.cloudflare.includes(x) ? ' <span style="color:red;">cloudflare</span>' : "" + const authenticate = blacklist.authenticate.includes(x) ? ' <span style="color:orange;">authenticate</span>' : "" + + let warnings = [cloudflare, authenticate].join(" ") + return ` <div> <x> <a href="${x}" target="_blank">${x}</a>${warnings} </x> - <input type="checkbox" class="${x}"/> </div>` - }), - '<br>' - ].join("\n<hr>\n") + }), + '<br>' + ].join("\n<hr>\n") + } + } localise.localisePage() - calcCheckBoxes() - - for (let element of checkListElement.getElementsByTagName("input")) { - networkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => { - if (event.target.checked) frontendDefaultRedirects.push(element.className) - else { - let index = frontendDefaultRedirects.indexOf(element.className) - if (index > -1) frontendDefaultRedirects.splice(index, 1) - } - - options[frontend][network].enabled = frontendDefaultRedirects - browser.storage.local.set({ options }, () => calcCheckBoxes()) - }) - } - function calcCustomInstances() { document.getElementById(frontend).getElementsByClassName("custom-checklist")[0].innerHTML = customInstances .map( @@ -191,7 +153,7 @@ async function processDefaultCustomInstances(frontend, network, document) { document.getElementById(frontend).getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => { let index = customInstances.indexOf(item) if (index > -1) customInstances.splice(index, 1) - options[frontend][network].custom = customInstances + options[frontend] = customInstances browser.storage.local.set({ options }, () => calcCustomInstances()) }) } @@ -208,10 +170,10 @@ async function processDefaultCustomInstances(frontend, network, document) { return } let protocolHostVar = utils.protocolHost(url) - if (frontendCustomInstanceInput.validity.valid && !redirects[frontend][network].includes(protocolHostVar)) { + if (frontendCustomInstanceInput.validity.valid) { if (!customInstances.includes(protocolHostVar)) { customInstances.push(protocolHostVar) - options[frontend][network].custom = customInstances + options[frontend] = customInstances browser.storage.local.set({ options }, () => { frontendCustomInstanceInput.value = "" calcCustomInstances() @@ -219,4 +181,8 @@ async function processDefaultCustomInstances(frontend, network, document) { } } }) -} \ No newline at end of file +} + +const r = window.location.href.match(/#(.*)/) +if (r) loadPage(r[1]) +else loadPage("general") diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index 2fd6a9a5..63938d78 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -58,20 +58,12 @@ importSettingsElement.addEventListener("change", () => { reader.onload = async () => { const data = JSON.parse(reader.result) if ("theme" in data && "disableImgur" in data && "imgurRedirects" in data) { - browser.storage.local.clear(() => - browser.storage.local.set({ ...data }, () => { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - await servicesHelper.upgradeOptions() - location.reload() - }) - }) - }) - ) + browser.storage.local.clear(async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + await servicesHelper.upgradeOptions() + location.reload() + }) } else if ("version" in data) { let options = data delete options.version @@ -98,16 +90,10 @@ function importError() { const resetSettings = document.getElementById("reset-settings") resetSettings.addEventListener("click", async () => { resetSettings.innerHTML = "..." - browser.storage.local.clear(() => { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - location.reload() - }) - }) + browser.storage.local.clear(async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + location.reload() }) }) @@ -170,7 +156,6 @@ browser.storage.local.get("options", r => { for (const x of [...exceptionsCustomInstances.url, ...exceptionsCustomInstances.regex]) { document.getElementById(`clear-${x}`).addEventListener("click", () => { - console.log(x) let index index = exceptionsCustomInstances.url.indexOf(x) if (index > -1) exceptionsCustomInstances.url.splice(index, 1) diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index ddd244d4..dc527c78 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -28,18 +28,22 @@ each val, service in services option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded + hr + each val, frontend in services[service].frontends if services[service].frontends[frontend].instanceList div(id=frontend) - each val, network in networks - div(class=network) - div(class="checklist") div(class="some-block option-block") - h4(data-localise="__MSG_customInstances__") Custom Instances + h4(data-localise="__MSG_instances__") Add your favorite instances + form(class="custom-instance-form") div(class="some-block option-block") input(class="custom-instance" placeholder=`http://${frontend}.com` type="url" ) button(class="add add-instance" type="submit") svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor") path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z") - div(class="checklist custom-checklist") \ No newline at end of file + + div(class="checklist custom-checklist") + each val, network in networks + div(class=network) + div(class="checklist") \ No newline at end of file diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index b2f2c299..aa3fb0d7 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -85,7 +85,7 @@ browser.storage.local.get(["options", "redirects"], r => { frontend = service[1] service = service[0] let isCustom = false - for (const network in config.networks) if (r.options[frontend][network].custom.indexOf(instance) > -1) isCustom = true + for (const network in config.networks) if (r.options[frontend].indexOf(instance) > -1) isCustom = true } divs[service].current.classList.remove("hide") divs[service].all.classList.add("hide") diff --git a/src/pages/widgets/head.pug b/src/pages/widgets/head.pug index 15e6d8d6..0c6e9fdb 100644 --- a/src/pages/widgets/head.pug +++ b/src/pages/widgets/head.pug @@ -3,5 +3,5 @@ head meta(name="viewport" content="width=device-width, initial-scale=1") link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg") link(href="../stylesheets/styles.css" rel="stylesheet") - title General + title Settings script(type="module" src="./init.js") \ No newline at end of file diff --git a/src/pages/widgets/links.pug b/src/pages/widgets/links.pug index 8c5a3915..82e82dbe 100644 --- a/src/pages/widgets/links.pug +++ b/src/pages/widgets/links.pug @@ -7,7 +7,10 @@ section(class="links" id="links") each val, key in services div(class="title") a(href="#"+key) - img(src=`/assets/images/${key}-icon.${services[key].imageType}`) + if services[key].imageType == 'svgMono' + img(src=`/assets/images/${key}-icon.svg`) + else + img(src=`/assets/images/${key}-icon.${services[key].imageType}`) span(data-localise="__MSG_"+key+"__")=services[key].name div(class="title") diff --git a/src/pages/widgets/switches.pug b/src/pages/widgets/switches.pug index 390c414d..7054ea72 100644 --- a/src/pages/widgets/switches.pug +++ b/src/pages/widgets/switches.pug @@ -1,6 +1,9 @@ each val, service in services div(class=service + " some-block") a(class="title" href=services[service].url) - img(src="../../assets/images/"+service+"-icon."+services[service].imageType) + if services[service].imageType == 'svgMono' + img(src=`../../assets/images/${service}-icon.svg`) + else + img(src=`../../assets/images/${service}-icon.${services[service].imageType}`) h4(data-localise="__MSG_"+service+"__")=services[service].name input(class=service + "-enabled" type="checkbox") \ No newline at end of file |