Skip to content

Commit

Permalink
Add tonies json reload API
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed Sep 6, 2024
1 parent f8bf5ab commit cb175e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/handler_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ error_t handleApiAssignUnknown(HttpConnection *connection, const char_t *uri, co
error_t handleApiPcmUpload(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiContent(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiContentDownload(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiToniesJsonReload(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiToniesJson(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiToniesJsonUpdate(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
error_t handleApiToniesCustomJson(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx);
Expand Down
7 changes: 7 additions & 0 deletions src/handler_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,13 @@ error_t handleApiFileMove(HttpConnection *connection, const char_t *uri, const c
return httpWriteResponseString(connection, message, false);
}

error_t handleApiToniesJsonReload(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx)
{
tonies_deinit();
tonies_init();
httpPrepareHeader(connection, "text/plain; charset=utf-8", 2);
return httpWriteResponseString(connection, "OK", false);
}
error_t handleApiToniesJson(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx)
{
char *tonies_path = custom_asprintf("%s%c%s", settings_get_string("internal.configdirfull"), PATH_SEPARATOR, TONIES_JSON_FILE);
Expand Down
1 change: 1 addition & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ request_type_t request_paths[] = {
{REQ_GET, "/api/stats", SERTY_WEB, &handleApiStats},
{REQ_GET, "/api/toniesJsonSearch", SERTY_WEB, &handleApiToniesJsonSearch},
{REQ_GET, "/api/toniesJsonUpdate", SERTY_WEB, &handleApiToniesJsonUpdate},
{REQ_GET, "/api/toniesJsonReload", SERTY_WEB, &handleApiToniesJsonReload},
{REQ_GET, "/api/toniesJson", SERTY_WEB, &handleApiToniesJson},
{REQ_GET, "/api/toniesCustomJson", SERTY_WEB, &handleApiToniesCustomJson},
{REQ_GET, "/api/tonieboxesJson", SERTY_WEB, &handleApiTonieboxJson},
Expand Down

0 comments on commit cb175e0

Please sign in to comment.