Improved caching
This commit is contained in:
parent
d1603fad40
commit
d5e1ce4e3a
@ -16,7 +16,7 @@ export class AnimeNotifier {
|
|||||||
statusMessage: StatusMessage
|
statusMessage: StatusMessage
|
||||||
visibilityObserver: IntersectionObserver
|
visibilityObserver: IntersectionObserver
|
||||||
pushManager: PushManager
|
pushManager: PushManager
|
||||||
lastRequestURL: string
|
mainPageLoaded: boolean
|
||||||
|
|
||||||
imageFound: MutationQueue
|
imageFound: MutationQueue
|
||||||
imageNotFound: MutationQueue
|
imageNotFound: MutationQueue
|
||||||
@ -199,14 +199,16 @@ export class AnimeNotifier {
|
|||||||
url: ""
|
url: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.lastRequestURL) {
|
// If mainPageLoaded is set, it means every single request is now an AJAX request for the /_/ prefixed page
|
||||||
message.url = this.lastRequestURL
|
if(this.mainPageLoaded) {
|
||||||
} else if(this.app.lastRequest) {
|
message.url = window.location.origin + "/_" + window.location.pathname
|
||||||
message.url = this.app.lastRequest.responseURL
|
|
||||||
} else {
|
} else {
|
||||||
|
this.mainPageLoaded = true
|
||||||
message.url = window.location.href
|
message.url = window.location.href
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Loaded", message.url)
|
||||||
|
|
||||||
navigator.serviceWorker.controller.postMessage(JSON.stringify(message))
|
navigator.serviceWorker.controller.postMessage(JSON.stringify(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +320,8 @@ export class AnimeNotifier {
|
|||||||
headers.append("X-Reload", "true")
|
headers.append("X-Reload", "true")
|
||||||
|
|
||||||
let path = this.app.currentPath
|
let path = this.app.currentPath
|
||||||
this.lastRequestURL = location.origin + "/_" + path
|
|
||||||
|
|
||||||
return fetch(this.lastRequestURL, {
|
return fetch("/_" + path, {
|
||||||
credentials: "same-origin",
|
credentials: "same-origin",
|
||||||
headers
|
headers
|
||||||
})
|
})
|
||||||
@ -514,7 +515,6 @@ export class AnimeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let path = "/_" + url
|
let path = "/_" + url
|
||||||
this.lastRequestURL = location.origin + "/_" + path
|
|
||||||
|
|
||||||
let request = fetch(path, {
|
let request = fetch(path, {
|
||||||
credentials: "same-origin"
|
credentials: "same-origin"
|
||||||
|
Loading…
Reference in New Issue
Block a user