Update Controller Documentation
The CheckForUpdateUpdateController
provides two endpoints
for checking for updates and updating Melon. It calls GitHub to check
for the latest release and triggers an update process if required.
For more details on how Melon managing updates, refer to the MelonInstaller Architecture.
This is apart of the Settings Endpoints, which are scattered across a couple of controllers that group them by similarity.
Controller Route: /api/settings
All routes within the CheckForUpdateUpdateController
are
prefixed by /api/settings
.
Summary of Endpoints
Endpoint | Method | Description | Authorization |
---|---|---|---|
/api/settings/check-for-updates |
GET | Checks if a newer version of the Melon server is available. | Admin, User |
/api/settings/update-melon |
POST | Initiates the process of updating the Melon server. | Admin |
Check for Updates
This endpoint checks if a new version of the Melon server is available by comparing the current version of the server with the latest release available on GitHub.
Details:
-
Endpoint:
/api/settings/check-for-updates
- Method:
GET
- Authorization: JWT with Admin or User role
- Consumes:
application/json
Responses:
-
200 OK: Returns whether an update is available, along
with version information and release notes.
- UpdateAvailable: Indicates if there is a newer version.
- CurrentVersion: The version of the server currently running.
- LatestVersion: The latest version available on GitHub.
-
ReleaseNotes: Notes related to the latest release
(if applicable).
- Release notes will be in markdown
- 400 Bad Request: Failed to check for updates.
Example Request (using curl
):
curl -X GET "https://your-melon-server.com/api/settings/check-for-updates" \
-H "Authorization: Bearer <Admin-or-User-JWT>"
Example Response:
{
"UpdateAvailable": true,
"CurrentVersion": "1.0.0",
"LatestVersion": "1.1.0",
"ReleaseNotes": "Bug fixes and performance improvements."
}
Update Melon
This endpoint triggers the update process for the Melon server. It
downloads the latest version and initiates the update process using
MelonInstaller.exe
.
Details:
-
Endpoint:
/api/settings/update-melon
- Method:
POST
- Authorization: JWT with Admin role
- Consumes:
application/json
Responses:
-
200 OK: Update process initiated successfully.
- If the server is already up-to-date, "Melon is up to date" will be returned.
- 400 Bad Request: If the update process fails or an error occurs.
- 404 Not Found: No update found if the GitHub release is unavailable.
Example Request (using curl
):
curl -X POST "https://your-melon-server.com/api/settings/update-melon" \
-H "Authorization: Bearer <Admin-JWT>"
Notes
-
The
check-for-updates
endpoint compares the current server version with the latest release on GitHub. -
The
update-melon
endpoint starts the update process, which involves running theMelonInstaller.exe
and exiting the current application.