diff options
-rw-r--r-- | appinfo/routes.php | 48 | ||||
-rw-r--r-- | js/service/registration.js | 56 | ||||
-rw-r--r-- | js/view/settings.vue | 35 | ||||
-rw-r--r-- | lib/AppInfo/Application.php | 3 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 114 | ||||
-rw-r--r-- | lib/PhoneNumberMask.php | 39 | ||||
-rw-r--r-- | lib/Provider/SmsProvider.php | 16 | ||||
-rw-r--r-- | lib/Provider/State.php | 49 | ||||
-rw-r--r-- | lib/Service/SetupService.php | 49 | ||||
-rw-r--r-- | lib/Service/SmsProvider/TestGateway.php | 43 | ||||
-rw-r--r-- | package-lock.json | 249 | ||||
-rw-r--r-- | package.json | 1 |
12 files changed, 537 insertions, 165 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php new file mode 100644 index 0000000..eff4857 --- /dev/null +++ b/appinfo/routes.php @@ -0,0 +1,48 @@ +<?php + +/** + * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 201 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +return [ + 'routes' => [ + [ + 'name' => 'settings#getVerificationState', + 'url' => '/settings/verification', + 'verb' => 'GET' + ], + [ + 'name' => 'settings#startVerification', + 'url' => '/settings/verification/start', + 'verb' => 'POST' + ], + [ + 'name' => 'settings#finishVerification', + 'url' => '/settings/verification/finish', + 'verb' => 'POST' + ], + [ + 'name' => 'settings#revokeVerification', + 'url' => '/settings/verification', + 'verb' => 'DELETE' + ], + ] +]; diff --git a/js/service/registration.js b/js/service/registration.js index be9f019..eee2dd4 100644 --- a/js/service/registration.js +++ b/js/service/registration.js @@ -1,17 +1,55 @@ import $ from 'jquery'; +import fetch from 'nextcloud_fetch'; + +export function getState() { + let url = OC.generateUrl('/apps/twofactor_sms/settings/verification') + + return fetch(url, { + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + } + }).then(function (resp) { + if (resp.ok) { + return resp.json(); + } + throw resp; + }) +} export function startVerification() { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(); - }, 2000); + let url = OC.generateUrl('/apps/twofactor_sms/settings/verification/start') + + return fetch(url, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + } + }).then(function (resp) { + if (resp.ok) { + return resp.json(); + } + throw resp; }) } -export function tryVerification() { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(); - }, 2000); +export function tryVerification(code) { + let url = OC.generateUrl('/apps/twofactor_sms/settings/verification/finish') + + return fetch(url, { + method: 'POST', + body: JSON.stringify({ + verificationCode: code + }), + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + } + }).then(function (resp) { + if (resp.ok) { + return resp.json(); + } + throw resp; }) } diff --git a/js/view/settings.vue b/js/view/settings.vue index 5992105..b58f7ee 100644 --- a/js/view/settings.vue +++ b/js/view/settings.vue @@ -24,37 +24,50 @@ <script> import l10n from "view/l10n.vue"; -import { startVerification, tryVerification } from "service/registration"; +import { + getState, + startVerification, + tryVerification +} from "service/registration"; export default { data() { return { - loading: false, + loading: true, state: 0, phoneNumber: "12344556", confirmationCode: "" }; }, + mounted: function() { + getState() + .then(res => { + this.state = res.state; + this.phoneNumber = res.phoneNumber; + this.loading = false; + }) + .catch(console.error.bind(this)); + }, methods: { enable: function() { this.loading = true; - startVerification().then( - function() { + startVerification() + .then(res => { this.state = 1; + this.phoneNumber = res.phoneNumber; this.loading = false; - }.bind(this) - ); + }) + .catch(console.error.bind(this)); }, confirm: function() { this.loading = true; - console.error(this.confirmationCode); - tryVerification().then( - function() { + tryVerification(this.confirmationCode) + .then(res => { this.state = 2; this.loading = false; - }.bind(this) - ); + }) + .catch(console.error.bind(this)); } }, components: { diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 233dfe3..e0bd1ae 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -28,6 +28,7 @@ use OCA\TwoFactorSms\Service\ISmsService; use OCA\TwoFactorSms\Service\SmsProvider\PlaySMS; use OCA\TwoFactorSms\Service\SmsProvider\SignalGateway; use OCA\TwoFactorSms\Service\SmsProvider\Telegram; +use OCA\TwoFactorSms\Service\SmsProvider\TestGateway; use OCA\TwoFactorSms\Service\SmsProvider\WebSmsDe; use OCP\AppFramework\App; use OCP\IConfig; @@ -63,6 +64,8 @@ class Application extends App { return SignalGateway::class; case 'telegram': return Telegram::class; + case 'test': + return TestGateway::class; case 'websms.de': return WebSmsDe::class; } diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php new file mode 100644 index 0000000..660cb54 --- /dev/null +++ b/lib/Controller/SettingsController.php @@ -0,0 +1,114 @@ +<?php + +/** + * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 201 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\TwoFactorSms\Controller; + +use OCA\TwoFactorSms\Exception\VerificationException; +use OCA\TwoFactorSms\PhoneNumberMask; +use OCA\TwoFactorSms\Service\SetupService; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\JSONResponse; +use OCP\IRequest; +use OCP\IUserSession; + +class SettingsController extends Controller { + + /** @var IUserSession */ + private $userSession; + + /** @var SetupService */ + private $setup; + + public function __construct(IRequest $request, IUserSession $userSession, + SetupService $setup) { + parent::__construct('twofactor_sms', $request); + + $this->userSession = $userSession; + $this->setup = $setup; + } + + /** + * @NoAdminRequired + */ + public function getVerificationState(): JSONResponse { + $user = $this->userSession->getUser(); + + if (is_null($user)) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + return new JSONResponse($this->setup->getState($user)); + } + + /** + * @NoAdminRequired + */ + public function startVerification(): JSONResponse { + $user = $this->userSession->getUser(); + + if (is_null($user)) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + $num = $this->setup->startSetup($user); + + return new JSONResponse([ + 'phoneNumber' => PhoneNumberMask::maskNumber($num), + ]); + } + + /** + * @NoAdminRequired + */ + public function finishVerification(string $verificationCode): JSONResponse { + $user = $this->userSession->getUser(); + + if (is_null($user)) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + try { + $this->setup->finishSetup($user, $verificationCode); + } catch (VerificationException $ex) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + return new JSONResponse([]); + } + + /** + * @NoAdminRequired + */ + public function revokeVerification(): JSONResponse { + $user = $this->userSession->getUser(); + + if (is_null($user)) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + return new JSONResponse([]); + } + +} diff --git a/lib/PhoneNumberMask.php b/lib/PhoneNumberMask.php new file mode 100644 index 0000000..6113ff1 --- /dev/null +++ b/lib/PhoneNumberMask.php @@ -0,0 +1,39 @@ +<?php + +/** + * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\TwoFactorSms; + +class PhoneNumberMask { + + /** + * convert 123456789 to ******789 + */ + public static function maskNumber(string $number): string { + $length = strlen($number); + $start = $length - 3; + + return str_repeat('*', $start) . substr($number, $start); + } + +} diff --git a/lib/Provider/SmsProvider.php b/lib/Provider/SmsProvider.php index a0dfcba..f5dc0ce 100644 --- a/lib/Provider/SmsProvider.php +++ b/lib/Provider/SmsProvider.php @@ -25,6 +25,7 @@ namespace OCA\TwoFactorSms\Provider; use OCA\TwoFactorSms\Exception\PhoneNumberMismatchException; use OCA\TwoFactorSms\Exception\SmsTransmissionException; +use OCA\TwoFactorSms\PhoneNumberMask; use OCA\TwoFactorSms\Service\ISmsService; use OCA\TwoFactorSms\Service\SetupService; use OCP\Authentication\TwoFactorAuth\IProvider; @@ -37,6 +38,9 @@ use OCP\Template; class SmsProvider implements IProvider { + const STATE_DISABLED = 0; + const STATE_VERIFYING = 1; + const STATE_ENABLED = 2; const SESSION_KEY = 'twofactor_sms_secret'; /** @var ISmsService */ @@ -115,7 +119,7 @@ class SmsProvider implements IProvider { } $tmpl = new Template('twofactor_sms', 'challenge'); - $tmpl->assign('phone', $this->protectPhoneNumber($phoneNumber)); + $tmpl->assign('phone', PhoneNumberMask::maskNumber($phoneNumber)); if ($this->config->getSystemValue('debug', false)) { $tmpl->assign('secret', $secret); } @@ -123,16 +127,6 @@ class SmsProvider implements IProvider { } /** - * convert 123456789 to ******789 - */ - private function protectPhoneNumber(string $number): string { - $length = strlen($number); - $start = $length - 3; - - return str_repeat('*', $start) . substr($number, $start); - } - - /** * Verify the given challenge */ public function verifyChallenge(IUser $user, string $challenge): bool { diff --git a/lib/Provider/State.php b/lib/Provider/State.php new file mode 100644 index 0000000..c7467b0 --- /dev/null +++ b/lib/Provider/State.php @@ -0,0 +1,49 @@ +<?php + +/** + * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\TwoFactorSms\Provider; + +use JsonSerializable; + +class State implements JsonSerializable { + + /** @var int */ + private $state; + + /** @var string */ + private $phoneNumber; + + public function __construct(int $state, string $phoneNumber = null) { + $this->state = $state; + $this->phoneNumber = $phoneNumber; + } + + public function jsonSerialize() { + return [ + 'state' => $this->state, + 'phoneNumber' => $this->phoneNumber, + ]; + } + +} diff --git a/lib/Service/SetupService.php b/lib/Service/SetupService.php index b1030cb..eae80be 100644 --- a/lib/Service/SetupService.php +++ b/lib/Service/SetupService.php @@ -32,6 +32,8 @@ use OCA\TwoFactorSms\Exception\PhoneNumberMissingException; use OCA\TwoFactorSms\Exception\SmsTransmissionException; use OCA\TwoFactorSms\Exception\VerificationException; use OCA\TwoFactorSms\Exception\VerificationTransmissionException; +use OCA\TwoFactorSms\Provider\SmsProvider; +use OCA\TwoFactorSms\Provider\State; use OCP\IConfig; use OCP\IUser; use OCP\Security\ISecureRandom; @@ -50,20 +52,30 @@ class SetupService { /** @var ISecureRandom */ private $random; - public function __construct(IConfig $config, AccountManager $accountManager, ISmsService $smsService, - ISecureRandom $random) { + public function __construct(IConfig $config, AccountManager $accountManager, + ISmsService $smsService, ISecureRandom $random) { $this->config = $config; $this->accountManager = $accountManager; $this->smsService = $smsService; $this->random = $random; } + public function getState(IUser $user): State { + $state = $this->config->getUserValue($user->getUID(), Application::APP_NAME, + 'verified', 'false') === 'true' ? SmsProvider::STATE_ENABLED : SmsProvider::STATE_DISABLED; + $verifiedNumber = $this->config->getUserValue($user->getUID(), + 'twofactor_sms', 'phone', null); + + return new State($state, $verifiedNumber); + } + /** * @throws PhoneNumberMissingException */ public function getChallengePhoneNumber(IUser $user): string { $numerFromUserData = $this->getVerificationPhoneNumber($user); - $verifiedNumber = $this->config->getUserValue($user->getUID(), 'twofactor_sms', 'phone', null); + $verifiedNumber = $this->config->getUserValue($user->getUID(), + 'twofactor_sms', 'phone', null); if (is_null($verifiedNumber)) { throw new PhoneNumberMissingException('verified phone number is missing'); } @@ -85,31 +97,43 @@ class SetupService { throw new PhoneNumberMissingException('user did not set a phone number'); } - return $userData[AccountManager::PROPERTY_PHONE]['value']; + $num = $userData[AccountManager::PROPERTY_PHONE]['value']; + + if (is_null($num) || empty($num)) { + throw new PhoneNumberMissingException('phone number is empty'); + } + + return $num; } /** * Send out confirmation message and save current phone number in user settings * - * @param IUser $user * @throws PhoneNumberMissingException */ - public function startSetup(IUser $user) { + public function startSetup(IUser $user): string { $phoneNumber = $this->getVerificationPhoneNumber($user); $verificationNumber = $this->random->generate(6, ISecureRandom::CHAR_DIGITS); try { - $this->smsService->send($phoneNumber, "$verificationNumber is your Nextcloud verification code."); + $this->smsService->send($phoneNumber, + "$verificationNumber is your Nextcloud verification code."); } catch (SmsTransmissionException $ex) { throw new VerificationTransmissionException('could not send verification code'); } - $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'phone', $phoneNumber); - $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'verification_code', $verificationNumber); - $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'verified', 'false'); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'phone', + $phoneNumber); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, + 'verification_code', $verificationNumber); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, + 'verified', 'false'); + + return $phoneNumber; } public function finishSetup(IUser $user, string $token) { - $verificationNumber = $this->config->getUserValue($user->getUID(), Application::APP_NAME, 'verification_code', null); + $verificationNumber = $this->config->getUserValue($user->getUID(), + Application::APP_NAME, 'verification_code', null); if (is_null($verificationNumber)) { throw new Exception('no verification code set'); } @@ -118,7 +142,8 @@ class SetupService { throw new VerificationException('verification token mismatch'); } - $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'verified', 'true'); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, + 'verified', 'true'); } } diff --git a/lib/Service/SmsProvider/TestGateway.php b/lib/Service/SmsProvider/TestGateway.php new file mode 100644 index 0000000..a3f4595 --- /dev/null +++ b/lib/Service/SmsProvider/TestGateway.php @@ -0,0 +1,43 @@ +<?php + +/** + * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\TwoFactorSms\Service\SmsProvider; + +use OCA\TwoFactorSms\Service\ISmsService; +use OCP\ILogger; + +class TestGateway implements ISmsService { + + /** @var ILogger */ + private $logger; + + public function __construct(ILogger $logger) { + $this->logger = $logger; + } + + public function send(string $recipient, string $message) { + $this->logger->info("message to <$recipient>: $message"); + } + +} diff --git a/package-lock.json b/package-lock.json index 8536b1f..4a06219 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2963,8 +2963,8 @@ "dev": true, "optional": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" } }, "ansi-regex": { @@ -2984,8 +2984,8 @@ "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.2.9" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "asn1": { @@ -3029,7 +3029,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "block-stream": { @@ -3037,7 +3037,7 @@ "bundled": true, "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "boom": { @@ -3045,7 +3045,7 @@ "bundled": true, "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "brace-expansion": { @@ -3053,7 +3053,7 @@ "bundled": true, "dev": true, "requires": { - "balanced-match": "0.4.2", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" } }, @@ -3084,7 +3084,7 @@ "bundled": true, "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "concat-map": { @@ -3107,7 +3107,7 @@ "bundled": true, "dev": true, "requires": { - "boom": "2.10.1" + "boom": "2.x.x" } }, "dashdash": { @@ -3116,7 +3116,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -3164,7 +3164,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "extend": { @@ -3204,10 +3204,10 @@ "bundled": true, "dev": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "fstream-ignore": { @@ -3216,9 +3216,9 @@ "dev": true, "optional": true, "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" } }, "gauge": { @@ -3227,14 +3227,14 @@ "dev": true, "optional": true, "requires": { - "aproba": "1.1.1", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "getpass": { @@ -3243,7 +3243,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -3259,12 +3259,12 @@ "bundled": true, "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-fs": { @@ -3298,10 +3298,10 @@ "bundled": true, "dev": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" } }, "hoek": { @@ -3315,9 +3315,9 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.0" + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { @@ -3325,8 +3325,8 @@ "bundled": true, "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -3370,7 +3370,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "jsbn": { @@ -3391,7 +3391,7 @@ "dev": true, "optional": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -3465,17 +3465,17 @@ "dev": true, "optional": true, "requires": { - "detect-libc": "1.0.2", + "detect-libc": "^1.0.2", "hawk": "3.1.3", - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.0.2", + "rc": "^1.1.7", "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^2.2.1", + "tar-pack": "^3.4.0" } }, "nopt": { @@ -3494,10 +3494,10 @@ "dev": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { @@ -3519,7 +3519,7 @@ "bundled": true, "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -3576,10 +3576,10 @@ "dev": true, "optional": true, "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -3595,13 +3595,13 @@ "bundled": true, "dev": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.1", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" } }, "request": { @@ -3610,28 +3610,28 @@ "dev": true, "optional": true, "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" } }, "rimraf": { @@ -3639,7 +3639,7 @@ "bundled": true, "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -3670,7 +3670,7 @@ "bundled": true, "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "sshpk": { @@ -3679,15 +3679,15 @@ "dev": true, "optional": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jodid25519": "1.0.2", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jodid25519": "^1.0.0", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" }, "dependencies": { "assert-plus": { @@ -3703,9 +3703,9 @@ "bundled": true, "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -3713,7 +3713,7 @@ "bundled": true, "dev": true, "requires": { - "safe-buffer": "5.0.1" + "safe-buffer": "^5.0.1" } }, "stringstream": { @@ -3727,7 +3727,7 @@ "bundled": true, "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -3741,9 +3741,9 @@ "bundled": true, "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "tar-pack": { @@ -3752,14 +3752,14 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.2.9", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" + "debug": "^2.2.0", + "fstream": "^1.0.10", + "fstream-ignore": "^1.0.5", + "once": "^1.3.3", + "readable-stream": "^2.1.4", + "rimraf": "^2.5.1", + "tar": "^2.2.1", + "uid-number": "^0.0.6" } }, "tough-cookie": { @@ -3768,7 +3768,7 @@ "dev": true, "optional": true, "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" } }, "tunnel-agent": { @@ -3777,7 +3777,7 @@ "dev": true, "optional": true, "requires": { - "safe-buffer": "5.0.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -3818,7 +3818,7 @@ "dev": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { @@ -5652,6 +5652,11 @@ "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", "dev": true }, + "nextcloud_fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nextcloud_fetch/-/nextcloud_fetch-1.1.0.tgz", + "integrity": "sha512-SL6L2sBDx0xeDZ56IWJgbtRO3zbWZnYbiJkPp8HjCmo7zwnhyS/LwtgtmuWD63cLhiDZym5NEpPQdI6ceiDTLQ==" + }, "nice-try": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", diff --git a/package.json b/package.json index 6cf1f51..1c2e074 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "dependencies": { "css-loader": "^0.28.11", "jquery": "^3.3.1", + "nextcloud_fetch": "^1.1.0", "vue": "^2.5.16", "vue-loader": "^14.2.2", "vue-template-compiler": "^2.5.16" |