Commit graph

2094 commits

Author SHA1 Message Date
Gina Häußge
d2ed80baca Merge branch 'dev/apiCaching' into devel
# Conflicts:
#	src/octoprint/filemanager/storage.py
#	src/octoprint/static/js/app/viewmodels/files.js
2016-09-16 17:11:14 +02:00
clemniem
74fd5e8956 Fixed KeyError in events.py that prevented a command associated with the ClientOpened event from execution.
The if-statement checked against currentData["job"] is not None, although it was not None even if there was no job.
2016-09-16 16:21:28 +02:00
Gina Häußge
650e1971d4 Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	src/octoprint/static/js/app/viewmodels/usersettings.js
2016-09-16 14:11:43 +02:00
Gina Häußge
0167015b46 Fix generate/delete API key functionality in user settings
Closes #1491
2016-09-12 12:48:10 +02:00
Gina Häußge
8b99c89acf Return 400 Bad Request if a multipart request lacks the boundary
It's mandatory according to RFC2046, section 5.1

See also #1486
2016-09-12 12:48:10 +02:00
Mathias Rangel Wulff
b794a4672f Correct check for undefined variable
The code was comparing the result of `typeof` with a variable named `undefined`.

As typeof returns a string it should compare to `'undefined'`.
2016-09-12 09:43:46 +00:00
Gina Häußge
0bb6f5215d "prerelease" key might not be in check if tracking stable releases 2016-09-12 09:25:34 +02:00
Gina Häußge
b6fbbb353a Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	src/octoprint/filemanager/storage.py
#	src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
2016-09-09 12:31:29 +02:00
Gina Häußge
7efa311b04 Updated the german translation again after adding a sentence 2016-09-09 11:52:54 +02:00
Gina Häußge
c6d9575127 Added link to "Using Release Channels" to the SWU settings dialog 2016-09-09 11:34:25 +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
a7bd770180 Allow overriding file name sanitization by sub classes of LocalStorage 2016-09-08 12:50:04 +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
64d484bd09 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/__init__.py
#	src/octoprint/util/jinja.py
2016-09-07 17:22:37 +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
209a88bd6a And consequently yet another update of the german translation 2016-09-07 12:10:34 +02:00
Gina Häußge
2256a1e825 Found an untranslated piece of UI 2016-09-07 12:05:54 +02:00
Gina Häußge
976be675e5 Declare cache_key before trying to access it 2016-09-07 11:59:43 +02:00
Gina Häußge
122ec39728 And another update of the german translation 2016-09-07 11:55:31 +02:00
Gina Häußge
d4428de9a0 Some rewording 2016-09-07 11:55:17 +02:00
Gina Häußge
536d46f15d Updated german translation 2016-09-07 10:21:21 +02:00
Gina Häußge
62d5f04373 Merge branch 'fix/portRestrictedCookies' into maintenance 2016-09-05 12:11:12 +02:00
Gina Häußge
b48af7133e Fixed validator for tornado 2016-09-05 12:10:58 +02:00
Gina Häußge
9a9502b281 "prerelease" might not be in check (chances for that are actually high), don't hiccup on that 2016-09-05 12:09:13 +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
Mike New
9bed3dcf8b fixed printer depth not saving or loading properly in the printer profile 2016-09-02 22:14:57 -07:00
Gina Häußge
f936c24da4 Changed wording on previous/next layer buttons & reordered 2016-09-01 15:12:22 +02:00
Gina Häußge
257cfe9dd9 Debug logging of render duration for / view 2016-09-01 13:20:05 +02:00
Gina Häußge
854eef7d00 Gracefully handle errors when reading webassets 2016-09-01 13:19:31 +02:00
Gina Häußge
37a39e82e2 path_in_location needs to use sanitized entry 2016-09-01 13:17:09 +02:00
Gina Häußge
c552c614b2 Fix upload highlight in folders & keep folder on files refresh 2016-09-01 13:16:33 +02:00
Gina Häußge
6f48ca68e2 Fixed a merge error, _execute returns three values in 1.3.0, not two 2016-09-01 10:29:29 +02:00
Gina Häußge
eb4be89d39 Renamed GcodeFileViewModel to FileViewModel
(Let's be realistic here)

Introduced new "additionalNames" property on viewmodel declaration
to allow for registering alternative lookup names for a view model.

The freshly renamed FileViewModel now resolves as both "filesViewModel"
 and "gcodeFilesViewModel", making the renaming backwards compatible

 Documented all that stuff (and some more)
2016-09-01 10:17:18 +02:00
Gina Häußge
2a33aef617 Refs weren't propery set on file API 2016-08-31 17:57:17 +02:00
Gina Häußge
e42ef3d070 Small fixes on the layer buttons
Removed unnecessary (and broken) call to event.preventDefault,
moved styles to less/css and also made sure to disable the buttons
not currently usable.
2016-08-31 17:20:23 +02:00
Gina Häußge
d2b0387994 Be sure that opts.url == urlToCall 2016-08-31 15:51:15 +02:00
Gina Häußge
20607dfab0 Work around a race condition(?) causing issues on startup
See lengthy comment inside main.js added in this commit.
2016-08-31 15:50:33 +02:00
Gina Häußge
9e1f82d977 Don't modify the list in the cache, make a copy 2016-08-31 11:49:53 +02:00
Gina Häußge
5c9ed254ff Fix a missing parameter 2016-08-31 11:11:47 +02:00
Gina Häußge
c32d9a33ee Make sure to include the sd files in the ETag calculation as well 2016-08-31 11:11:18 +02:00
Gina Häußge
bccc706329 First throw at caching of API methods
Most caching is left to the client, by utilizing ETag and Last-Modified headers.

Where it was easily achievable, an additional server side miniature cache of intermediary
results was introduced (e.g. for the files). The regular cached decorator was not used
since it targets caching full responses, and the responses in question already contained
client request specific data. Caching "one step earlier" allows better usage of the cache here.

Also introduced a dependency on the scandir module, to get a bit of a performance boost
on os.walk and os.listdir (which have been replaced with scandir.walk and scandir.listdir
respectively). See https://github.com/benhoyt/scandir#background on why that made
sense.
2016-08-30 19:02:30 +02:00
Gina Häußge
e00de7145f Fixed some indentation 2016-08-30 18:05:22 +02:00
Gina Häußge
ce28b637ab Better solution for access to .md files when running from source
The SelectedFileSystemLoader doesn't collect everything and the
kitchen sink from disk...
2016-08-29 17:50:14 +02:00
Gina Häußge
a13e12bb5e More work on JS Client documentation 2016-08-26 17:47:38 +02:00
Gina Häußge
12bc85694b Small optimizations on copy and move commands 2016-08-26 17:47:28 +02:00
Gina Häußge
efca776102 Merge branch 'maintenance' into devel
Conflicts:
	src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
	src/octoprint/plugins/softwareupdate/updaters/update_script.py
2016-08-26 14:24:13 +02:00
Gina Häußge
21b7339187 SWU: Move branch config to update check & fix release version detection again 2016-08-26 14:18:17 +02:00
Gina Häußge
df1a97b0e1 SWU: Only enforce unequality comparison on release channel switch 2016-08-26 10:40:01 +02:00
Gina Häußge
66da377b64 SWU: Minor fixes in the octoprint check population 2016-08-26 10:19:20 +02:00