Compare commits
No commits in common. "ba71f5f4b9147085a9fdf14d412d2776b03c241f" and "b03027e3d5c11421d213a70d21be1ec2660b1c83" have entirely different histories.
ba71f5f4b9
...
b03027e3d5
@ -59,28 +59,10 @@ STORAGE_ROOT = os.environ.get('STORAGE_ROOT', '/opt/roblox-assets')
|
|||||||
PUBLIC_ASSET_BASE = os.environ.get('PUBLIC_ASSET_BASE', 'https://assets.rublox.pro/roblox')
|
PUBLIC_ASSET_BASE = os.environ.get('PUBLIC_ASSET_BASE', 'https://assets.rublox.pro/roblox')
|
||||||
|
|
||||||
MAX_RBXL_SIZE = 50 * 1024 * 1024 # 50 MB
|
MAX_RBXL_SIZE = 50 * 1024 * 1024 # 50 MB
|
||||||
|
ALLOWED_USER_IDS = [1] # пока только МИН
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
# CORS открыт для всех источников — фронт студии живёт на studio.rublox.pro,
|
CORS(app, resources={r'/*': {'origins': '*'}})
|
||||||
# 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-сессий студии: фронт пушит сюда
|
# Devlog для удалённой отладки dev-сессий студии: фронт пушит сюда
|
||||||
# console.error/warn, failed network requests, неожиданные exceptions.
|
# console.error/warn, failed network requests, неожиданные exceptions.
|
||||||
@ -111,7 +93,8 @@ def auth_check(req) -> int:
|
|||||||
uid = int(user_id_str)
|
uid = int(user_id_str)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise RuntimeError(f'Bad X-User-Id: {user_id_str!r}')
|
raise RuntimeError(f'Bad X-User-Id: {user_id_str!r}')
|
||||||
# Импорт открыт всем (см. вики «Импорт из Roblox»).
|
if uid not in ALLOWED_USER_IDS:
|
||||||
|
raise RuntimeError(f'User {uid} not allowed (only МИН)')
|
||||||
return uid
|
return uid
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export function highlightCode(text, lang) {
|
|||||||
// Классифицируем
|
// Классифицируем
|
||||||
if (tok.startsWith('--') || tok.startsWith('//') || tok.startsWith('/*')) {
|
if (tok.startsWith('--') || tok.startsWith('//') || tok.startsWith('/*')) {
|
||||||
tokens.push({ type: 'comment', text: tok });
|
tokens.push({ type: 'comment', text: tok });
|
||||||
} else if (/^["'`[]/.test(tok)) {
|
} else if (/^["'`\[]/.test(tok)) {
|
||||||
tokens.push({ type: 'string', text: tok });
|
tokens.push({ type: 'string', text: tok });
|
||||||
} else if (/^\d/.test(tok)) {
|
} else if (/^\d/.test(tok)) {
|
||||||
tokens.push({ type: 'number', text: tok });
|
tokens.push({ type: 'number', text: tok });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user