feat: fix mods tab, add client/server split, and scaffold server dirs
Mods tab bug fixes:
- mod_manager: fix wrong kwargs in set_enabled_mods, fix scan dir to use
mods/ subdir instead of server root, migrate old string-list format to
dict format on read
- service: replace dead server_mods SQL JOIN with get_enabled_mods()
call through the mod_manager capability; pass is_server_mod to
build_mod_args
- mods_router: accept list[EnabledModEntry] objects (name + is_server_mod)
instead of bare strings
Client/server mod split:
- Mods now stored as list[{"name": str, "is_server_mod": bool}]; old
string-list format auto-migrated on read
- is_server_mod=true routes to -serverMod= arg; false to -mod= arg
- ModList UI: amber Client/Server badge in selected pane; toggle button
in split-pane selector
Directory scaffold:
- process_config: adds "mods" to dir layout; provides get_dir_readme()
with per-directory README.txt content
- file_utils: ensure_server_dirs() gains readme_provider kwarg; writes
README.txt idempotently if absent
- service.create_server: passes readme_provider via hasattr probe
- main.py startup: backfills all existing servers with correct subdirs
and README files (idempotent)
Docs: API.md and FRONTEND.md updated for new mod schema and types
Test __init__.py files added for pytest discovery
This commit is contained in:
44
API.md
44
API.md
@@ -1374,18 +1374,30 @@ List all available mods and which are currently enabled for this server.
|
||||
"mods": [
|
||||
{
|
||||
"name": "@CBA_A3",
|
||||
"folder_path": "C:/Arma3Server/@CBA_A3",
|
||||
"enabled": true
|
||||
"path": "D:/Arma3Server/1/mods/@CBA_A3",
|
||||
"size_bytes": 12345678,
|
||||
"enabled": true,
|
||||
"is_server_mod": false,
|
||||
"display_name": "Community Base Addons A3",
|
||||
"workshop_id": "450814997"
|
||||
},
|
||||
{
|
||||
"name": "@ACRE2",
|
||||
"folder_path": "C:/Arma3Server/@ACRE2",
|
||||
"enabled": true
|
||||
"path": "D:/Arma3Server/1/mods/@ACRE2",
|
||||
"size_bytes": 9876543,
|
||||
"enabled": true,
|
||||
"is_server_mod": true,
|
||||
"display_name": "ACRE2",
|
||||
"workshop_id": "751965892"
|
||||
},
|
||||
{
|
||||
"name": "@USAF",
|
||||
"folder_path": "C:/Arma3Server/@USAF",
|
||||
"enabled": false
|
||||
"path": "D:/Arma3Server/1/mods/@USAF",
|
||||
"size_bytes": 55000000,
|
||||
"enabled": false,
|
||||
"is_server_mod": false,
|
||||
"display_name": null,
|
||||
"workshop_id": null
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1393,6 +1405,8 @@ List all available mods and which are currently enabled for this server.
|
||||
}
|
||||
```
|
||||
|
||||
Mod folders are scanned from `{server_data_dir}/{server_id}/mods/@*`. `display_name` is parsed from `mod.cpp`; `workshop_id` from `meta.cpp`. `is_server_mod: true` means the mod is passed via `-serverMod=` instead of `-mod=`.
|
||||
|
||||
---
|
||||
|
||||
### PUT /servers/{server_id}/mods/enabled
|
||||
@@ -1405,13 +1419,18 @@ Set the list of enabled mods. This **replaces** the entire enabled list — send
|
||||
|
||||
```json
|
||||
{
|
||||
"mods": ["@CBA_A3", "@ACRE2"]
|
||||
"mods": [
|
||||
{ "name": "@CBA_A3", "is_server_mod": false },
|
||||
{ "name": "@ACRE2", "is_server_mod": true }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|--------|---------------|----------|------------------------------------|
|
||||
| `mods` | array[string] | Yes | Complete list of mod names to enable |
|
||||
| Field | Type | Required | Description |
|
||||
|---------------------|---------|----------|-------------|
|
||||
| `mods` | array | Yes | Complete list of mod entries to enable |
|
||||
| `mods[].name` | string | Yes | Mod folder name (must start with `@`) |
|
||||
| `mods[].is_server_mod` | bool | No | `true` → `-serverMod=`, `false` (default) → `-mod=` |
|
||||
|
||||
**Response 200:**
|
||||
|
||||
@@ -1420,7 +1439,10 @@ Set the list of enabled mods. This **replaces** the entire enabled list — send
|
||||
"success": true,
|
||||
"data": {
|
||||
"message": "Enabled mods updated. Restart the server for changes to take effect.",
|
||||
"enabled_mods": ["@CBA_A3", "@ACRE2"]
|
||||
"enabled_mods": [
|
||||
{ "name": "@CBA_A3", "is_server_mod": false },
|
||||
{ "name": "@ACRE2", "is_server_mod": true }
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user