mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-08 08:47:32 +08:00
[Enhance] Add limiter & Building API
- Add a custom limiter and use it for limiting users' download instead of using database > So add a requirement `limits`. - Fix a character's value - Change the email max length to 64 - Change something about API's roles and powers - Add an API endpoint for getting users' roles and powers
This commit is contained in:
@@ -54,11 +54,10 @@ def auth_required(request):
|
||||
try:
|
||||
user = UserAuth(c)
|
||||
user.token = headers['Authorization'][7:]
|
||||
return view(user.token_get_id(), *args, **kwargs)
|
||||
user_id = user.token_get_id()
|
||||
except ArcError as e:
|
||||
return error_return(e)
|
||||
|
||||
return error_return()
|
||||
return view(user_id, *args, **kwargs)
|
||||
|
||||
return wrapped_view
|
||||
return decorator
|
||||
|
||||
@@ -12,7 +12,7 @@ from werkzeug.datastructures import ImmutableMultiDict
|
||||
from .auth import auth_required
|
||||
from .func import arc_try, error_return, success_return
|
||||
from .present import present_info
|
||||
from .purchase import bundle_pack, bundle_bundle
|
||||
from .purchase import bundle_bundle, bundle_pack
|
||||
from .score import song_score_friend
|
||||
from .user import user_me
|
||||
from .world import world_all
|
||||
@@ -33,8 +33,7 @@ def download_song(user_id):
|
||||
x = DownloadList(c, UserOnline(c, user_id))
|
||||
x.song_ids = request.args.getlist('sid')
|
||||
x.url_flag = json.loads(request.args.get('url', 'true'))
|
||||
x.clear_user_download()
|
||||
if x.is_limited and x.url_flag:
|
||||
if x.url_flag and x.is_limited:
|
||||
raise ArcError('You have reached the download limit.', 903)
|
||||
|
||||
x.add_songs()
|
||||
|
||||
Reference in New Issue
Block a user