diff options
-rw-r--r-- | apps/files/lib/Controller/ApiController.php | 5 | ||||
-rw-r--r-- | apps/files_external/lib/Service/DBConfigService.php | 46 | ||||
-rw-r--r-- | apps/files_sharing/css/mobile.scss | 2 | ||||
-rw-r--r-- | apps/files_sharing/css/public.scss | 2 | ||||
-rw-r--r-- | apps/twofactor_backupcodes/appinfo/info.xml | 4 | ||||
-rwxr-xr-x | autotest-checkers.sh | 3 | ||||
-rw-r--r-- | core/css/apps.scss | 15 | ||||
-rw-r--r-- | core/css/mobile.scss | 4 | ||||
-rw-r--r-- | core/css/variables.scss | 5 | ||||
-rw-r--r-- | lib/private/Security/Crypto.php | 14 | ||||
-rw-r--r-- | lib/private/Settings/Manager.php | 2 | ||||
-rw-r--r-- | lib/public/Security/ICrypto.php | 1 | ||||
-rw-r--r-- | settings/css/settings.scss | 2 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesSharingAppContext.php | 2 |
14 files changed, 66 insertions, 41 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 3085b72ac7a..a967c8bd7bb 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -320,8 +320,9 @@ class ApiController extends Controller { * * @NoAdminRequired * - * @param String - * @return String + * @param string + * @return string + * @throws \OCP\Files\NotFoundException */ public function getNodeType($folderpath) { $node = $this->userFolder->get($folderpath); diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index c986acbaa5d..65995b21cc4 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -25,6 +25,7 @@ namespace OCA\Files_External\Service; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\Security\ICrypto; @@ -300,12 +301,15 @@ class DBConfigService { if ($key === 'password') { $value = $this->encryptValue($value); } - $count = $this->connection->insertIfNotExist('*PREFIX*external_config', [ - 'mount_id' => $mountId, - 'key' => $key, - 'value' => $value - ], ['mount_id', 'key']); - if ($count === 0) { + + try { + $builder = $this->connection->getQueryBuilder(); + $builder->insert('external_config') + ->setValue('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)) + ->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)) + ->setValue('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)) + ->execute(); + } catch(UniqueConstraintViolationException $e) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_config') ->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)) @@ -321,13 +325,14 @@ class DBConfigService { * @param string $value */ public function setOption($mountId, $key, $value) { - - $count = $this->connection->insertIfNotExist('*PREFIX*external_options', [ - 'mount_id' => $mountId, - 'key' => $key, - 'value' => json_encode($value) - ], ['mount_id', 'key']); - if ($count === 0) { + try { + $builder = $this->connection->getQueryBuilder(); + $builder->insert('external_options') + ->setValue('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)) + ->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)) + ->setValue('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR)) + ->execute(); + } catch(UniqueConstraintViolationException $e) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_options') ->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR)) @@ -338,11 +343,16 @@ class DBConfigService { } public function addApplicable($mountId, $type, $value) { - $this->connection->insertIfNotExist('*PREFIX*external_applicable', [ - 'mount_id' => $mountId, - 'type' => $type, - 'value' => $value - ], ['mount_id', 'type', 'value']); + try { + $builder = $this->connection->getQueryBuilder(); + $builder->insert('external_applicable') + ->setValue('mount_id', $builder->createNamedParameter($mountId)) + ->setValue('type', $builder->createNamedParameter($type)) + ->setValue('value', $builder->createNamedParameter($value)) + ->execute(); + } catch(UniqueConstraintViolationException $e) { + // applicable exists already + } } public function removeApplicable($mountId, $type, $value) { diff --git a/apps/files_sharing/css/mobile.scss b/apps/files_sharing/css/mobile.scss index 3aaa5718cab..0202fdd08d1 100644 --- a/apps/files_sharing/css/mobile.scss +++ b/apps/files_sharing/css/mobile.scss @@ -1,4 +1,4 @@ -@media only screen and (max-width: 768px) { +@media only screen and (max-width: $breakpoint-mobile) { /* make header scroll up for single shares, more view of content on small screens */ #header.share-file { diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss index c31b4f82bed..9d752115c59 100644 --- a/apps/files_sharing/css/public.scss +++ b/apps/files_sharing/css/public.scss @@ -207,7 +207,7 @@ thead { } // hide the primary on public share on mobile -@media only screen and (max-width: 768px) { +@media only screen and (max-width: $breakpoint-mobile) { #body-public { .header-right { #header-primary-action { diff --git a/apps/twofactor_backupcodes/appinfo/info.xml b/apps/twofactor_backupcodes/appinfo/info.xml index fd575ec12bb..b28f75254b6 100644 --- a/apps/twofactor_backupcodes/appinfo/info.xml +++ b/apps/twofactor_backupcodes/appinfo/info.xml @@ -26,10 +26,6 @@ <provider>OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider</provider> </two-factor-providers> - <settings> - <personal>OCA\TwoFactorBackupCodes\Settings\Personal</personal> - </settings> - <activity> <providers> <provider>OCA\TwoFactorBackupCodes\Activity\Provider</provider> diff --git a/autotest-checkers.sh b/autotest-checkers.sh index 96525655fe1..dcf864ee850 100755 --- a/autotest-checkers.sh +++ b/autotest-checkers.sh @@ -40,7 +40,4 @@ done; php ./build/files-checker.php RESULT=$(($RESULT+$?)) -php ./build/signed-off-checker.php -RESULT=$(($RESULT+$?)) - exit $RESULT diff --git a/core/css/apps.scss b/core/css/apps.scss index b7afc19705d..039374bf726 100644 --- a/core/css/apps.scss +++ b/core/css/apps.scss @@ -599,6 +599,14 @@ kbd { /* APP-CONTENT AND WRAPPER ------------------------------------------ */ /* Part where the content will be loaded into */ + +/** + * !Important. We are defining the minimum requirement we want for flex + * Just before the mobile breakpoint we have $breakpoint-mobile (768px) - $navigation-width + * -> 468px. In that case we want 200px for the list and 268px for the content + */ +$min-content-width: $breakpoint-mobile - $navigation-width - $list-min-width; + #app-content { z-index: 1000; background-color: var(--color-main-background); @@ -626,7 +634,7 @@ kbd { /* CONTENT DETAILS AFTER LIST*/ .app-content-details { /* grow full width */ - flex-grow: 1; + flex: 1 1 $min-content-width; #app-navigation-toggle-back { display: none; } @@ -1100,7 +1108,6 @@ $popovericon-size: 16px; /* CONTENT LIST ------------------------------------------------------------ */ .app-content-list { - max-width: 300px; @include position('sticky'); top: $header-height; border-right: 1px solid var(--color-border); @@ -1111,7 +1118,9 @@ $popovericon-size: 16px; max-height: calc(100vh - #{$header-height}); overflow-y: auto; overflow-x: hidden; - flex: 0 1 300px; + flex: 1 1 $list-min-width; + min-width: $list-min-width; + max-width: $list-max-width; /* Default item */ .app-content-list-item { diff --git a/core/css/mobile.scss b/core/css/mobile.scss index f7f3827eba5..3e21672df82 100644 --- a/core/css/mobile.scss +++ b/core/css/mobile.scss @@ -1,4 +1,4 @@ -@media only screen and (max-width: 768px) { +@media only screen and (max-width: $breakpoint-mobile) { /* position share dropdown */ #dropdown { @@ -114,7 +114,7 @@ display: none; } #body-settings #controls { - min-width: 768px !important; + min-width: $breakpoint-mobile !important; } /* do not show dates in filepicker */ diff --git a/core/css/variables.scss b/core/css/variables.scss index a827629479c..2ec9ba333b4 100644 --- a/core/css/variables.scss +++ b/core/css/variables.scss @@ -87,3 +87,8 @@ $header-height: 50px; $navigation-width: 300px; $sidebar-min-width: 300px; $sidebar-max-width: 500px; +$list-min-width: 200px; +$list-max-width: 300px; + +// mobile +$breakpoint-mobile: 768px; diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index 04d618bf373..876f159950c 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -108,15 +108,16 @@ class Crypto implements ICrypto { * @param string $password Password to encrypt, if not specified the secret from config.php will be taken * @return string plaintext * @throws \Exception If the HMAC does not match + * @throws \Exception If the decryption failed */ public function decrypt(string $authenticatedCiphertext, string $password = ''): string { - if($password === '') { + if ($password === '') { $password = $this->config->getSystemValue('secret'); } $this->cipher->setPassword($password); $parts = explode('|', $authenticatedCiphertext); - if(\count($parts) !== 3) { + if (\count($parts) !== 3) { throw new \Exception('Authenticated ciphertext could not be decoded.'); } @@ -126,11 +127,16 @@ class Crypto implements ICrypto { $this->cipher->setIV($iv); - if(!hash_equals($this->calculateHMAC($parts[0].$parts[1], $password), $hmac)) { + if (!hash_equals($this->calculateHMAC($parts[0] . $parts[1], $password), $hmac)) { throw new \Exception('HMAC does not match.'); } - return $this->cipher->decrypt($ciphertext); + $result = $this->cipher->decrypt($ciphertext); + if ($result === false) { + throw new \Exception('Decryption failed'); + } + + return $result; } } diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 036f1ed594f..42ec16e223b 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -167,7 +167,7 @@ class Manager implements IManager { } if (!$setting instanceof ISettings) { - $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]); + $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered (' . $class . ')'), ['level' => ILogger::INFO]); continue; } diff --git a/lib/public/Security/ICrypto.php b/lib/public/Security/ICrypto.php index ef5bd2bf7c9..3e17d461b64 100644 --- a/lib/public/Security/ICrypto.php +++ b/lib/public/Security/ICrypto.php @@ -60,6 +60,7 @@ interface ICrypto { * @param string $password Password to encrypt, if not specified the secret from config.php will be taken * @return string plaintext * @throws \Exception If the HMAC does not match + * @throws \Exception If the decryption failed * @since 8.0.0 */ public function decrypt(string $authenticatedCiphertext, string $password = ''): string; diff --git a/settings/css/settings.scss b/settings/css/settings.scss index a7dbe0e7d8f..be1c6a08b68 100644 --- a/settings/css/settings.scss +++ b/settings/css/settings.scss @@ -905,7 +905,7 @@ span.version { } } -@media only screen and (max-width: 768px) { +@media only screen and (max-width: $breakpoint-mobile) { .store .section { width: 50%; } diff --git a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php index fc589a84ac6..4be1ddf22c1 100644 --- a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php @@ -198,7 +198,7 @@ class FilesSharingAppContext implements Context, ActorAwareInterface { PHPUnit_Framework_Assert::fail("The Share menu is not visible yet after $timeout seconds"); } - // The acceptance tests are run in a window wider than 768px, so the + // The acceptance tests are run in a window wider than the mobile breakpoint, so the // download item should not be shown in the menu (although it will be in // the DOM). PHPUnit_Framework_Assert::assertFalse( |