refactor(api): 重构API蓝图结构按功能模块拆分
- 将原有的单一api蓝图拆分为多个独立蓝图(torrent、book、music、file、video、image) - 每个蓝图负责对应的功能模块,实现更好的代码组织和维护性 - 更新应用初始化文件中的蓝图注册方式,使用新的模块化结构 - 修改前端API调用路径,将/files/rename调整为/file/rename - 在torrent服务中新增按名称查询功能和相关处理逻辑
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from flask import Blueprint, current_app, Response
|
||||
|
||||
from app.services import BookService
|
||||
|
||||
bp = Blueprint("book", __name__)
|
||||
|
||||
|
||||
@bp.route("/download")
|
||||
def book_download():
|
||||
book_object = BookService()
|
||||
app = current_app._get_current_object()
|
||||
|
||||
def generate():
|
||||
with app.app_context():
|
||||
yield from book_object.book_download()
|
||||
|
||||
return Response(generate(), mimetype='text/event-stream')
|
||||
Reference in New Issue
Block a user