Commit graph

132 commits

Author SHA1 Message Date
Gina Häußge
8c1a79558b Always include timelapse view model in bundled js files
Even if the webcam URLs and the FFMPEG path is not yet configured. Otherwise
setting those URLs and the path will require a restart of OctoPrint to enable properly -
that's overkill.
(cherry picked from commit 1425b20)
2015-08-24 14:52:50 +02:00
Gina Häußge
e33f69917f Made webassets folder cleanup win32-proof
If re-creation of the folder fails due to an access error, perform three retries. It might
be caused by the folder being open in the file explorer. Waiting a bit before retrying
seems to do the trick.

See also #1019
(cherry picked from commit a43de42)
2015-08-11 18:14:39 +02:00
Gina Häußge
0c44762f6f Fix: Better error handling for webassets + cache
(cherry picked from commit 38be47c)
2015-08-11 14:08:04 +02:00
Gina Häußge
96aad9d34f Better resilience against errors within plugins
(cherry picked from commit 75992ef)
2015-07-14 09:26:20 +02:00
Gina Häußge
8d14ea6093 Rewrite urls in packed css and less files
See also #962
(cherry picked from commit 7ea2ee2)
2015-07-08 16:46:46 +02:00
Gina Häußge
97826b2f3b Fix: More resilience against missing plugin assets
Two changes:

  * Asset existence will now be checked before they get included
    in the assets to bundle by webassets, logging a warning if a
    file isn't present.
  * Monkey-patched webassets filter chain to not die when a file
    doesn't exist, but to log an error instead and just return
    an empty file instead.
(cherry picked from commit 2a5ec33)
2015-07-08 16:46:38 +02:00
Gina Häußge
549b60edb1 Allow polling for changes in watched folder
Some underlying file systems might not trigger change events (e.g.
mounted remote file systems). Added a feature flag to allow for
switching to a (less performant) polling method.
(cherry picked from commit f2df174)
2015-07-06 10:20:57 +02:00
Gina Häußge
401ebcf685 Fix: Cleanly exit on SIGTERM 2015-06-25 15:18:33 +02:00
Gina Häußge
67a0fd11dd PluginSettings.get_plugin_data_folder moved to OctoPrintPlugin.get_plugin_data_folder
That way plugins don't need to implement the SettingsPlugin mixin in order to access their data folder, which is now an injected property in OctoPrintPlugin. Plugin authors should still always use the getter since that will also make sure the folder actually does exist (lazy creation).

PluginSettings.get_plugin_data_folder has been marked as deprecated.
2015-06-24 13:59:45 +02:00
Gina Häußge
0e60b26048 Config migration must happen after all plugin implementations are initialized
Introduced new callback for settings plugin to hook into the point after the settings have been migrated since the initialize method is not suitable for that as it might be called before other plugin implementations reachable through hooks are initialized.
2015-06-19 22:31:05 +02:00
Gina Häußge
d5af7b9b48 SettingsPlugins may now track configuration versions
OctoPrint will take care of calling a migration function on the plugin if the plugin demands a newer configuration version than currently stored in config.yaml.
2015-06-19 11:10:07 +02:00
Gina Häußge
6e90c9d730 Reintroduced minification
Still opt-in though.
2015-06-18 13:49:40 +02:00
Gina Häußge
31d7eaad90 Add ";" delimiters between bundled JS files
This is to make sure that they all end on a ; and hence stuff doesn't break if a file included directly after starts with a (...) construct. Of course it would be better if all bundled files are valid in that matter, however since we can't enforce that, we'll add this slight overhead to reduce the risk of stuff breaking.

See for example: http://stackoverflow.com/questions/20307462/js-cant-combine-lib-files
2015-06-18 13:00:18 +02:00
Gina Häußge
cbc6f20fa6 Split assets up a bit to allow better debugging of issues with webassets 2015-06-17 18:43:38 +02:00
Gina Häußge
592cad5b99 Deprecated AppPlugin mixin and introduced octoprint.accesscontrol.appkey hook instead
Plugins implementing the mixin will automatically be migrated to providing the single mixin method as hook handler.
2015-06-09 18:50:55 +02:00
Gina Häußge
be5a5f3c69 Fix: Also take configuration changes into account for update-necessary-check on assets
This way, changes to the minify parameter actually change behaviour...
2015-06-08 18:06:45 +02:00
Gina Häußge
0d7d4cb142 Custom webassets filter that rewrites LESS imports
Need to point to ../less folder
2015-06-04 09:06:04 +02:00
Gina Häußge
8d3f933562 Fixed webassets cache method to also allow overwriting files under windows
Utilizing a monkey patch to swap os.rename for shutil.move, which also works if the target file already exists.
2015-06-04 09:05:31 +02:00
Gina Häußge
3dc0452a45 Adjusted docs to describe new web asset handling 2015-06-03 20:21:12 +02:00
Gina Häußge
261f6709a3 Depend on Flask-Assets 0.10
Compatibility adjustments and version pinning
2015-06-03 19:36:38 +02:00
Gina Häußge
b63f842210 Webassets are now written to ~/.octoprint/generated
Same holds true for cache files, so there should be no problem anymore with installs where the static folder is not writable.

Also introduced two new devel config vars to disable merging and minifying of the assets, solved the empty-less-bundle problem and made sure babel knows about the jinja extension.
2015-06-03 18:27:30 +02:00
Gina Häußge
157b78a052 WIP: Use Flask-Assets to merge js, css and less files
Should reduce number of requests and hence load times needed for loading web interface.

TODO: Handling of empty bundles needs to be fixed
2015-06-03 16:42:57 +02:00
Gina Häußge
02b7085543 Merge branch 'dev/translationsAsPackages' into devel
Conflicts:
	src/octoprint/server/__init__.py
2015-06-02 13:58:40 +02:00
Gina Häußge
52dd2ad7ac Management dialog for language packs
Allows managing language packs of core OctoPrint and plugins.
2015-06-02 13:39:10 +02:00
Gina Häußge
7f8a3849c7 Adjusted messages.js compilation, debugged new i18n handling and added logging 2015-06-02 13:31:41 +02:00
Gina Häußge
106b21f288 New hook for specifying custom template types
TODO: documentation
2015-06-01 11:41:54 +02:00
Gina Häußge
71319942d9 Fix: Don't have plugin i18n paths overwrite the core i18n path
Stopped translations bundled with OctoPrint to work
2015-05-29 18:23:16 +02:00
Gina Häußge
ceb0e29da3 Changed existing octoprint.server.http.* hooks to prefix routes with /plugin/<identifier>/
This will hopefully prevent conflicting routes between multiple plugins from being registered and also ensures a more consistent behaviour compared to BlueprintPlugin mixins.

 Thanks to @Salandora for bringing this up.
2015-05-27 14:30:41 +02:00
Gina Häußge
5c2a9ce5db Allow downloading all uploaded files, not just gcode and stl
Hidden files (starting with .) will produce a 404. This also excludes .metadata.yaml from being downloadable. The alternative of adding all extensions defined by plugins to the regex dynamically was not chosen since that would necessitate to make plugins implementing the "octoprint.filemanager.extension_tree" hook restart needing plugins in the lifecycle management for a minimal gain in perceived security.

Solves #897
2015-05-26 13:55:04 +02:00
Gina Häußge
e8ca6709b9 New hook "octoprint.server.http.routes" to extend static tornado routes through plugins
TODO: docs

Thanks @Salandora
2015-05-21 18:07:15 +02:00
Gina Häußge
9f54985ce5 Also support client side translations for plugins 2015-05-12 11:58:48 +02:00
Gina Häußge
b908ff5821 Enhanced flask-babel to also allow plugins to provide translated strings
This way plugins can maintain their own translations of their UIs. Some monkey patching was necessary, not the cleanest solution but it should work.
2015-05-11 18:44:30 +02:00
Gina Häußge
4c7520efb9 New hook "octoprint.server.http.bodysize" and lifecycle support for restart needing hooks
The new hook allows extending the list of rules for maximum body sizes differing from the default of 100KB and can be used by plugins to allow uploads to them that exceed that file size.

Also extended the plugin manager to detect plugins that implement restart needing hooks (such as the above one) and handling those plugins the same as plugins containing implementations that inherit from octoprint.plugin.core.RestartNeedingPlugin
2015-05-11 15:47:40 +02:00
Gina Häußge
a996f7b6fb New hook octoprint.filemanager.preprocessor
Allows preprocessing files that are uploaded or otherwise added to the system (e.g. through slicing) before their contents are saved to disk
2015-04-17 14:45:58 +02:00
Gina Häußge
fc00ef032e Merge branch 'devel' into dev/pluginLifecycleMgmt 2015-04-13 18:24:20 +02:00
Gina Häußge
f480e29342 Fixed implementation/docs mismatch: header_addon -> template_header
Closes #848, thanks to @markwal for spotting and reporting
2015-04-13 12:53:19 +02:00
Gina Häußge
97aecdf4cf First throw at working plugin lifecycle management
Plugins may be enabled and disabled during runtime. If they are of types which allow hot loading, this will be done. Otherwise they will be marked as pending and updated after a restart. Same for installation and uninstallation.
2015-04-02 23:02:42 +02:00
Gina Häußge
3ebf5e5240 Merge branch 'devel' into dev/pluginLifecycleMgmt
Conflicts:
	src/octoprint/plugin/core.py
2015-04-01 11:02:05 +02:00
Gina Häußge
66e3ee28b6 Started work on plugin lifecycle management
Plugins may be loaded, unloaded, activated and deactivated. Errors while trying to load a plugin or initializing an implementation will only result in it staying deactive but registered in the system, allowing it to be further processed e.g. by a plugin manager
2015-04-01 10:55:13 +02:00
Gina Häußge
8a3993ca59 To determine order of template components, first use user order, then default order, then type ordering
Also moved suffix calculation for template keys into _process_template_config
2015-03-31 18:22:38 +02:00
Gina Häußge
8ff0096eb6 Fix & Docs: Plugins may only have one mixin implementation
Multiple mixins are allowed of course. Allowing multiple implementations lead to too many problems due to plugin names for referring to the APIs of SimpleApiPlugins or the assets of AssetPlugins.

 Hence __plugin_implementations__ has been deprecated in favor of __plugin_implementation__. The plugin subsystem will automatically copy the first implementation from __plugin_implementations__ to __plugin_implementation__ and log a deprecation warning.

 Adjusted documentation accordingly. Also added docs for helpers.
2015-03-30 16:50:06 +02:00
Gina Häußge
954397b6a6 Changed logging of plugin subsystem slightly
Detected plugins are now logged in a better readable way and with additional information.

Also marked folder for bundled plugins as bundled - forgot to do that earlier.
2015-03-25 18:56:11 +01:00
Gina Häußge
87acd4c555 Fix: don't die during locale selection if access control is disabled 2015-03-19 09:31:13 +01:00
Gina Häußge
ddb588e751 Language settings now work, both global and per user
Still need to test if reload of current user settings works upon change of those.
2015-03-18 15:49:29 +01:00
Gina Häußge
f98ebaafee WIP on introducing user settings (incl. interface language) 2015-03-18 11:30:08 +01:00
Gina Häußge
f79e361823 Merge branch 'dev/tornadoTimeFunc' into devel 2015-03-16 12:40:10 +01:00
Gina Häußge
89fba67eb0 Added X-Clacks-Overhead header to commemorate Sir Terry
For as long as his name is still passed along the Clacks,
    Death can't have him.
    -- "Going Postal", Chapter 4 Prologue

RIP Terry Pratchett

See also http://gnuterrypratchett.com/
2015-03-16 10:41:04 +01:00
Gina Häußge
57de36a9d3 Monkey patching tornado to backport tornadoweb/tornado#1290
Should hopefully help with freezing/blocking issues upon first connect with the net on the Pi, more tests needed.
2015-03-16 10:19:03 +01:00
Gina Häußge
1f559049c6 Merge branch 'devel' into dev/tornadoTimeFunc 2015-03-12 19:20:17 +01:00
Gina Häußge
22c73d831a More cleanup for the feedback controls
Preprocessing for better performancy, unit tests for preprocessing, controls don't need a type anymore (makes things way less complicated and repetitive)
2015-03-10 21:49:18 +01:00