mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Implemented web interface for API key management, close GH-24
This commit is contained in:
parent
115be57651
commit
6aee8c7a48
@ -1,5 +1,5 @@
|
|||||||
from ..database import *
|
from ..database import *
|
||||||
from ..globalconf import malojaconfig
|
from ..globalconf import malojaconfig, apikeystore
|
||||||
from ..__pkginfo__ import version
|
from ..__pkginfo__ import version
|
||||||
from ..malojauri import uri_to_internal
|
from ..malojauri import uri_to_internal
|
||||||
from .. import utilities
|
from .. import utilities
|
||||||
@ -331,5 +331,9 @@ def newrule(**keys):
|
|||||||
@api.post("settings")
|
@api.post("settings")
|
||||||
@authenticated_api
|
@authenticated_api
|
||||||
def set_settings(**keys):
|
def set_settings(**keys):
|
||||||
from .. import globalconf
|
malojaconfig.update(keys)
|
||||||
globalconf.malojaconfig.update(keys)
|
|
||||||
|
@api.post("apikeys")
|
||||||
|
@authenticated_api
|
||||||
|
def set_settings(**keys):
|
||||||
|
apikeystore.update(keys)
|
||||||
|
@ -313,7 +313,7 @@ config(
|
|||||||
|
|
||||||
|
|
||||||
### symmetric keys are fine for now since we hopefully use HTTPS
|
### symmetric keys are fine for now since we hopefully use HTTPS
|
||||||
apikeystore = KeyStore(file=data_dir['clients']("apikeys.yml"),save_endpoint="/apis/mlj_1/api_keys")
|
apikeystore = KeyStore(file=data_dir['clients']("apikeys.yml"),save_endpoint="/apis/mlj_1/apikeys")
|
||||||
|
|
||||||
oldfile = pthj(dir_settings['config'],"clients","authenticated_machines.tsv")
|
oldfile = pthj(dir_settings['config'],"clients","authenticated_machines.tsv")
|
||||||
if os.path.exists(oldfile):
|
if os.path.exists(oldfile):
|
||||||
|
@ -4,5 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{% block maincontent %}
|
{% block maincontent %}
|
||||||
|
Here you can add and remove API keys used by your scrobblers. It is recommended to use
|
||||||
|
a different key for each scrobbler.<br/><br/>
|
||||||
{{ apikeys.html() }}
|
{{ apikeys.html() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user