[httpd/spotify] Remove redirect to legacy admin.html page

This commit is contained in:
chme 2020-11-21 12:25:01 +01:00
parent b8a66a92cf
commit 13e8103962
3 changed files with 10 additions and 19 deletions

View File

@ -262,14 +262,13 @@ httpd_fixup_uri(struct evhttp_request *req)
/* --------------------------- REQUEST HELPERS ------------------------------ */
void
httpd_redirect_to_admin(struct evhttp_request *req)
httpd_redirect_to(struct evhttp_request *req, const char *path)
{
struct evkeyvalq *headers;
headers = evhttp_request_get_output_headers(req);
evhttp_add_header(headers, "Location", "/admin.html");
evhttp_add_header(headers, "Location", path);
httpd_send_reply(req, HTTP_MOVETEMP, "Moved", NULL, HTTPD_SEND_NO_GZIP);
}
@ -450,20 +449,12 @@ serve_file(struct evhttp_request *req, const char *uri)
ret = stat(path, &sb);
if (ret < 0)
{
if (strcmp(uri, "/") == 0)
{
httpd_redirect_to_admin(req);
return;
}
else
{
DPRINTF(E_LOG, L_HTTPD, "Could not stat() %s: %s\n", path, strerror(errno));
httpd_send_error(req, HTTP_NOTFOUND, "Not Found");
return;
}
}
}
if (path_is_legal(path) != 0)
{
@ -833,14 +824,14 @@ httpd_gen_cb(struct evhttp_request *req, void *arg)
if (!uri)
{
DPRINTF(E_WARN, L_HTTPD, "No URI in request\n");
httpd_redirect_to_admin(req);
httpd_redirect_to(req, "/");
return;
}
parsed = httpd_uri_parse(uri);
if (!parsed || !parsed->path)
{
httpd_redirect_to_admin(req);
httpd_redirect_to(req, "/");
goto out;
}

View File

@ -150,10 +150,10 @@ void
httpd_send_error(struct evhttp_request *req, int error, const char *reason);
/*
* Redirects to /admin.html
* Redirects to the given path
*/
void
httpd_redirect_to_admin(struct evhttp_request *req);
httpd_redirect_to(struct evhttp_request *req, const char *path);
bool

View File

@ -60,7 +60,7 @@ oauth_reply_spotify(struct httpd_request *hreq)
return -1;
}
httpd_redirect_to_admin(hreq->req);
httpd_redirect_to(hreq->req, "/#/settings/online-services");
return 0;
}