add example docker-compose, fix db location
M.dockerignore
| @@ -40,5 +40,5 @@ yarn-error.log* | |||
|---|---|---|---|
| 40 | 40 | **/*.log | |
| 41 | 41 | package-lock.json | |
| 42 | 42 | **/*.bun | |
| 43 | - | *.sqlite | |
| 43 | + | db | |
| 44 | 44 | assets/dist | |
M.gitignore
| @@ -40,5 +40,5 @@ yarn-error.log* | |||
|---|---|---|---|
| 40 | 40 | **/*.log | |
| 41 | 41 | package-lock.json | |
| 42 | 42 | **/*.bun | |
| 43 | - | *.sqlite | |
| 43 | + | db | |
| 44 | 44 | assets/dist | |
Adocker-compose.yml
| @@ -0,0 +1,9 @@ | |||
|---|---|---|---|
| 1 | + | services: | |
| 2 | + | zigbin: | |
| 3 | + | build: | |
| 4 | + | context: . | |
| 5 | + | dockerfile: Dockerfile | |
| 6 | + | volumes: | |
| 7 | + | - ./db:/app/db | |
| 8 | + | ports: | |
| 9 | + | - 3000:3000 | |
Msrc/index.ts
| @@ -7,10 +7,7 @@ import crypto from 'crypto' | |||
|---|---|---|---|
| 7 | 7 | import { DecryptFile, filetypes, Index, NotFound, SetCookie, ShowFile, WrongPassword } from "./components" | |
| 8 | 8 | import cron from "@elysiajs/cron" | |
| 9 | 9 | ||
| 10 | - | ||
| 11 | - | //TODO: add deletion timer | |
| 12 | - | ||
| 13 | - | const db = new Database("./db.sqlite") | |
| 10 | + | const db = new Database("./db/db.sqlite") | |
| 14 | 11 | db.exec("PRAGMA foreign_keys = ON") | |
| 15 | 12 | db.exec("PRAGMA journal_mode = WAL2") | |
| 16 | 13 | db.exec("CREATE TABLE IF NOT EXISTS files (uuid TEXT PRIMARY KEY, filename TEXT NOT NULL, content BLOB NOT NULL, filetype TEXT NOT NULL, encrypted INTEGER NOT NULL, delete_at INTEGER) STRICT") | |