From f78de8ab3d22e31f0bd8275913fea549b046c29b Mon Sep 17 00:00:00 2001 From: Maxime Cannoodt Date: Wed, 29 Jun 2022 22:06:27 +0200 Subject: [PATCH] add note cache headers --- server/prisma/dev.db | Bin 815104 -> 815104 bytes webapp/src/lib/model/EncryptedNote.ts | 2 +- webapp/src/routes/note/[id].svelte | 7 ++++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/prisma/dev.db b/server/prisma/dev.db index d456d0f31c25fb66afd1ba4aa3984fb1b1ba6de8..64afe8ba5bff52c874ea67a7ddcc2c87fa4175a4 100644 GIT binary patch delta 1443 zcmZ|N%d6uA6bImY9dDhP`^e13jVOZ%3PJLIt;QtHqfOJMN!uia!JBsxPoAAW-5q_iFTeZv4`<2t*2DX0WAC-S>w7o$ZeHC_k3V^QbgUg5YhT~KBOdP_y?^Wa-J_$&rw>m5 zchup7XE(om_wXa-(dwNcDz1HLG`A311*6DpnSt6DMs~DVJ6i!8A!Jo>-9f9_tcHwg zGNj?4p^=iI--fWRx4>`*oV)Exb5n3A)w|el={A}>nXa_3AZsy<(C!d1iN*;yI#$R!m86q9UE9eP5RDyL=yd#W$~FYUZxX^jdi9|bSSQZlSw6egq&+W z3C+6*!W0V;N|M%Q*z=;X$2snDtL&&vz_LU&mXuMG-_oskGgO;&cMWs7nocxy)`!v1 z#I2+#M6G1%%48&YxP`fxAUZT>4UM$!Z%u55w{0f_*CZ>=1CC+p@jx@URDm;O1SWwe z59kWk>AAoM8%f1B3YnUIiSO#A;DI#4I1@BtGDd*Qt|yerV9vJdL|FTLM_N&B#a>hn zq=D*mfU%;rXpSY`ExD;V>_YaS=T@B_YRr>tv5uYQHffjL1v5>VsH#ogL0Khq1lAL6 ze+BpB1#8jJtgTrNITm+tX=ScD@tP%)>k*l)G@8j|TI^3Cf+0(F8o2lzaczNLC9V@T z%O2X}jTIq5Gg}Jdp}C}UYBkKWr72TrZ=wV-R!gEG+GNw+KZL)K7W;*|B}KNEZfIlF zT9-A@?sf$_&4itjDpu}boq8&zQ@M=>Q!`dqh0If}wMC4r!Jv@HU_9}cyy6{F}KM#rCYAqO~LMI!U#1lGpArk=mYC))*Y5Y7Z&+dCd~J7U<#y|z+Gb1trSj*eJx@0CLLB47As0Ae>T4_zdpYp-&MYueB1dx^HonbNMPGH-64UEZ~MChwtQX| z1_s8(lM`=BGV--o=dl4XI}mdKF((jnZLiMb?wYurbpuBR8*2uKJ*)Bb)@Q8B(;Znk SPdoskp-J}u diff --git a/webapp/src/lib/model/EncryptedNote.ts b/webapp/src/lib/model/EncryptedNote.ts index e2accf9..d2748db 100644 --- a/webapp/src/lib/model/EncryptedNote.ts +++ b/webapp/src/lib/model/EncryptedNote.ts @@ -1,7 +1,7 @@ export type EncryptedNote = { id: string; insert_time: Date; - expiry_time: Date; + expire_time: Date; ciphertext: string; hmac: string; }; diff --git a/webapp/src/routes/note/[id].svelte b/webapp/src/routes/note/[id].svelte index 146ca15..daf6fc7 100644 --- a/webapp/src/routes/note/[id].svelte +++ b/webapp/src/routes/note/[id].svelte @@ -10,9 +10,14 @@ try { const note: EncryptedNote = await response.json(); note.insert_time = new Date(note.insert_time as unknown as string); - note.expiry_time = new Date(note.expiry_time as unknown as string); + note.expire_time = new Date(note.expire_time as unknown as string); + const maxage = Math.floor((note.expire_time.valueOf() - note.insert_time.valueOf()) / 1000); return { status: response.status, + cache: { + maxage: maxage, + private: false + }, props: { note } }; } catch {