Skip to content

Commit 03f228c

Browse files
committed
☔ Extend safemode to language packs
Cherry-picked from cc1d88c Implements OctoPrint#3271
1 parent 93ae368 commit 03f228c

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

docs/features/safemode.rst

+17-10
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@ Safe mode
55
*********
66

77
With the advent of support for plugins in OctoPrint, it quickly became apparent that some of the bugs
8-
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins instead of
9-
OctoPrint itself.
8+
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins or language
9+
packs instead of OctoPrint itself.
1010

1111
To allow an easier identification of these cases, OctoPrint 1.3.0 introduced safe mode. Starting
12-
OctoPrint in safe mode disables all plugins that are not bundled with OctoPrint, allowing to easier
13-
identify most cases where a third party plugin is the culprit of an observed issue.
12+
OctoPrint in safe mode disables all plugins (and starting with 1.3.13 also all language packs) that are
13+
not bundled with OctoPrint, allowing to easier identify most cases where a third party plugin or language
14+
pack is the culprit of an observed issue.
1415

15-
Additionally, OctoPrint allows uninstalling plugins in this mode, allowing recovery from cases where
16-
a third party plugin causes the server to not start up or the web interface to not render or function
17-
correctly anymore.
16+
Additionally, OctoPrint allows uninstalling plugins and language packs in this mode, allowing recovery
17+
from cases where a third party addition causes the server to not start up or the web interface to not
18+
render or function correctly anymore.
1819

1920
Whenever reporting an issue with OctoPrint, please always attempt to reproduce it in safe mode as well to
20-
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party plugins.
21+
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party additions.
2122

2223
.. _sec-features-safemode-how:
2324

@@ -73,11 +74,17 @@ When OctoPrint is running in safe mode the following changes to its normal opera
7374

7475
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
7576
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
76-
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint`` (Windows) and
77-
``~/Library/Application Support/OctoPrint`` (MacOS).
77+
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint/plugins`` (Windows) and
78+
``~/Library/Application Support/OctoPrint/plugins`` (MacOS).
79+
* OctoPrint will not enable any of the installed third party language packs. OctoPrint considers all language packs
80+
third party language packs that do not ship with OctoPrint's sources, so any language plugins installed
81+
through the language pack manager within settings and/or stored in the language pack folder at
82+
``~/.octoprint/translations`` (Linux), ``%APPDATA%/OctoPrint/translations`` (Windows) or
83+
``~/Library/Application Support/OctoPrint/translations`` (MacOS).
7884
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
7985
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
8086
* OctoPrint will not allow to enable third party plugins.
87+
* OctoPrint will still allow to manage language packs.
8188
* OctoPrint's web interface will display a notification to remind you that it is running in
8289
safe mode.
8390

19.5 KB
Loading

src/octoprint/server/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ def run(self):
261261
# monkey patch a bunch of stuff
262262
util.tornado.fix_json_encode()
263263
util.flask.fix_flask_jsonify()
264-
util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")])
264+
265+
additional_translation_folders = []
266+
if not safe_mode:
267+
additional_translation_folders += [self._settings.getBaseFolder("translations")]
268+
util.flask.enable_additional_translations(additional_folders=additional_translation_folders)
265269

266270
# setup app
267271
self._setup_app(app)

src/octoprint/static/js/app/dataupdater.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
153153
if (self._safeModePopup) self._safeModePopup.remove();
154154
if (data["safe_mode"]) {
155155
// safe mode is active, let's inform the user
156-
log.info("Safe mode is active. Third party plugins are disabled and cannot be enabled.");
156+
log.info("Safe mode is active. Third party plugins and language packs are disabled and cannot be enabled.");
157157
log.info("Reason for safe mode: " + data["safe_mode"]);
158158

159159
var reason = gettext("Unknown");
@@ -174,7 +174,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
174174

175175
self._safeModePopup = new PNotify({
176176
title: gettext("Safe mode is active"),
177-
text: _.sprintf(gettext("<p>The server is currently running in safe mode. Third party plugins are disabled and cannot be enabled.</p><p>Reason: %(reason)s</p>"), {reason: reason}),
177+
text: _.sprintf(gettext("<p>The server is currently running in safe mode. Third party plugins and language packs are disabled and cannot be enabled.</p><p>Reason: %(reason)s</p>"), {reason: reason}),
178178
hide: false
179179
});
180180
}

0 commit comments

Comments
 (0)