From 23adffde0b3c0ee13a7fd584ae1264f2ca1c1bfa Mon Sep 17 00:00:00 2001 From: Klemek Date: Mon, 29 Apr 2024 23:28:07 +0200 Subject: [PATCH] working cookies --- main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 9781fec..1661a8d 100644 --- a/main.js +++ b/main.js @@ -150,7 +150,7 @@ let app = { }, getData() { const re = /:\s?(?:(?:(\d+)\s?h)?(\d+)?(?:\s?m(?:in)?)?)\s?$/i; - this.setCookie('rawData', this.rawData); + this.setCookie('rawData', btoa(this.rawData)); return this.rawData .split("\n") .map((line) => line.trim()) @@ -214,7 +214,8 @@ let app = { const d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); let expires = "expires="+ d.toUTCString(); - document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; + console.log(cname + "=" + cvalue + "; path=/; " + expires); + document.cookie = cname + "=" + cvalue + "; path=/; " + expires; }, getCookie(cname, defaultValue) { let name = cname + "="; @@ -234,7 +235,7 @@ let app = { }, mounted: function () { console.log("app mounted"); - this.rawData = this.getCookie('rawData', this.rawData); + this.rawData = atob(this.getCookie('rawData', btoa(this.rawData))); this.data = this.getData(); setTimeout(this.showApp); setInterval(() => {