From 7b84e3b949d2cb58e871b981bee73b2c39f45771 Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Fri, 10 Apr 2026 16:37:53 -0400 Subject: [PATCH] home page done except for export button --- config.example.ts | 2 +- ssr/buildHome.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.example.ts b/config.example.ts index f05d206..39c3959 100644 --- a/config.example.ts +++ b/config.example.ts @@ -1,6 +1,6 @@ export const config = { api: { - publicDomain: '', + publicDomain: 'should end with a /', port: 14014, }, db: { diff --git a/ssr/buildHome.ts b/ssr/buildHome.ts index e15fce2..25726c3 100644 --- a/ssr/buildHome.ts +++ b/ssr/buildHome.ts @@ -1,3 +1,5 @@ +import config from '~config'; + import dbClient from 'db/client.ts'; interface Plan { @@ -9,7 +11,7 @@ interface Plan { const makePlanButtons = (planId: string, deleted: boolean) => deleted ? `` - : ``; + : ``; const makePlanItem = (plan: Plan, deleted: boolean) => `
  • ${plan.folder}${plan.folder && '/'}${plan.name} - ${makePlanButtons(plan.id, deleted)}
  • `; @@ -43,10 +45,16 @@ const userPIN=prompt('Please enter your PIN:'); fetch(\`/api/\${action}/\${planId}\`,{method:actionMethod.get(action),body:JSON.stringify({name:userName,pin:userPIN,folder:newName,planName:newName})}) .catch((e)=>{e.text().then((text)=>{alert(text);});}) .then((r) => { -if(r.status===200){localStorage.setItem('name',userName);r.text().then((text)=>{alert(text);location.reload();});} +if(r.status===200){localStorage.setItem('name',userName);r.text().then((text)=>{alert(text);window.location.reload();});} else{r.text().then((text)=>{alert(text);});} }); } +function openPlan(planId){window.open(\`${config.api.publicDomain}#/share/\${planId}\`);} +async function sharePlan(planId){ +const link=\`${config.api.publicDomain}#/share/\${planId}\`; +try{await navigator.clipboard.writeText(link);alert('Link copied to clipboard');} +catch (error){prompt('Failed to copy to clipboard, please select and copy the link below:',link);} +}

    This is a very basic management page. Please excuse the number of alert/prompts that will come up when you click on things as it was the quickest way to build it out.

    Please note: anything modifying data will require you to enter your PIN again as both the web view you are looking at and server behind it are completely stateless for simplicity.