From 42ab598b7419c4d6f4a4b5640b480cf036870039 Mon Sep 17 00:00:00 2001 From: Antipkin-A Date: Wed, 28 Sep 2022 11:43:48 +0300 Subject: [PATCH 01/27] disable plugins to settings --- controller/editorapicontroller.php | 4 ++++ controller/settingscontroller.php | 6 +++++- js/settings.js | 4 +++- l10n/ru.js | 3 ++- l10n/ru.json | 3 ++- lib/appconfig.php | 27 +++++++++++++++++++++++++++ templates/settings.php | 6 ++++++ 7 files changed, 49 insertions(+), 4 deletions(-) diff --git a/controller/editorapicontroller.php b/controller/editorapicontroller.php index d85773d3..5e302034 100644 --- a/controller/editorapicontroller.php +++ b/controller/editorapicontroller.php @@ -703,6 +703,10 @@ private function setCustomization($params) { $params["editorConfig"]["customization"]["macros"] = false; } + //default is true + if($this->config->GetCustomizationPlugins() === false) { + $params["editorConfig"]["customization"]["plugins"] = false; + } /* from system config */ diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index 246ca7bf..93763a6f 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -126,6 +126,7 @@ public function index() { "toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(), "successful" => $this->config->SettingsAreSuccessful(), "macros" => $this->config->GetCustomizationMacros(), + "plugins" => $this->config->GetCustomizationPlugins(), "reviewDisplay" => $this->config->GetCustomizationReviewDisplay(), "theme" => $this->config->GetCustomizationTheme(), "templates" => $this->GetGlobalTemplates() @@ -206,6 +207,7 @@ public function SaveAddress($documentserver, * @param bool $toolbarNoTabs - display toolbar tab * @param string $reviewDisplay - review viewing mode * @param string $theme - default theme mode + * @param bool $plugins - enable plugins * * @return array */ @@ -222,7 +224,8 @@ public function SaveCommon($defFormats, $help, $toolbarNoTabs, $reviewDisplay, - $theme + $theme, + $plugins ) { $this->config->SetDefaultFormats($defFormats); @@ -239,6 +242,7 @@ public function SaveCommon($defFormats, $this->config->SetCustomizationToolbarNoTabs($toolbarNoTabs); $this->config->SetCustomizationReviewDisplay($reviewDisplay); $this->config->SetCustomizationTheme($theme); + $this->config->SetCustomizationPlugins($plugins); return [ ]; diff --git a/js/settings.js b/js/settings.js index b00a6a5e..d1d0d34b 100644 --- a/js/settings.js +++ b/js/settings.js @@ -137,6 +137,7 @@ var toolbarNoTabs = $("#onlyofficeToolbarNoTabs").is(":checked"); var reviewDisplay = $("input[type='radio'][name='reviewDisplay']:checked").attr("id").replace("onlyofficeReviewDisplay_", ""); var theme = $("input[type='radio'][name='theme']:checked").attr("id").replace("onlyofficeTheme_", ""); + var plugins = $("#onlyofficePlugins").is(":checked"); $.ajax({ method: "PUT", @@ -155,7 +156,8 @@ help: help, toolbarNoTabs: toolbarNoTabs, reviewDisplay: reviewDisplay, - theme: theme + theme: theme, + plugins: plugins }, success: function onSuccess(response) { $(".section-onlyoffice").removeClass("icon-loading"); diff --git a/l10n/ru.js b/l10n/ru.js index 4107a571..50d9b6cd 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -111,6 +111,7 @@ OC.L10N.register( "Default editor theme": "Тема редактора по умолчанию", "Light": "Светлая", "Classic Light": "Светлая классическая", - "Dark": "Темная" + "Dark": "Темная", + "Enable plugins": "Включить работу с плагинами" }, "nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"); diff --git a/l10n/ru.json b/l10n/ru.json index 01a97e24..6786d067 100644 --- a/l10n/ru.json +++ b/l10n/ru.json @@ -109,6 +109,7 @@ "Default editor theme": "Тема редактора по умолчанию", "Light": "Светлая", "Classic Light": "Светлая классическая", - "Dark": "Темная" + "Dark": "Темная", + "Enable plugins": "Включить работу с плагинами" },"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);" } \ No newline at end of file diff --git a/lib/appconfig.php b/lib/appconfig.php index 38bbc9d4..0db20d25 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -277,6 +277,13 @@ class AppConfig { */ public $_customization_macros = "customization_macros"; + /** + * The config key for the plugins + * + * @var string + */ + public $_customizationPlugins = "customization_plugins"; + /** * @param string $AppName - application name */ @@ -867,6 +874,26 @@ public function GetCustomizationMacros() { return $this->config->getAppValue($this->appName, $this->_customization_macros, "true") === "true"; } + /** + * Save plugins setting + * + * @param bool $value - enable macros + */ + public function SetCustomizationPlugins($value) { + $this->logger->info("Set plugins enabled: " . json_encode($value), ["app" => $this->appName]); + + $this->config->setAppValue($this->appName, $this->_customizationPlugins, json_encode($value)); + } + + /** + * Get plugins setting + * + * @return bool + */ + public function GetCustomizationPlugins() { + return $this->config->getAppValue($this->appName, $this->_customizationPlugins, "true") === "true"; + } + /** * Save the list of groups * diff --git a/templates/settings.php b/templates/settings.php index 78012822..5227bced 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -122,6 +122,12 @@

+

+ checked="checked" /> + +

+

t("The default application for opening the format")) ?>

$setting) { ?> From 7707d2ebe7273d09ae6da70735fb7d989b501f26 Mon Sep 17 00:00:00 2001 From: Antipkin-A Date: Wed, 28 Sep 2022 11:51:56 +0300 Subject: [PATCH 02/27] disable plugins to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 422feb99..3b0f2c6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Added - Chinese (Traditional, Taiwan), Basque (Spain), Armenian and Malay (Malaysia) empty file templates +- disable plugins setting ## Changed - fix edit of locked file From ae23df1480936c8f14c0c961e792b04b44d1e4fe Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 20 Jan 2023 15:53:04 +0500 Subject: [PATCH 03/27] Copyright 2023 --- appinfo/app.php | 2 +- appinfo/application.php | 2 +- appinfo/routes.php | 2 +- controller/callbackcontroller.php | 2 +- controller/editorapicontroller.php | 2 +- controller/editorcontroller.php | 2 +- controller/federationcontroller.php | 2 +- controller/settingsapicontroller.php | 2 +- controller/settingscontroller.php | 2 +- controller/templatecontroller.php | 2 +- controller/webassetcontroller.php | 2 +- css/editor.css | 2 +- css/main.css | 2 +- css/settings.css | 2 +- css/template.css | 2 +- js/desktop.js | 2 +- js/editor.js | 2 +- js/listener.js | 2 +- js/main.js | 2 +- js/settings.js | 2 +- js/share.js | 2 +- js/template.js | 2 +- lib/adminsettings.php | 2 +- lib/appconfig.php | 2 +- lib/command/documentserver.php | 2 +- lib/crypt.php | 2 +- lib/documentservice.php | 2 +- lib/fileutility.php | 2 +- lib/fileversions.php | 2 +- lib/hookhandler.php | 2 +- lib/hooks.php | 2 +- lib/keymanager.php | 2 +- lib/notifier.php | 2 +- lib/preview.php | 2 +- lib/remoteinstance.php | 2 +- lib/templatemanager.php | 2 +- lib/version.php | 2 +- lib/versionmanager.php | 2 +- settings.php | 2 +- templates/editor.php | 2 +- templates/settings.php | 2 +- 41 files changed, 41 insertions(+), 41 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index c2e1e0ef..bb6cf568 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,7 +1,7 @@ Date: Tue, 7 Feb 2023 13:44:37 +0300 Subject: [PATCH 04/27] fix public folder (ffffa62cf175db2ebec18291a8da2968649be242) --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 0bbec536..e69bb93b 100644 --- a/js/main.js +++ b/js/main.js @@ -109,7 +109,7 @@ winEditor.location.href = url; } else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.mobile || OCA.Onlyoffice.Desktop) { winEditor = window.open(url, "_blank"); - } else if ($("#isPublic").val() === "1" && !$("#filestable").length) { + } else if ($("#isPublic").val() === "1" && $("#mimetype").val() !== "httpd/unix-directory") { location.href = url; } else { var $iframe = $("