refactor: split sidebar filetree upload runtime
This commit is contained in:
@@ -142,6 +142,10 @@ pub fn build_router(state: AppState) -> Router {
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-command-runtime.js",
|
||||
get(web_shell::sidebar_filetree_command_runtime_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-upload-runtime.js",
|
||||
get(web_shell::sidebar_filetree_upload_runtime_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/sidebar-attachment-open-runtime.js",
|
||||
get(web_shell::sidebar_attachment_open_runtime_asset),
|
||||
@@ -603,6 +607,7 @@ mod tests {
|
||||
"/api/mnote-browser-runtime/sidebar-tree-live-apply-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-open-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-command-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-filetree-upload-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-attachment-open-runtime.js",
|
||||
"/api/mnote-browser-runtime/sidebar-tree-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-live-controller.js",
|
||||
|
||||
@@ -798,6 +798,20 @@ pub async fn sidebar_filetree_command_runtime_asset() -> Response {
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn sidebar_filetree_upload_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/sidebar-filetree-upload-runtime.js");
|
||||
Response::builder()
|
||||
.status(StatusCode::OK)
|
||||
.header(
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
)
|
||||
.header(header::CACHE_CONTROL, "no-store")
|
||||
.header(HEADER_MNOTE_WEB_OWNER, "mnote-web")
|
||||
.body(Body::from(JS))
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn sidebar_attachment_open_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/sidebar-attachment-open-runtime.js");
|
||||
Response::builder()
|
||||
|
||||
Reference in New Issue
Block a user