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

Moved all native API endpoints to new auth handling

This commit is contained in:
krateng 2022-04-14 19:36:50 +02:00
parent 62a654bfbf
commit 1a977d9c0c

View File

@ -328,7 +328,7 @@ def post_scrobble(
@api.post("importrules") @api.post("importrules")
@authenticated_api @authenticated_function(api=True)
def import_rulemodule(**keys): def import_rulemodule(**keys):
"""Internal Use Only""" """Internal Use Only"""
filename = keys.get("filename") filename = keys.get("filename")
@ -346,7 +346,7 @@ def import_rulemodule(**keys):
@api.post("rebuild") @api.post("rebuild")
@authenticated_api @authenticated_function(api=True)
def rebuild(**keys): def rebuild(**keys):
"""Internal Use Only""" """Internal Use Only"""
log("Database rebuild initiated!") log("Database rebuild initiated!")
@ -401,7 +401,7 @@ def search(**keys):
@api.post("addpicture") @api.post("addpicture")
@authenticated_api @authenticated_function(api=True)
def add_picture(b64,artist:Multi=[],title=None): def add_picture(b64,artist:Multi=[],title=None):
"""Internal Use Only""" """Internal Use Only"""
keys = FormsDict() keys = FormsDict()
@ -414,7 +414,7 @@ def add_picture(b64,artist:Multi=[],title=None):
@api.post("newrule") @api.post("newrule")
@authenticated_api @authenticated_function(api=True)
def newrule(**keys): def newrule(**keys):
"""Internal Use Only""" """Internal Use Only"""
pass pass
@ -424,26 +424,26 @@ def newrule(**keys):
@api.post("settings") @api.post("settings")
@authenticated_api @authenticated_function(api=True)
def set_settings(**keys): def set_settings(**keys):
"""Internal Use Only""" """Internal Use Only"""
malojaconfig.update(keys) malojaconfig.update(keys)
@api.post("apikeys") @api.post("apikeys")
@authenticated_api @authenticated_function(api=True)
def set_apikeys(**keys): def set_apikeys(**keys):
"""Internal Use Only""" """Internal Use Only"""
apikeystore.update(keys) apikeystore.update(keys)
@api.post("import") @api.post("import")
@authenticated_api @authenticated_function(api=True)
def import_scrobbles(identifier): def import_scrobbles(identifier):
"""Internal Use Only""" """Internal Use Only"""
from ..thirdparty import import_scrobbles from ..thirdparty import import_scrobbles
import_scrobbles(identifier) import_scrobbles(identifier)
@api.get("backup") @api.get("backup")
@authenticated_api @authenticated_function(api=True)
def get_backup(**keys): def get_backup(**keys):
"""Internal Use Only""" """Internal Use Only"""
from ..proccontrol.tasks.backup import backup from ..proccontrol.tasks.backup import backup
@ -455,7 +455,7 @@ def get_backup(**keys):
return static_file(os.path.basename(archivefile),root=tmpfolder) return static_file(os.path.basename(archivefile),root=tmpfolder)
@api.get("export") @api.get("export")
@authenticated_api @authenticated_function(api=True)
def get_export(**keys): def get_export(**keys):
"""Internal Use Only""" """Internal Use Only"""
from ..proccontrol.tasks.export import export from ..proccontrol.tasks.export import export
@ -468,7 +468,7 @@ def get_export(**keys):
@api.post("delete_scrobble") @api.post("delete_scrobble")
@authenticated_api @authenticated_function(api=True)
def delete_scrobble(timestamp): def delete_scrobble(timestamp):
"""Internal Use Only""" """Internal Use Only"""
database.remove_scrobble(timestamp) database.remove_scrobble(timestamp)