diff options
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/auth/oauth1/oauth1.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/auth/oauth2/oauth2.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/auth/publickey/rsa.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/backend/dropbox.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/backend/google.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/backend/legacybackend.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/frontenddefinitiontrait.php | 22 |
7 files changed, 21 insertions, 11 deletions
diff --git a/apps/files_external/lib/auth/oauth1/oauth1.php b/apps/files_external/lib/auth/oauth1/oauth1.php index dd83c9a6a69..808681530ea 100644 --- a/apps/files_external/lib/auth/oauth1/oauth1.php +++ b/apps/files_external/lib/auth/oauth1/oauth1.php @@ -46,7 +46,7 @@ class OAuth1 extends AuthMechanism { (new DefinitionParameter('token_secret', 'token_secret')) ->setType(DefinitionParameter::VALUE_HIDDEN), ]) - ->setCustomJs('oauth1') + ->addCustomJs('oauth1') ; } diff --git a/apps/files_external/lib/auth/oauth2/oauth2.php b/apps/files_external/lib/auth/oauth2/oauth2.php index c89007b52ba..d4bba8ef0eb 100644 --- a/apps/files_external/lib/auth/oauth2/oauth2.php +++ b/apps/files_external/lib/auth/oauth2/oauth2.php @@ -44,7 +44,7 @@ class OAuth2 extends AuthMechanism { (new DefinitionParameter('token', 'token')) ->setType(DefinitionParameter::VALUE_HIDDEN), ]) - ->setCustomJs('oauth2') + ->addCustomJs('oauth2') ; } diff --git a/apps/files_external/lib/auth/publickey/rsa.php b/apps/files_external/lib/auth/publickey/rsa.php index 9045f6818f9..7732beeddf8 100644 --- a/apps/files_external/lib/auth/publickey/rsa.php +++ b/apps/files_external/lib/auth/publickey/rsa.php @@ -52,7 +52,7 @@ class RSA extends AuthMechanism { (new DefinitionParameter('private_key', 'private_key')) ->setType(DefinitionParameter::VALUE_HIDDEN), ]) - ->setCustomJs('public_key') + ->addCustomJs('public_key') ; } diff --git a/apps/files_external/lib/backend/dropbox.php b/apps/files_external/lib/backend/dropbox.php index f9156082515..2133c274996 100644 --- a/apps/files_external/lib/backend/dropbox.php +++ b/apps/files_external/lib/backend/dropbox.php @@ -44,6 +44,7 @@ class Dropbox extends Backend { // all parameters handled in OAuth1 mechanism ]) ->addAuthScheme(AuthMechanism::SCHEME_OAUTH1) + ->addCustomJs('dropbox') ->setLegacyAuthMechanism($legacyAuth) ; } diff --git a/apps/files_external/lib/backend/google.php b/apps/files_external/lib/backend/google.php index b2b48a0e402..b18b7bdb348 100644 --- a/apps/files_external/lib/backend/google.php +++ b/apps/files_external/lib/backend/google.php @@ -44,6 +44,7 @@ class Google extends Backend { // all parameters handled in OAuth2 mechanism ]) ->addAuthScheme(AuthMechanism::SCHEME_OAUTH2) + ->addCustomJs('gdrive') ->setLegacyAuthMechanism($legacyAuth) ; } diff --git a/apps/files_external/lib/backend/legacybackend.php b/apps/files_external/lib/backend/legacybackend.php index 084758ff78a..752c501e1ec 100644 --- a/apps/files_external/lib/backend/legacybackend.php +++ b/apps/files_external/lib/backend/legacybackend.php @@ -84,7 +84,7 @@ class LegacyBackend extends Backend { $this->setPriority($definition['priority']); } if (isset($definition['custom'])) { - $this->setCustomJs($definition['custom']); + $this->addCustomJs($definition['custom']); } if (isset($definition['has_dependencies']) && $definition['has_dependencies']) { $this->hasDependencies = true; diff --git a/apps/files_external/lib/frontenddefinitiontrait.php b/apps/files_external/lib/frontenddefinitiontrait.php index 9f2b7c40f7f..ccc2a75fd1b 100644 --- a/apps/files_external/lib/frontenddefinitiontrait.php +++ b/apps/files_external/lib/frontenddefinitiontrait.php @@ -36,8 +36,8 @@ trait FrontendDefinitionTrait { /** @var DefinitionParameter[] parameters for mechanism */ private $parameters = []; - /** @var string|null custom JS */ - private $customJs = null; + /** @var string[] custom JS */ + private $customJs = []; /** * @return string @@ -92,7 +92,7 @@ trait FrontendDefinitionTrait { } /** - * @return string|null + * @return string[] */ public function getCustomJs() { return $this->customJs; @@ -102,8 +102,18 @@ trait FrontendDefinitionTrait { * @param string $custom * @return self */ + public function addCustomJs($custom) { + $this->customJs[] = $custom; + return $this; + } + + /** + * @param string $custom + * @return self + * @deprecated 9.1.0, use addCustomJs() instead + */ public function setCustomJs($custom) { - $this->customJs = $custom; + $this->customJs = [$custom]; return $this; } @@ -121,10 +131,8 @@ trait FrontendDefinitionTrait { $data = [ 'name' => $this->getText(), 'configuration' => $configuration, + 'custom' => $this->getCustomJs(), ]; - if (isset($this->customJs)) { - $data['custom'] = $this->getCustomJs(); - } return $data; } |