[Enhance] Link Play Rooms info & API for that

- Add an HTTP API endpoint for getting the information of rooms and players in Link Play
This commit is contained in:
Lost-MSth
2023-12-03 16:42:53 +08:00
parent 150686d9f8
commit f3c17cdde7
5 changed files with 129 additions and 40 deletions

View File

@@ -0,0 +1,21 @@
from flask import Blueprint, request
from core.linkplay import RemoteMultiPlayer
from .api_auth import api_try, request_json_handle, role_required
from .api_code import success_return
bp = Blueprint('multiplay', __name__, url_prefix='/multiplay')
@bp.route('/rooms', methods=['GET'])
@role_required(request, ['select'])
@request_json_handle(request, optional_keys=['offset', 'limit'])
@api_try
def rooms_get(data, user):
'''获取房间列表'''
r = RemoteMultiPlayer().get_rooms(offset=data.get(
'offset', 0), limit=data.get('limit', 100))
return success_return(r)