From 4538d122c58c94ce0da192e1b061f931934f0478 Mon Sep 17 00:00:00 2001 From: N0rdye Date: Wed, 28 Jun 2023 15:58:21 +0500 Subject: [PATCH] ui fixes --- index.js | 9 +++++---- views/header.ejs | 14 ++++++++------ views/project.ejs | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 4dda7d7..a2804b9 100644 --- a/index.js +++ b/index.js @@ -26,6 +26,7 @@ app.use(express.urlencoded({ })); app.use(express.static('public')); app.use(cookieParser()); +var week = 7 * 24 * 3600 * 1000; app.post('/back_login', (req, res) => { @@ -42,7 +43,7 @@ app.post('/back_login', (req, res) => { db.gv("users","login",`'${ilogin}'`,(udata)=>{udata = udata[0]; if(ipass == udata["pass"]){ console.log(udata["uuid"]+" logged in by login & pass from "+cook["sid"]); - res.cookie("uuid",udata["uuid"],{maxAge:1000000,path:"/;SameSite=Lax"}); + res.cookie("uuid",udata["uuid"],{maxAge:week,path:"/;SameSite=None"}); // db.sv("users","sids",sids += inp["sid"]+";","uuid",udata["uuid"],()=>{}); db.nr("sids",'`sid`,`uid`',`'${cook["sid"]}','${udata["id"]}'`); @@ -150,8 +151,7 @@ app.post("/sid_log",(req,res) =>{ app.post("/get_sid" , (req,res) =>{ let inp = req.body; let sid = func.get_uuid(inp["name"]); - var week = 7 * 24 * 3600 * 1000; - res.cookie("sid",sid,{maxAge:(week),path:"/;SameSite=Lax"}); + res.cookie("sid",sid,{maxAge:(week),path:"/;SameSite=None"}); res.send({out:"good"}); }); @@ -210,12 +210,13 @@ app.post("/save_proj", (req,res) => { if(projin == null){ // console.log("proj not in"); // console.log(pname,udata["id"],proj); + console.log(`${udata["uuid"]} created project ${pname} from ${cook["sid"]}`); db.nr("projects","`uid`,`name`,`body`",`'${udata["id"]}','${pname}','${proj}'`); } else if (projin != null){ db.sv("projects","body",proj,"id",projin["id"],()=>{}); + console.log(`${udata["uuid"]} saved project ${projin["name"]} from ${cook["sid"]}`); // console.log("proj in"); } - console.log(`${udata["uuid"]} saved project ${projin["name"]} from ${cook["sid"]}`); }) }) diff --git a/views/header.ejs b/views/header.ejs index b69d1d5..f268b12 100644 --- a/views/header.ejs +++ b/views/header.ejs @@ -1,5 +1,5 @@ <%- include('./static/start.ejs',{name:proj_name,async: true}) %> <%- include('./header.ejs') %> - +
+ +