mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2026-09-27 04:51:45 +00:00
Compare commits
10
Commits
7ef162bd83
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6ea6376e1 | ||
|
|
19e7899309 | ||
|
|
9e69730bfd | ||
|
|
b5e1c4b42a | ||
|
|
7660dd7c30 | ||
|
|
685784c360 | ||
|
|
cc2c45221b | ||
|
|
b113d253a9 | ||
|
|
c99c62cf00 | ||
|
|
8034b1a501 |
@@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Frontend uses `@cryptgeon/shared` for crypto + payload codec (replacing the previous local `cryptgeon/shared`); heavy pack/unpack runs in a web worker.
|
||||
- CLI rebuilt with `vite-plus` (bundles all deps) and imports from `@cryptgeon/shared`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- SPA fallback now serves the app (200) for client-side routes such as `/about` and `/note/<id>`, while unmatched `/api/*` paths still return 404.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- Endpoints moved to `/api/v3/notes/` and `/api/v3/status`; health check to `/healthz`.
|
||||
|
||||
+10
-12
@@ -1,17 +1,17 @@
|
||||
services:
|
||||
cache:
|
||||
image: valkey/valkey:7-alpine
|
||||
image: valkey/valkey:9-alpine
|
||||
# This is required to stay in RAM only.
|
||||
command: valkey-server --save "" --appendonly no
|
||||
# Set a size limit. See link below on how to customise.
|
||||
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||
# https://valkey.io/topics/lru-cache/
|
||||
# --maxmemory 1gb --maxmemory-policy allkeys-lru
|
||||
# This prevents the creation of an anonymous volume.
|
||||
tmpfs:
|
||||
- /data
|
||||
|
||||
app:
|
||||
image: cupcakearmy/cryptgeon:v3
|
||||
image: cupcakearmy/cryptgeon:3
|
||||
depends_on:
|
||||
- cache
|
||||
environment:
|
||||
@@ -19,11 +19,9 @@ services:
|
||||
SIZE_LIMIT: 4 MiB
|
||||
ports:
|
||||
- 80:8000
|
||||
|
||||
# Optional health checks
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "--fail", "http://127.0.0.1:8000/healthz"]
|
||||
# interval: 1m
|
||||
# timeout: 3s
|
||||
# retries: 2
|
||||
# start_period: 5s
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "--fail", "http://127.0.0.1:8000/healthz"]
|
||||
interval: 1m
|
||||
timeout: 3s
|
||||
retries: 2
|
||||
start_period: 5s
|
||||
|
||||
Generated
+1
-1
@@ -252,7 +252,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cryptgeon"
|
||||
version = "3.0.0-rc.4"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"bs62",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cryptgeon"
|
||||
version = "3.0.0-rc.4"
|
||||
version = "3.0.0"
|
||||
authors = ["cupcakearmy <hi@nicco.io>"]
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
|
||||
@@ -20,6 +20,10 @@ mod note;
|
||||
mod status;
|
||||
mod store;
|
||||
|
||||
async fn api_not_found() -> axum::http::StatusCode {
|
||||
axum::http::StatusCode::NOT_FOUND
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
@@ -39,11 +43,13 @@ async fn main() {
|
||||
.nest("/notes", notes_routes)
|
||||
.merge(status_routes);
|
||||
|
||||
let api_routes = Router::new().nest("/v3", v3_routes);
|
||||
let api_routes = Router::new()
|
||||
.nest("/v3", v3_routes)
|
||||
.fallback(api_not_found);
|
||||
|
||||
let index = format!("{}{}", config::FRONTEND_PATH.to_string(), "/index.html");
|
||||
let serve_dir =
|
||||
ServeDir::new(config::FRONTEND_PATH.to_string()).not_found_service(ServeFile::new(index));
|
||||
ServeDir::new(config::FRONTEND_PATH.to_string()).fallback(ServeFile::new(index));
|
||||
let app = Router::new()
|
||||
.nest("/api", api_routes)
|
||||
.merge(health_routes)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cryptgeon",
|
||||
"version": "3.0.0-rc.4",
|
||||
"version": "3.0.0",
|
||||
"homepage": "https://github.com/cupcakearmy/cryptgeon",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("@web", () => {
|
||||
for (const path of ["/", "/about", "/note/does-not-exist"]) {
|
||||
test(`serves ${path} with status 200`, async ({ request }) => {
|
||||
const response = await request.get(path);
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
}
|
||||
|
||||
test("api still reports a missing note as 404", async ({ request }) => {
|
||||
const response = await request.get("/api/notes/does-not-exist");
|
||||
expect(response.status()).toBe(404);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user