diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 59d6d1a..7434caa 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,7 +32,8 @@ jobs: fail-fast: false matrix: php-versions: [ '8.1' ] - server-versions: [ 'master', 'stable29', 'stable28' ] + #server-versions: [ 'stable30', 'stable29', 'stable28' ] + server-versions: [ 'stable30' ] name: Integration test @@ -42,7 +43,7 @@ jobs: with: path: server repository: nextcloud/server - ref: + ref: ${{ matrix.server-versions }} - name: Checkout app uses: actions/checkout@v3 @@ -81,6 +82,8 @@ jobs: working-directory: server/ env: DROPBOX_CONFIG: ${{ secrets.DROPBOX_CONFIG }} + OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} + OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} run: | echo $DROPBOX_CONFIG > config.json sudo apt install jq sqlite3 @@ -88,12 +91,15 @@ jobs: sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'token', $(cat config.json | jq '.config.token'));" sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'refresh_token', $(cat config.json | jq '.config.refresh_token'));" sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'importing_dropbox', '1');" + sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_id', '$OAUTH_CLIENT_ID');" + sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_secret', '$OAUTH_CLIENT_SECRET');" - name: Run import working-directory: server/ run: | php occ integration_dropbox:start-import admin - for run in {1..10}; do php cron.php; done + for run in {1..10}; do date; echo "run $run starting"; php cron.php; ls -lh data/admin/files/Dropbox\ import/ ; echo "run $run done"; done + date - name: Check import result working-directory: server/ @@ -108,10 +114,12 @@ jobs: EOM diff result.expected.txt result.txt cat > du-sh.expected.txt <<- EOM - 1.5G data/admin/files/Dropbox import/ + 1.6G data/admin/files/Dropbox import/ EOM + echo CHECK + du -sh data/admin/files/Dropbox\ import/* + echo END CHECK du -sh data/admin/files/Dropbox\ import/ | diff du-sh.expected.txt - - - name: Show log on failure working-directory: server/ diff --git a/lib/Command/StartImport.php b/lib/Command/StartImport.php index 05b11b9..ca37d30 100644 --- a/lib/Command/StartImport.php +++ b/lib/Command/StartImport.php @@ -36,7 +36,7 @@ protected function configure() { */ protected function execute(InputInterface $input, OutputInterface $output): int { try { - $this->dropboxStorageAPIService->importDropboxJob($input->getArgument('user_id')); + $this->dropboxStorageAPIService->startImportDropbox($input->getArgument('user_id')); } catch (\Exception $ex) { $output->writeln('Failed to start import'); $output->writeln($ex->getMessage()); diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 9a96904..63f32cc 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -65,6 +65,7 @@ public function setConfig(array $values): DataResponse { $this->config->deleteUserValue($this->userId, Application::APP_ID, 'user_name'); $this->config->deleteUserValue($this->userId, Application::APP_ID, 'uid'); $this->config->deleteUserValue($this->userId, Application::APP_ID, 'account_id'); + $this->config->deleteUserValue($this->userId, Application::APP_ID, 'email'); $this->config->deleteUserValue($this->userId, Application::APP_ID, 'token'); $this->config->deleteUserValue($this->userId, Application::APP_ID, 'refresh_token'); } @@ -123,6 +124,9 @@ public function submitAccessCode(string $code = ''): DataResponse { if (isset($result['email'])) { $this->config->setUserValue($this->userId, Application::APP_ID, 'email', $result['email']); $data['email'] = $result['email']; + } elseif (isset($info['email'])) { + $this->config->setUserValue($this->userId, Application::APP_ID, 'email', $info['email']); + $data['email'] = $info['email']; } if (isset($info['name'], $info['name']['display_name'])) { $this->config->setUserValue($this->userId, Application::APP_ID, 'user_name', $info['name']['display_name']); diff --git a/src/components/PersonalSettings.vue b/src/components/PersonalSettings.vue index 4218a4f..ff02cdf 100644 --- a/src/components/PersonalSettings.vue +++ b/src/components/PersonalSettings.vue @@ -205,6 +205,8 @@ export default { methods: { onLogoutClick() { this.state.user_name = '' + this.state.email = null + this.state.account_id = null this.saveOptions({ user_name: this.state.user_name }) }, onAccessCodeInput() { diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index a1f1d6d..300dde7 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -7,6 +7,7 @@ +