1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Changed API url

This commit is contained in:
Krateng 2019-05-12 10:20:47 +02:00
parent 0bf1790a7c
commit 3fce682c00
6 changed files with 9 additions and 9 deletions

View File

@ -36,14 +36,14 @@ Also neat: You can use your **custom artist or track images**.
If you're missing packages, the console output will tell you so. Install them.
2) (Recommended) Put your server behind a reverse proxy for SSL encryption. Configure that proxy to rewrite /db/ requests to the database port. In nginx this would look as follows:
2) (Recommended) Put your server behind a reverse proxy for SSL encryption. Configure that proxy to rewrite /api/ requests to the API port. In nginx this would look as follows:
location / {
proxy_pass http://yoururl:42010;
}
location /db {
rewrite ^/db(.*)$ $1 break;
location /api {
rewrite ^/api(.*)$ $1 break;
proxy_pass http://yoururl:42011;
}

View File

@ -255,7 +255,7 @@ function scrobble(artist,title,seconds) {
chrome.storage.local.get("serverurl",function(result) {
URL = result["serverurl"]
var xhttp = new XMLHttpRequest();
xhttp.open("POST",URL + "/db/newscrobble",true);
xhttp.open("POST",URL + "/api/newscrobble",true);
xhttp.send("artist=" + artiststring + "&title=" + titlestring + "&duration=" + seconds + "&key=" + APIKEY)
});
});

View File

@ -1,6 +1,6 @@
{
"name": "Maloja Scrobbler",
"version": "1.0",
"version": "1.1",
"description": "Scrobbles tracks from various sites to your Maloja server",
"manifest_version": 2,
"permissions": ["activeTab",

View File

@ -72,7 +72,7 @@ function updateAPIKey() {
}
function checkServer() {
url = document.getElementById("serverurl").value + "/db/test?key=" + document.getElementById("apikey").value
url = document.getElementById("serverurl").value + "/api/test?key=" + document.getElementById("apikey").value
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = createCheckmarks;

View File

@ -71,7 +71,7 @@ def customerror(error):
# this is the fallback option. If you run this service behind a reverse proxy, it is recommended to rewrite /db/ requests to the port of the db server
# e.g. location /db { rewrite ^/db(.*)$ $1 break; proxy_pass http://yoururl:12349; }
@webserver.get("/db/<pth:path>")
@webserver.get("/api/<pth:path>")
def database_get(pth):
keys = FormsDict.decode(request.query) # The Dal★Shabet handler
keystring = "?"
@ -88,7 +88,7 @@ def database_get(pth):
response.status = e.code
return
@webserver.post("/db/<pth:path>")
@webserver.post("/api/<pth:path>")
def database_post(pth):
response.set_header("Access-Control-Allow-Origin","*")
try:

View File

@ -6,7 +6,7 @@ function search(searchfield) {
else {
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = searchresult
xhttp.open("GET","/db/search?max=5&query=" + encodeURIComponent(txt), true);
xhttp.open("GET","/api/search?max=5&query=" + encodeURIComponent(txt), true);
xhttp.send();
}
}