mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-19 06:06:54 +00:00
fix: avoid caching pageviews data (#1849)
This commit is contained in:
@@ -3,11 +3,23 @@ import { baseurl } from '../../_config.yml';
|
||||
importScripts(`${baseurl}/assets/js/data/swconf.js`);
|
||||
|
||||
const purge = swconf.purge;
|
||||
const interceptor = swconf.interceptor;
|
||||
|
||||
function verifyUrl(url) {
|
||||
const requestPath = new URL(url).pathname;
|
||||
const requestUrl = new URL(url);
|
||||
const requestPath = requestUrl.pathname;
|
||||
|
||||
for (const path of swconf.denyPaths) {
|
||||
if (!requestUrl.protocol.startsWith('http')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const prefix of interceptor.urlPrefixes) {
|
||||
if (requestUrl.href.startsWith(prefix)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const path of interceptor.paths) {
|
||||
if (requestPath.startsWith(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user