From 64869c91c43f2eef8ce7eb31003e01a05c154459 Mon Sep 17 00:00:00 2001 From: dusk Date: Tue, 29 Oct 2024 17:45:20 +0900 Subject: [PATCH] feat: notes wip, viewing + data structure --- .gitignore | 2 ++ bun.lockb | Bin 154232 -> 154600 bytes package.json | 1 + src/lib/index.ts | 4 +-- src/lib/notes.ts | 40 ++++++++++++++++++++++++ src/routes/notes/+page.server.ts | 34 ++++++++++++++++++++ src/routes/notes/+page.svelte | 18 +++++++++++ src/routes/notes/create/+page.server.ts | 0 src/routes/notes/create/+page.svelte | 0 9 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/lib/notes.ts create mode 100644 src/routes/notes/+page.server.ts create mode 100644 src/routes/notes/+page.svelte create mode 100644 src/routes/notes/create/+page.server.ts create mode 100644 src/routes/notes/create/+page.svelte diff --git a/.gitignore b/.gitignore index 52bb891..8d9d6dc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ node_modules /.svelte-kit /build /visitcount +/notes +/note # OS .DS_Store diff --git a/bun.lockb b/bun.lockb index 212876d008e0ff86f1df7abc36f5edf5bce9f726..c4f5fc3abde10ba91e431b76c9cef54ca3e58efc 100755 GIT binary patch delta 23447 zcmeI4d3;S*+xO2pa>zjtLnC5V)I3HK!7vyed4cE1%owJX9 z{S)t*Ro<5y*Be|e<;#zrSs44v7ZvJG9e(Uovy5B$Pq&>}A@0$4i*MNb#;E=S-7dMN z&4{b!KJomriSt$X=!DVfDTyvu1LbmgU9Oy>p)OY`WM^H^T`jv!d6%mStU9tXvWUaa zm2Mdl)_BS$*=uE<*O+Q^#7qR484vhh?87FO2L1$a|3M9QmFjXE^dHWCik*k@PsHuOr(#vY{g@Ix@(S zKhvhzpKxS8k{;)*v}JbATaMyoM?Q_Dt2wET9N@@qj%?+~+eDqf=KMr3BtD0b62GL3 z)RfWVU9PTmaTeazk@=2n;mG9sT&^;%Y#K^>d^B~r9z!7o{EqC0l;KNEN*dEBCBv1; zXq1N6rvlOUuW$3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D>KapB#j7O<@UyymTzaB9sUwN1s85}6@$8e z>a@K&xvp{EPTa`~Q%a{nRSUCVC&SN~o#yIJRZlfA^>(Q)Y+b{5akyV;X6$0m4&L@Q z;?r#fZ@smwRcQsb4=^9^Qk}gA2ADdd5h?z!aloBWHyD`m8L&a4qpXucJ(#ze43 z)D2!D_qRz+yWM{G$;y-?CltEYS!P;!_YX6V?p3#WzaD1Z+^cF^<%ipEhw|?+2V|46 z_nJgr@V48hnu^hgeX4!w&cB`wJtBD9=D*nS6It0h?pF)i1m8K1d46BzhiCRQREASz zG$*j&t##4Q41aLT!dEzX3?1PN=Se1%Z!Zzkp?rzWpV}&_{?=+`ZX&6yA51Ri>kU5= z7<52I_xaZu1uwii6PKD=+^Uxx2>8Mi)tW!n@%MmG@-C{q@n{#8_y3}*pqYr1^IVIX*E-ma3?Z%lae)9=0NHU^tK?sa+j^S7m*dph~a z_ifkh!~IyZ;v+ihU!Ohcs4qX_HQ1vj^dRHj-Yml9y=;$z>Ne}pC}-@>HB%4L?L}tw zK?dLEtmi&v=vAK@Yvpk&D$TVW{r09M_E~L8d2H0 z$a#xjt(Cf=OhJ`v6Z%zC<`WLtZ<y+D| zTJUzihvse>SZ;FzHpK|D;1EN0zWM18gX;}b@i3zb^Vq|xfl?;rFg{c_b40vowjd&c zSLqe5zwf(O9~tq0e2a>XmIK;*rt%RMj)OU7?=hxS@GidIArbYmD{f5M}9 z%(+|>b(Hdbe$R(IXjOm)hNHR*6CI zR>QzV)g$Sb6IDtL(#=;#X&I-o!K%BCxNf;lIxg4!*KOjqntOWYFr|*umK>t%9>h)#GW%=qZ2P`Gd`_ z { return { @@ -18,4 +18,4 @@ export const scopeCookies = (cookies: Cookies, path: string) => { } export const visitCountFile = `${env.WEBSITE_DATA_DIR}/visitcount` -export const visitCount = writable(parseInt(existsSync(visitCountFile) ? readFileSync(visitCountFile).toString() : '0')); \ No newline at end of file +export const visitCount = writable(parseInt(existsSync(visitCountFile) ? readFileSync(visitCountFile).toString() : '0')); diff --git a/src/lib/notes.ts b/src/lib/notes.ts new file mode 100644 index 0000000..1510224 --- /dev/null +++ b/src/lib/notes.ts @@ -0,0 +1,40 @@ +import { existsSync, readFileSync, writeFileSync } from 'fs' +import { nanoid } from 'nanoid' +import { env } from '$env/dynamic/private' + +export interface Note { + content: string, + published: Date, +} +type NoteId = string + +export const notesFolder = `${env.WEBSITE_DATA_DIR}/note` +export const notesListFile = `${env.WEBSITE_DATA_DIR}/notes` + +export const getNotePath = (id: NoteId) => { return `${notesFolder}/${id}` } +export const genNoteId = () => { + let id = nanoid(8) + while (existsSync(getNotePath(id))) { + id = nanoid(8) + } + return id +} +export const noteExists = (id: NoteId) => { return existsSync(getNotePath(id)) } +export const readNote = (id: NoteId): Note => { + return JSON.parse(readFileSync(getNotePath(id)).toString()) +} +export const writeNote = (id: NoteId, note: Note) => { + writeFileSync(getNotePath(id), JSON.stringify(note)) + // only append to note list if its not in it yet + let noteList = readNotesList() + if (noteList.indexOf(id) === -1) { + writeNotesList(noteList.concat([id])) + } +} + +export const readNotesList = (): NoteId[] => { + return JSON.parse(readFileSync(notesListFile).toString()) +} +export const writeNotesList = (note_ids: NoteId[]) => { + writeFileSync(notesListFile, JSON.stringify(note_ids)) +} diff --git a/src/routes/notes/+page.server.ts b/src/routes/notes/+page.server.ts new file mode 100644 index 0000000..c73804a --- /dev/null +++ b/src/routes/notes/+page.server.ts @@ -0,0 +1,34 @@ +import { noteExists, readNote, readNotesList } from '$lib/notes' + +const notesPerPage: number = 5 + +export const load = ({url}) => { + // get the note id to search for and display the page it is in + const noteId = url.searchParams.get("id") + // get the page no if one is provided, otherwise default to 1 + let page = parseInt(url.searchParams.get("page") || "1") + if (isNaN(page)) { page = 1 } + + // calculate page count + const notesList = readNotesList() + const pageCount = Math.ceil(notesList.length / notesPerPage) + + // find what page the note id if supplied is from + if (noteId !== null && noteExists(noteId)) { + const noteIndex = notesList.lastIndexOf(noteId) + if (noteIndex > -1) { + page = Math.floor(noteIndex / notesPerPage) + 1 + } + } + + // clamp page between our min and max + page = Math.min(page, pageCount) + page = Math.max(page, 1) + + // get the notes from the chosen page + const notes = notesList.slice((page - 1) * notesPerPage, page * notesPerPage).map( + (id) => {return {noteId: id, note: readNote(id)}} + ) + + return {notes, highlightedNote: noteId, page} +} diff --git a/src/routes/notes/+page.svelte b/src/routes/notes/+page.svelte new file mode 100644 index 0000000..0538a43 --- /dev/null +++ b/src/routes/notes/+page.svelte @@ -0,0 +1,18 @@ + + +

+ +
+
[gazesystems /notes/]$ cat *
+{#each data.notes as {noteId, note}}
+
+{noteId}|> {note.content} +{/each} +
+
+
+
diff --git a/src/routes/notes/create/+page.server.ts b/src/routes/notes/create/+page.server.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/notes/create/+page.svelte b/src/routes/notes/create/+page.svelte new file mode 100644 index 0000000..e69de29