Skip to content

Commit 43dcfba

Browse files
committed
fix: db path error, add i18n.
1 parent 81d4705 commit 43dcfba

46 files changed

Lines changed: 3841 additions & 668 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ ADMIN_USER=admin
44
ADMIN_PASS=admin
55

66
# ── 路徑 ──
7-
DATA_DIR=./data
8-
DB_PATH=./data/just-wiki.db
9-
MEDIA_DIR=./data/media
7+
# Resolved relative to the process cwd (repo root for `make dev-backend`).
8+
# Docker overrides these to /app/data/... in docker-compose.yml.
9+
DATA_DIR=./backend/data
10+
DB_PATH=./backend/data/just-wiki.db
11+
MEDIA_DIR=./backend/data/media
1012

1113
# ── Security ──
1214
COOKIE_SECURE=false # Set to true in production with HTTPS

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ These are separate systems with independent rendering logic — changes to one d
6565
- **Viewer**: `components/Viewer/MarkdownViewer.jsx` — Renders via `lib/markdown.js`. Sanitized with DOMPurify.
6666
- **Markdown pipeline**: `lib/markdown.js` — Centralized markdown-it + GFM pipeline. Adds callout blocks (`:::info/warning/tip/danger`), wikilinks (`[[slug]]`, `[[slug|text]]`), transclusion (`![[slug]]`), KaTeX (`$...$`, `$$...$$`), Mermaid fences, Draw.io embeds (`::drawio[id]`). Both the Viewer and any other rendering must go through this module.
6767

68-
### Database (SQLite, single file at `data/just-wiki.db`)
68+
### Database (SQLite, single file at `backend/data/just-wiki.db` in dev, `/app/data/just-wiki.db` in docker)
6969

7070
Key tables: `users`, `pages` (with `parent_id` hierarchy and `slug` URL), `page_versions`, `tags`, `page_tags`, `backlinks`, `templates`, `media`, `media_references`, `diagrams`, `comments`, `bookmarks`, `activity_log`, `page_acl`, `groups`, `group_members`, `page_watchers`, `notifications`, `view_dedup`. FTS5 virtual table `search_index` for full-text search with CJK support.
7171

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dev:
66
@make dev-frontend
77

88
dev-backend:
9-
cd backend && source .venv/bin/activate && PYTHON_GIL=1 uvicorn app.main:app --reload --port 8000
9+
source backend/.venv/bin/activate && PYTHON_GIL=1 uvicorn app.main:app --reload --reload-dir backend --port 8000 --app-dir backend
1010

1111
dev-frontend:
1212
cd frontend && npm run dev

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Key variables:
100100
| `SECRET_KEY` | Session signing key | `change-me-...` |
101101
| `ADMIN_USER` | Admin username | `admin` |
102102
| `ADMIN_PASS` | Admin password | `admin` |
103-
| `DB_PATH` | SQLite database path | `./data/just-wiki.db`|
103+
| `DB_PATH` | SQLite database path | `./backend/data/just-wiki.db`|
104104
| `AI_ENABLED` | Enable AI chat | `false` |
105105
| `AI_API_KEY` | LLM provider API key (required if enabled) ||
106106

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ docker-compose up -d
9696
| `SECRET_KEY` | Session 簽章金鑰 | `change-me-...` |
9797
| `ADMIN_USER` | 管理員帳號 | `admin` |
9898
| `ADMIN_PASS` | 管理員密碼 | `admin` |
99-
| `DB_PATH` | SQLite 資料庫路徑 | `./data/just-wiki.db` |
99+
| `DB_PATH` | SQLite 資料庫路徑 | `./backend/data/just-wiki.db` |
100100
| `AI_ENABLED` | 啟用 AI 問答功能 | `false` |
101101
| `AI_API_KEY` | LLM 供應商 API 金鑰(啟用時必填) ||
102102

backend/app/database.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,11 @@ def hello():
11691169
11701170
Welcome to JustWiki! The pages below walk you through what the wiki can do in both English and 中文. Feel free to edit or delete them once your team has settled in.
11711171
1172-
- [[welcome|Welcome to JustWiki]] — English walkthrough
11731172
- [[welcome-zh|歡迎使用 JustWiki]] — 中文導覽
1174-
- [[welcome-mindmap|JustWiki Feature Mindmap]] — English mindmap overview
11751173
- [[welcome-mindmap-zh|JustWiki 功能心智圖]] — 中文心智圖總覽
1174+
- [[welcome|Welcome to JustWiki]] — English walkthrough
1175+
- [[welcome-mindmap|JustWiki Feature Mindmap]] — English mindmap overview
1176+
11761177
"""
11771178

11781179

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ services:
99
volumes:
1010
- ./data:/app/data
1111
env_file: .env
12+
# Override the dev-oriented paths in .env so the container reads/writes
13+
# the mounted /app/data volume regardless of what DATA_DIR is set to in
14+
# the shared .env file.
15+
environment:
16+
DATA_DIR: /app/data
17+
DB_PATH: /app/data/just-wiki.db
18+
MEDIA_DIR: /app/data/media
1219
restart: unless-stopped
1320

1421
frontend:

frontend/package-lock.json

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"@prosemirror-adapter/react": "^0.5.3",
2727
"axios": "^1.15.0",
2828
"dompurify": "^3.3.3",
29+
"i18next": "^26.0.8",
30+
"i18next-browser-languagedetector": "^8.2.1",
2931
"katex": "^0.16.45",
3032
"markdown-it": "^14.1.1",
3133
"markdown-it-container": "^4.0.0",
@@ -34,6 +36,7 @@
3436
"react-dom": "^19.2.4",
3537
"react-force-graph-2d": "^1.29.1",
3638
"react-force-graph-3d": "^1.29.1",
39+
"react-i18next": "^17.0.4",
3740
"react-router-dom": "^7.14.0",
3841
"remark-math": "^6.0.0",
3942
"three": "^0.184.0",

frontend/src/App.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Routes, Route, Navigate, Outlet, useLocation } from 'react-router-dom'
22
import { lazy, Suspense, useEffect } from 'react'
3+
import { useTranslation } from 'react-i18next'
34
import useAuth from './store/useAuth'
45
import useTheme from './store/useTheme'
56
import useSettings from './store/useSettings'
@@ -37,13 +38,14 @@ import PageOrPublicView from './pages/PageOrPublicView'
3738
* notification bell unmounting and refetching.
3839
*/
3940
function AuthGate() {
41+
const { t } = useTranslation()
4042
const { user, loading } = useAuth()
4143
const location = useLocation()
4244
const homeSlug = useSettings((s) => s.home_page_slug)
4345
const settingsLoaded = useSettings((s) => s.loaded)
4446

4547
if (loading || !settingsLoaded) {
46-
return <div className="flex items-center justify-center h-screen">Loading...</div>
48+
return <div className="flex items-center justify-center h-screen">{t('common.loading')}</div>
4749
}
4850

4951
if (user) {
@@ -87,6 +89,7 @@ function RoleRoute({ role }) {
8789
}
8890

8991
export default function App() {
92+
const { t } = useTranslation()
9093
const { checkAuth } = useAuth()
9194
const initTheme = useTheme((s) => s.init)
9295
const fetchSettings = useSettings((s) => s.fetch)
@@ -118,7 +121,7 @@ export default function App() {
118121
<Route
119122
path="/graph"
120123
element={
121-
<Suspense fallback={<div className="text-text-secondary">Loading graph…</div>}>
124+
<Suspense fallback={<div className="text-text-secondary">{t('common.loadingGraph')}</div>}>
122125
<GraphView />
123126
</Suspense>
124127
}
@@ -127,7 +130,7 @@ export default function App() {
127130
<Route
128131
path="/admin"
129132
element={
130-
<Suspense fallback={<div className="text-text-secondary">Loading admin…</div>}>
133+
<Suspense fallback={<div className="text-text-secondary">{t('common.loadingAdmin')}</div>}>
131134
<Admin />
132135
</Suspense>
133136
}

0 commit comments

Comments
 (0)