mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-22 00:00:49 +00:00
Check status code for GS api requests
This commit is contained in:
@@ -203,6 +203,11 @@ static int load_server_status(PSERVER_DATA server) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (xml_status(data->memory, data->size) == GS_ERROR) {
|
||||
ret = GS_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (xml_search(data->memory, data->size, "currentgame", ¤tGameText) != GS_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -408,7 +413,9 @@ int gs_pair(PSERVER_DATA server, char* pin) {
|
||||
else if ((ret = http_request(url, data)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "1") != 0) {
|
||||
@@ -464,7 +471,9 @@ int gs_pair(PSERVER_DATA server, char* pin) {
|
||||
|
||||
free(result);
|
||||
result = NULL;
|
||||
if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "1") != 0) {
|
||||
@@ -521,7 +530,9 @@ int gs_pair(PSERVER_DATA server, char* pin) {
|
||||
|
||||
free(result);
|
||||
result = NULL;
|
||||
if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "1") != 0) {
|
||||
@@ -570,7 +581,9 @@ int gs_pair(PSERVER_DATA server, char* pin) {
|
||||
|
||||
free(result);
|
||||
result = NULL;
|
||||
if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "1") != 0) {
|
||||
@@ -587,7 +600,9 @@ int gs_pair(PSERVER_DATA server, char* pin) {
|
||||
|
||||
free(result);
|
||||
result = NULL;
|
||||
if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "paired", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "1") != 0) {
|
||||
@@ -624,6 +639,8 @@ int gs_applist(PSERVER_DATA server, PAPP_LIST *list) {
|
||||
sprintf(url, "https://%s:47984/applist?uniqueid=%s&uuid=%s", server->serverInfo.address, unique_id, uuid_str);
|
||||
if (http_request(url, data) != GS_OK)
|
||||
ret = GS_IO_ERROR;
|
||||
else if (xml_status(data->memory, data->size) == GS_ERROR)
|
||||
ret = GS_ERROR;
|
||||
else if (xml_applist(data->memory, data->size, list) != GS_OK)
|
||||
ret = GS_INVALID;
|
||||
|
||||
@@ -679,7 +696,9 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
|
||||
else
|
||||
goto cleanup;
|
||||
|
||||
if ((ret = xml_search(data->memory, data->size, "gamesession", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "gamesession", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (!strcmp(result, "0")) {
|
||||
@@ -711,7 +730,9 @@ int gs_quit_app(PSERVER_DATA server) {
|
||||
if ((ret = http_request(url, data)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if ((ret = xml_search(data->memory, data->size, "cancel", &result)) != GS_OK)
|
||||
if ((ret = xml_status(data->memory, data->size) != GS_OK))
|
||||
goto cleanup;
|
||||
else if ((ret = xml_search(data->memory, data->size, "cancel", &result)) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (strcmp(result, "0") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user