forked from MinhQuan/MiscCorpo
Refactor static serving: use Blueprint static_folder, inline header
- Disable Flask default /static/ folder (static_folder=None in app.py) - Add headerRoute blueprint to serve views/header/ at /assets/header/ - Configure transcription and scraper blueprints with static_folder pointing to their respective views/ subfolders - Inline header HTML directly in headerLoader.js (remove fetch call) - Update all HTML templates to use new /assets/... URLs
This commit is contained in:
@@ -1,23 +1,30 @@
|
||||
# routes/scraperZLibraryRoute.py
|
||||
from flask import Blueprint
|
||||
from controllers.scraperZLibraryController import ScraperController
|
||||
|
||||
# Create blueprint
|
||||
scraperZLibraryRoute = Blueprint('scraperZLibrary', __name__)
|
||||
|
||||
# Define routes
|
||||
scraperZLibraryRoute.route('/', methods=['GET'])(ScraperController.index)
|
||||
scraperZLibraryRoute.route('/api/search', methods=['POST'])(ScraperController.search_books)
|
||||
scraperZLibraryRoute.route('/api/download/txt', methods=['POST'])(ScraperController.download_txt)
|
||||
scraperZLibraryRoute.route('/api/download/json', methods=['POST'])(ScraperController.download_json)
|
||||
scraperZLibraryRoute.route('/api/download/books', methods=['POST'])(ScraperController.download_books_zip) # New route
|
||||
scraperZLibraryRoute.add_url_rule(
|
||||
'/api/download/stream',
|
||||
view_func=ScraperController.download_books_stream,
|
||||
methods=['POST'],
|
||||
)
|
||||
scraperZLibraryRoute.add_url_rule(
|
||||
'/api/download/file/<token>',
|
||||
view_func=ScraperController.fetch_stored_file,
|
||||
methods=['GET'],
|
||||
)
|
||||
# routes/scraperZLibraryRoute.py
|
||||
from flask import Blueprint
|
||||
from controllers.scraperZLibraryController import ScraperController
|
||||
|
||||
# Blueprint với static_folder trỏ vào views/scraperZLibraryPages
|
||||
# → Flask serve CSS/JS qua URL /scraperZLibrary/assets/scraper/...
|
||||
# Lưu ý: static_url_path chỉ cần phần sau /scraperZLibrary/ (url_prefix đã được thêm khi register)
|
||||
scraperZLibraryRoute = Blueprint(
|
||||
'scraperZLibrary',
|
||||
__name__,
|
||||
static_folder='../views/scraperZLibraryPages',
|
||||
static_url_path='/assets/scraper',
|
||||
)
|
||||
|
||||
# Define routes
|
||||
scraperZLibraryRoute.route('/', methods=['GET'])(ScraperController.index)
|
||||
scraperZLibraryRoute.route('/api/search', methods=['POST'])(ScraperController.search_books)
|
||||
scraperZLibraryRoute.route('/api/download/txt', methods=['POST'])(ScraperController.download_txt)
|
||||
scraperZLibraryRoute.route('/api/download/json', methods=['POST'])(ScraperController.download_json)
|
||||
scraperZLibraryRoute.route('/api/download/books', methods=['POST'])(ScraperController.download_books_zip) # New route
|
||||
scraperZLibraryRoute.add_url_rule(
|
||||
'/api/download/stream',
|
||||
view_func=ScraperController.download_books_stream,
|
||||
methods=['POST'],
|
||||
)
|
||||
scraperZLibraryRoute.add_url_rule(
|
||||
'/api/download/file/<token>',
|
||||
view_func=ScraperController.fetch_stored_file,
|
||||
methods=['GET'],
|
||||
)
|
||||
Reference in New Issue
Block a user