mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Dirty hack to turn off wrong caching of AntiZapret
This commit is contained in:
parent
94b4261418
commit
84902d8e5a
|
@ -146,7 +146,14 @@
|
||||||
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
|
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
|
||||||
|
|
||||||
if (!newLastModifiedStr) {
|
if (!newLastModifiedStr) {
|
||||||
const ifWasEverModified = lastModifiedStr !== new Date(0).toUTCString();
|
/*
|
||||||
|
TODO: Get rid of this dirty hack
|
||||||
|
IPFS used by AntiZapret always returns last-modified date as new Date(1000) which is 1 sec since unix epoch.
|
||||||
|
Last-modified isn't changed but target redireciton URL is and this URL should be compared to the last cached URL.
|
||||||
|
Hack here is to consider 5 seconds since epoch time the same way as the unix epoch start.
|
||||||
|
If you think etags are the solution then know that etags can't be read from the fetch API, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers.
|
||||||
|
*/
|
||||||
|
const ifWasEverModified = new Date(lastModifiedStr) - new Date(0) > 5000;
|
||||||
if (ifWasEverModified) {
|
if (ifWasEverModified) {
|
||||||
|
|
||||||
addWarning(
|
addWarning(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"description": "__MSG_extDesc__",
|
"description": "__MSG_extDesc__",
|
||||||
"version": "0.0.${version}",
|
"version": "0.0.${version}",
|
||||||
"icons": {
|
"icons": {
|
||||||
"128": "/icons/default-128.png"
|
"128": "icons/default-128.png"
|
||||||
},
|
},
|
||||||
"author": "anticensority+owners@googlegroups.com",
|
"author": "anticensority+owners@googlegroups.com",
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user