don't cache instances.json
This commit is contained in:
parent
02d58bc64e
commit
4c8ac492c0
2 changed files with 20 additions and 19 deletions
|
@ -7,22 +7,22 @@ fetch("/instances.json")
|
||||||
.then(
|
.then(
|
||||||
(
|
(
|
||||||
json: {
|
json: {
|
||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
descriptionLong?: string;
|
descriptionLong?: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
display?: boolean;
|
display?: boolean;
|
||||||
online?: boolean;
|
online?: boolean;
|
||||||
uptime: { alltime: number; daytime: number; weektime: number };
|
uptime: { alltime: number; daytime: number; weektime: number };
|
||||||
urls: {
|
urls: {
|
||||||
wellknown: string;
|
wellknown: string;
|
||||||
api: string;
|
api: string;
|
||||||
cdn: string;
|
cdn: string;
|
||||||
gateway: string;
|
gateway: string;
|
||||||
login?: string;
|
login?: string;
|
||||||
};
|
};
|
||||||
}[]
|
}[]
|
||||||
)=>{
|
)=>{
|
||||||
console.warn(json);
|
console.warn(json);
|
||||||
for(const instance of json){
|
for(const instance of json){
|
||||||
|
@ -77,8 +77,7 @@ login?: string;
|
||||||
div.append(statbox);
|
div.append(statbox);
|
||||||
div.onclick = _=>{
|
div.onclick = _=>{
|
||||||
if(instance.online){
|
if(instance.online){
|
||||||
window.location.href =
|
window.location.href = "/register.html?instance=" + encodeURI(instance.name);
|
||||||
"/register.html?instance=" + encodeURI(instance.name);
|
|
||||||
}else{
|
}else{
|
||||||
alert("Instance is offline, can't connect");
|
alert("Instance is offline, can't connect");
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,9 @@ async function getfile(event: FetchEvent):Promise<Response>{
|
||||||
}
|
}
|
||||||
|
|
||||||
let path=toPath(event.request.url);
|
let path=toPath(event.request.url);
|
||||||
|
if(path === "/instances.json"){
|
||||||
|
return await fetch(path);
|
||||||
|
}
|
||||||
console.log("Getting path: "+path);
|
console.log("Getting path: "+path);
|
||||||
const responseFromCache = await caches.match(path);
|
const responseFromCache = await caches.match(path);
|
||||||
if(responseFromCache){
|
if(responseFromCache){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue