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

Fixed token validation endpoint for Listenbrainz

This commit is contained in:
Krateng 2020-08-06 17:27:15 +02:00
parent ddbdc7ec56
commit bdfb2a4a0b
3 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,6,7
version = 2,6,8
versionstr = ".".join(str(n) for n in version)
links = {
"pypi":"malojaserver",

View File

@ -212,10 +212,10 @@ class LBrnz1(APIHandler):
def validate_token(self,pathnodes,keys):
try:
token = keys.get("Authorization").replace("token ","").replace("Token ","").strip()
token = keys.get("token").strip()
except:
raise BadAuthException()
if token not in database.allAPIkeys():
raise InvalidAuthException()
else:
return 200,{"code":200,"message":"Token valid.",valid:True}
return 200,{"code":200,"message":"Token valid.","valid":True,"user_name":"n/a"}

View File

@ -3,3 +3,4 @@
replaceartist SING女團 S.I.N.G.
replacetitle SING-Moonlight Thoughts Moonlight Thoughts (English Version)
replacetitle 那不勒斯的黎明 Dawn in Naples

Can't render this file because it has a wrong number of fields in line 4.