Fixed creating unnecessary cookies #204. Fixed a thing in twitter. Update README
This commit is contained in:
parent
933a37bd90
commit
2b4ea71e78
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -28,8 +28,8 @@
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.24539"
|
||||
inkscape:cx="127.56556"
|
||||
inkscape:cy="47.297859"
|
||||
inkscape:cx="73.642921"
|
||||
inkscape:cy="70.407563"
|
||||
inkscape:window-width="1888"
|
||||
inkscape:window-height="1060"
|
||||
inkscape:window-x="32"
|
||||
@ -168,7 +168,7 @@
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.10451px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#818488;fill-opacity:1;stroke:none;stroke-width:0.0970465"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.10451px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0970465"
|
||||
x="214.87363"
|
||||
y="159.88052"
|
||||
id="text5452"
|
||||
@ -178,12 +178,12 @@
|
||||
transform="scale(0.99871289,1.0012888)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan5450"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#818488;fill-opacity:1;stroke-width:0.0970465"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke-width:0.0970465"
|
||||
x="214.87363"
|
||||
y="159.88052">Available for</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:7.00835px;line-height:1.25;font-family:sans-serif;fill:#818488;fill-opacity:1;stroke:none;stroke-width:0.133242"
|
||||
style="font-style:normal;font-weight:normal;font-size:7.00835px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.133242"
|
||||
x="214.51498"
|
||||
y="166.31212"
|
||||
id="text5746"
|
||||
@ -193,7 +193,7 @@
|
||||
transform="scale(0.99871289,1.0012888)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan5744"
|
||||
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-family:Ubuntu;-inkscape-font-specification:'Ubuntu Medium';fill:#818488;fill-opacity:1;stroke-width:0.133242"
|
||||
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-family:Ubuntu;-inkscape-font-specification:'Ubuntu Medium';fill:#000000;fill-opacity:1;stroke-width:0.133242"
|
||||
x="214.51498"
|
||||
y="166.31212">Chromium</tspan></text>
|
||||
</g>
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -161,12 +161,9 @@ let hide_hls_notification;
|
||||
|
||||
function initLibredditCookies() {
|
||||
if (enableCustom) {
|
||||
let checkedInstances = [
|
||||
...libredditNormalRedirectsChecks,
|
||||
...libredditNormalCustomRedirects,
|
||||
...libredditTorRedirectsChecks,
|
||||
...libredditTorCustomRedirects
|
||||
]
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
||||
else if (protocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
||||
|
||||
for (const instance of checkedInstances) {
|
||||
browser.cookies.set({ url: instance, name: "theme", value: theme })
|
||||
|
@ -292,30 +292,14 @@ function initSearxCookies() {
|
||||
if (theme == 'light') themeValue = 'logicodev';
|
||||
if (theme == 'dark') themeValue = 'logicodev-dark';
|
||||
if (applyThemeToSites && themeValue) {
|
||||
let allInstances = [...redirects.searx.normal, ...redirects.searx.tor, ...redirects.searx.i2p, ...searxNormalCustomRedirects, ...searxTorCustomRedirects, ...searxI2pCustomRedirects];
|
||||
let checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects, ...searxTorRedirectsChecks, ...searxTorCustomRedirects, ...searxI2pRedirectsChecks, ...searxI2pCustomRedirects];
|
||||
for (const instanceUrl of allInstances)
|
||||
if (!checkedInstances.includes(instanceUrl)) {
|
||||
browser.cookies.remove({
|
||||
url: instanceUrl,
|
||||
name: "oscar-style",
|
||||
})
|
||||
browser.cookies.remove({
|
||||
url: instanceUrl,
|
||||
name: "oscar",
|
||||
})
|
||||
}
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||
else if (protocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
||||
else if (protocol == 'i2p') checkedInstances = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects];
|
||||
|
||||
for (const instanceUrl of checkedInstances) {
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "oscar-style",
|
||||
value: themeValue
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "theme",
|
||||
value: 'oscar'
|
||||
})
|
||||
browser.cookies.set({ url: instanceUrl, name: "oscar-style", value: themeValue })
|
||||
browser.cookies.set({ url: instanceUrl, name: "theme", value: 'oscar' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,12 +89,9 @@ let api_legacy;
|
||||
function initProxiTokCookies() {
|
||||
console.log('initProxiTokCookies')
|
||||
if (enableCustom) {
|
||||
let checkedInstances = [
|
||||
...proxiTokNormalRedirectsChecks,
|
||||
...proxiTokNormalCustomRedirects,
|
||||
...proxiTokTorRedirectsChecks,
|
||||
...proxiTokTorCustomRedirects
|
||||
]
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects]
|
||||
else if (protocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects]
|
||||
|
||||
for (const instance of checkedInstances) {
|
||||
browser.cookies.set({ url: instance, name: "theme", value: theme })
|
||||
|
@ -210,7 +210,7 @@ function redirect(url, initiator) {
|
||||
|
||||
// https://pbs.twimg.com/profile_images/648888480974508032/66_cUYfj_400x400.jpg
|
||||
if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video")
|
||||
return `${randomInstance}/pic/${encodeURIComponent(url.href)}`;
|
||||
return `${randomInstance}/pic/${encodeURIComponent(`${url.host}${url.pathname}`)}`;
|
||||
else if (url.pathname.split("/").includes("tweets"))
|
||||
return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
||||
else if (url.host == 't.co')
|
||||
@ -267,10 +267,9 @@ function removeXFrameOptions(e) {
|
||||
];
|
||||
if (!twitterList.includes(protocolHost) || e.type != 'sub_frame') return;
|
||||
let isChanged = false;
|
||||
console.log(e.responseHeaders);
|
||||
for (const i in e.responseHeaders) if (e.responseHeaders[i].name == 'x-frame-options') {
|
||||
isChanged = true;
|
||||
e.responseHeaders.splice(i, 1);
|
||||
isChanged = true;
|
||||
}
|
||||
if (isChanged) return { responseHeaders: e.responseHeaders };
|
||||
}
|
||||
@ -290,85 +289,25 @@ function isNitter(url, type) {
|
||||
|
||||
function initNitterCookies() {
|
||||
if (enableCustomSettings) {
|
||||
console.log('initNitterCookies')
|
||||
let allInstances = [...redirects.nitter.normal, ...redirects.nitter.tor, ...nitterNormalCustomRedirects, ...nitterTorCustomRedirects]
|
||||
let checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects, ...nitterTorRedirectsChecks, ...nitterTorCustomRedirects]
|
||||
for (const instanceUrl of allInstances) if (!checkedInstances.includes(instanceUrl))
|
||||
browser.cookies.remove({
|
||||
url: instanceUrl,
|
||||
name: "theme",
|
||||
})
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects]
|
||||
else if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects]
|
||||
|
||||
for (const instanceUrl of checkedInstances) {
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "theme",
|
||||
value: theme,
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "infiniteScroll",
|
||||
value: infiniteScroll ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "stickyProfile",
|
||||
value: stickyProfile ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "bidiSupport",
|
||||
value: bidiSupport ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "hideTweetStats",
|
||||
value: hideTweetStats ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "hideBanner",
|
||||
value: hideBanner ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "hidePins",
|
||||
value: hidePins ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "hideReplies",
|
||||
value: hideReplies ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "squareAvatars",
|
||||
value: squareAvatars ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "mp4Playback",
|
||||
value: mp4Playback ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "hlsPlayback",
|
||||
value: hlsPlayback ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "proxyVideos",
|
||||
value: proxyVideos ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "muteVideos",
|
||||
value: muteVideos ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "autoplayGifs",
|
||||
value: autoplayGifs ? 'on' : '',
|
||||
})
|
||||
browser.cookies.set({ url: instanceUrl, name: "theme", value: theme })
|
||||
browser.cookies.set({ url: instanceUrl, name: "infiniteScroll", value: infiniteScroll ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "stickyProfile", value: stickyProfile ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "bidiSupport", value: bidiSupport ? 'on' : '', })
|
||||
browser.cookies.set({ url: instanceUrl, name: "hideTweetStats", value: hideTweetStats ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "hideBanner", value: hideBanner ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "hidePins", value: hidePins ? 'on' : '', })
|
||||
browser.cookies.set({ url: instanceUrl, name: "hideReplies", value: hideReplies ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "squareAvatars", value: squareAvatars ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "mp4Playback", value: mp4Playback ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "hlsPlayback", value: hlsPlayback ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "proxyVideos", value: proxyVideos ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "muteVideos", value: muteVideos ? 'on' : '' })
|
||||
browser.cookies.set({ url: instanceUrl, name: "autoplayGifs", value: autoplayGifs ? 'on' : '' })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -420,8 +359,6 @@ async function init() {
|
||||
|
||||
alwaysUsePreferred = r.alwaysUsePreferred ?? false;
|
||||
|
||||
theme = r.theme ?? 'DEFAULT';
|
||||
|
||||
redirects.nitter = dataJson.nitter;
|
||||
if (r.twitterRedirects) redirects = r.twitterRedirects;
|
||||
|
||||
|
@ -118,20 +118,14 @@ function initWikilessCookies() {
|
||||
if (theme == 'light') themeValue = 'white';
|
||||
if (theme == 'dark') themeValue = 'dark';
|
||||
if (applyThemeToSites && themeValue) {
|
||||
let allInstances = [...redirects.wikiless.normal, ...redirects.wikiless.tor, ...redirects.wikiless.i2p, ...wikilessNormalCustomRedirects, ...wikilessTorCustomRedirects, ...wikilessI2pCustomRedirects]
|
||||
let checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects, ...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects, ...wikilessI2pRedirectsChecks, ...wikilessI2pCustomRedirects]
|
||||
for (const instanceUrl of allInstances)
|
||||
if (!checkedInstances.includes(instanceUrl))
|
||||
browser.cookies.remove({
|
||||
url: instanceUrl,
|
||||
name: "theme",
|
||||
})
|
||||
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects]
|
||||
else if (protocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects]
|
||||
else if (protocol == 'i2p') checkedInstances = [...wikilessI2pRedirectsChecks, ...wikilessI2pCustomRedirects]
|
||||
|
||||
for (const instanceUrl of checkedInstances)
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "theme",
|
||||
value: themeValue
|
||||
})
|
||||
browser.cookies.set({ url: instanceUrl, name: "theme", value: themeValue })
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,16 +206,16 @@ async function init() {
|
||||
"wikipediaRedirects",
|
||||
"wikilessNormalRedirectsChecks",
|
||||
"wikilessTorRedirectsChecks",
|
||||
"wikilessI2pRedirectsChecks",
|
||||
"wikilessI2pRedirectsChecks",
|
||||
"wikilessNormalCustomRedirects",
|
||||
"wikilessTorCustomRedirects",
|
||||
"wikilessI2pCustomRedirects",
|
||||
"wikilessI2pCustomRedirects",
|
||||
"wikipediaProtocol",
|
||||
|
||||
"theme",
|
||||
"applyThemeToSites",
|
||||
|
||||
], r => {
|
||||
], r => {
|
||||
disable = r.disableWikipedia ?? true;
|
||||
|
||||
protocol = r.wikipediaProtocol ?? "normal";
|
||||
@ -235,8 +229,8 @@ async function init() {
|
||||
wikilessTorRedirectsChecks = r.wikilessTorRedirectsChecks ?? [...redirects.wikiless.tor];
|
||||
wikilessTorCustomRedirects = r.wikilessTorCustomRedirects ?? [];
|
||||
|
||||
wikilessI2pRedirectsChecks = r.wikilessI2pRedirectsChecks ?? [...redirects.wikiless.i2p];
|
||||
wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects ?? [];
|
||||
wikilessI2pRedirectsChecks = r.wikilessI2pRedirectsChecks ?? [...redirects.wikiless.i2p];
|
||||
wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects ?? [];
|
||||
|
||||
theme = r.theme ?? 'DEFAULT';
|
||||
applyThemeToSites = r.applyThemeToSites ?? false;
|
||||
|
@ -506,12 +506,10 @@ function initPipedMaterialLocalStorage(tabId) {
|
||||
function initInvidiousCookies() {
|
||||
console.log('initInvidiousCookies()');
|
||||
if (!disable && frontend == 'invidious' && enableCustomSettings) {
|
||||
let checkedInstances = [
|
||||
...invidiousNormalRedirectsChecks,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...invidiousTorRedirectsChecks,
|
||||
...invidiousTorCustomRedirects,
|
||||
];
|
||||
let checkedInstances;
|
||||
if (protocol == 'normal') checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
|
||||
else if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
||||
|
||||
for (const instanceUrl of checkedInstances)
|
||||
browser.cookies.get(
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user