updated to accept only .tar.zstd uploads

This commit is contained in:
2026-09-23 17:48:42 +02:00
parent cf337483d7
commit c6b27cd3c9
15 changed files with 556 additions and 50 deletions
+25 -5
View File
@@ -5,30 +5,50 @@ Simple web application created using DTLib.Web.
## Important
Restart web application once per day to delete outdated data and clean RAM.
## Config
`SaveUpload` section of `config.json`:
- `MaxSizeCompressedBytes` - max size of uploaded `.tar.zst` (default 60 MiB)
- `MaxSizePlainTextBytes` - max size of the game data entry after decompression (default 200 MiB)
## Routes
### POST `/uploadSave`
- **Query Params:**
- `game` - short name of the game (see [../README.md](../README.md))
- **Request Body:** `application/octet-stream` - .eu4 file
- `originalFileType` - `text` | `zip`
- `originalFileName` - name of the original save file (max 255 characters)
- **Request Body:** `application/zstd` - single zstd frame containing a tar with files of the original save.
Game data is read from the entry named in [GameSaveEntryNames](./Game.cs) (`gamestate` for EU4).
A plain text save is a tar with just that one entry.
The blob is stored byte-for-byte and can be downloaded with `/getSaveFile`.
- **Response:**
```json
{ "saveId": "string" }
{ "id": "string" }
```
or `{ "errorMessage": "string" }`
or `{ "errorMessage": "string" }`
(status 413 if upload or uncompressed game data exceeds the limits from config)
### GET `/getSaveStatus`
- **Query Params:**
- `id` - id of uploaded save file
- **Response:** [SaveFileMetadata](./SaveFileMetadata.cs)
- **Response:** [SaveFileMetadata](./Database/SaveFileMetadata.cs)
```json
{
"id": "string",
"game": "string",
"status": "string",
"status": "initialized | uploaded | parsing | saving_results | done | error",
"uploadDateTime": "string",
"originalFileType": "text | zip",
"originalFileName": "string",
"errorMessage": "string?"
}
```
### GET `/getSaveFile`
- **Query Params:**
- `id` - id of uploaded save file
- **Response:** `application/zstd` - uploaded blob, unchanged
or `{ "errorMessage": "string" }`
### GET `/getSaveData`
- **Query Params:**
- `id` - id of uploaded save file