Kragrathea / OctoPrint-PrettyGCode

114 stars 22 forks source link

Unable to use PrettyGCode when serving octoprint from a directory #132

Open WolfspiritM opened 2 years ago

WolfspiritM commented 2 years ago

Hi,

I've set up octoprint like in this example: https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107

This works fine but PrettyGCode isn't working and produces 404 errors fo example: GET http://octoprint/downloads/files/local/null 404 (Not Found) GET http://octoprint/plugin/prettygcode/static/js/models/ExtruderNozzle.obj 404 (Not Found)

The correct folder in my case would be "http://octoprint/octo/"...

Octoprint exposes that in a "BASEURL" variable and I think PrettyGCode should use one of that instead of calling "/...". In my case it looks like this:

    var BASEURL = "/octo/";
    var API_BASEURL = BASEURL + "api/";
    var PLUGIN_BASEURL = BASEURL + "plugin/";

So I think the following lines should be changed to include BASEURL: https://github.com/Kragrathea/OctoPrint-PrettyGCode/blob/ccd36060959080d6dd1c67a19ead227c87bae70e/octoprint_prettygcode/static/js/prettygcode.js#L19 https://github.com/Kragrathea/OctoPrint-PrettyGCode/blob/ccd36060959080d6dd1c67a19ead227c87bae70e/octoprint_prettygcode/static/js/prettygcode.js#L572 https://github.com/Kragrathea/OctoPrint-PrettyGCode/blob/ccd36060959080d6dd1c67a19ead227c87bae70e/octoprint_prettygcode/static/js/prettygcode.js#L695 https://github.com/Kragrathea/OctoPrint-PrettyGCode/blob/ccd36060959080d6dd1c67a19ead227c87bae70e/octoprint_prettygcode/static/js/prettygcode.js#L724 https://github.com/Kragrathea/OctoPrint-PrettyGCode/blob/ccd36060959080d6dd1c67a19ead227c87bae70e/octoprint_prettygcode/static/js/prettygcode.js#L1536

Not sure if that are all I've found.

dj1an commented 2 years ago

I had the same Problem. Adding BASEURL in front of hardcoded Paths fixed this. Thanks!