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