Commit graph

47 commits

Author SHA1 Message Date
Gina Häußge
080a6e9ccd Extend atomic_write to allow setting & persisting file permissions 2016-09-23 14:26:33 +02:00
Gina Häußge
bbe6e44d44 Only use non-postfixed cookie if no postfixed one exists
Example:

  * both "session" and "session_P5000" cookies available: "session" value from "session_P5000"
  * only "session" cookie available: "session" value from "session"
  * only "session_P5000" cookie available: "session" value from "session_P5000"
2016-09-08 15:42:51 +02:00
Gina Häußge
53b74f9caa Only construct HTTP_HOST header from SERVER_NAME and _PORT if it's unset
If HTTP_HOST is set, following PEP333 it takes precedence over SERVER_NAME and
_PORT, so we set those from it.
2016-09-08 15:18:09 +02:00
Gina Häußge
2b22d26eac Fixed a small issue with RFC 5987 headers arriving as unicode in parser
Also added API docs regarding header encoding, incl support for RFC 5987
for filename fields in Content-Disposition headers in multipart/form-data
parts, incl. an example of an upload request with a utf-8 encoded filename.
2016-09-07 18:44:46 +02:00
Gina Häußge
13728c231c Also explicitely support ISO-8859-1 encoded multipart headers
Solves an issue with clients encoding filenames in multipart
 headers in ISO-8859-1, causing an HTTP 500 response code.

 This change makes ISO-8859-1 encoded headers work, sends
 a 400 Bad Request instead of 500 Internal Server Error if the
 request multipart headers cannot be decoded as either UTF-8
 or ISO-8859-1, defines UTF-8 content type for multipart text
 fields in rebuilt body and also adds support for RFC 5987 for the
 multipart file upload "filename" header component.
2016-09-07 17:03:59 +02:00
Gina Häußge
9d9eb3390d Cookie names are now port specific, based on the request associated with a response
* make sure server_port headers are properly set in reverse proxied scenarios
  * overwrite request and response classes to
    * always apply reverse proxy environment changes (so far missing for tornado
      context)
    * strip cookie name suffixes from cookie names on requests and
    * be sure to set cookie name suffixes for cookie names on responses
    * include script root in path used for cookies
  * some minor refactoring in octoprint.server setup routines
  * removed ReverseProxied class (didn't work for tornado context)
  * add unit tests for the whole reverse proxy, request and response customization
2016-09-05 12:06:56 +02:00
Gina Häußge
3fb9248d2a More timelapse unit tests 2016-02-10 16:44:46 +01:00
Gina Häußge
99c65b8cf4 Unit test for unrendered timelapse cleanup 2016-02-10 14:40:10 +01:00
Gina Häußge
4b7552e56e Fixed file manager unit tests, added tests for print recovery functionality 2016-02-09 10:45:54 +01:00
Gina Häußge
7743372ee4 Slugify file names on local storage
Just stripping anything non-ASCII leads to errors with UTF-8 only
filenames.

Closes #1181
2016-01-11 16:42:05 +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
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
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
a53195d2a0 Added Unit Tests for BlueprintPlugin mixin
(cherry picked from commit 53a62ab)
2015-10-26 09:15:54 +01:00
Gina Häußge
b4cb0dec87 Unit tests and some fixes for improved plugin settings processing
(cherry picked from commit bcd0f34)
2015-10-26 08:53:08 +01:00
Gina Häußge
d34790e74e Unit tests for octoprint.util.RepeatedTimer
(cherry picked from commit 7362067)
2015-10-20 12:07:31 +02:00
Gina Häußge
5f982ec6c8 Merge branch 'fix/atomicWrites' into maintenance 2015-10-07 17:53:43 +02:00
Gina Häußge
dcf2e51b21 Moved filemanager method tests to test_filemanager.py 2015-10-07 17:50:08 +02:00
Gina Häußge
85e6ae8e82 Fixed a unit test that broke by switching to atomic_write 2015-10-07 17:45:07 +02:00
Gina Häußge
859ea0d0e4 Added mime type guessing for downloads to Tornado 2015-10-07 17:19:18 +02:00
Gina Häußge
59993bfca4 Fixed & refactored temperature parsing
T-only lines were not properly parsed. Should now be fixed to
be associated to currently selected extruder. Also added unit
tests for the temperature parsing.

While at it also extracted regexes and added unit tests for command
parsing (gcode & parameters)
(cherry picked from commit f6a259f)
2015-08-24 14:55:42 +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
ea1fe29a5e Fixed unit tests again 2015-04-16 13:31:41 +02:00
Gina Häußge
2aa31024e6 Finalizing first version of plugin lifecycle management 2015-04-14 17:55:46 +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
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
Gina Häußge
e79fd99a41 Fixed comment handling in GCODE lines, escapes are no longer stripped
A good example while late night commits can sometimes be a bad idea.
2015-03-06 11:37:06 +01:00
Gina Häußge
975cc5ccfc GCODE scripts are now Jinja templates
Refactored some things in octoprint.util.comm and octoprint.settings, added migration function to get users of the devel version up to date with their gcode scripts. Migration function will be removed again one week from now.
2015-03-06 01:42:09 +01:00
Gina Häußge
333c9ba205 Refactoring of "printer" modules
- renamed methods from camelCase to snake_case
- renamed callback mathods from comm module from camelCase to snake_case
- extracted and documented public interface to be used by plugins
- extracted callback interface to be implemented by subscribed callbacks to printer
 - moved standard implementation to custom package
 - moved time estimation classes to custom package
2015-03-03 17:01:33 +01:00
Gina Häußge
e702736455 Updated/fixed unit tests and travis configuration 2015-03-02 12:58:24 +01:00
Gina Häußge
84c32a3cd9 Unit tests for octoprint.plugin.PluginSettings
And some small fixes of that class in the process...
2015-02-27 10:29:08 +01:00
Gina Häußge
28738a5179 More documentation and unit tests 2015-02-18 17:16:37 +01:00
Gina Häußge
be9021d377 Some more unit tests for the plugin manager 2015-02-05 19:20:51 +01:00
Gina Häußge
23387d6e48 More work on the template refactoring and new template plugin types 2015-01-15 11:06:59 +01:00
Gina Häußge
dc2318f404 Use the rolling average of the last n estimations instead of the current estimation for reporting print time left 2014-12-18 12:01:01 +01:00
Gina Häußge
014d39c11d Fetch estimated print time from cura slicing result, create print time statistics per printer profile, interpolate between stats and live estimation during printing for print time left 2014-12-17 17:31:30 +01:00
Gina Häußge
5ac908afd4 Pauses in the print job are now cleaned from the basis for print time estimation, also switched to a rolling window approach for determining when estimation becomes stable 2014-12-16 13:27:31 +01:00
Gina Häußge
f2562500a3 Print time estimation is now not displayed until it becomes somewhat stable 2014-12-12 23:38:57 +01:00
Gina Häußge
2ea1b9df6c Fully switched to printer profiles 2014-12-02 11:30:00 +01:00
Gina Häußge
f8955c0d1b Fix of file type detection 2014-10-29 12:17:26 +01:00
Gina Häußge
71d73c6562 Do not try to slice on local slicers when printing
Since slicing takes a lot of resources, that might lead to quality loss for the print job.
2014-10-21 14:14:00 +02:00
Gina Häußge
cd973adedf Improved slicing and file management
- File management is prepared to support folders (UI still lacking support)
- STL files are now first class citizens
  - can be managed via the file list (and filtered from it)
  - can be sliced on demand
- Slicing now happens via plugins
- Added Cura plugin
  - uses CuraEngine directly instead of full Cura installation
  - Cura profile importer for importing profiles from regular Cura installs via settings dialog
  - TODO: UI for editing profiles
- API for slicing and slicing profile management
2014-10-06 17:34:07 +02:00
Gina Häußge
08e4c05129 Plugins can now also be retrieved via entry_points, also added EventPlugin and afterStartup handler in StartupPlugin 2014-09-10 15:46:14 +02:00
Gina Häußge
e1366ef90f First experiments with a plugin system, service discovery and connectivity ensurance 2014-09-05 17:11:11 +02:00
Gina Häußge
097e398efc Fixed test (did not yet match new return value format) 2013-12-21 16:15:22 +01:00
Gina Häußge
fe37ab3cd8 Refactored server.py into submodules, extracted ajax and rest api into their own blueprints, and while doing all this also took care of #291 2013-10-28 22:08:36 +01:00