[httpd/spotify] Remove redirect to legacy admin.html page
This commit is contained in:
parent
b8a66a92cf
commit
13e8103962
23
src/httpd.c
23
src/httpd.c
|
@ -262,14 +262,13 @@ httpd_fixup_uri(struct evhttp_request *req)
|
||||||
/* --------------------------- REQUEST HELPERS ------------------------------ */
|
/* --------------------------- REQUEST HELPERS ------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
httpd_redirect_to_admin(struct evhttp_request *req)
|
httpd_redirect_to(struct evhttp_request *req, const char *path)
|
||||||
{
|
{
|
||||||
struct evkeyvalq *headers;
|
struct evkeyvalq *headers;
|
||||||
|
|
||||||
headers = evhttp_request_get_output_headers(req);
|
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);
|
httpd_send_reply(req, HTTP_MOVETEMP, "Moved", NULL, HTTPD_SEND_NO_GZIP);
|
||||||
}
|
}
|
||||||
|
@ -451,17 +450,9 @@ serve_file(struct evhttp_request *req, const char *uri)
|
||||||
ret = stat(path, &sb);
|
ret = stat(path, &sb);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
if (strcmp(uri, "/") == 0)
|
DPRINTF(E_LOG, L_HTTPD, "Could not stat() %s: %s\n", path, strerror(errno));
|
||||||
{
|
httpd_send_error(req, HTTP_NOTFOUND, "Not Found");
|
||||||
httpd_redirect_to_admin(req);
|
return;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,14 +824,14 @@ httpd_gen_cb(struct evhttp_request *req, void *arg)
|
||||||
if (!uri)
|
if (!uri)
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_HTTPD, "No URI in request\n");
|
DPRINTF(E_WARN, L_HTTPD, "No URI in request\n");
|
||||||
httpd_redirect_to_admin(req);
|
httpd_redirect_to(req, "/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed = httpd_uri_parse(uri);
|
parsed = httpd_uri_parse(uri);
|
||||||
if (!parsed || !parsed->path)
|
if (!parsed || !parsed->path)
|
||||||
{
|
{
|
||||||
httpd_redirect_to_admin(req);
|
httpd_redirect_to(req, "/");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,10 @@ void
|
||||||
httpd_send_error(struct evhttp_request *req, int error, const char *reason);
|
httpd_send_error(struct evhttp_request *req, int error, const char *reason);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redirects to /admin.html
|
* Redirects to the given path
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
httpd_redirect_to_admin(struct evhttp_request *req);
|
httpd_redirect_to(struct evhttp_request *req, const char *path);
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -60,7 +60,7 @@ oauth_reply_spotify(struct httpd_request *hreq)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
httpd_redirect_to_admin(hreq->req);
|
httpd_redirect_to(hreq->req, "/#/settings/online-services");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue