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

Some URLs are not displayed with action button (Open Web Page) and Web Browser widgets #2990

Open
Mathis-Hu opened this issue Mar 26, 2024 · 6 comments

Comments

@Mathis-Hu
Copy link
Contributor

When entering some https:// URLs, the page is not loaded, it seems to happen when the page requires an authentication to access.

Some of my users want to access the web page of a web server with instrumentations, but they cannot with both widgets.

For the Open Web Page action (responsible class : ModelResourceUtil.java) , it seem that the code is checking if the page exist and is trying to read it. So if the page is not correct or have an authentication, it will not load it, and you'll not have any pop up to inform you that it doesn't work.
I think it would be better if Phoebus only check if the page exist before opening it. Then if the URL is not correct, it will load anyways and the user can see that it's not correct, and it will allow the users to use URL for other cases (like the use case of my users).

Our lab modified the class so now phoebus only check if the page exist, and it work for our users. I will make a PR for that if it does not pose security issue or anything that justified the original operation.

For the web browser widget, it seems that phoebus uses WebEngine from javafx and that it's that class that manage the loading of web page. Do you think it would be possible to change some code to make the Web Browser less restrictive with URL like the changes I made for the Open Web Page action ?

@kasemir

@kasemir
Copy link
Collaborator

kasemir commented Mar 26, 2024

For the "Open Web Page" action, we try to simply pass the URL on to the system web browser (Firefox, Safari, Chrome, ...).
The ModelResourceUtil performs some additional gymnastics because we generally support relative paths etc., so it's checking a few options. Maybe the "Open Web Page" action can circumvent that, only expand macros and then pass the url on to the system web browser? Or reducing the try-to-read check to check-if-exists also sounds reasonable.
For the web browser widget, I see that mostly as a way to show formatted but otherwise static text, for example usage information that would he hard to duplicate with just labels. For anything beyond that, a designated web browser is better (more features, lower CPU load). But you're welcome to take over maintenance of the web browser widget and make it fully support anything anybody will ever try to accomplish with it.

@Mathis-Hu
Copy link
Contributor Author

Ok, thank you for your answer, I will make a PR with the commit for the Open Web Page action, for the Web Browser widget, I'll try to take a look at what could be done

@tanviash
Copy link
Collaborator

tanviash commented Apr 18, 2024

We are seeing a similar problem when action 'Open Webpage' is called.
MicrosoftTeams-image (1)
MicrosoftTeams-image (2)

One interesting observation is if we change https:// to http://, works okay but now with https://

@kasemir
Copy link
Collaborator

kasemir commented Apr 18, 2024

#2991 should fix that, but it changes the flow beyond just a replacement of

final InputStream stream = openURL(resource_name);
stream.close();
return true;

in the ModelResourceUtil with

URL url = new URL(resource_name);
url.openConnection();
return true;

Is your https:// problem fixed by just that replacement? Then let's do that.

@shroffk
Copy link
Member

shroffk commented Aug 1, 2024

@Mathis-Hu can you confirm is the above works?

@Mathis-Hu
Copy link
Contributor Author

@shroffk For the action open web page with action button it is working. For the Web browser widget I have a doubt, but I don't think I patched it.

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

4 participants