only hide "paste clipboard" button for Firefox Tor users

This commit is contained in:
jbmagination 2023-10-30 18:17:07 -04:00
parent a4c8eff71a
commit 197c1dc0e6
3 changed files with 8 additions and 8 deletions

View File

@ -344,9 +344,9 @@ function resetSettings() {
localStorage.clear();
window.location.reload();
}
if (window.location.hostname.endsWith(".onion")) document.getElementById('paste').style = "pointer-events:none;visibility:hidden;";
if (window.location.hostname.endsWith(".onion") && !(navigator.getBattery())) document.getElementById('paste').style = "pointer-events:none;visibility:hidden;";
async function pasteClipboard() {
if (window.location.hostname.endsWith(".onion")) return
if (window.location.hostname.endsWith(".onion") && !(navigator.getBattery())) return
try {
let t = await navigator.clipboard.readText();
if (regex.test(t)) {
@ -391,7 +391,7 @@ async function download(url) {
if (url.includes("youtube.com/") || url.includes("/youtu.be/")) req.vCodec = sGet("vCodec").slice(0, 4);
if ((url.includes("tiktok.com/") || url.includes("douyin.com/")) && sGet("disableTikTokWatermark") === "true") req.isNoTTWatermark = true;
}
if (window.location.hostname.endsWith(".onion") && !(sGet("onionPreference") == "noOnions")) req.onionPreference = sGet("onionPreference")
if (window.location.hostname.endsWith(".onion") && !(sGet("onionPreference") == "noOnions")) req.onionPreference = sGet("onionPreference");
if (sGet("disableMetadata") === "true") req.disableMetadata = true;

View File

@ -52,8 +52,8 @@ export default async function(obj) {
let redditURL;
let regularURL = "reddit.com";
let torURL = "reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad.onion";
if (torEnabled) redditURL = torURL
else redditURL = regularURL;
redditURL = regularURL;
if (global.torEnabled) redditURL = torURL;
let twitterDispatcher;
twitterDispatcher = false;

View File

@ -9,8 +9,8 @@ export default async function(obj) {
let twitterURL;
let regularURL = "twitter.com";
let torURL = "twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion";
if (torEnabled) twitterURL = torURL
else twitterURL = regularURL;
twitterURL = regularURL;
if (global.torEnabled) twitterURL = torURL;
let twitterDispatcher;
twitterDispatcher = false;
@ -35,7 +35,7 @@ export default async function(obj) {
dispatcher: twitterDispatcher,
method: "POST",
headers: _headers
}).then((r) => { return r.status === 200 ? r.json() : false }).catch((err) => { return false });
}).then((r) => { return r.status === 200 ? r.json() : false }).catch(() => { return false });
if (!req_act) return { error: 'ErrorCouldntFetch' };
_headers["host"] = twitterURL;