Legacy audioscrobbler should now use correct scheme automatically

This commit is contained in:
Krateng 2020-11-01 20:41:30 +01:00
parent 5b7d1fd8e9
commit df6ad4f073
3 changed files with 16 additions and 17 deletions

View File

@ -139,19 +139,19 @@ You can use any third-party scrobbler that supports the audioscrobbler (GNUFM) o
GNU FM |  
------ | ---------
Gnukebox URL | Your Maloja URL followed by `/apis/audioscrobbler`
Username | Any name, doesn't matter (don't leave empty)
Username | Doesn't matter
Password | Any of your API keys
ListenBrainz |  
------ | ---------
API URL | Your Maloja URL followed by `/apis/listenbrainz`
Username | Any name, doesn't matter (don't leave empty)
Username | Doesn't matter
Auth Token | Any of your API keys
Audioscrobbler v1.2 |  
------ | ---------
Server URL | Your Maloja URL followed by `/apis/audioscrobbler_legacy`
Username | `nossl` if your server isn't behind an SSL reverse proxy (http instead of https)
Username | Doesn't matter
Password | Any of your API keys
Known working scrobblers:
@ -159,6 +159,7 @@ Known working scrobblers:
* [Web Scrobbler](https://github.com/web-scrobbler/web-scrobbler) for desktop browsers (requires you to supply the full endpoint (`yoururl.tld/apis/listenbrainz/1/submit-listens`))
* [Simple Scrobbler](https://simple-last-fm-scrobbler.github.io) for Android
* [Airsonic Advanced](https://github.com/airsonic-advanced/airsonic-advanced) (requires you to supply the full endpoint (`yoururl.tld/apis/listenbrainz/1/submit-listens`))
* [Funkwhale](https://dev.funkwhale.audio/funkwhale/funkwhale) (use the legacy API `yoururl.tld/apis/audioscrobbler_legacy`)
I'm thankful for any feedback whether other scrobblers work!

View File

@ -2,6 +2,8 @@ from ._base import APIHandler
from ._exceptions import *
from .. import database
from bottle import request
class AudioscrobblerLegacy(APIHandler):
__apiname__ = "Legacy Audioscrobbler"
__doclink__ = "https://web.archive.org/web/20190531021725/https://www.last.fm/api/submissions"
@ -36,9 +38,9 @@ class AudioscrobblerLegacy(APIHandler):
timestamp = keys.get("t")
apikey = keys.get("api_key")
host = keys.get("Host")
protocol = 'http' if (keys.get("u") == 'nossl') else 'https'
# we utilize the useless username field for the protocol
protocol = request.urlparts.scheme
if (keys.get("u") == 'nossl'): protocol = 'http' #user override
if auth is not None:
for key in database.allAPIkeys():
if check_token(auth, key, timestamp):

View File

@ -485,7 +485,7 @@
"raw": ""
},
"url": {
"raw": "{{url}}/apis/audioscrobbler_legacy/?hs=true&t={{timestamp}}&a={{legacy_token}}&u=nossl",
"raw": "{{url}}/apis/audioscrobbler_legacy/?hs=true&t={{timestamp}}&a={{legacy_token}}",
"host": [
"{{url}}"
],
@ -506,10 +506,6 @@
{
"key": "a",
"value": "{{legacy_token}}"
},
{
"key": "u",
"value": "nossl"
}
]
}
@ -590,32 +586,32 @@
],
"variable": [
{
"id": "5c4cf10d-6008-4aff-8afe-cbf3b4be64e9",
"id": "88c0d6ae-fb1a-420d-aa65-494f561090ff",
"key": "url",
"value": "http://localhost:42010"
},
{
"id": "f86e3a7a-f14e-4e88-a2bd-f07a2486d413",
"id": "4cd70ff6-d2d8-4ff9-bb51-ee0ac46a0c7a",
"key": "api_key",
"value": "localdevtestkey"
},
{
"id": "c85768d8-7407-4b97-a8d7-29d15e7c9147",
"id": "bb5a3d1f-34a7-421d-a60a-eaa6dd3cac61",
"key": "example_artist",
"value": "EXID ft. Jeremy Soule"
},
{
"id": "938a104d-a775-42b3-a760-8389e4fb0f20",
"id": "6a344668-55f0-44de-ae9b-bb7df916f5fd",
"key": "example_song",
"value": "Why is the Rum gone?"
},
{
"id": "682dd4b1-fbde-414e-a1e2-245554cd19ba",
"id": "17fc8bb2-4fc3-461c-8581-48573f640f7c",
"key": "example_artist_2",
"value": "BLACKPINK ft. Tzuyu"
},
{
"id": "51f38a46-5ca1-4548-9ba8-1203edc06376",
"id": "b87d84f6-3f3a-4732-becf-b34794a1c178",
"key": "example_song_2",
"value": "POP/STARS"
}