|
| 1 | +import ajax from "@deadlyjack/ajax"; |
1 | 2 | import tutorial from "components/tutorial"; |
2 | 3 | import alert from "dialogs/alert"; |
3 | 4 | import box from "dialogs/box"; |
@@ -133,7 +134,7 @@ async function run( |
133 | 134 |
|
134 | 135 | //this extra www is incorrect because asset_directory itself has www |
135 | 136 | //but keeping it in case something depends on it |
136 | | - pathName = `${ASSETS_DIRECTORY}www/`; |
| 137 | + pathName = "/"; |
137 | 138 | port = constants.CONSOLE_PORT; |
138 | 139 |
|
139 | 140 | start(); |
@@ -191,9 +192,9 @@ async function run( |
191 | 192 | isConsole || |
192 | 193 | appSettings.value.console === appSettings.CONSOLE_LEGACY |
193 | 194 | ) { |
194 | | - url = `${ASSETS_DIRECTORY}/js/build/console.build.js`; |
| 195 | + url = constants.CONSOLE_BUILD_PATH; |
195 | 196 | } else { |
196 | | - url = `${DATA_STORAGE}/eruda.js`; |
| 197 | + url = `${DATA_STORAGE}eruda.js`; |
197 | 198 | } |
198 | 199 | sendFileContent(url, reqId, "application/javascript"); |
199 | 200 | break; |
@@ -478,14 +479,22 @@ async function run( |
478 | 479 | * @returns |
479 | 480 | */ |
480 | 481 | async function sendFileContent(url, id, mime, processText) { |
481 | | - const fs = fsOperation(url); |
| 482 | + let text; |
| 483 | + if (url.includes(constants.CONSOLE_BUILD_PATH)) { |
| 484 | + text = await ajax.get(url, { |
| 485 | + responseType: "text", |
| 486 | + }); |
| 487 | + } else { |
| 488 | + const fs = fsOperation(url); |
482 | 489 |
|
483 | | - if (!(await fs.exists())) { |
484 | | - error(id); |
485 | | - return; |
| 490 | + if (!(await fs.exists())) { |
| 491 | + error(id); |
| 492 | + return; |
| 493 | + } |
| 494 | + |
| 495 | + text = await fs.readFile(appSettings.value.defaultFileEncoding); |
486 | 496 | } |
487 | 497 |
|
488 | | - let text = await fs.readFile(appSettings.value.defaultFileEncoding); |
489 | 498 | text = processText ? processText(text) : text; |
490 | 499 | if (mime === MIMETYPE_HTML) { |
491 | 500 | sendHTML(text, id); |
|
0 commit comments