From f2d314ae06e2c792cfe22827efbe5c4e7816a130 Mon Sep 17 00:00:00 2001 From: May Shech Date: Thu, 21 Dec 2023 21:34:04 +0200 Subject: [PATCH 01/10] Adding cache buster to index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d77975d5..79392bdd 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - +
From 478c100ee770521b495e8f3867c1f2f77ab68444 Mon Sep 17 00:00:00 2001 From: May Shech Date: Thu, 21 Dec 2023 21:39:33 +0200 Subject: [PATCH 02/10] Updating the timestamp to today's date --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 79392bdd..9b49582f 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - +
From 62657aab6bb3a1fe4adeff75f033c61ff7c93841 Mon Sep 17 00:00:00 2001 From: May Shech Date: Fri, 22 Dec 2023 13:25:50 +0200 Subject: [PATCH 03/10] Making cache buster change every one hour automatically --- cacheBuster.ts | 19 +++++++++++++++++++ index.html | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 cacheBuster.ts diff --git a/cacheBuster.ts b/cacheBuster.ts new file mode 100644 index 00000000..ea73ea07 --- /dev/null +++ b/cacheBuster.ts @@ -0,0 +1,19 @@ +// cacheBuster.ts +function generateCacheBuster(): string { + // Find the main.ts script tag and remove it + const mainScript: HTMLScriptElement | null = document.querySelector('script[src*="main.ts"]'); + if (mainScript) { + mainScript.remove(); + } + // Generate a cache buster value based on the current timestamp + const currentTimestamp: number = Math.floor(Date.now() / 1000); + const cacheBusterValue: number = Math.floor(currentTimestamp / 3600); + return `?v=${cacheBusterValue}`; + } + + // Set the src attribute for main.ts script + const script: HTMLScriptElement = document.createElement('script'); + script.type = 'module'; + script.src = `/main.ts${generateCacheBuster()}`; + document.head.appendChild(script); + \ No newline at end of file diff --git a/index.html b/index.html index 9b49582f..4249d18c 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - +
@@ -273,5 +273,6 @@

Error

arrow_2_circlepath + From badb758711c4e9c2f5d3a46cdfda26f27c4c035d Mon Sep 17 00:00:00 2001 From: May Shech Date: Fri, 22 Dec 2023 13:28:48 +0200 Subject: [PATCH 04/10] Updating cacheBuster.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- cacheBuster.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cacheBuster.ts b/cacheBuster.ts index ea73ea07..d0eb7284 100644 --- a/cacheBuster.ts +++ b/cacheBuster.ts @@ -7,6 +7,7 @@ function generateCacheBuster(): string { } // Generate a cache buster value based on the current timestamp const currentTimestamp: number = Math.floor(Date.now() / 1000); + // Divide by 3600 to create a cache buster value that updates every hour const cacheBusterValue: number = Math.floor(currentTimestamp / 3600); return `?v=${cacheBusterValue}`; } From f56ef884b4c088bf9287dab65844c979ad68972e Mon Sep 17 00:00:00 2001 From: May Shech Date: Sat, 23 Dec 2023 13:16:51 +0200 Subject: [PATCH 05/10] Updating aatp to match our previous changes (replaced login with subscribe) --- aatp/peerbook_webrtc/admin.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aatp/peerbook_webrtc/admin.spec.ts b/aatp/peerbook_webrtc/admin.spec.ts index 9a7a22b1..942be0b7 100644 --- a/aatp/peerbook_webrtc/admin.spec.ts +++ b/aatp/peerbook_webrtc/admin.spec.ts @@ -238,7 +238,7 @@ test.describe('peerbook administration', () => { const fromPeerbook = await page.$$('.from-peerbook') expect(fromPeerbook.length).toBe(0) }) - test('try login with an invalid email', async ({ browser }) => { + test('try subscribe with an invalid email', async ({ browser }) => { // TODO: rename to context2 context = await browser.newContext() page = await context.newPage() @@ -261,7 +261,7 @@ test.describe('peerbook administration', () => { await sleep(100) if (await page.locator('[data-test="twr-minimized"]').isVisible()) await page.click('[data-test="twr-minimized"]') - await page.keyboard.type('login') + await page.keyboard.type('subscribe') await page.keyboard.press("Enter") await sleep(100) let twr = await getTWRBuffer(page) @@ -279,9 +279,9 @@ test.describe('peerbook administration', () => { twr = await getTWRBuffer(page) expect(twr).toMatch(/Invalid credentials/) }) - test('try login with an invalid OTP', async () => { + test('try subscribe with an invalid OTP', async () => { await sleep(100) - await page.keyboard.type('login') + await page.keyboard.type('subscribe') await page.keyboard.press("Enter") await sleep(100) let twr = await getTWRBuffer(page) @@ -299,9 +299,9 @@ test.describe('peerbook administration', () => { twr = await getTWRBuffer(page) expect(twr).toMatch(/Invalid credentials/) }) - test('login with a valid email & OTP', async () => { + test('subscribe with a valid email & OTP', async () => { await sleep(100) - await page.keyboard.type('login') + await page.keyboard.type('subscribe') await page.keyboard.press("Enter") await sleep(100) let twr = await getTWRBuffer(page) From 9ff0a6aace89aba278b4a5a397fb17cf6276466d Mon Sep 17 00:00:00 2001 From: May Shech Date: Mon, 25 Dec 2023 13:32:45 +0200 Subject: [PATCH 06/10] Modifying cache buster --- cacheBuster.ts | 20 -------------------- index.html | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 cacheBuster.ts diff --git a/cacheBuster.ts b/cacheBuster.ts deleted file mode 100644 index d0eb7284..00000000 --- a/cacheBuster.ts +++ /dev/null @@ -1,20 +0,0 @@ -// cacheBuster.ts -function generateCacheBuster(): string { - // Find the main.ts script tag and remove it - const mainScript: HTMLScriptElement | null = document.querySelector('script[src*="main.ts"]'); - if (mainScript) { - mainScript.remove(); - } - // Generate a cache buster value based on the current timestamp - const currentTimestamp: number = Math.floor(Date.now() / 1000); - // Divide by 3600 to create a cache buster value that updates every hour - const cacheBusterValue: number = Math.floor(currentTimestamp / 3600); - return `?v=${cacheBusterValue}`; - } - - // Set the src attribute for main.ts script - const script: HTMLScriptElement = document.createElement('script'); - script.type = 'module'; - script.src = `/main.ts${generateCacheBuster()}`; - document.head.appendChild(script); - \ No newline at end of file diff --git a/index.html b/index.html index 4249d18c..ffd04f03 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,9 @@ Terminal 7 + + + @@ -13,7 +16,21 @@ + + + +
@@ -273,6 +290,5 @@

Error

arrow_2_circlepath - From c97faa504402e84bbb0134069a830d7fc3db23bc Mon Sep 17 00:00:00 2001 From: May Shech Date: Mon, 25 Dec 2023 13:33:03 +0200 Subject: [PATCH 07/10] Adding netlify settings for cache --- netlify.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 netlify.toml diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..d19f505e --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[[headers]] +for = "/*" +[headers.values] +Cache-Control = "public, max-age=86400" From 67d5c30a65eec14ba871217bbb28589c143563c0 Mon Sep 17 00:00:00 2001 From: May Shech Date: Mon, 25 Dec 2023 16:00:14 +0200 Subject: [PATCH 08/10] Commenting the module for check purposes --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ffd04f03..3d7f0a95 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ - + +