Implement AsciiDoc and TipTap conversion logic, including new Admonition node and CodeBlock extension; add DiffViewer and HistoryPanel components for document version comparison; introduce password hashing utility with SHA-256.
This commit is contained in:
165
README.md
165
README.md
@@ -1,55 +1,136 @@
|
||||
# Archivum
|
||||
|
||||
A high-performance, production-ready wiki system optimized for Desktop and Mobile, designed to run on a Raspberry Pi 5 (ARM64) or any AMD64 host.
|
||||
Archivum är ett självhostat wiki- och dokumenthanteringssystem. Det är tänkt att användas för allt från enkla anteckningar och teknisk dokumentation till världsbyggande inför rollspelskampanjer. Alla dokument lagras som **AsciiDoc**-filer (`.adoc`) på disk, vilket innebär att du kan läsa och redigera dem direkt med valfritt predikat — utan att öppna webbgränssnittet. Applikationen renderar dokumenten till HTML i webbläsaren och hanterar automatisk **versionshantering via Git**, så att varje sparning skapar ett commit och alla ändringar kan rullas tillbaka.
|
||||
|
||||
## Tech Stack
|
||||
- **Backend:** Go (Golang) + GraphQL (gqlgen) + SQLite (modernc.org/sqlite).
|
||||
- **Frontend:** Vue 3 (Composition API) + Vite + Tailwind CSS.
|
||||
- **PWA:** Vite-plugin-pwa for mobile installation and offline caching.
|
||||
- **Version Control:** Git (Backend executes Git commands on the storage path).
|
||||
- **Editor:** TipTap (Visual) and CodeMirror (Manual AsciiDoc).
|
||||
- **Auth:** LDAP + JWT with in-memory session tracking.
|
||||
> Se [ARCHITECTURE.md](ARCHITECTURE.md) för detaljerad dokumentation om arkitektur, exekveringsflöden och komponentstruktur.
|
||||
|
||||
## Core Architectural Flow
|
||||
---
|
||||
|
||||
### 1. Configuration & First-Run Setup
|
||||
- **Config Management:** Separate `config.json` (Backend) and `settings.json` (Frontend). Paths defined via Docker environment variables.
|
||||
- **Initial State:** If configs are missing/empty, API signals `REQUIRE_SETUP`. Frontend triggers a "Setup Wizard" for LDAP, Admin user, and Storage paths.
|
||||
## Användningsområden
|
||||
|
||||
### 2. Mobile & PWA Optimization
|
||||
- **Responsive Design:** Mobile-first UI using Tailwind. The sidebar (tree view) should become a slide-over menu on mobile.
|
||||
- **Read-Optimized:** Documents must be perfectly rendered for small screens with adjustable font sizes.
|
||||
- **PWA Features:** Manifest and Service Worker for "Add to Home Screen" support, fast loading, and basic offline viewing of cached documents.
|
||||
- **Anteckningar** — snabbanteckningar och personliga kunskapsbaser
|
||||
- **Wiki** — team-wiki med dokumentträd och historik
|
||||
- **Teknisk dokumentation** — API-dokumentation, systembeskrivningar, runbooks
|
||||
- **Rollspelskampanjer** — världsbyggande, NPC-register, kartor och händelseloggar
|
||||
|
||||
### 3. Git-Storage & History
|
||||
- **Save Operation:** Receive AsciiDoc string + Commit Message -> Write to disk -> Git Commit with user as author.
|
||||
- **History & Diff:** GraphQL queries for commit logs and unified diffs.
|
||||
---
|
||||
|
||||
### 4. The Visual Transformer (Round-trip)
|
||||
- TypeScript "Bridge" using **Asciidoctor.js AST**:
|
||||
- `toTipTap(asciidoc: string): JSON`
|
||||
- `fromTipTap(json: JSON): string`
|
||||
## Krav
|
||||
|
||||
## Detailed Requirements
|
||||
### För att köra med Docker (rekommenderat)
|
||||
|
||||
### Backend (Go)
|
||||
- **CGO-Free:** Pure Go SQLite for multi-arch support (ARM64/AMD64).
|
||||
- **Git:** Manage repo via `os/exec` or `go-git`.
|
||||
- **Auth:** LDAP + Salted Bearer tokens.
|
||||
- [Docker](https://docs.docker.com/get-docker/) ≥ 24
|
||||
- [Docker Compose](https://docs.docker.com/compose/) v2
|
||||
|
||||
### Frontend (Vue 3)
|
||||
- **Hybrid Editor:** Seamless toggle between Visual (TipTap) and Source (CodeMirror).
|
||||
- **Mobile UI:** Collapsible navigation and touch-friendly buttons.
|
||||
- **Setup Wizard:** Dedicated route for initial configuration.
|
||||
### För lokal utveckling
|
||||
|
||||
### Docker & Deployment
|
||||
- **Multi-Stage Dockerfile:** Multi-arch support.
|
||||
- **Volumes:** Handle `${DOCKER_PATH}/config` and `${DOCKER_PATH}/data`.
|
||||
- **Permissions:** Respect PUID/PGID for file system access.
|
||||
- [Go](https://go.dev/dl/) ≥ 1.22
|
||||
- [Node.js](https://nodejs.org/) ≥ 20 + npm
|
||||
- [Git](https://git-scm.com/) (används av backenden för versionshantering)
|
||||
|
||||
---
|
||||
|
||||
## Snabbstart med Docker Compose
|
||||
|
||||
**1. Skapa en `.env`-fil** i mappen `docker/` (eller i roten):
|
||||
|
||||
```env
|
||||
DOCKER_PATH=/opt/archivum # Host-katalog där config/ och data/ skapas
|
||||
HOST_PORT=8080
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
TZ=Europe/Stockholm
|
||||
```
|
||||
|
||||
**2. Starta:**
|
||||
|
||||
```bash
|
||||
docker compose -f docker/docker-compose.yml up -d
|
||||
```
|
||||
|
||||
**3. Öppna** `http://localhost:8080` i webbläsaren. Installationsguiden startar automatiskt vid första körningen.
|
||||
|
||||
---
|
||||
|
||||
## Lokal utveckling
|
||||
|
||||
### Backend
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
go run ./cmd/server
|
||||
# Servern lyssnar på :4000
|
||||
# config.json i backend/ används som konfiguration
|
||||
```
|
||||
|
||||
### Frontend
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev
|
||||
# Dev-server på :5173 med proxy till :4000
|
||||
```
|
||||
|
||||
Öppna `http://localhost:5173`. API-anrop proxyas automatiskt till backend-servern.
|
||||
|
||||
### Bygga frontend för produktion
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm run build
|
||||
# Utdata i frontend/dist/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Konfiguration
|
||||
|
||||
Konfigurationen lagras i `config.json`. Filen skapas automatiskt av installationsguiden.
|
||||
|
||||
| Fält | Beskrivning |
|
||||
|----------------|-----------------------------------------------------|
|
||||
| `storage_path` | Sökväg till katalogen där .adoc-filer och Git-repot lagras |
|
||||
| `db_path` | Sökväg till SQLite-databasen (användarkonton) |
|
||||
| `jwt_secret` | Hemlig nyckel för session-tokens |
|
||||
| `listen_addr` | TCP-adress att lyssna på, t.ex. `:4000` |
|
||||
| `ldap` | Valfri LDAP-konfiguration för företagsinloggning |
|
||||
|
||||
---
|
||||
|
||||
## Dokumentformat
|
||||
|
||||
Alla dokument skrivs i [AsciiDoc](https://asciidoc.org/). Exempeldokument:
|
||||
|
||||
```asciidoc
|
||||
= Mitt dokument
|
||||
:author: Anna Andersson
|
||||
:date: 2026-04-12
|
||||
|
||||
== Introduktion
|
||||
|
||||
Det här är ett *fetstilt* stycke med en https://example.com[länk].
|
||||
|
||||
== Kodexempel
|
||||
|
||||
[source,go]
|
||||
----
|
||||
fmt.Println("Hello, Archivum!")
|
||||
----
|
||||
```
|
||||
|
||||
Filen sparas som `mitt-dokument.adoc` i `storage_path` och versionshanteras automatiskt.
|
||||
|
||||
---
|
||||
|
||||
## Docker: Multi-arch build
|
||||
|
||||
För att bygga och pusha en image som stöder både AMD64 och ARM64 (Raspberry Pi):
|
||||
|
||||
```bash
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-t ditt-registry/archivum:latest \
|
||||
-f docker/Dockerfile --push .
|
||||
```
|
||||
|
||||
## Deliverables
|
||||
1. Full project structure.
|
||||
2. PWA configuration (`vite-plugin-pwa`) and responsive layout components.
|
||||
3. The TypeScript Bridge for AsciiDoc <-> TipTap conversion.
|
||||
4. Multi-arch Dockerfile and Docker Compose template.
|
||||
5. README.md with setup guide and JSON schema.
|
||||
|
||||
Reference in New Issue
Block a user