MoffKalast / vizanti

A mission planner and visualizer for controlling outdoor ROS robots.
https://wiki.ros.org/vizanti
BSD 3-Clause "New" or "Revised" License
134 stars 26 forks source link

Add base URL option #35

Closed tony2guo closed 9 months ago

tony2guo commented 10 months ago

Hi, thanks for the great work! I would like to use Vizanti under some subfolder like this: http:///vizanti Possible adding a base URL option or use relative URLs?

MoffKalast commented 10 months ago

Hmm well if by host_ip you mean without the :port part that's a bit of a problem. ROS really doesn't want anything to do with root and linux won't let anything but root host on port 80, so it's a bit of a standoff. One option that I've used in the past is to set up a root hosted redirect server like nginx on port 80 separately, that then routes to 5000. Or running server.pywith sudo python3.

The server expects some specific paths which would need to be adjusted on both ends to support the extra /vizanti, but in theory it would be doable.

tony2guo commented 10 months ago

I am using Traefik as a reverse proxy to route subfolder /vizanti to port 5000 but found some errors due to some URLs is not relative URLs. I'll try to fix this and create a PR.

tony2guo commented 10 months ago

To add a base URL, I've tried blueprints but can not get it to work. I've also tried to hardcode the base URL: https://github.com/MoffKalast/vizanti/compare/noetic-devel...tony2guo:vizanti:base-url It works, but there should be some better ways. I'm not familiar with Flask, so I'm not sure how this should be done.

MoffKalast commented 10 months ago

The current setup uses jinja templating, which seems to have some kind of url_for function that would be added to returned templates. Not sure if it's the correct URL though.

tony2guo commented 10 months ago

Thanks for the info. I'll try url_for().