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

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

@@ -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):