From 75fa10a71c8db748db3852b6f57b109ddc32d6fc Mon Sep 17 00:00:00 2001 From: Victor Phan Date: Wed, 29 Apr 2026 14:40:11 +0700 Subject: [PATCH] =?UTF-8?q?update=20l=C3=AAn=20v1.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 + README.md | 10 +++ .../ee/ai-chat/services/ai-chat-service.ts | 4 +- .../services/attachment-service.ts | 6 +- .../features/page/services/page-service.ts | 18 +---- docker-compose.yml | 6 +- manage.sh | 77 +++++++++++++++++++ 7 files changed, 96 insertions(+), 26 deletions(-) create mode 100755 manage.sh diff --git a/.dockerignore b/.dockerignore index 2ee17c14..bc3d3092 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,3 +7,4 @@ dist apps/*/dist packages/*/dist .nx +data diff --git a/README.md b/README.md index 7571b2a5..ea0dd3ee 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,13 @@ Special thanks to; cách up project lên ghcr.io docker build -t ghcr.io/victorphan03/docmost:latest . docker push ghcr.io/victorphan03/docmost:latest + +./manage.sh start: Khởi chạy dự án (chạy ngầm). +./manage.sh stop: Dừng các container. +./manage.sh restart: Khởi động lại dự án. +./manage.sh build: Xây dựng lại các image và khởi chạy. +./manage.sh logs: Xem log thời gian thực. +./manage.sh status: Kiểm tra trạng thái các container. +./manage.sh clean: Dừng và xóa toàn bộ dữ liệu (Lưu ý: Dữ liệu trong database sẽ bị mất). + +sudo chown -R 1000:1000 data/docmost diff --git a/apps/client/src/ee/ai-chat/services/ai-chat-service.ts b/apps/client/src/ee/ai-chat/services/ai-chat-service.ts index 2932372e..7832e5d9 100644 --- a/apps/client/src/ee/ai-chat/services/ai-chat-service.ts +++ b/apps/client/src/ee/ai-chat/services/ai-chat-service.ts @@ -52,9 +52,7 @@ export async function uploadChatFile( if (chatId) { formData.append("chatId", chatId); } - return await api.post("/ai/chats/upload", formData, { - headers: { "Content-Type": "multipart/form-data" }, - }); + return await api.post("/ai/chats/upload", formData); } export function sendChatMessage( diff --git a/apps/client/src/features/attachments/services/attachment-service.ts b/apps/client/src/features/attachments/services/attachment-service.ts index fa43da3c..53cb67e9 100644 --- a/apps/client/src/features/attachments/services/attachment-service.ts +++ b/apps/client/src/features/attachments/services/attachment-service.ts @@ -58,11 +58,7 @@ export async function uploadIcon( } formData.append("image", processed); - return await api.post("/attachments/upload-image", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); + return await api.post("/attachments/upload-image", formData); } export async function uploadUserAvatar(file: File): Promise { diff --git a/apps/client/src/features/page/services/page-service.ts b/apps/client/src/features/page/services/page-service.ts index 94915af2..0b72be2b 100644 --- a/apps/client/src/features/page/services/page-service.ts +++ b/apps/client/src/features/page/services/page-service.ts @@ -137,11 +137,7 @@ export async function importPage(file: File, spaceId: string) { formData.append("spaceId", spaceId); formData.append("file", file); - const req = await api.post("/pages/import", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); + const req = await api.post("/pages/import", formData); return req.data; } @@ -156,11 +152,7 @@ export async function importZip( formData.append("source", source); formData.append("file", file); - const req = await api.post("/pages/import-zip", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); + const req = await api.post("/pages/import-zip", formData); return req.data; } @@ -186,11 +178,7 @@ export async function uploadFile( formData.append("pageId", pageId); formData.append("file", file); - const req = await api.post("/files/upload", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); + const req = await api.post("/files/upload", formData); return req as unknown as IAttachment; } diff --git a/docker-compose.yml b/docker-compose.yml index c8c9f5dd..7e753c1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: docmost: build: . - image: ghcr.io/victorphan03/docmost:v1.0.2 + image: ghcr.io/victorphan03/docmost:v1.0.3 depends_on: - db - redis @@ -18,7 +18,7 @@ services: db: build: ./custom-images/db - image: ghcr.io/victorphan03/db:v1.0.2 + image: ghcr.io/victorphan03/db:v1.0.3 environment: POSTGRES_DB: docmost POSTGRES_USER: docmost @@ -31,7 +31,7 @@ services: redis: build: ./custom-images/redis - image: ghcr.io/victorphan03/redis:v1.0.2 + image: ghcr.io/victorphan03/redis:v1.0.3 command: ["redis-server", "--appendonly", "yes", "--maxmemory-policy", "noeviction"] restart: unless-stopped ports: diff --git a/manage.sh b/manage.sh new file mode 100755 index 00000000..94298cf7 --- /dev/null +++ b/manage.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Docmost Custom Management Script + +# Colors for output +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Function to display help +show_help() { + echo -e "${BLUE}Docmost Custom Management Script${NC}" + echo "Usage: ./manage.sh [command]" + echo "" + echo "Commands:" + echo " start Start the project in detached mode" + echo " stop Stop the project" + echo " restart Restart the project" + echo " build Build the images and start" + echo " logs Show real-time logs" + echo " status Show status of containers" + echo " clean Stop and remove all volumes (WARNING: Data will be lost)" + echo " help Show this help message" +} + +# Check if docker is installed +if ! command -v docker &> /dev/null; then + echo -e "${RED}Error: docker is not installed.${NC}" + exit 1 +fi + +# Determine docker compose command (docker compose or docker-compose) +if docker compose version &> /dev/null; then + DOCKER_COMPOSE="docker compose" +else + DOCKER_COMPOSE="docker-compose" +fi + +case "$1" in + start) + echo -e "${GREEN}Starting Docmost Custom...${NC}" + $DOCKER_COMPOSE up -d + echo -e "${GREEN}Project is running at http://localhost:3000${NC}" + ;; + stop) + echo -e "${YELLOW}Stopping Docmost Custom...${NC}" + $DOCKER_COMPOSE stop + ;; + restart) + echo -e "${YELLOW}Restarting Docmost Custom...${NC}" + $DOCKER_COMPOSE restart + ;; + build) + echo -e "${BLUE}Building and starting Docmost Custom...${NC}" + $DOCKER_COMPOSE up -d --build + ;; + logs) + $DOCKER_COMPOSE logs -f + ;; + status) + $DOCKER_COMPOSE ps + ;; + clean) + echo -e "${RED}WARNING: This will remove all data volumes.${NC}" + read -p "Are you sure? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + $DOCKER_COMPOSE down -v + echo -e "${GREEN}Project cleaned.${NC}" + fi + ;; + help|*) + show_help + ;; +esac