Skip to main content

Screensaver Upload

Upload a custom screensaver image. The browser converts a PNG / JPG / image into the device s .ss format first; this API receives that pre-converted file.

Most users should use the Screensaver page in NM Monitor — it handles the conversion automatically. This page is for integrators who want to push their own assets programmatically.


Two-step flow


GET /api/update/screensaver/preflight

Ask the device whether a file of size bytes can be stored. The device decides whether it has to free space first (by overwriting the oldest existing screensaver).

Query parameters

NameRequiredMeaning
sizeyesSize in bytes of the .ss file you intend to upload.

Response — file fits

{
"fileSize": 65536,
"fsFree": 262144,
"maxUploadable": 327680,
"action": "new",
"overwriteCount": 0,
"overwriteFiles": [],
"existingCount": 2,
"spaceAfter": 196608
}

Response — needs overwrite

{
"fileSize": 180000,
"fsFree": 60000,
"maxUploadable": 400000,
"action": "overwrite",
"overwriteCount": 2,
"overwriteFiles": [
{"name": "saver_320_240_001.ss", "size": 65536},
{"name": "saver_320_240_002.ss", "size": 72104}
],
"existingCount": 4,
"spaceAfter": 17640
}

Response — too big

{
"fileSize": 1500000,
"fsFree": 60000,
"maxUploadable": 400000,
"action": "reject",
"overwriteCount": 0,
"overwriteFiles": [],
"existingCount": 4,
"spaceAfter": 0
}
FieldTypeMeaning
fileSizeintegerEcho of the requested upload size.
fsFreeintegerCurrent free bytes on the on-device FS.
maxUploadableintegerFree bytes plus all existing screensaver bytes — the absolute upper bound.
actionstring"new", "overwrite", or "reject".
overwriteCountintegerHow many existing screensavers will be deleted to make room.
overwriteFilesobject[]The list of files about to be removed (name + size).
existingCountintegerExisting screensaver files matching the current screen size.
spaceAfterintegerPredicted free bytes once the upload lands.

POST /api/update/screensaver

Uploads the actual .ss file as multipart/form-data.

Request

  • Content type: multipart/form-data
  • File extension: must end in .ss.
  • Max size: 200 KB.
  • First 2 bytes of the file: magic 0x4E 0x53.

Response — success

{
"status": "ok",
"path": "/ss/saver_320_240_003.ss"
}

Response — failure

StatusBodyCause
400Only .ss files are accepted.Wrong file extension.
400Invalid .ss file header.Magic bytes do not match.
413File too large (max 200 KB).Body exceeded 200 KB.
500Failed to open file for writing.File system error.
500Write error.File system error during write.

Example

SIZE=$(stat -c%s saver_320_240_003.ss)
curl "http://192.168.1.42/api/update/screensaver/preflight?size=$SIZE"
# inspect "action"; if "reject", abort
curl -X POST -F "file=@saver_320_240_003.ss" \
http://192.168.1.42/api/update/screensaver
warning

Uploading a screensaver briefly pauses mining while the file system flushes. Hashrate returns to normal within ~1 second.