π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Fixes
Smaug67399004303dc4ee
diff --git a/backend/controllers/ressources.controller.go b/backend/controllers/ressources.controller.goindex 814cd011..c18208ae 100644--- a/backend/controllers/ressources.controller.go+++ b/backend/controllers/ressources.controller.go@@ -88,13 +88,14 @@ func (ctr *Controller) UploadFile(c *gin.Context) (int, any) {}// Create a new ressource+ id := ctr.app.Snowflake.Generate()ressource := &models.Ressource{- Id: ctr.app.Snowflake.Generate(),+ Id: id,Filename: fmt.Sprintf("%.*s", 40, header.Filename),Filesize: header.Size,Filetype: mimeType,OriginalPath: header.Filename,- TransformedPath: header.Filename,+ TransformedPath: fmt.Sprintf("%d%s", id, ext),AuthorId: userId,CreatedTimestamp: time.Now().UnixMilli(),}@@ -102,7 +103,6 @@ func (ctr *Controller) UploadFile(c *gin.Context) (int, any) {_, err = ctr.app.Services.Ressource.CreateRessource(ressource)if err != nil {- fmt.Println(err)return http.StatusInternalServerError, errors.New("failed to create ressource")}diff --git a/frontend/.env.development b/frontend/.env.developmentindex 758af34e..ecdd20d5 100644--- a/frontend/.env.development+++ b/frontend/.env.development@@ -1,2 +1,2 @@VITE_BASE_API="http://localhost:8080"-VITE_BASE_CDN="http://localhost:3002"\ No newline at end of file+VITE_BASE_CDN="http://localhost:9000/alexandrie-uploads/"\ No newline at end of filediff --git a/frontend/components/DataTable.vue b/frontend/components/DataTable.vueindex decf3dfe..4f7cfb62 100644--- a/frontend/components/DataTable.vue+++ b/frontend/components/DataTable.vue@@ -1,6 +1,6 @@<template><div class="container">- <div class="header">+ <div class="header" style="border-bottom: 1px solid var(--border-color)"><input type="text" v-model="searchInput" placeholder="Search..." /><div><span>Rows per page</span>diff --git a/frontend/composables/icons.ts b/frontend/composables/icons.tsindex 5f1c1ccb..19899908 100644--- a/frontend/composables/icons.ts+++ b/frontend/composables/icons.ts@@ -1,23 +1,24 @@const icons = {add_file: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-240h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>`,add_folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M560-320h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"/></svg>`,- archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/><rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/></svg>`,+ archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/><rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/></svg>`,backup: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M260-160q-91 0-155.5-63T40-377q0-78 47-139t123-78q17-72 85-137t145-65q33 0 56.5 23.5T520-716v242l64-62 56 56-160 160-160-160 56-56 64 62v-242q-76 14-118 73.5T280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-48-22-89.5T600-680v-93q74 35 117 103.5T760-520q69 8 114.5 59.5T920-340q0 75-52.5 127.5T740-160H260Zm220-358Z"/></svg>`,categories: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-320h480v-480h-80v280l-100-60-100 60v-280H320v480Zm0 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm360-720h200-200Zm-200 0h480-480Z"/></svg>`,cdn: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M485-440h163q26 0 44-18t18-44q0-26-18-44.5T648-565h-2q-5-32-29-53.5T560-640q-26 0-47 13.5T481-590q-30 2-50.5 23.5T410-515q0 30 21.5 52.5T485-440ZM120-120q-33 0-56.5-23.5T40-200v-520h80v520h680v80H120Zm160-160q-33 0-56.5-23.5T200-360v-440q0-33 23.5-56.5T280-880h200l80 80h280q33 0 56.5 23.5T920-720v360q0 33-23.5 56.5T840-280H280Zm0-80h560v-360H527l-80-80H280v440Zm0 0v-440 440Z"/></svg>`,- close: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>`,+ close: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>`,collapse: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m480-500 160-160H320l160 160Zm280-340q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560ZM200-320v120h560v-120H200Zm560-80v-360H200v360h560Zm-560 80v120-120Z"/></svg>`,copy: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg>`,delete: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z" /></svg>`,draft: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--turquoise)" d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>`,edit: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>`,- file: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--red);" d="M200-200h360v-200h200v-360H200v560Zm0 80q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v400L600-120H200Zm80-280v-80h200v80H280Zm0-160v-80h400v80H280Zm-80 360v-560 560Z"/></svg>`,+ filessssss: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--red);" d="M200-200h360v-200h200v-360H200v560Zm0 80q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v400L600-120H200Zm80-280v-80h200v80H280Zm0-160v-80h400v80H280Zm-80 360v-560 560Z"/></svg>`,+ file: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="var(--red)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path style="fill:none" d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path style="fill:none" d="M14 2v4a2 2 0 0 0 2 2h4"/><path style="fill:none" d="M10 9H8"/><path style="fill:none" d="M16 13H8"/><path style="fill:none" d="M16 17H8"/></svg>`,file_parent: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M320-320h200v-200H320v200Zm0-280h480v-200H320v200Zm280 280h200v-200H600v200Zm-280 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z"/></svg>`,folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--yellow)" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"/></svg>`,logout: `<svg xmlns="http://www.w3.org/2000/svg" style="fill:var(--font-color);" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z"/></svg>`,plus: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>`,profil: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M234-276q51-39 114-61.5T480-360q69 0 132 22.5T726-276q35-41 54.5-93T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 59 19.5 111t54.5 93Zm246-164q-59 0-99.5-40.5T340-580q0-59 40.5-99.5T480-720q59 0 99.5 40.5T620-580q0 59-40.5 99.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q53 0 100-15.5t86-44.5q-39-29-86-44.5T480-280q-53 0-100 15.5T294-220q39 29 86 44.5T480-160Zm0-360q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm0-60Zm0 360Z"/></svg>`,- search: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"class="mr-2 h-4 w-4 shrink-0 opacity-50"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg>`,+ search: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"class="mr-2 h-4 w-4 shrink-0 opacity-50"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg>`,security: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m438-338 226-226-57-57-169 169-84-84-57 57 141 141Zm42 258q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z"/></svg>`,settings: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/></svg>`,users: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-160v-112q0-34 17.5-62.5T104-378q62-31 126-46.5T360-440q66 0 130 15.5T616-378q29 15 46.5 43.5T680-272v112H40Zm720 0v-120q0-44-24.5-84.5T666-434q51 6 96 20.5t84 35.5q36 20 55 44.5t19 53.5v120H760ZM360-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm400-160q0 66-47 113t-113 47q-11 0-28-2.5t-28-5.5q27-32 41.5-71t14.5-81q0-42-14.5-81T544-792q14-5 28-6.5t28-1.5q66 0 113 47t47 113ZM120-240h480v-32q0-11-5.5-20T580-306q-54-27-109-40.5T360-360q-56 0-111 13.5T140-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T440-640q0-33-23.5-56.5T360-720q-33 0-56.5 23.5T280-640q0 33 23.5 56.5T360-560Zm0 320Zm0-400Z"/></svg>`,diff --git a/frontend/composables/utils.ts b/frontend/composables/utils.tsindex bc6274e6..1bf9f8ef 100644--- a/frontend/composables/utils.ts+++ b/frontend/composables/utils.ts@@ -22,7 +22,7 @@ export const isMobile = () => (import.meta.client ? window.innerWidth <= 768 : fexport const isTablet = () => (import.meta.client ? window.innerWidth <= 1280 : false);export function useAvatar(user: User): string {- return user.avatar ? CDN + user.avatar : CDN + '/webp/default.svg';+ return user.avatar ? CDN + user.id + '/avatar' : CDN + '/default_avatar.png';}export function parseUserAgent(uaString?: string) {if (!uaString) return { os: 'Unknown OS', browser: 'Unknown Browser' };diff --git a/frontend/pages/dashboard/cdn.vue b/frontend/pages/dashboard/cdn.vueindex b7620258..d64a4b91 100644--- a/frontend/pages/dashboard/cdn.vue+++ b/frontend/pages/dashboard/cdn.vue@@ -18,7 +18,7 @@<div v-if="ressourcesStore.ressources.length" class="ressources-list"><DataTable :headers="headers" :rows="rows"><template #action="{ cell }">- <a :href="`${CDN}${cell?.data.transformed_path || cell?.data.original_path}`" target="_blank"><Icon name="view" /> </a>+ <a :href="`${CDN}${cell?.data.author_id}/${cell?.data.transformed_path || cell?.data.original_path}`" target="_blank"><Icon name="view" /> </a><Icon name="delete" @click="() => deleteRessource(cell?.data.id)" /></template></DataTable>@@ -62,7 +62,7 @@ const submitFile = async () => {await ressourcesStore.post(body)- .then(r => (fileLink.value = `${CDN}/${(r as DB_Ressource).transformed_path || (r as DB_Ressource).original_path}`))+ .then(r => (fileLink.value = `${CDN}${(r as DB_Ressource).author_id}/${(r as DB_Ressource).transformed_path}`)).catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 3000 })).finally(() => (isLoading.value = false));};@@ -84,8 +84,8 @@ const rows: any = computed(() =>ressourcesStore.ressources.map(res => {return {name: { content: res.filename },- size: { content: readableFileSize(res.file_size) },- type: { content: `<span class="tag ${color(res.file_type)}">${res.file_type}</span>`, type: 'html' },+ size: { content: readableFileSize(res.filesize) },+ type: { content: `<span class="tag ${color(res.filetype)}">${res.filetype}</span>`, type: 'html' },date: { content: new Date(res.created_timestamp).toLocaleDateString() },action: { type: 'slot', data: res },};diff --git a/frontend/pages/dashboard/settings/_views/profile.vue b/frontend/pages/dashboard/settings/_views/profile.vueindex 5e47ee8b..ed94f470 100644--- a/frontend/pages/dashboard/settings/_views/profile.vue+++ b/frontend/pages/dashboard/settings/_views/profile.vue@@ -55,8 +55,7 @@ const previewAvatar = (event: Event) => {const updateUser = async () => {if (!userStore.user) return;- const newAvatar = await uploadAvatar();- if (newAvatar) userStore.user.avatar = newAvatar;+ await uploadAvatar();userStore.update(userStore.user).then(() => useNotifications().add({ title: 'Success:', message: 'User updated', type: 'success', timeout: 3000 }))diff --git a/frontend/stores/db_strustures.d.ts b/frontend/stores/db_strustures.d.tsindex 47073d96..cb5f6ba8 100644--- a/frontend/stores/db_strustures.d.ts+++ b/frontend/stores/db_strustures.d.ts@@ -54,8 +54,8 @@ export interface ConnectionLog {export interface DB_Ressource {id: string;filename: string;- file_size: number;- file_type: string;+ filesize: number;+ filetype: string;original_path: string;transformed_path: string;author_id: string;diff --git a/frontend/stores/ressources.store.ts b/frontend/stores/ressources.store.tsindex b6aa9c80..30e66ffb 100644--- a/frontend/stores/ressources.store.ts+++ b/frontend/stores/ressources.store.ts@@ -12,7 +12,7 @@ export const useRessourcesStore = defineStore('ressources', {fetch: function () {if (this.ressources.length > 0) return this.ressources;return new Promise(async (resolve, reject) => {- const request = await makeRequest(`ressources`, 'GET', {});+ const request = await makeRequest(`ressources/@me`, 'GET', {});if (request.status == 'success') {this.ressources = request.result as DB_Ressource[];resolve(this.ressources);