Replace js by ts
This commit is contained in:
@@ -27,12 +27,17 @@ static PDFJS_WORKER_JS: &[u8] = include_bytes!(
|
||||
);
|
||||
|
||||
// Viewer JS modules (served at brittle://app/viewer/<file>)
|
||||
// Note: We now serve the compiled JavaScript files from TypeScript
|
||||
static VIEWER_JS: &[u8] = include_bytes!("../assets/viewer/viewer.js");
|
||||
static VIEWPORT_TRACKER_JS: &[u8] = include_bytes!("../assets/viewer/viewport-tracker.js");
|
||||
static PAGE_MANAGER_JS: &[u8] = include_bytes!("../assets/viewer/page-manager.js");
|
||||
static ZOOM_CONTROLLER_JS: &[u8] = include_bytes!("../assets/viewer/zoom-controller.js");
|
||||
static PAGE_MANAGER_ENHANCED_JS: &[u8] = include_bytes!("../assets/viewer/page-manager-enhanced.js");
|
||||
static ZOOM_CONTROLLER_ENHANCED_JS: &[u8] = include_bytes!("../assets/viewer/zoom-controller-enhanced.js");
|
||||
static RENDER_WORKER_JS: &[u8] = include_bytes!("../assets/viewer/render-worker.js");
|
||||
static RENDER_SYSTEM_JS: &[u8] = include_bytes!("../assets/viewer/render-system.js");
|
||||
static PERFORMANCE_MANAGER_JS: &[u8] = include_bytes!("../assets/viewer/performance-manager.js");
|
||||
static VISIBILITY_MANAGER_JS: &[u8] = include_bytes!("../assets/viewer/visibility-manager.js");
|
||||
static MESSAGE_BRIDGE_JS: &[u8] = include_bytes!("../assets/viewer/message-bridge.js");
|
||||
static ANNOTATION_LAYER_JS: &[u8] = include_bytes!("../assets/viewer/annotation-layer.js");
|
||||
|
||||
// ── Public API ────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -70,11 +75,15 @@ fn serve_viewer_asset(file_name: &str) -> Response<Vec<u8>> {
|
||||
let bytes: &[u8] = match file_name {
|
||||
"viewer.js" => VIEWER_JS,
|
||||
"viewport-tracker.js" => VIEWPORT_TRACKER_JS,
|
||||
"page-manager.js" => PAGE_MANAGER_JS,
|
||||
"zoom-controller.js" => ZOOM_CONTROLLER_JS,
|
||||
"render-worker.js" => RENDER_WORKER_JS,
|
||||
"message-bridge.js" => MESSAGE_BRIDGE_JS,
|
||||
_ => return response_404(),
|
||||
"page-manager-enhanced.js" => PAGE_MANAGER_ENHANCED_JS,
|
||||
"zoom-controller-enhanced.js" => ZOOM_CONTROLLER_ENHANCED_JS,
|
||||
"render-worker.js" => RENDER_WORKER_JS,
|
||||
"render-system.js" => RENDER_SYSTEM_JS,
|
||||
"performance-manager.js" => PERFORMANCE_MANAGER_JS,
|
||||
"visibility-manager.js" => VISIBILITY_MANAGER_JS,
|
||||
"message-bridge.js" => MESSAGE_BRIDGE_JS,
|
||||
"annotation-layer.js" => ANNOTATION_LAYER_JS,
|
||||
_ => return response_404(),
|
||||
};
|
||||
response_ok(bytes.to_vec(), "application/javascript; charset=utf-8")
|
||||
}
|
||||
@@ -286,9 +295,12 @@ pub mod routing {
|
||||
for name in &[
|
||||
"viewer.js",
|
||||
"viewport-tracker.js",
|
||||
"page-manager.js",
|
||||
"zoom-controller.js",
|
||||
"page-manager-enhanced.js",
|
||||
"zoom-controller-enhanced.js",
|
||||
"render-worker.js",
|
||||
"render-system.js",
|
||||
"performance-manager.js",
|
||||
"visibility-manager.js",
|
||||
"message-bridge.js",
|
||||
] {
|
||||
let path = format!("/viewer/{}", name);
|
||||
|
||||
Reference in New Issue
Block a user