Commit graph

3307 commits

Author SHA1 Message Date
Gina Häußge
fc4e786745 Merge branch 'fix/betterUiCaching' into dev/betterUiCaching
Conflicts:
	src/octoprint/util/jinja.py
2015-11-26 19:49:32 +01:00
Gina Häußge
63d095ab00 Refactored implementation of get_all_template_paths 2015-11-26 19:48:44 +01:00
Gina Häußge
4fc43ebd1c Merge branch 'fix/betterUiCaching' into dev/betterUiCaching
Conflicts:
	src/octoprint/server/util/flask.py
	src/octoprint/server/views.py
	src/octoprint/static/js/app/dataupdater.js
	src/octoprint/util/jinja.py
2015-11-26 19:45:17 +01:00
Gina Häußge
47670a1bbd Merge branch 'fix/1120' into devel 2015-11-26 16:07:53 +01:00
Gina Häußge
6db57122b4 Catch and log all exceptions that might be raised in the watchdog
Solves #1120
2015-11-26 16:07:29 +01:00
Gina Häußge
c595d02f22 reload(true) shouldn't be necessary any more
UI + assets should actually have ETag and LastModified headers and proper
IfMatch handling on the server side and hence the server should do the
right thing on its own.
2015-11-26 14:15:06 +01:00
Gina Häußge
2e23cd39a4 Added ETag and LastModified headers + processing to UI index
That should improve performance tremendously.

Both ETag and LastModified depend on all files the template rendering
depends on. If any of the depended on files changes, both values will
change as well. That allows us to track whether our cached copy is
still current (and force a refresh if not) and also process IfMatch request
headers and reply with a 304 directly so that we do not even have to
transfer the data if nothing changed and the browser still has it.
2015-11-26 13:32:32 +01:00
Gina Häußge
b3e6fe622d Merge branch 'fix/preemptiveUiCaching' into dev/preemptiveUiCachingWithUiPlugins
Conflicts:
	src/octoprint/server/__init__.py
	src/octoprint/server/views.py
2015-11-24 18:46:58 +01:00
Gina Häußge
3de4f91f50 Decoupled decorator from PreemptiveCache class
Coupling it led to problems (naturally) when there was no
PreemptiveCache instance available yet.
2015-11-24 18:41:53 +01:00
Gina Häußge
53a2e6e27e Merge branch 'fix/preemptiveUiCaching' into dev/preemptiveUiCachingWithUiPlugins
Conflicts:
	src/octoprint/server/__init__.py
	src/octoprint/server/util/flask.py
	src/octoprint/server/views.py
	src/octoprint/util/__init__.py
2015-11-24 17:18:55 +01:00
Gina Häußge
6473937b75 Refactore preemptive flask cache into a proper class
Also now tracks timestamps of last access to a preemptively cached
resource and cleans up stuff that hasn't been accessed in a while (7 days
by default)
2015-11-24 14:37:30 +01:00
Gina Häußge
0ef9f85a94 Merge branch 'fix/preemptiveUiCaching' into devel
Conflicts:
	src/octoprint/server/views.py
2015-11-23 19:55:13 +01:00
Gina Häußge
fab5fc4899 Added preemptive caching of / and /i18n/<locale>/messages.js
Introduced a @preemptively_cached decorator that for decorated views
persists the provided data in ~/.octoprint/data/preemptive_flask_cache.yaml
in a list indexed by the view's path if the data is not yet part of the list.

During initialization the server will iterate over the persisted paths and data
and for each persisted path and entry in the list initialize a temporary WSGI
environment based on the data (which is interpretated as keyword arguments
to werkzeug's EnvironmentBuilder) which will then be used to call the view
function in the correct context.

The current implementation for / and /i18n/<locale>/messages.js utilizes
that decorator to allow preemptive caching of those views (/ being probably
the most expensive one in the whole core application) utilizing request base URLs
(internal access, external access, reverse proxy with prefix url etc) that had been
encountered in the past.

Through the new config setting server.preemptiveCaching.exceptions it is
possible to define a set of base URLs to never cache. Preemptive caching can
be globally disabled by setting devel.cache.preemptive to false.
2015-11-23 17:35:25 +01:00
Gina Häußge
ab13a99b09 Merge branch 'fix/prefixAwareCache' into devel
Conflicts:
	src/octoprint/server/views.py
2015-11-23 12:21:42 +01:00
Gina Häußge
d0eca800fb Make the current request's baseurl to a part of the cache key
This way we create separate caches for URLs access via different schemes/prefixes/etc.
Otherwise our generated page might not work when accessing OctoPrint from external
after accessing it from internal once.
2015-11-23 12:17:57 +01:00
Gina Häußge
a379724963 Fixed a bug in octoprint dev plugin:new command 2015-11-23 11:13:50 +01:00
Gina Häußge
89fcfbedb4 Merge branch 'fix/detachedHeadVersions' into devel 2015-11-20 13:56:35 +01:00
Gina Häußge
a6c24e174d Fixed version reporting on detached HEADs
HEAD "branch" also should disable usage of lookup table.
2015-11-20 13:54:09 +01:00
Gina Häußge
3ea77c76ef Fixed an import error introduced through moving the jinja trycatch extension 2015-11-20 11:46:28 +01:00
Gina Häußge
91ade13ded Merge branch 'fix/browserTabAwareness' into devel
Conflicts:
	src/octoprint/static/js/app/main.js
	src/octoprint/static/js/app/viewmodels/control.js
	src/octoprint/static/js/app/viewmodels/gcode.js
2015-11-20 11:44:09 +01:00
Gina Häußge
a52a5ca338 GCodeViewer: Even if off screen render 100% view on PrintDone event
Otherwise the GCODE Viewer will get stuck "half way through" if
"sync with progress" is enabled but the tab/browser tab loses focus
during printing and only regains it after the print has finished.
2015-11-20 11:40:06 +01:00
Gina Häußge
acc85127c5 Track browser tab visibility, only activate webcam/gcode viewer when visible
This might help with #1065 if indeed is related to background tab suspending behaviours in
browsers, but is a completely blind guess at this point since I still have not been able to
reproduce that issue myself.

Backported.

(cherry picked from commit 720cdad)
2015-11-20 11:06:25 +01:00
Gina Häußge
5fb1c2d7a0 Merge branch 'fix/useIsHiddenPath' into devel 2015-11-20 10:12:33 +01:00
Gina Häußge
454f16a7c3 Fixed a broken unit test (pro tip: test new tests before committing...) 2015-11-20 10:12:15 +01:00
Gina Häußge
73d8ff9991 Merge branch 'fix/useIsHiddenPath' into devel
Conflicts:
	tests/util/test_file_helpers.py
2015-11-20 10:07:46 +01:00
Gina Häußge
a731f748d9 Moved existing hidden file checks to utilize octoprint.util.is_hidden_path 2015-11-20 10:02:06 +01:00
Gina Häußge
3d0fc8d674 Moved jinja ExceptionHandlerExtension to octoprint.util.jinja 2015-11-19 19:08:10 +01:00
Gina Häußge
1f90096a89 Merge branch 'fix/hiddenTemplatesListed' into devel
Conflicts:
	src/octoprint/util/__init__.py
	tests/util/test_file_helpers.py
2015-11-19 19:04:21 +01:00
Gina Häußge
9a7bddd530 Also don't include hidden files in other templates 2015-11-19 19:03:04 +01:00
Gina Häußge
83f66e133e Do not include hidden files in listed gcode scripts 2015-11-19 18:58:56 +01:00
Gina Häußge
ab97abf13e Some fixes and unit tests for octoprint.util.atomic_write, .bom_aware_open and .tempdir
(cherry picked from commit 4fcb853)
2015-11-19 15:15:35 +01:00
Gina Häußge
a4e805685a Merge branch 'dev/folderSupport' into devel 2015-11-19 12:52:49 +01:00
Gina Häußge
5062c1ce68 Merge branch 'maintenance' into devel
Conflicts:
	src/octoprint/plugins/cura/__init__.py
	src/octoprint/plugins/cura/templates/cura_settings.jinja2
2015-11-19 11:51:16 +01:00
Gina Häußge
7820c17d08 [Cura] Make plugin a bit more verbose regarding usage & setup 2015-11-19 11:42:12 +01:00
Gina Häußge
43420163db Fixed some pinned versions for dependencies, introduced upper bounds 2015-11-19 10:48:06 +01:00
Gina Häußge
f1f55036e8 Simplistic folder add dialog 2015-11-18 18:36:23 +01:00
Gina Häußge
da890b036f Bugfix: emptyFolder filter was always active 2015-11-18 18:34:09 +01:00
Gina Häußge
1a20665729 Minor code style corrections 2015-11-18 17:45:15 +01:00
Gina Häußge
3db21f1a70 Fixed highlighting for files in folders
While at it also adjusted highlighting so that the folder containing
the currently selected file will be highlighted if the selected file is
not within the current folder but in one of its sub folders.
2015-11-18 17:44:11 +01:00
Gina Häußge
8b4aecde35 Merge branch 'devel' into dev/folderSupport 2015-11-18 17:16:12 +01:00
Gina Häußge
720cdadfbb Track browser tab visibility, only activate webcam/gcode viewer when visible
This might help with #1065 if indeed is related to background tab suspending behaviours in
browsers, but is a completely blind guess at this point since I still have not been able to
reproduce that issue myself.
2015-11-18 17:13:41 +01:00
Gina Häußge
50c3f99a42 virtual_printer: usage "screen" for the !!DEBUG commands 2015-11-18 13:56:39 +01:00
Gina Häußge
5d03b02baf virtual_printer: Refactoring for less error prone and more flexible command matching 2015-11-18 13:36:08 +01:00
Gina Häußge
66ad1150d5 Add toggle button to hide/show empty folders 2015-11-18 12:20:12 +01:00
Gina Häußge
d744c7e561 File search now operates recursively 2015-11-18 12:12:49 +01:00
Gina Häußge
306fd164d7 Refactoring of localstorage and added tests
* improved internal metadata handling
  * less code duplication
  * individual locks per metadata file
  * unit tests for copy and move operations
2015-11-18 10:47:49 +01:00
Salandora
9ed79adb8d Fix SD Support deactivated bug and added "unknown command" to the whitelist of errors 2015-11-17 19:32:34 +01:00
Gina Häußge
d85e93e79d Merge branch 'dev/clickClient' into devel 2015-11-17 08:41:37 +01:00
Gina Häußge
46e54b9d35 [SWU] First version of working CLI 2015-11-16 16:07:29 +01:00
Gina Häußge
21520f7fc5 Added octoprint client listen command and fixed socket client 2015-11-16 16:06:55 +01:00