Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setFileHandler blocks webui.js from being served #72

Open
DevRubicate opened this issue Dec 24, 2024 · 1 comment
Open

setFileHandler blocks webui.js from being served #72

DevRubicate opened this issue Dec 24, 2024 · 1 comment

Comments

@DevRubicate
Copy link
Contributor

DevRubicate commented Dec 24, 2024

I'm trying to use setFileHandler to serve a .js file for a <script src="test.js"> in my WebUI window.

Scenario 1:

const win = new WebUI();
win.show(myhtml);
win.setFileHandler(myCallback);

Outcome:
The window opens and attempts to load test.js before setFileHandler starts serving, leading to a 404.

Scenario 2:

const win = new WebUI();
win.setFileHandler(myCallback);
win.show(myhtml);

Outcome:
The window opens and during it's initialization where it needs to load the built-in webui.js then setFileHandler blocks that requests and does not serve webui.js so the window never successfully initializes.

I suggest that setFileHandler be changed to have a hardcoded exception for webui.js so that it will not intercept that request and allow the window initialization proceed as normal. It's possible that the same happens with favicon.svg but I have not tested.

Edit: I tried serving a copy of webui.js myself in setFileHandler but the window still fails to initialize, so my diagnosis might not be 100% accurate. I can at least confirm that loading test.js inside a setTimeout so that there is a delay makes it successfully load from setFileHandler

@AlbertShown
Copy link
Contributor

I suggest that setFileHandler be changed to have a hardcoded exception for webui.js

It should be already the case, let me check that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants