Skip to content

Commit 9188cbd

Browse files
committed
add api key to octodash update mesh, #632
1 parent 77bc887 commit 9188cbd

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

octoprint_bedlevelvisualizer/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,8 @@ def bedlevelvisualizer_route(self):
541541
self._bedlevelvisualizer_logger.debug("using stored mesh for octodash view: {}".format(mesh))
542542
bed = self.bed_type
543543
commands = self._settings.get(["command"]).split("\n")
544-
render_kwargs = {"mesh": mesh, "bed": bed, "commands": commands}
544+
apikey = self._settings.global_get(["api", "key"])
545+
render_kwargs = {"mesh": mesh, "bed": bed, "commands": commands, "apikey": apikey}
545546
except Exception as e:
546547
self._logger.debug("Bed Visualizer error: {}".format(e))
547548
render_kwargs = {"error": "{}".format(e)}

octoprint_bedlevelvisualizer/templates/bedlevelvisualizer_octodash.jinja2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
type: "POST",
4545
dataType: "json",
4646
data: JSON.stringify({commands:gcode_commands, parameters: {}}),
47-
contentType: "application/json; charset=UTF-8"
47+
contentType: "application/json; charset=UTF-8",
48+
headers: {
49+
"X-Api-Key": "{{ apikey }}",
50+
},
4851
}).done(function(response){
4952
window.location.reload(true);
5053
});

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "Bed Visualizer"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "1.1.2rc6"
17+
plugin_version = "1.1.2rc7"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)