summaryrefslogtreecommitdiffstats
path: root/src/db.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-07-29 01:03:24 +0200
committersalmonik <salmonik@tuta.io>2026-07-29 01:03:24 +0200
commit74d2ada067bd2fd9436710ab7ac260e0eddf1314 (patch)
tree1f791bb895a611d8e729a735ba098a647808a157 /src/db.rs
parentcreate example config on startup (diff)
downloadminecraft-ui-74d2ada067bd2fd9436710ab7ac260e0eddf1314.tar.gz
minecraft-ui-74d2ada067bd2fd9436710ab7ac260e0eddf1314.zip
Add per-instance mod management with client-side detection
- New mod validation engine (src/mods.rs) with constant-pool class-file scanning: detects server-side content (block, tileentity, command, worldgen) vs client-only API (gui, renderer, forge/client) - 7 client-only mods correctly detected (AppleSkin, CraftingTweaks, Durability101, EnchantmentDescriptions, InventoryHUD, MouseTweaks, TrashSlot); 51 server-capable; 1 unknown - Routes + templating for mod upload (jar/zip), listing, delete, rescan - Multipart upload with 500MB limit (bypasses axum's default 2MB) - Per-instance mod summary card on edit page - Whitelist toggle checkbox on edit page (persisted, drives ENABLE_WHITELIST) - Dynamic Java image tag (java8/java17/java21) based on MC version - Class scan is informational-only; rejection based on metadata side=CLIENT - has_modpack flag cleanup on mod delete - Remove hx-boost from <body> (was corrupting multipart uploads)
Diffstat (limited to '')
-rw-r--r--src/db.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/db.rs b/src/db.rs
index 7868e3e..2024032 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -62,6 +62,18 @@ impl Database {
62 updated_at TEXT NOT NULL DEFAULT (datetime('now')) 62 updated_at TEXT NOT NULL DEFAULT (datetime('now'))
63 ); 63 );
64 64
65 CREATE TABLE IF NOT EXISTS mods (
66 id INTEGER PRIMARY KEY AUTOINCREMENT,
67 instance_id INTEGER NOT NULL,
68 filename TEXT NOT NULL,
69 display_name TEXT,
70 side TEXT NOT NULL DEFAULT 'UNKNOWN',
71 accepted INTEGER NOT NULL DEFAULT 0,
72 rejection_reason TEXT,
73 created_at TEXT NOT NULL DEFAULT (datetime('now')),
74 FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE
75 );
76
65 CREATE TABLE IF NOT EXISTS backups ( 77 CREATE TABLE IF NOT EXISTS backups (
66 id INTEGER PRIMARY KEY AUTOINCREMENT, 78 id INTEGER PRIMARY KEY AUTOINCREMENT,
67 instance_id INTEGER NOT NULL, 79 instance_id INTEGER NOT NULL,
@@ -98,6 +110,10 @@ impl Database {
98 let _ = conn.execute_batch( 110 let _ = conn.execute_batch(
99 "ALTER TABLE instances ADD COLUMN container_state TEXT NOT NULL DEFAULT 'stopped'", 111 "ALTER TABLE instances ADD COLUMN container_state TEXT NOT NULL DEFAULT 'stopped'",
100 ); 112 );
113 // Migration: add whitelist_enabled column if missing
114 let _ = conn.execute_batch(
115 "ALTER TABLE instances ADD COLUMN whitelist_enabled INTEGER NOT NULL DEFAULT 1",
116 );
101 Ok(()) 117 Ok(())
102 } 118 }
103 119