2026-01-20 10:13:51 +08:00
|
|
|
'''
|
|
|
|
|
资源文件读取路由
|
|
|
|
|
'''
|
2026-02-08 20:55:19 +08:00
|
|
|
from flask import Blueprint, send_file, jsonify
|
2026-01-20 09:34:24 +08:00
|
|
|
from ..utils import assets
|
|
|
|
|
|
2026-02-12 17:15:03 +08:00
|
|
|
asset_bp = Blueprint("asset", __name__, url_prefix="/asset")
|
2026-01-20 09:34:24 +08:00
|
|
|
|
2026-01-21 16:37:36 +08:00
|
|
|
@asset_bp.route("/list")
|
|
|
|
|
def asset_list():
|
2026-02-08 20:55:19 +08:00
|
|
|
return jsonify(assets.readAssetsList())
|
2026-01-21 16:37:36 +08:00
|
|
|
|
2026-01-20 09:34:24 +08:00
|
|
|
@asset_bp.route("/pic/<id>")
|
2026-01-21 16:37:36 +08:00
|
|
|
def find_pic(id: str):
|
2026-01-20 09:34:24 +08:00
|
|
|
path = "../resources/assets/pics/" + assets.readPicPath(id)
|
|
|
|
|
return send_file(path)
|
|
|
|
|
|
|
|
|
|
@asset_bp.route("/sound/<id>")
|
2026-01-21 16:37:36 +08:00
|
|
|
def find_sound(id: str):
|
2026-01-20 09:34:24 +08:00
|
|
|
path = "../resources/assets/sounds/" + assets.readSoundPath(id)
|
|
|
|
|
return send_file(path)
|