Compare commits
2 Commits
b03027e3d5
...
ba71f5f4b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba71f5f4b9 | ||
|
|
2f9d6a21f6 |
@ -59,10 +59,28 @@ STORAGE_ROOT = os.environ.get('STORAGE_ROOT', '/opt/roblox-assets')
|
||||
PUBLIC_ASSET_BASE = os.environ.get('PUBLIC_ASSET_BASE', 'https://assets.rublox.pro/roblox')
|
||||
|
||||
MAX_RBXL_SIZE = 50 * 1024 * 1024 # 50 MB
|
||||
ALLOWED_USER_IDS = [1] # пока только МИН
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app, resources={r'/*': {'origins': '*'}})
|
||||
# CORS открыт для всех источников — фронт студии живёт на studio.rublox.pro,
|
||||
# api-rbxl проксируется через NPM на minecraftia-school.ru/api-rbxl/*.
|
||||
# Поддерживаем preflight (OPTIONS) явно через after_request — иногда
|
||||
# flask-cors не отдавал заголовки для OPTIONS если NPM их перекрывал.
|
||||
CORS(app, resources={r'/*': {'origins': '*'}}, supports_credentials=False)
|
||||
|
||||
|
||||
@app.after_request
|
||||
def _add_cors_headers(resp):
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
resp.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'
|
||||
resp.headers['Access-Control-Allow-Headers'] = 'Content-Type, X-User-Id, X-User-Login'
|
||||
resp.headers['Access-Control-Max-Age'] = '3600'
|
||||
return resp
|
||||
|
||||
|
||||
@app.route('/import/rbxl/analyze', methods=['OPTIONS'])
|
||||
@app.route('/import/rbxl/create', methods=['OPTIONS'])
|
||||
def _preflight():
|
||||
return '', 204
|
||||
|
||||
# Devlog для удалённой отладки dev-сессий студии: фронт пушит сюда
|
||||
# console.error/warn, failed network requests, неожиданные exceptions.
|
||||
@ -93,8 +111,7 @@ def auth_check(req) -> int:
|
||||
uid = int(user_id_str)
|
||||
except ValueError:
|
||||
raise RuntimeError(f'Bad X-User-Id: {user_id_str!r}')
|
||||
if uid not in ALLOWED_USER_IDS:
|
||||
raise RuntimeError(f'User {uid} not allowed (only МИН)')
|
||||
# Импорт открыт всем (см. вики «Импорт из Roblox»).
|
||||
return uid
|
||||
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ export function highlightCode(text, lang) {
|
||||
// Классифицируем
|
||||
if (tok.startsWith('--') || tok.startsWith('//') || tok.startsWith('/*')) {
|
||||
tokens.push({ type: 'comment', text: tok });
|
||||
} else if (/^["'`\[]/.test(tok)) {
|
||||
} else if (/^["'`[]/.test(tok)) {
|
||||
tokens.push({ type: 'string', text: tok });
|
||||
} else if (/^\d/.test(tok)) {
|
||||
tokens.push({ type: 'number', text: tok });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user