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

fix: add port to webcam url if port is not 80 #1566

Merged
merged 3 commits into from
Dec 16, 2023

Conversation

dictor93
Copy link
Contributor

This PR fixes the URL for MJPEG adaptive streamer. When used port different then th "80". (Relevant current port added to the URL)

@meteyou
Copy link
Member

meteyou commented Sep 21, 2023

i don't think, that this will work for all setups. i think this PR will also change the port for absolute paths, because it doesn't check if the URL is absolute or relative.

@dictor93
Copy link
Contributor Author

i don't think, that this will work for all setups. i think this PR will also change the port for absolute paths, because it doesn't check if the URL is absolute or relative.

As you can see URL constructor used with second parameter (baseUrl) https://github.com/mainsail-crew/mainsail/pull/1566/files#diff-fdc7a161a3e6714807dbdb170673c137562833dde75941a4b98626f4a6187d55R97

So the url can not be relative. Is not it?

@dictor93
Copy link
Contributor Author

dictor93 commented Sep 22, 2023

I really can't understand what the problem is that the request for camera data goes to the same port as all other requests in the application. That is, if my reverse proxy server for example listens on port 8081 and refers to mainsail, then all requests go to <hostname>/8081/route... so why should the cam requests go to <hostname>/webcam/ and not at <hostname>/8081/webcam ? Is there a security issue here? No, because I use a reverse proxy with authorization. Why are you @meteyou contradicting?

Also, some of the streamer components reference the current port: for example

So, also i guess the same changes need to be implemented for Uv4lMjpeg and Mjpegstreamer

@meteyou
Copy link
Member

meteyou commented Sep 22, 2023

Yes, this is your special case, but when a user don't have the webcam on the same host or esp32-cams, you cannot overwrite your Webinterface port on the webcam address.

@meteyou
Copy link
Member

meteyou commented Sep 22, 2023

I just now checked the link to the WebRTC CameraStreamer. Yes, this streamer is wrong.

If you already do this fix, please fix all streamers for your use case.

@dictor93
Copy link
Contributor Author

Yes, this is your special case, but when a user don't have the webcam on the same host or esp32-cams, you cannot overwrite your Webinterface port on the webcam address.

That is, you mean that my edit will work fine if the camera is on the same host as the mainsail, but there will be problems for cameras from other hosts?

I just now checked the link to the WebRTC CameraStreamer. Yes, this streamer is wrong.

If you already do this fix, please fix all streamers for your use case.

Do you want me to add fixes to my PR? Which exactly? Remove port override?

@meteyou
Copy link
Member

meteyou commented Sep 23, 2023

That is, you mean that my edit will work fine if the camera is on the same host as the mainsail, but there will be problems for cameras from other hosts?

yes, especially if another port is used, it is always overwritten.

Do you want me to add fixes to my PR? Which exactly? Remove port override?

it would be nice, if you fix all webcams the same way and not only 1 client.

@meteyou
Copy link
Member

meteyou commented Dec 3, 2023

@dictor93 any update here?

@meteyou meteyou changed the title Fix: Added port to the MJPEG streamer url fix: add port to webcam url if port is not 80 Dec 16, 2023
@meteyou meteyou merged commit 20524b0 into mainsail-crew:develop Dec 16, 2023
9 of 10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants