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

Webcam not working when using port other than port 80. #1668

Closed
delicado opened this issue Dec 2, 2023 · 3 comments
Closed

Webcam not working when using port other than port 80. #1668

delicado opened this issue Dec 2, 2023 · 3 comments
Labels
⚡ Type: Bug Something isn't working

Comments

@delicado
Copy link

delicado commented Dec 2, 2023

Mainsail Version:

2.6.0

Browser:

Chrome

Device:

Desktop PC

Operating System:

Windows

What happened?

I tried accessing klipper via google VPS. Using SSH tunneling on my host machine, I could not use port 80. So I use 8080 instead, but I could not access the webcam. I fixed it by modifying the Mainsail installation of kiauh. The problem is getHostUrl() returns a URL without the port number and Mjpegstreamer and the likes uses it to access the resource, if the URL is using a port other than 80, then there that issue. I located it in /assets/b7111f84.js on my installation of Mainsail. It's already minified, but I hope you can locate the exact source file so it can be fixed. The code looks like this:

getters$n = {
    getUrl: (o) => "//" + o.hostname + (o.port !== 80 ? ":" + o.port : ""),
    getHostUrl: (o) => (o.protocol === "wss" ? "https" : "http") + "://" + o.hostname + "/",
    getWebsocketUrl: (o, l) => o.protocol + ":" + l.getUrl + "/websocket",
  },

Changing it to fixed the problem:

getters$n = {
    getUrl: (o) => "//" + o.hostname + (o.port !== 80 ? ":" + o.port : ""),
    getHostUrl: (o) => (o.protocol === "wss" ? "https" : "http") + "://" + o.hostname + ":" + o.port + "/",
    getWebsocketUrl: (o, l) => o.protocol + ":" + l.getUrl + "/websocket",
  },

What did you expect to happen instead?

It should work.

How to reproduce this bug?

Make a proxy for your mainsail. I did it with ssh tunneling to other computer, in my case it is GCP VPS.
ssh -R 8080:localhost:80 -N username@host_address

Additional information:

No response

@delicado delicado added the ⚡ Type: Bug Something isn't working label Dec 2, 2023
@meteyou
Copy link
Member

meteyou commented Dec 2, 2023

you have to use an absolute path in your webcam settings. changing the getUrl function will create many other issues.

in an older version we changed this behavior some time before, but there was multiple other issues with cross installations. so i don't think i will/can fix this with creating multiple other issues.

@meteyou meteyou closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
@delicado
Copy link
Author

delicado commented Dec 3, 2023

Oh so that's what the textbox for on the Webcam settings. I see, thanks.

@meteyou
Copy link
Member

meteyou commented Dec 16, 2023

@delicado i think i found a fix for this issue. pls check the next release.

PR with the fix: #1566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants