📚 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
Add color to categories, fixes, fix auth access token duration, fix css colors & icons, add import link in settings
Smaug67398764299b590a
diff --git a/Makefile b/Makefilenew file mode 100644index 00000000..b61aa73d--- /dev/null+++ b/Makefile@@ -0,0 +1,15 @@+.PHONY: backend frontend minio migrate all+++backend:+ cd backend && go run main.go++frontend:+ cd frontend && npm run dev++minio:+ minio server ./minio --console-address :9001 --address "localhost:9000"++migrate:+ migrate create -ext sql -dir backend/migrations/ -seq $(name)+diff --git a/backend/controllers/authentication.controller.go b/backend/controllers/authentication.controller.goindex 3088fb9d..1869237e 100644--- a/backend/controllers/authentication.controller.go+++ b/backend/controllers/authentication.controller.go@@ -79,7 +79,7 @@ func (ctr *Controller) Login(c *gin.Context) (int, any) {return http.StatusInternalServerError, errors.New("failed to create session")}- c.SetCookie("Authorization", tokenString, ctr.app.Config.Auth.RefreshTokenExpiry, "/", "localhost", false, true)+ c.SetCookie("Authorization", tokenString, ctr.app.Config.Auth.AccessTokenExpiry, "/", "localhost", false, true)c.SetCookie("RefreshToken", session.RefreshToken, int(time.Duration(ctr.app.Config.Auth.RefreshTokenExpiry).Seconds()), "/", "localhost", false, true)user.Password = ""diff --git a/backend/controllers/categories.controller.go b/backend/controllers/categories.controller.goindex 44533151..2bb46a58 100644--- a/backend/controllers/categories.controller.go+++ b/backend/controllers/categories.controller.go@@ -65,6 +65,7 @@ func (ctr *Controller) CreateCategory(c *gin.Context) (int, any) {Id: ctr.app.Snowflake.Generate(),Name: category.Name,Icon: category.Icon,+ Color: category.Color,Order: category.Order,Role: category.Role,WorkspaceId: category.WorkspaceId,@@ -109,6 +110,7 @@ func (ctr *Controller) UpdateCategory(c *gin.Context) (int, any) {Id: categoryid,Name: category.Name,Icon: category.Icon,+ Color: category.Color,Order: category.Order,Role: category.Role,WorkspaceId: category.WorkspaceId,@@ -132,16 +134,6 @@ func (ctr *Controller) UpdateCategory(c *gin.Context) (int, any) {// @Success 204 {object} Success// @Failure 400 {object} Error// @Failure 401 {object} Error--// Delete document-// @Summary Delete document-// @Method DELETE-// @Router /documents/{id} [delete]-// @Security Authenfification: Auth-// @Param id path string true "Document ID"-// @Success 200 {object} Success(models.Document)-// @Failure 400 {object} Error-// @Failure 401 {object} Errorfunc (ctr *Controller) DeleteCategory(c *gin.Context) (int, any) {categoryId, err := utils.GetIdParam(c, c.Param("id"))if err != nil {diff --git a/backend/middlewares/authentification.go b/backend/middlewares/authentification.goindex 7fbda862..1caa70be 100644--- a/backend/middlewares/authentification.go+++ b/backend/middlewares/authentification.go@@ -2,7 +2,6 @@ package middlewaresimport ("alexandrie/utils"- "fmt""net/http""os""strconv"@@ -15,7 +14,7 @@ func Auth() gin.HandlerFunc {return func(c *gin.Context) {tokenString, err := c.Cookie("Authorization")if err != nil {- c.JSON(http.StatusUnauthorized, utils.Error("Unauthorized"))+ c.JSON(http.StatusUnauthorized, utils.Error("Bad access token."))c.Abort() // Stop further processing if unauthorizedreturn}@@ -30,7 +29,6 @@ func Auth() gin.HandlerFunc {})if err != nil || !token.Valid {- fmt.Println("Error parsing token:", err)c.JSON(http.StatusUnauthorized, utils.Error("Unauthorized"))c.Abort() // Stop further processing if unauthorizedreturndiff --git a/backend/migrations/000004_add_category_color.down.sql b/backend/migrations/000004_add_category_color.down.sqlnew file mode 100644index 00000000..e69de29bdiff --git a/backend/migrations/000004_add_category_color.up.sql b/backend/migrations/000004_add_category_color.up.sqlnew file mode 100644index 00000000..cd91c9d0--- /dev/null+++ b/backend/migrations/000004_add_category_color.up.sql@@ -0,0 +1,3 @@+alter table categories+ add color int null after icon;+diff --git a/backend/models/category.model.go b/backend/models/category.model.goindex 6083df47..3aa54f04 100644--- a/backend/models/category.model.go+++ b/backend/models/category.model.go@@ -6,6 +6,7 @@ type Category struct {Id types.Snowflake `json:"id" form:"id" binding:"omitempty"`Name string `json:"name" form:"name" binding:"required,max=50"`Icon string `json:"icon" form:"icon" binding:"omitempty,max=30000"`+ Color *int `json:"color" form:"color" binding:"omitempty"`Order int `json:"order" form:"order" binding:"omitempty"`Role int `json:"role" form:"role" binding:"omitempty"` // 0 category; 1 workspace;WorkspaceId *types.Snowflake `json:"workspace_id" form:"workspace_id" binding:"omitempty"`diff --git a/backend/services/category.service.go b/backend/services/category.service.goindex acea6965..1a11dce5 100644--- a/backend/services/category.service.go+++ b/backend/services/category.service.go@@ -28,7 +28,7 @@ func (s *Service) GetAllCategories(userId types.Snowflake) ([]*models.Category,for rows.Next() {var category models.Category- if err := rows.Scan(&category.Id, &category.Name, &category.Icon, &category.Order, &category.Role, &category.WorkspaceId, &category.ParentId, &category.AuthorId); err != nil {+ if err := rows.Scan(&category.Id, &category.Name, &category.Icon, &category.Color, &category.Order, &category.Role, &category.WorkspaceId, &category.ParentId, &category.AuthorId); err != nil {return nil, err}categories = append(categories, &category)@@ -42,6 +42,7 @@ func (s *Service) GetCategory(categoryId types.Snowflake) (*models.Category, err&category.Id,&category.Name,&category.Icon,+ &category.Color,&category.Order,&category.Role,&category.WorkspaceId,@@ -54,10 +55,11 @@ func (s *Service) GetCategory(categoryId types.Snowflake) (*models.Category, err}func (s *Service) CreateCategory(category *models.Category) error {- _, err := s.db.Exec("INSERT INTO categories (id, name, icon, `order`, role, workspace_id, parent_id, author_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",+ _, err := s.db.Exec("INSERT INTO categories (id, name, icon, color, `order`, role, workspace_id, parent_id, author_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",category.Id,category.Name,category.Icon,+ category.Color,category.Order,category.Role,category.WorkspaceId,@@ -67,9 +69,10 @@ func (s *Service) CreateCategory(category *models.Category) error {}func (s *Service) UpdateCategory(category *models.Category) error {- _, err := s.db.Exec("UPDATE categories SET name = ?, icon = ?, `order` = ?, role = ?, workspace_id = ?, parent_id = ? WHERE id = ?",+ _, err := s.db.Exec("UPDATE categories SET name = ?, icon = ?, color = ?, `order` = ?, role = ?, workspace_id = ?, parent_id = ? WHERE id = ?",category.Name,category.Icon,+ category.Color,category.Order,category.Role,category.WorkspaceId,diff --git a/frontend/components/AppColorPicker.vue b/frontend/components/AppColorPicker.vuenew file mode 100644index 00000000..feb0efad--- /dev/null+++ b/frontend/components/AppColorPicker.vue@@ -0,0 +1,46 @@+<template>+ <div class="color-picker">+ <div+ v-for="(_, index) in AppColors"+ :key="index"+ class="color-option"+ :style="{ backgroundColor: getAppColor(index) ? `var(--${getAppColor(index)})` : '#fff', border: '1px solid var(--border-color)', outline: selectedColor === index ? `2px solid var(--${getAppColor(index)})` : 'none' }"+ :class="{ selected: selectedColor === index }"+ @click="selectColor(index)"+ ></div>+ </div>+</template>++<script setup lang="ts">+const props = defineProps<{ selectedColor?: number | null }>();+const emit = defineEmits<{ (e: 'update:selectedColor', color: number): void }>();++const selectedColor = ref<number | null | undefined>(props.selectedColor);++function selectColor(color: number) {+ selectedColor.value = color;+ emit('update:selectedColor', color);+}+</script>++<style scoped>+.color-picker {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ padding: 6px;+ border-radius: 8px;+ border: 1px solid var(--border-color);+ background: var(--background-soft);+}++.color-option {+ width: 24px;+ height: 24px;+ border-radius: 50%;+ cursor: pointer;+}+.selected {+ outline-offset: 2px;+}+</style>diff --git a/frontend/components/Icon.vue b/frontend/components/Icon.vueindex 142e02a2..129b9924 100644--- a/frontend/components/Icon.vue+++ b/frontend/components/Icon.vue@@ -15,16 +15,15 @@ const icon = useIcon(props.name as IconName) || props.name;&:deep(svg) {width: 20px;- max-height: 22px;-+ max-height: 20px;path {- fill: inherit; // Utilise la couleur de l'élément parent }+ fill: inherit;}}}.fill:deep(svg) > path {- fill: inherit !important; // Utilise la couleur de l'élément parent }+ fill: inherit !important;}.mid {&:deep(svg) {diff --git a/frontend/components/ModalManager.vue b/frontend/components/ModalManager.vueindex 8f4e8e2e..4b998da1 100644--- a/frontend/components/ModalManager.vue+++ b/frontend/components/ModalManager.vue@@ -1,7 +1,7 @@<template><Transition name="modal"><div v-if="modals.length">- <div v-for="(modal, index) in modals" :key="modal.name" class="modal-mask modal-pos" :style="{ zIndex: 120 + index }">+ <div v-for="(modal, index) in modals" :key="index" class="modal-mask modal-pos" :style="{ zIndex: 120 + index }"><div v-if="index !== modals.length - 1" class="modal-overlay"></div><div class="modal-container"><button @click="modalManager.close(modal)" class="close-btn"><Icon name="close" :big="true" /></button>diff --git a/frontend/components/Sidebar/SidebarItem.vue b/frontend/components/Sidebar/SidebarItem.vueindex 5602d236..efc3b2d9 100644--- a/frontend/components/Sidebar/SidebarItem.vue+++ b/frontend/components/Sidebar/SidebarItem.vue@@ -1,6 +1,6 @@<template><span class="item" @click="onClick" :draggable="draggable" @dragstart="dragStart" @dragover.prevent="dragOver" @drop="drop" @dragleave="dragLeave" :class="{ 'drag-over': isDragOver }" :key="item.id">- <Icon :name="getIcon()" />+ <Icon :name="icon" :class="customClass" /> <NuxtLink :to="item.route" style="width: 100%" class="close">{{ item.title }} </NuxtLink><NuxtLink v-if="item.data.type === 'category'" :to="`/dashboard/categories/${item.id}/edit`" class="nav close"> <Icon name="settings" fill="var(--font-color)" /> </NuxtLink><NuxtLink v-if="item.data.type === 'category'" :to="`/dashboard/docs/new?cat=${item.id}`" class="nav close"> <Icon name="plus" fill="var(--font-color)" /> </NuxtLink>@@ -16,15 +16,16 @@ const categoriesStore = useCategoriesStore();const { isOpened } = useSidebar();const props = defineProps<{ item: Item }>();--function getIcon() {+const customClass = ref('');+const icon = computed(() => {+ if ('color' in props.item.data) customClass.value = props.item.data.color ? `item-icon ${getAppColor(props.item.data.color as number)}` : '';if ('icon' in props.item.data && props.item.data.icon) return props.item.data.icon;if (props.item.data.type === 'category') return 'folder';if (props.item.data.type === 'document' && props.item.childrens?.length) return 'file_parent';if (props.item.data.type === 'document' && props.item.data.accessibility == 2) return 'draft';if (props.item.data.type === 'document' && props.item.data.accessibility == 3) return 'archive';return 'file';-}+});const draggable = ref<boolean>(true);const isDragOver = ref<boolean>(false);@@ -98,23 +99,31 @@ const drop = async (event: DragEvent) => {color: var(--font-color);cursor: pointer;width: 98%;- font-size: 15.5px;+ font-size: 16px;font-weight: 400;+ letter-spacing: -0.5px;&:hover,&:has(.router-link-exact-active:not(.nav)) {background: var(--bg-contrast-2);}.icon {+ width: 20px;+ height: 20px;&:deep(svg) {fill: $primary-color;- margin-right: 4px;-path {fill: $primary-color;}}}+ .item-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ padding: 2px;+ border-radius: 4px; // Coins arrondis+ }}.drag-over {diff --git a/frontend/composables/utils.ts b/frontend/composables/utils.tsindex d322eac9..815c841b 100644--- a/frontend/composables/utils.ts+++ b/frontend/composables/utils.ts@@ -11,3 +11,8 @@ export const isTablet = () => (import.meta.client ? window.innerWidth <= 1280 :export function useAvatar(user: User): string {return user.avatar ? CDN + user.id + '/avatar' : CDN + '/default_avatar.png';}++export const AppColors = ['', 'blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];+export function getAppColor(index: number): string {+ return AppColors[index % AppColors.length] || '';+}diff --git a/frontend/helpers/icons.ts b/frontend/helpers/icons.tsindex a5d6851f..e17400a8 100644--- a/frontend/helpers/icons.ts+++ b/frontend/helpers/icons.ts@@ -9,11 +9,12 @@ const icons = {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>`,+ draft: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--teal)" 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>`,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" height="24px" viewBox="0 -960 960 960" style="fill:var(--yellow)"><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-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>`,+ import: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="m720-80 120-120-28-28-72 72v-164h-40v164l-72-72-28 28L720-80ZM480-800 243-663l237 137 237-137-237-137ZM120-321v-318q0-22 10.5-40t29.5-29l280-161q10-5 19.5-8t20.5-3q11 0 21 3t19 8l280 161q19 11 29.5 29t10.5 40v159h-80v-116L479-434 200-596v274l240 139v92L160-252q-19-11-29.5-29T120-321ZM720 0q-83 0-141.5-58.5T520-200q0-83 58.5-141.5T720-400q83 0 141.5 58.5T920-200q0 83-58.5 141.5T720 0ZM480-491Z"/></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>`,diff --git a/frontend/helpers/markdown/container.ts b/frontend/helpers/markdown/container.tsindex 603464dd..ef44be0b 100644--- a/frontend/helpers/markdown/container.ts+++ b/frontend/helpers/markdown/container.ts@@ -9,7 +9,7 @@ export const containerPlugin = (md: MarkdownIt) => {.use(...createContainer('yellow', 'WARNING', md)).use(...createContainer('red', 'DANGER', md)).use(...createContainer('details', 'Details', md))- .use(...createContainer('turquoise', 'INFO', md))+ .use(...createContainer('teal', 'INFO', md)).use(...createInvisibleContainer('no-print')).use(...createInvisibleContainer('center')).use(...createInvisibleContainer('columns'))diff --git a/frontend/helpers/markdown/containers-svg.ts b/frontend/helpers/markdown/containers-svg.tsindex b0eb0c1c..2e6868c9 100644--- a/frontend/helpers/markdown/containers-svg.ts+++ b/frontend/helpers/markdown/containers-svg.ts@@ -44,7 +44,7 @@ export const containerSvg = (md: MarkdownIt) => {if (tokens[idx].nesting === 1) {// opening tag- return containerOpen(m[1], svg_info, 'turquoise');+ return containerOpen(m[1], svg_info, 'teal');} else {// closing tagreturn '</div>\n';diff --git a/frontend/helpers/utils.ts b/frontend/helpers/utils.tsindex 79134b2b..eccbdf3b 100644--- a/frontend/helpers/utils.ts+++ b/frontend/helpers/utils.ts@@ -1,14 +1,14 @@-const colors = ['var(--blue)', 'var(--turquoise)', 'var(--yellow)', 'var(--red)', 'var(--red)'];+const colors = ['var(--blue)', 'var(--teal)', 'var(--yellow)', 'var(--red)', 'var(--red)'];-export function useColorHash(str: string): string {+export function useColorHash(str: string, list = colors): string {// Calculer un hash unique pour la chaînelet hash = 0;for (let i = 0; i < str.length; i++) {hash = str.charCodeAt(i) + ((hash << 5) - hash);}- const index = Math.abs(hash % colors.length);- return colors[index] as string;+ const index = Math.abs(hash % list.length);+ return list[index] as string;}export function parseUserAgent(uaString?: string) {diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.tsindex 809f9f4a..8bcc067f 100644--- a/frontend/nuxt.config.ts+++ b/frontend/nuxt.config.ts@@ -14,6 +14,15 @@ export default defineNuxtConfig({},},},+ vue: {+ template: {+ compilerOptions: {+ isCustomElement: tag => {+ return ['tag'].includes(tag);+ },+ },+ },+ },},$production: {ignore: [diff --git a/frontend/pages/(public)/index.vue b/frontend/pages/(public)/index.vueindex cab11367..1a682206 100644--- a/frontend/pages/(public)/index.vue+++ b/frontend/pages/(public)/index.vue@@ -58,7 +58,7 @@ onMounted(() => {const colorMode = useColorMode();const doc = ref({- content_markdown: `# Welcome to Alexandrie ! 🚀\n## Formatting options\n\nLorem **ipsum dolor** *sit amet*, consectetur _adipiscing elit_. ==But not sad.== \n\n### Different content blocks\n\n:::blue Blue\nA blue block\n:::\n:::red Red\nA red block\n:::\n:::green Green\nA green block\n:::\n:::grey Grey\nA grey block\n:::\n:::yellow Yellow\nA yellow block\n:::\n:::turquoise Turquoise\nA turquoise block\n:::\n:::details Details\nA details block\n:::\n\n\n:::no-print\nThis content will not be printed\n:::\n\n:::center\nThis content is centered\n:::\n\n:::definition Red Info\nBlock of content (ex: definition)\n:::\n\n:::property Blue Info\nBlock of content (ex: property)\n:::\n\n:::theorem Turquoise Info\nBlock of content (ex: theorem)\n:::\n\n:::info-u Info without background\nBlock of content (ex: info, tip, note)\n:::\n\n:::warning Warning Info\nBlock of content (ex: warning)\n:::\n\n### Bullet and Numbered Lists:\n\n- Bullet 1\n- Bullet 2\n - Sub-bullet 2-1\n\n1. Item 1\n1. Item 2\n\n### Markdown Tables\n\n| Column 1 | Column 2 | Column 3 |\n|:----------|:----------|:---------|\n|Item 1 | Item 2 | Item 3 |\n\n### Other formats\n\n$\\text{This is a math block: } f(x) = ax^2+bx+c$\n\n\`\`\`javascript\nconst hello = "Hello world";\n\`\`\`\n\n> Note: This content is a quote\n>> Nested quote\n\n## Shortcuts\n\n- **Ctrl + S**: Save\n- **Ctrl + P**: Toggle preview\n- **Ctrl + Q**: Switch to document\n- **Ctrl + B**: Bold formatting\n- **Ctrl + I**: Italic formatting\n- **Ctrl + U**: Underline formatting\n- **Ctrl + K**: Insert link\n- **Ctrl + M**: Insert image\n\n## Snippets\n\n- **!m**: Insert a math block (LaTeX)\n- **!def**: Insert a definition block\n- **!thm**: Insert a theorem block\n- **!center**: Center the content\n- **!red**: Insert a red block\n- **!green**: Insert a green block\n- **!blue**: Insert a blue block\n- **!yellow**: Insert a yellow block\n- **!details**: Insert a details block\n`,+ content_markdown: `# Welcome to Alexandrie ! 🚀\n## Formatting options\n\nLorem **ipsum dolor** *sit amet*, consectetur _adipiscing elit_. ==But not sad.== \n\n### Different content blocks\n\n:::blue Blue\nA blue block\n:::\n:::red Red\nA red block\n:::\n:::green Green\nA green block\n:::\n:::grey Grey\nA grey block\n:::\n:::yellow Yellow\nA yellow block\n:::\n:::teal teal\nA teal block\n:::\n:::details Details\nA details block\n:::\n\n\n:::no-print\nThis content will not be printed\n:::\n\n:::center\nThis content is centered\n:::\n\n:::definition Red Info\nBlock of content (ex: definition)\n:::\n\n:::property Blue Info\nBlock of content (ex: property)\n:::\n\n:::theorem teal Info\nBlock of content (ex: theorem)\n:::\n\n:::info-u Info without background\nBlock of content (ex: info, tip, note)\n:::\n\n:::warning Warning Info\nBlock of content (ex: warning)\n:::\n\n### Bullet and Numbered Lists:\n\n- Bullet 1\n- Bullet 2\n - Sub-bullet 2-1\n\n1. Item 1\n1. Item 2\n\n### Markdown Tables\n\n| Column 1 | Column 2 | Column 3 |\n|:----------|:----------|:---------|\n|Item 1 | Item 2 | Item 3 |\n\n### Other formats\n\n$\\text{This is a math block: } f(x) = ax^2+bx+c$\n\n\`\`\`javascript\nconst hello = "Hello world";\n\`\`\`\n\n> Note: This content is a quote\n>> Nested quote\n\n## Shortcuts\n\n- **Ctrl + S**: Save\n- **Ctrl + P**: Toggle preview\n- **Ctrl + Q**: Switch to document\n- **Ctrl + B**: Bold formatting\n- **Ctrl + I**: Italic formatting\n- **Ctrl + U**: Underline formatting\n- **Ctrl + K**: Insert link\n- **Ctrl + M**: Insert image\n\n## Snippets\n\n- **!m**: Insert a math block (LaTeX)\n- **!def**: Insert a definition block\n- **!thm**: Insert a theorem block\n- **!center**: Center the content\n- **!red**: Insert a red block\n- **!green**: Insert a green block\n- **!blue**: Insert a blue block\n- **!yellow**: Insert a yellow block\n- **!details**: Insert a details block\n`,});</script>diff --git a/frontend/pages/dashboard/categories/[id]/edit.vue b/frontend/pages/dashboard/categories/[id]/edit.vueindex abcec49e..941ba2e1 100644--- a/frontend/pages/dashboard/categories/[id]/edit.vue+++ b/frontend/pages/dashboard/categories/[id]/edit.vue@@ -12,18 +12,20 @@<input type="number" v-model.number="category.order" id="order" /></div></div>+ <label>Name</label>+ <input type="text" v-model="category.name" id="name" required /><label>Role</label><select v-model="category.role"><option :value="1">Category</option><option :value="2">Workspace</option></select>- <label>Name</label>- <input type="text" v-model="category.name" id="name" required />- <label>Icon (svg supported)</label>+ <label style="display: flex; align-items: center">Icon <AppHint text="SVG supported" /></label><textarea type="text" v-model="category.icon" rows="5"></textarea>+ <label for="color">Color</label>+ <AppColorPicker v-model:selectedColor="category.color" name="color" /><div class="form-row"><div class="form-column">- <label>Workspace - for top categories -</label>+ <label style="display: flex; align-items: center">Workspace <AppHint text="For top categories" /></label><select v-model="category.workspace_id"><option :value="null">None</option><option v-for="wp in categoriesStore.getAll.filter(a => a.id != route.params.id && a.role == 2)" :value="wp.id">{{ wp.name }}</option>@@ -33,10 +35,11 @@<label>Parent</label><select v-model="category.parent_id"><option :value="null">None</option>- <option v-for="cp in categoriesStore.getParents.filter(a => a.id != route.params.id && a.role == 1)" :value="cp.id">{{ cp.name }}</option>+ <option v-for="cp in categoriesStore.getAll" :value="cp.id">{{ cp.name }}</option></select></div></div>+<div style="display: flex; justify-content: flex-end"><AppButton type="danger" @click="deleteCategory()">Delete</AppButton><AppButton type="primary" class="btn primary" @click="updateCategory">Update</AppButton>@@ -92,7 +95,6 @@ input,textarea,select {width: 100%;- background-color: var(--bg-contrast-2);}.form-row {display: flex;diff --git a/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue b/frontend/pages/dashboard/categories/_components/WorkspaceTree.vueindex de5aea7c..bbb1580e 100644--- a/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue+++ b/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue@@ -2,12 +2,12 @@<div class="tree-node" v-if="node.data.type === 'category'"><div class="tree-content"><div class="tree-label">- <Icon name="folder" style="display: inline" />+ <Icon class="icon" name="folder" style="display: inline; width: 15px" /><span>{{ node.title }}</span></div><div class="tree-actions">- <span style="padding: 2px" @click="$emit('edit', node)" title="Edit"><Icon name="edit" style="display: inline" /></span>- <span style="padding: 2px" @click="$emit('delete', node)" title="Delete"><Icon name="delete" style="display: inline" /></span>+ <span style="padding: 2px" @click="$emit('edit', node)" title="Edit"><Icon class="icon" name="edit" style="display: inline" /></span>+ <span style="padding: 2px" @click="$emit('delete', node)" title="Delete"><Icon class="icon" name="delete" style="display: inline" /></span></div></div>@@ -69,4 +69,11 @@ defineEmits(['edit', 'delete']);cursor: pointer;margin: 0 2.5px;}+.icon {+ margin-right: 2px;+ &:deep(svg) {+ width: 20px;+ height: 20px;+ }+}</style>diff --git a/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue b/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vueindex d578871e..172ab270 100644--- a/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue+++ b/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue@@ -5,6 +5,8 @@<input type="text" v-model="category.name" required /><label>Icon <AppHint text="SVG supported" /></label><input type="text" v-model="category.icon" id="icon" />+ <label for="color">Color</label>+ <AppColorPicker v-model:selectedColor="category.color" name="color" /><label>Parent</label><div><AppSelect v-model="category.parent_id" :items="categoriesItem" placeholder="Select a category parent" />diff --git a/frontend/pages/dashboard/docs/index.vue b/frontend/pages/dashboard/docs/index.vueindex afa2c5eb..b8f293ca 100644--- a/frontend/pages/dashboard/docs/index.vue+++ b/frontend/pages/dashboard/docs/index.vue@@ -27,7 +27,7 @@ const rows = computed(() =>badges = '<tag class="green">Document</tag>';break;case 2:- badges = '<tag class="turquoise">Draft</tag>';+ badges = '<tag class="teal">Draft</tag>';break;case 3:badges = '<tag class="red">Archived</tag>';diff --git a/frontend/pages/dashboard/settings/index.vue b/frontend/pages/dashboard/settings/index.vueindex 3ead0448..d6a89d03 100644--- a/frontend/pages/dashboard/settings/index.vue+++ b/frontend/pages/dashboard/settings/index.vue@@ -17,6 +17,7 @@<span>Workspaces</span><NuxtLink to="/dashboard/categories"><Icon fill="var(--font-color)" name="categories" />Manage categories</NuxtLink><NuxtLink to="/dashboard/docs"><Icon fill="var(--font-color)" name="draft" />Manage documents</NuxtLink>+ <NuxtLink to="/dashboard/import"><Icon fill="var(--font-color)" name="import" />Manage importations</NuxtLink><span>Other</span><NuxtLink @click="logoutUser"><Icon fill="var(--font-color)" name="logout" />Logout</NuxtLink></nav>diff --git a/frontend/stores/_utils.ts b/frontend/stores/_utils.tsindex 6e0b10f4..29c86ff5 100644--- a/frontend/stores/_utils.ts+++ b/frontend/stores/_utils.ts@@ -30,7 +30,7 @@ export async function makeRequest<T>(route: string, method: string, body: Objectif (is_getting_new_token) return promise;console.log('\x1b[41m[AUTH]\x1b[0m Access token invalid. Getting new access token...');is_getting_new_token = true;- const login = await useAPI('GET', `auth/refreshToken`, {});+ const login = await useAPI('POST', `auth/refresh`, {});is_getting_new_token = false;if (login.status === 'success') {console.log('\x1b[42m[AUTH]\x1b[0m New access token received.');@@ -44,7 +44,6 @@ export async function makeRequest<T>(route: string, method: string, body: Objectreturn { status: 'error', message: String(e) };}}-function treatQueue(access_token: boolean = true) {console.log(`[API] Treating queue with access_token: ${access_token}`);while (requestQueue.length > 0) {diff --git a/frontend/stores/db_strustures.d.ts b/frontend/stores/db_strustures.d.tsindex cb5f6ba8..202f46c3 100644--- a/frontend/stores/db_strustures.d.ts+++ b/frontend/stores/db_strustures.d.ts@@ -20,6 +20,7 @@ export interface DB_Category {id: string;name: string;icon?: string;+ color?: number;order?: number;role: number; // 1 Category; 2 Workspaceworkspace_id?: string;diff --git a/frontend/styles/_variables.scss b/frontend/styles/_variables.scssindex 3e848c92..eb0ff647 100644--- a/frontend/styles/_variables.scss+++ b/frontend/styles/_variables.scss@@ -58,9 +58,15 @@ $primary-dark: color.adjust(#007aff, $lightness: -10%);--yellow: #F97300;--yellow-bg: rgba(255, 193, 7, 0.15);--yellow-border: rgba(255, 193, 7, 0.3);- --turquoise: #00ADB5;- --turquoise-bg: rgba(23, 162, 184, 0.2);- --turquoise-border: rgba(23, 162, 184, 0.25);+ --teal: #00ADB5;+ --teal-bg: rgba(23, 162, 184, 0.2);+ --teal-border: rgba(23, 162, 184, 0.25);+ --purple: #6f42c1;+ --purple-bg: rgba(111, 66, 193, 0.2);+ --purple-border: rgba(111, 66, 193, 0.25);+ --pink: #ff0e6a;+ --pink-bg: rgba(255, 14, 106, 0.2);+ --pink-border: rgba(255, 14, 106, 0.25);--info-border: #2573cf;}@@ -90,9 +96,9 @@ $primary-dark: color.adjust(#007aff, $lightness: -10%);--yellow: #F97300;--yellow-bg: rgba(255, 197, 23, 0.2);--yellow-border: rgba(255, 197, 23, .25);- --turquoise: #00d6b4;- --turquoise-bg: rgba(0, 255, 255, 0.2);- --turquoise-border: rgba(0, 209, 178, .25);+ --teal: #00d6b4;+ --teal-bg: rgba(0, 255, 255, 0.2);+ --teal-border: rgba(0, 209, 178, .25);}@@ -121,7 +127,7 @@ $primary-dark: color.adjust(#007aff, $lightness: -10%);--yellow: #F97300;--yellow-bg: rgba(255, 193, 7, 0.15);--yellow-border: rgba(255, 193, 7, 0.3);- --turquoise: #00ADB5;- --turquoise-bg: rgba(23, 162, 184, 0.2);- --turquoise-border: rgba(23, 162, 184, 0.25);+ --teal: #00ADB5;+ --teal-bg: rgba(23, 162, 184, 0.2);+ --teal-border: rgba(23, 162, 184, 0.25);}\ No newline at end of filediff --git a/frontend/styles/markdown.scss b/frontend/styles/markdown.scssindex 42712350..e9cc8d3b 100644--- a/frontend/styles/markdown.scss+++ b/frontend/styles/markdown.scss@@ -1,23 +1,3 @@-red {- color: var(--red);-}--blue {- color: var(--blue);-}--green {- color: var(--green);-}--yellow {- color: var(--yellow);-}--pink {- color: var(--red);-}-.markdown-container {margin-top: 10px;background-color: var(--bg-contrast);@@ -37,9 +17,9 @@ pink {border-left: 4px solid var(--yellow);}- &:has(.turquoise) {+ &:has(.teal) {background-color: var(--bg-contrast);- border-left: 4px solid var(--turquoise);+ border-left: 4px solid var(--teal);}.svg-icon {@@ -69,12 +49,12 @@ pink {}}- .turquoise {- color: var(--turquoise);+ .teal {+ color: var(--teal);.svg-icon {- fill: var(--turquoise);- color: var(--turquoise);+ fill: var(--teal);+ color: var(--teal);}}@@ -134,6 +114,14 @@ pink {border-color: var(--grey-border);color: var(--grey);background-color: var(--grey-bg);++ * {+ fill: var(--grey) !important;++ path {+ fill: var(--grey) !important;+ }+ }}.blue,@@ -141,6 +129,14 @@ pink {border-color: var(--blue-border);color: var(--blue);background-color: var(--blue-bg);++ * {+ fill: var(--blue) !important;++ path {+ fill: var(--blue) !important;+ }+ }}.green,@@ -148,13 +144,29 @@ pink {border-color: var(--green-border);color: var(--green);background-color: var(--green-bg);++ * {+ fill: var(--green) !important;++ path {+ fill: var(--green) !important;+ }+ }}-.turquoise,-[turquoise] {- border-color: var(--turquoise-border);- color: var(--turquoise);- background-color: var(--turquoise-bg);+.teal,+[teal] {+ border-color: var(--teal-border);+ color: var(--teal);+ background-color: var(--teal-bg);++ * {+ fill: var(--teal) !important;++ path {+ fill: var(--teal) !important;+ }+ }}.yellow,@@ -162,6 +174,14 @@ pink {border-color: var(--yellow-border);color: var(--yellow);background-color: var(--yellow-bg);++ * {+ fill: var(--yellow) !important;++ path {+ fill: var(--yellow) !important;+ }+ }}@@ -170,6 +190,44 @@ pink {border-color: var(--red-border);color: var(--red);background-color: var(--red-bg);++ * {+ fill: var(--red) !important;++ path {+ fill: var(--red) !important;+ }+ }+}++.purple,+[purple] {+ border-color: var(--purple-border);+ color: var(--purple);+ background-color: var(--purple-bg);++ * {+ fill: var(--purple) !important;++ path {+ fill: var(--purple) !important;+ }+ }+}++.pink,+[pink] {+ border-color: var(--pink-border);+ color: var(--pink);+ background-color: var(--pink-bg);++ * {+ fill: var(--pink) !important;++ path {+ fill: var(--pink) !important;+ }+ }}