Commit graph

4307 commits

Author SHA1 Message Date
Gina Häußge
8630ec5beb Fix some bugs in the client lib refactoring
* Endless recursion on file delete as reported in #1738
  * Broken implementation of .move
  * Broken definition of .pathForEntry, .entryForPath,
    .pathForElement and .elementByPath
2017-02-15 16:15:35 +01:00
Gina Häußge
e8349d6593 Always create a user session for requests with an API key
API endpoints that were not decorated with restricted_access so far did
not properly create a user session for cookie-less requests with an API
key only.

That meant that flask.current_user stayed an anonymous user, even with
the global admin API key. In case of /api/settings that meant that even
with the global admin API key it was not possible to read settings that
are admin-only (like the API key for example) or user-only.

This has now been rectified by moving the session creation into a
different before_request handler that is registered globally on all API
endpoints, meaning that an API key will now always lead to a user
session to be created, regardless of the requirements of the API
endpoint in question. Additionally the CORS handling was extracted
as well as the API key presence enforcement.

BlueprintPlugins will now also get the CORS and session-from-API-Key
treatment if they do not declare their endpoints as restricted.

Might solve the API key "n/a" issue filed in #1751, but since the cause
of that isn't identified yet that's not sure.
2017-02-15 13:12:35 +01:00
Gina Häußge
9b457cce9e Fixed user settings API 2017-02-15 11:38:33 +01:00
Gina Häußge
b2229ae24a SWU: Ignore empty or None configs 2017-02-14 15:03:20 +01:00
Gina Häußge
189c842881 dict_merge should not hiccup on None values 2017-02-14 15:02:33 +01:00
Gina Häußge
6963e5e495 SWU: We need to do that overwrite protection differently
Only replace data from config.yaml with merged results once everything
trying to overwrite stuff is filtered out.
2017-02-14 12:52:07 +01:00
Gina Häußge
7b6642f7c2 SWU: Better resilience against overwriting of update configs
Don't allow overwriting of "octoprint" config through plugins, don't
allow overwriting of already registered configs unless id to register
matches plugin identifier (in which case the already registered config
was probably a case of a copy-paste-error from another plugin).
2017-02-14 11:14:03 +01:00
Gina Häußge
5d97dc4b40 Better resilience against broken software update configs
Fixes #1773
2017-02-14 10:42:02 +01:00
Paul de Vries
b453897ea3 Upgrade LESS.min.js from 2.7.1 to 2.7.2
This will fix the broken contrast function introduced in 2.7.1

This commit will only affect the contrast function
See more @ https://github.com/less/less.js/compare/v2.7.1...v2.7.2#diff-8c2e50ef84a06711745a46e22c67d631
2017-02-05 14:45:10 +01:00
Gina Häußge
54a9a7b906 Use codecs.open for translation po files 2017-01-26 17:22:51 +01:00
Gina Häußge
a3f24c59e9 Don't render untranslated strings to messages.js 2017-01-26 17:22:07 +01:00
Gina Häußge
42f4fad257 Fixed minor doc issue 2017-01-26 15:00:06 +01:00
Gina Häußge
eaadf8743b Allow multiple instances of the JS client
We now have a global OctoPrintClient, which is the class from which
all clients are derived, and a global OctoPrint, which is a single
instance already setup and ready to use in case we only need one.

It would be cleaner to have clients create that singular instance
themselves, but we need to maintain backward compatibility for now
with how we established the client to work with the 1.3.0 release.

New clients can be create with

    client = new OctoPrintClient({ /* options */ });

Alternatively the options can be left out and set at a later point:

    client = new OctoPrintClient();
    /* ... */
    client.options = { /* options */ };

Individual client components register themselves with OctoPrintClient
via OctoPrintClient.registerComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.<name>",
 e.g. "OctoPrint.files".

Plugin components register themselves with OctoPrintClient via
OctoPrintClient.registerPluginComponent(name, component) from the
component JS files. Just like before their instances are then
available in the individual client instances under "<client>.plugins
.<name>", e.g. "OctoPrint.plugins.softwareupdate".

This should make it possible to create dashboard pages utilizing the
JS client that monitor the status of multiple OctoPrint instances,
without workarounds such as having to swap out the options globally
before each request.

See #1681 for the corresponding discussion.
2017-01-26 14:59:56 +01:00
Gina Häußge
b0cd742bf4 Fix UMD pattern 2017-01-26 14:59:54 +01:00
Gina Häußge
7ab3eabe0f Support for shared nozzle setups
Support multi-extruder setups that share a single nozzle and heater,
like the E3D Cyclops, Diamon hotend or probably the upcoming Prusa Mk2
multi-extruder upgrade.

The Control tab will still allow tool switching and extruding for
the configured extruders, the Temperature tab will only display
one hotend temperature though.

Printer profiles have been extended by a new option
extruder.sharedNozzle that defaults to False. Extruder offsets are
not displayed in the profile editor if that setting is checked and
reset to (0,0).
2017-01-26 13:33:42 +01:00
Gina Häußge
8f3b6dca79 Fix stupid typo 2017-01-25 16:21:15 +01:00
Gina Häußge
29a2c6abec Allow new locales to be provided by plugins
Core translations still win over plugin translations, but at least
this way it's possible to provide full blown translations via plugins.
2017-01-25 16:02:25 +01:00
Gina Häußge
9a464e01d8 Merge branch 'master' into maintenance 2017-01-25 12:53:49 +01:00
Gina Häußge
37966644aa Upped version numbers for branches 2017-01-25 12:50:50 +01:00
Gina Häußge
6393de8c7d Preparing release of 1.3.1 2017-01-25 08:24:07 +01:00
Gina Häußge
9250cd0c3b Whitespace, comments & added @eyal0 to AUTHORS.md
(cherry picked from commit c7f67cc)
2017-01-24 11:38:52 +01:00
Eyal Soha
6b2f28240e Ignore a leading v or V in github release tags.
This fixes foosel/OctoPrint#1723 .

(cherry picked from commit f1c3829)
2017-01-24 11:38:46 +01:00
Gina Häußge
c8dfe363bc Only offer daemon subcommand on linux 2017-01-20 17:10:59 +01:00
Gina Häußge
e20fcd9ce5 Merge branch 'rc/maintenance' into maintenance 2017-01-20 16:28:42 +01:00
Gina Häußge
adbd6b7fa1 Preparing release of 1.3.1rc2 2017-01-20 15:33:32 +01:00
Gina Häußge
3da3cfd8a0 Fixed passing of "daemon" legacy parameter on CLI
This time this hopefully really solves #1641
2017-01-20 15:33:24 +01:00
Gina Häußge
88a8bdf7b3 Add "Restart in safe mode" system menu entry 2017-01-20 14:27:06 +01:00
Gina Häußge
a948050c54 SWU: Fixed update configs without restart 2017-01-19 14:07:04 +01:00
Gina Häußge
0d76df2cd5 SWU: Fixed python_checker and python_updater 2017-01-19 14:06:33 +01:00
Gina Häußge
3b5c2fe519 SWU: Config version 4 didn't properly migrate old commands -> version 5 2017-01-19 12:33:45 +01:00
Gina Häußge
6f5ee4d291 Fixed doctests of software update version checks 2017-01-19 12:33:44 +01:00
Gina Häußge
507ddde9dd Improved error resilience in plugin repository handling 2017-01-19 12:33:43 +01:00
Gina Häußge
a646fff5ff Fix persistence of config version on settings migration 2017-01-19 12:33:27 +01:00
Gina Häußge
6268e27dd7 Fix settings not allowing to delete values not in defaults anymore 2017-01-19 12:33:25 +01:00
Gina Häußge
caa84d7918 Don't kill manual software update configs during migration
See lengthy comment in source added through this commit for details.
2017-01-19 12:11:01 +01:00
Gina Häußge
6bd788a83f Always define pixfmt for timelapse in video filter chain
Apparently having a chain AND the pix_fmt parameter
produces issues with higher resolutions.

Should fix #1317
2017-01-17 13:03:27 +01:00
Gina Häußge
4c971a92db from ... import * is only allowed at module level 2017-01-13 14:17:39 +01:00
Gina Häußge
5b3a7bed93 Preparing release of 1.3.1rc1 2017-01-13 13:56:50 +01:00
Gina Häußge
1f0e67f85e Added FAQ link to footer 2017-01-13 13:42:53 +01:00
Noah Martin
74597483dc Added a mask icon for Safari pinned tab and touchbar
(cherry picked from commit ff02192)
2017-01-13 13:33:21 +01:00
Gina Häußge
cb89509bb2 Fixed sorting in 3rd party licenses 2017-01-13 13:30:57 +01:00
Gina Häußge
c194fdbb28 Added @noahsmartin to AUTHORS 2017-01-13 13:30:38 +01:00
Noah Martin
b1057a4cc8 Simplified install process on Mac
(cherry picked from commit 726eec8)
2017-01-13 13:29:11 +01:00
Gina Häußge
20cd13904d Cura: Fix selection of which start/end gcode to choose
So far the plugin selected the gcode script corresponding to the number of
extruders configured in the printer profile. After a close look into the
implementation in Cura itself, prompted by #1708, it turns out that this is
in fact wrong.

Cura selects the gcode script to use based on the maximum of the number of
extruders needed for printing the models in the scene and the minimum number
of extruders needed for generating support (if support extruder is "both" or "first"
or there is only one extruder, that's 1, if it's "second" and there is more than one
extruder, it's 2).

This commit changes the plugin's implementation to mirror this implementation.
The difference to Cura is that we have the number of extruders needed for the
models in the scene hard coded to 1 since we only support STL right now which
can never contain more than one object. If we ever decide to support merging of
multiple STLs into one single multi-extruder print or other model files like AMF
or OBJ from OctoPrint's slicer support, we need to change this.
2017-01-13 12:54:01 +01:00
Gina Häußge
95e4ad82b4 Cura: Fix off-by-one error for placeholder replacement
Affected print_temperature and filament_diameter placeholders.

E.g. `print_temperature2` was wrongly attempting to fetch `print_temperatures[2]`
 instead of `print_temperatures[1]` (0-based-indexing!)

 Partially fixes #1708
2017-01-13 11:25:08 +01:00
Gina Häußge
9e3d2bed65 Merge branch 'improve/passwordManagers' into maintenance 2017-01-12 18:59:39 +01:00
Gina Häußge
7f3d4a8380 Allow configuration of analysis throttling via config.yaml 2017-01-12 18:16:50 +01:00
Gina Häußge
e6dd37e26e Various analysis queue fixes
* Fix priority queue sorting (sorts ascending, not descending!)
  * Abort low priority jobs when a high priority job comes in
  * Utilize queue for tracking aborted jobs too
  * Abort analysis for items that are to be deleted/moved (also
    fixes issue under Windows where it was impossible to delete
    a file for which the analysis was still running).
2017-01-12 18:16:42 +01:00
Gina Häußge
d69c166f10 Fix unanalysed files from subfolders to not be found on startup 2017-01-12 15:15:02 +01:00
Gina Häußge
f6875c0df4 Update german translation 2017-01-12 14:34:00 +01:00