From 815f99ce9cb900d432469477873898a35a1e2a89 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 14 Jul 2017 01:50:10 +0200 Subject: [PATCH] More fixes --- scripts/Actions.ts | 10 +--------- scripts/AnimeNotifier.ts | 6 ++---- sw/service-worker.ts | 2 +- utils/AllowEmbed.go | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/scripts/Actions.ts b/scripts/Actions.ts index d08f4eb4..bd5672d2 100644 --- a/scripts/Actions.ts +++ b/scripts/Actions.ts @@ -206,20 +206,12 @@ export function search(arn: AnimeNotifier, search: HTMLInputElement, e: Keyboard let term = search.value - arn.app.currentPath = "/search/" + term - - if(window.location.pathname.startsWith("/search/")) { - history.replaceState("search", null, arn.app.currentPath) - } else { - history.pushState("search", null, arn.app.currentPath) - } - if(!term || term.length < 2) { arn.app.content.innerHTML = "Please enter at least 2 characters to start searching." return } - arn.reloadContent() + arn.diff("/search/" + term) } // Add anime to collection diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index 54fe10eb..dedd5302 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -134,9 +134,7 @@ export class AnimeNotifier { return } - navigator.serviceWorker.register("service-worker", { - scope: "./" - }).then(registration => { + navigator.serviceWorker.register("/service-worker").then(registration => { registration.update() }) @@ -409,7 +407,7 @@ export class AnimeNotifier { } diff(url: string) { - if(url == this.app.currentPath) { + if(url === this.app.currentPath) { return Promise.reject(null) } diff --git a/sw/service-worker.ts b/sw/service-worker.ts index 1b44f0b5..5378672f 100644 --- a/sw/service-worker.ts +++ b/sw/service-worker.ts @@ -26,7 +26,7 @@ self.addEventListener("fetch", async (evt: any) => { } // Do not use cache in some cases - if(request.method !== "GET" || isAuth || request.url.includes("chrome-extension")) { + if(request.method !== "GET" || isAuth) { return evt.waitUntil(evt.respondWith(fetch(request))) } diff --git a/utils/AllowEmbed.go b/utils/AllowEmbed.go index 16761b8c..0beac966 100644 --- a/utils/AllowEmbed.go +++ b/utils/AllowEmbed.go @@ -5,6 +5,6 @@ import "github.com/aerogo/aero" // AllowEmbed allows the page to be called by the browser extension. func AllowEmbed(ctx *aero.Context, response string) string { // This is a bit of a hack. - ctx.SetResponseHeader("X-Frame-Options", "ALLOW-FROM chrome-extension://hjfcooigdelogjmniiahfiilcefdlpha/options.html") + // ctx.SetResponseHeader("X-Frame-Options", "ALLOW-FROM chrome-extension://hjfcooigdelogjmniiahfiilcefdlpha/options.html") return response }