Commit graph

296 commits

Author SHA1 Message Date
Gina Häußge
5c20e264e2 Feature flag to enable legacy plugin assets
Work around issues like #2246 until the plugins that are affected are
fixed.

To be removed in 1.3.8.

See also #2200
2017-11-29 15:55:09 +01:00
Gina Häußge
aa65671ac7 Always check active flag 2017-11-28 13:05:28 +01:00
Gina Häußge
d174d7ab80 Temporary fix for #2246 until #2200 is solved 2017-11-27 17:24:40 +01:00
Gina Häußge
c479c5455c Don't log request on uncaught errors in tornado
Might leak information if logs are shared. Still stick to the old
logging verbosity however if running in debug mode.
2017-11-17 12:06:17 +01:00
Gina Häußge
b2d70de144 Environment detection & logging on startup
Incl. OctoPi version & RPi model through bundled plugin that only
gets loaded if OctoPi is detected.
2017-11-10 17:32:59 +01:00
Gina Häußge
9837f67140 Small adjustments in webasset filters
* Add comment with source file to JsDelimiterBundler and
    JsPluginDelimiterBundler
  * Include source file name in JsPluginDelimiterBundler catch
    block and use log.error instead of console.error
2017-11-06 11:39:11 +01:00
Josh Major
dc53942015 Added plugin Javascript isolation 2017-11-04 10:08:04 -05:00
Gina Häußge
0afa854763 Support a centralized plugin blacklist (opt-in)
A centralized plugin blacklist read from plugins.octoprint.org on server
start now allows us to stop plugins from being loaded that are known to
cause severe issues with OctoPrint's regular operation.

Blacklist entries can be restricted for specific plugin versions &
OctoPrint versions, allowing for very granular control of any kind of
blocking.

Additionally users may disable blacklist processing in general (an
opt-in wizard and a new section in the settings have been added) and
at server start via the new --ignore-blacklist parameter available for
"octoprint serve" and "octoprint daemon".

If a plugin is blacklisted, OctoPrint will not even import the
plugin module in question (if only a plugin key is specified OR a key
and a version and the plugin's version is already known during import
time, which is the case for plugins loaded from entry points) or at the
very least stop the plugin from being enabled (if a plugin key and a
version is specified and the plugin's version is only known after
loading, which is the case for plugins loaded from directories).
2017-10-25 17:29:00 +02:00
Gina Häußge
42ac133436 Support full UTF8 file names
Files (and folders) are still slugified to ASCII for storage on disk,
but now the original filename is stored alongside in metadata.yaml
and used for display in the file list and print status.

The slicing dialog also inherits that display name for use as base
for the suggested GCODE name.

Internally, everything still depends completely on the slugified
ASCII version.

This implements #2094
2017-10-12 18:08:41 +02:00
Gina Häußge
12b8a54081 set_close_exec on intermediary server port for unix & windows
Using the win32 API it's possible to prevent the intermediary server
socket from inheriting itself to subprocesses. So let's use that here.

Another bit of the solution for #2090.
2017-08-23 18:31:42 +02:00
Gina Häußge
c336452f6c Do not run subprocesses while intermediary server is active
Any processes inheriting the open port descriptor of that server will
cause the actual server startup to fail due to the port still being
claimed.

We can't fully prevent this under Windows thanks to fnctl not being
available and win32api being a PITA, and also close_fds on Popen not
being allowed if we also need to redirect stdout/stderr/stdin for a
process. So let's hope hardening against this problem when running
under *nix, adding a bit fat warning to never start a subprocess
during the intermediary's runtime and also moving the only actual
process we so far DID start (analysis backlog processing) to after
Tornado is running will suffice.

Fixes #2035
2017-07-27 09:58:20 +02:00
Gina Häußge
a6d3299b91 Add user manager factory hook 2017-07-20 20:03:05 +02:00
Gina Häußge
67f7580506 Only run connectivity checker if enabled
Otherwise assume we are online but don't ping anything.

See also #2011
2017-07-20 20:02:44 +02:00
Gina Häußge
187c09e7da Centralized online connectivity check
See also #2011
2017-07-19 18:42:27 +02:00
Gina Häußge
6f5707a0fc Attach identity reset to logout signals
Safer than doing it manually
2017-07-17 13:14:45 +02:00
Gina Häußge
ed6c01c12a Remove current_user from template contexts
That should never have been enabled for our usage scenario in the
first place.
2017-06-30 14:37:37 +02:00
Gina Häußge
7ab4d12548 Better error resilience against wrong user manager
Also improved get_class by using importlib instead of complicated
climbing through the whole module tree.
2017-06-29 15:07:17 +02:00
Gina Häußge
5e0b53b651 Better thread safety for SockJS
Heartbeat messages could still be sent out of turn, causing message
corruption or other weird things. This should hopefully fix this.
2017-06-23 17:56:17 +02:00
Gina Häußge
cfae406a4c Fix issue with hover pos being undefined & resizing of plot 2017-06-07 10:59:22 +02:00
Gina Häußge
00c14e6936 First throw at tracking individual data points in the temp graph
See #1640
2017-06-07 10:10:31 +02:00
Gina Häußge
5a23b46c11 Merge branch 'staging/maintenance' into maintenance 2017-06-01 16:11:50 +02:00
Gina Häußge
cbdf85c27a Fix crash on startup thanks to invalid default profile & auto connect
See #1942

This does NOT fix the root cause of `_default.profile` becoming an
empty file (apparently during migration from config.yaml?), however
since this particular situation was impossible to reproduce so far this
workaround for the consequences will have to suffice for now since we
want a hotfix as fast as possible for 1.3.3.
2017-06-01 12:10:12 +02:00
Gina Häußge
77b6d83e0b Set X-Robots-Tag and remove Server header in responses
Also set robots meta tag in index.jinja2
2017-05-24 16:53:54 +02:00
Gina Häußge
832c27ed18 Filter source maps from bundled assets
At least for now. Might be re-evaluated in the future. URL rewrite
filter for such a case already in place.
2017-05-19 12:28:20 +02:00
Gina Häußge
59d78ba893 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2017-05-18 11:20:54 +02:00
Gina Häußge
7770ee3d08 static/assets/vendor => static/vendor
Our static folder is basically an assets folder (it just is named differently).
So let's get rid of the redundant directory level.
2017-05-18 11:12:33 +02:00
Gina Häußge
2d9ad41e49 Moved FontAwesome css into vendor folder & use cssrewrite filter for webassets
That fixes up the relative URLs to the font files and should make updates down the line
a thing of a quick copy and paste (plus allow some more sophisticated dependency
management down the road as well).

Also renamed fonts folder for FontAwesome 3.2.1 from font to fonts, for more
consistency.
2017-05-18 11:10:37 +02:00
Gina Häußge
821156c9d6 Py3: basestring => past.builtins.basestring 2017-05-17 19:01:42 +02:00
Davide Depau
d8d9c7fe64 Merge branch 'maintenance' into fa-update 2017-05-17 17:46:01 +02:00
Davide Depau
6c0f2de780 upgrade FontAwesome CSS+fonts to 4.7.0, keeping 3.2.1 as fallback [2/2] 2017-05-17 17:35:49 +02:00
Gina Häußge
9fac314d71 SWU: restart asynchronously instead of synchronously
Otherwise we will block ourselves, waiting for the restart command to
complete which it only can when we are no longer there.

Should reduce restart times on update significantly.

Downside is that we no longer can wait for the return code of the
call. However, that should be caught by our UI handler timing out for
the restart and showing an error prompting the user to restart
manually.
2017-05-17 13:44:11 +02:00
Gina Häußge
c91fe0c4fc Further decouple some plugin fetch tasks from initial startup thread 2017-05-11 15:23:41 +02:00
Gina Häußge
1666a1f607 Removed "minify" option for assets and some redundancy 2017-04-10 16:28:04 +02:00
Gina Häußge
a477268beb More logging for preemptive cache 2017-04-10 10:43:46 +02:00
Gina Häußge
b24851ca05 New events: FileAdded, FileRemoved, FolderAdded, FolderRemoved
Closes #1092
2017-04-03 15:50:23 +02:00
Gina Häußge
ea3b7ab1da Update pnotify to version 2.1.0, incl. all modules 2017-03-31 15:22:59 +02:00
Gina Häußge
162e8c50d3 Fixed CSS and LESS bundling for core vs plugins vs all 2017-02-23 17:05:42 +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
a646fff5ff Fix persistence of config version on settings migration 2017-01-19 12:33:27 +01:00
Gina Häußge
97bf331307 Add safe mode that disables all third party plugins
Can be enabled either through new --safe command line
parameter or through server.startOnceInSafeMode in
config.yaml

When running in safe mode the plugin manager will
only allow to disable or uninstall third party plugins. Enabling
third party plugins or installing new plugins is disabled.

That will hopefully allow for more straightforward recovery
in case of a misbehaving plugin.
2016-11-18 13:02:16 +01:00
Gina Häußge
1a75dcd5ee Allow locale definition via request header
Important for session less API calls that might return
localized content (e.g. the system commands).

See #1593
2016-11-18 07:56:35 +01:00
Gina Häußge
a58b167bed Utilize settings chain maps for plugin default settings too 2016-11-16 15:37:49 +01:00
Gina Häußge
8e90555381 Updated & renamed some JS dependencies 2016-10-18 12:31:56 +02:00
Gina Häußge
df5eae91a6 Adjust empty asset handling to match style in devel 2016-10-17 14:31:56 +02:00
Gina Häußge
c66be226b1 Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
2016-10-17 14:24:17 +02:00
Gina Häußge
88f8077b77 Plugin JS files might be empty, need to handle that
Otherwise webassets will explode with empty file list on bundle creation.
2016-10-17 12:16:53 +02:00
Gina Häußge
613363379f Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	src/octoprint/templates/javascripts.jinja2
2016-10-13 17:17:44 +02:00
Gina Häußge
6cd6b98c2b Core JS needs to go after plugin JS, or we might run into race conditions 2016-10-13 16:11:13 +02:00
Gina Häußge
9de78001dd Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	docs/plugins/concepts.rst
#	src/octoprint/__init__.py
#	src/octoprint/server/__init__.py
#	src/octoprint/templates/javascripts.jinja2
#	src/octoprint/timelapse.py

Merge branch 'devel' into dev/wizard

# Conflicts:
#	octoprint_octobullet/__init__.py
#	octoprint_octobullet/templates/octobullet_settings.jinja2

Merge branch 'devel' into dev/wizard

# Conflicts:
#	octoprint_octobullet/__init__.py
#	octoprint_octobullet/templates/octobullet_settings.jinja2
2016-10-13 14:22:40 +02:00
Gina Häußge
419f3370a2 Split JS/CSS/LESS assets between core+bundled plugins and external plugins
That way a JS error in an external plugin won't nuke the whole UI, which IMHO
is worth the additional requests needed to load the split up files.

See #1544 for an example of such a situation.
2016-10-13 12:07:00 +02:00