Disable caching

This commit is contained in:
ilyaigpetrov 2020-07-23 10:10:22 +00:00
parent ed3997272e
commit ba19010545

View File

@ -145,7 +145,6 @@
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
if (!newLastModifiedStr) {
/*
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.
@ -153,9 +152,11 @@
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) {
/*
TODO: I turn off caching for now because I see no easy way out.
const ifWasEverModified = new Date(lastModifiedStr) - new Date(0) > 5000;
if (!newLastModifiedStr && ifWasEverModified) {
addWarning(
(ifRu
? 'Ваш PAC-скрипт не нуждается в обновлении. Его дата: '
@ -165,7 +166,7 @@
const res = {lastModified: lastModifiedStr};
return cb(null, res);
}
}
*/
// Employ all urls, the latter are fallbacks for the former.
const pacDataPromise = provider.pacUrls.reduce(