diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0b03e23 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/vendor-bin/**/composer.lock binary diff --git a/.github/workflows/appstore-build-publish.yml b/.github/workflows/appstore-build-publish.yml new file mode 100644 index 0000000..7da96c8 --- /dev/null +++ b/.github/workflows/appstore-build-publish.yml @@ -0,0 +1,172 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Build and publish app release + +on: + release: + types: [published] + +env: + PHP_VERSION: 8.1 + +jobs: + build_and_publish: + runs-on: ubuntu-latest + + # Only allowed to be run on nextcloud-releases repositories + if: ${{ github.repository_owner == 'nextcloud-releases' }} + + steps: + - name: Check actor permission + uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0 + with: + require: write + + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: ${{ env.APP_NAME }} + + - name: Get appinfo data + id: appinfo + uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master + with: + filename: ${{ env.APP_NAME }}/appinfo/info.xml + expression: "//info//dependencies//nextcloud/@min-version" + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 + id: versions + # Continue if no package.json + continue-on-error: true + with: + path: ${{ env.APP_NAME }} + fallbackNode: '^20' + fallbackNpm: '^10' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + # Skip if no package.json + if: ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + # Skip if no package.json + if: ${{ steps.versions.outputs.npmVersion }} + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" + + - name: Set up php ${{ env.PHP_VERSION }} + uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2 + with: + php-version: ${{ env.PHP_VERSION }} + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check composer.json + id: check_composer + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2 + with: + files: "${{ env.APP_NAME }}/composer.json" + + - name: Install composer dependencies + if: steps.check_composer.outputs.files_exists == 'true' + run: | + cd ${{ env.APP_NAME }} + composer install --no-dev + + - name: Build ${{ env.APP_NAME }} + # Skip if no package.json + if: ${{ steps.versions.outputs.nodeVersion }} + env: + CYPRESS_INSTALL_BINARY: 0 + run: | + cd ${{ env.APP_NAME }} + npm ci + npm run build + + - name: Check Krankerl config + id: krankerl + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2 + with: + files: ${{ env.APP_NAME }}/krankerl.toml + + - name: Install Krankerl + if: steps.krankerl.outputs.files_exists == 'true' + run: | + wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb + sudo dpkg -i krankerl_0.14.0_amd64.deb + + - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with krankerl + if: steps.krankerl.outputs.files_exists == 'true' + run: | + cd ${{ env.APP_NAME }} + krankerl package + + - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with makefile + if: steps.krankerl.outputs.files_exists != 'true' + run: | + cd ${{ env.APP_NAME }} + make appstore + + - name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }} + continue-on-error: true + id: server-checkout + run: | + NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }} + wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip + unzip latest-$NCVERSION.zip + + - name: Checkout server master fallback + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + if: ${{ steps.server-checkout.outcome != 'success' }} + with: + submodules: true + repository: nextcloud/server + path: nextcloud + + - name: Sign app + run: | + # Extracting release + cd ${{ env.APP_NAME }}/build/artifacts + tar -xvf ${{ env.APP_NAME }}.tar.gz + cd ../../../ + # Setting up keys + echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key + wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt" + # Signing + php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }} + # Rebuilding archive + cd ${{ env.APP_NAME }}/build/artifacts + tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }} + + - name: Attach tarball to github release + uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2 + id: attach_to_release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}.tar.gz + asset_name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}.tar.gz + tag: ${{ github.ref }} + overwrite: true + + - name: Upload app to Nextcloud appstore + uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1 + with: + app_name: ${{ env.APP_NAME }} + appstore_token: ${{ secrets.APPSTORE_TOKEN }} + download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7bfaa31..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,122 +0,0 @@ -on: - push: - branches: [release] - -name: Publish release - -jobs: - build: - name: Build, upload and release in the appstore - environment: release - env: - APP_ID: integration_gitlab - runs-on: ubuntu-latest - steps: - - name: Use Node 16 - uses: actions/setup-node@v2 - with: - node-version: 16 - - - name: Set up npm - run: npm i -g npm@^8.0.0 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.4' - extensions: mbstring, intl, sqlite3 - ini-values: post_max_size=256M, max_execution_time=180 - coverage: xdebug - tools: php-cs-fixer, phpunit - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Get current tag - id: tag - run: | - git fetch --tags --force - tag=$(git tag -l --points-at HEAD) - vtag=$(echo $tag | grep "^v[0-9]\+\.[0-9]\+\.[0-9]\+" || echo "") - echo "##[set-output name=currenttag;]$vtag" - - - name: Build project - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }} - id: build_release - run: | - echo "##[set-output name=app_id;]$APP_ID" - echo "###### copy certificate" - mkdir -p ~/.nextcloud/certificates - echo "$APP_CRT" > ~/.nextcloud/certificates/${APP_ID}.crt - echo "$APP_KEY" > ~/.nextcloud/certificates/${APP_ID}.key - echo "###### install dependencies" - export DEBIAN_FRONTEND=noninteractive - sudo apt update -y - sudo apt install make openssl -y - echo "###### installing nextcloud" - mkdir ~/html - git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master ~/html/nextcloud - sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' ~/html/nextcloud/lib/autoloader.php - cp -r $GITHUB_WORKSPACE ~/html/nextcloud/apps/${APP_ID} - php ~/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password" - php ~/html/nextcloud/occ app:enable ${APP_ID} - php ~/html/nextcloud/occ maintenance:mode --off - cd ~/html/nextcloud/apps/${APP_ID} - echo "###### npm install" - npm ci - echo "###### npm run build" - npm run build - echo "###### make appstore" - tag=${{ steps.tag.outputs.currenttag }} - version=${tag/v/} - webserveruser=runner occ_dir=~/html/nextcloud version=$version make appstore - echo "##[set-output name=version;]$version" - env: - APP_CRT: ${{ secrets.APP_CRT }} - APP_KEY: ${{ secrets.APP_KEY }} - - - name: Create Release - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }} - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tag.outputs.currenttag }} - release_name: ${{ steps.tag.outputs.currenttag }} - draft: false - prerelease: false - - - name: Upload Release Asset - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }} - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/build/${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz - asset_name: ${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz - asset_content_type: application/gzip - - - name: Publish normal release to appstore - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && !endsWith( steps.tag.outputs.currenttag , 'nightly' ) }} - id: publish - run: | - SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n') - VERSION=${{ steps.build_release.outputs.version }} - DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${APP_ID}-${VERSION}.tar.gz - curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'"}' - env: - APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }} - - - name: Publish nightly release to appstore - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && endsWith( steps.tag.outputs.currenttag , 'nightly' ) }} - id: nightly - run: | - SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n') - VERSION=${{ steps.build_release.outputs.version }} - DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${APP_ID}-${VERSION}.tar.gz - curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'", "nightly": true}' - env: - APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }} diff --git a/.nextcloudignore b/.nextcloudignore new file mode 100644 index 0000000..e7e2347 --- /dev/null +++ b/.nextcloudignore @@ -0,0 +1,37 @@ +.git +.github +.gitignore +.tx +.vscode +.php-cs-fixer.* +/.codecov.yml +/.eslintrc.js +/.gitattributes +/.gitignore +/.l10nignore +/.nextcloudignore +/.travis.yml +/.pre-commit-config.yaml +/babel.config.js +/build +/CODE_OF_CONDUCT.md +/composer.* +/node_modules +/screenshots +/src +/vendor +/vendor-bin +/jest.config.js +/Makefile +/makefile +/krankerl.toml +/package-lock.json +/package.json +/postcss.config.js +/psalm.xml +/pyproject.toml +/renovate.json +/stylelint.config.js +/webpack.config.js +/webpack.js +tests diff --git a/CHANGELOG.md b/CHANGELOG.md index d361dd4..b346e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## 2.0.1 - 2024-07-11 +### Added +- add .nextcloudignore and .gitattributes + +## 2.0.0 - 2024-07-11 +### Changed +- Remove unused endpoint @provokateurin +- update app build publish workflow @kyteinsky + +### Fixed +- Only send Oauth credentials to the right URLs @provokateurin + +### Added +- add krankerl.toml @kyteinsky + ## 1.0.12 – 2022-12-21 ### Changed - split issue/MR search provider in 2 diff --git a/appinfo/info.xml b/appinfo/info.xml index d131993..3908df5 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Integration of GitLab software development management service - 1.0.12 + 2.0.1 agpl Julien Veyssier Gitlab diff --git a/appinfo/routes.php b/appinfo/routes.php index be724e8..f22a074 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -19,7 +19,6 @@ ['name' => 'gitlabAPI#getEvents', 'url' => '/events', 'verb' => 'GET'], ['name' => 'gitlabAPI#getTodos', 'url' => '/todos', 'verb' => 'GET'], ['name' => 'gitlabAPI#markTodoAsDone', 'url' => '/todos/{id}/mark-done', 'verb' => 'PUT'], - ['name' => 'gitlabAPI#getGitlabUrl', 'url' => '/url', 'verb' => 'GET'], ['name' => 'gitlabAPI#getProjectAvatar', 'url' => '/avatar/project', 'verb' => 'GET'], ['name' => 'gitlabAPI#getUserAvatar', 'url' => '/avatar/user/{userId}', 'verb' => 'GET'], ] diff --git a/krankerl.toml b/krankerl.toml new file mode 100644 index 0000000..d7967b3 --- /dev/null +++ b/krankerl.toml @@ -0,0 +1,5 @@ +[package] +before_cmds = [ + "npm ci", + "npm run build", +] diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 2bf7030..0b9b249 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -173,8 +173,7 @@ public function oauthRedirect(string $code = '', string $state = ''): RedirectRe if ($clientID and $clientSecret and $configState !== '' and $configState === $state) { $redirect_uri = $this->config->getUserValue($this->userId, Application::APP_ID, 'redirect_uri'); $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; - $gitlabUrl = $this->config->getUserValue($this->userId, Application::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl; - $result = $this->gitlabAPIService->requestOAuthAccessToken($gitlabUrl, [ + $result = $this->gitlabAPIService->requestOAuthAccessToken($adminOauthUrl, [ 'client_id' => $clientID, 'client_secret' => $clientSecret, 'code' => $code, @@ -190,6 +189,7 @@ public function oauthRedirect(string $code = '', string $state = ''): RedirectRe $expiresAt = $nowTs + (int) $result['expires_in']; $this->config->setUserValue($this->userId, Application::APP_ID, 'token_expires_at', $expiresAt); } + $this->config->setUserValue($this->userId, Application::APP_ID, 'url', $adminOauthUrl); $this->config->setUserValue($this->userId, Application::APP_ID, 'token', $accessToken); $this->config->setUserValue($this->userId, Application::APP_ID, 'refresh_token', $refreshToken); $this->config->setUserValue($this->userId, Application::APP_ID, 'token_type', 'oauth'); diff --git a/lib/Controller/GitlabAPIController.php b/lib/Controller/GitlabAPIController.php index 8e2bc99..1a5b4e5 100644 --- a/lib/Controller/GitlabAPIController.php +++ b/lib/Controller/GitlabAPIController.php @@ -11,15 +11,15 @@ namespace OCA\Gitlab\Controller; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataDisplayResponse; +use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; use OCP\IConfig; use OCP\IRequest; -use OCP\AppFramework\Http\DataResponse; -use OCP\AppFramework\Controller; -use OCA\Gitlab\Service\GitlabAPIService; use OCA\Gitlab\AppInfo\Application; +use OCA\Gitlab\Service\GitlabAPIService; use OCP\IURLGenerator; class GitlabAPIController extends Controller { @@ -40,10 +40,6 @@ class GitlabAPIController extends Controller { * @var string */ private $accessToken; - /** - * @var string - */ - private $gitlabUrl; /** * @var IURLGenerator */ @@ -60,21 +56,9 @@ public function __construct(string $appName, $this->gitlabAPIService = $gitlabAPIService; $this->userId = $userId; $this->accessToken = $this->config->getUserValue($this->userId, Application::APP_ID, 'token'); - $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; - $this->gitlabUrl = $this->config->getUserValue($this->userId, Application::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl; $this->urlGenerator = $urlGenerator; } - /** - * get notification list - * @NoAdminRequired - * - * @return DataResponse - */ - public function getGitlabUrl(): DataResponse { - return new DataResponse($this->gitlabUrl); - } - /** * get gitlab user avatar * @NoAdminRequired diff --git a/lib/Reference/GitlabReferenceProvider.php b/lib/Reference/GitlabReferenceProvider.php index 7ec35d1..ce25126 100644 --- a/lib/Reference/GitlabReferenceProvider.php +++ b/lib/Reference/GitlabReferenceProvider.php @@ -54,7 +54,13 @@ private function getGitlabUrls(): array { //if ($this->userId === null) { // return ['https://gitlab.com']; //} - $urls = [$this->gitlabAPIService->getConnectedGitlabUrl($this->userId)]; + $urls = []; + $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; + if ($this->userId !== null) { + $urls[] = $this->config->getUserValue($this->userId, Application::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl; + } else { + $urls[] = $adminOauthUrl; + } // unfortunately most of what we need for reference stuff requires authentication // let's not allow to handle multiple gitlab servers //$extraUrls = $this->config->getUserValue($this->userId, Application::APP_ID, 'link_urls'); diff --git a/lib/Service/GitlabAPIService.php b/lib/Service/GitlabAPIService.php index cf34c06..87beb27 100644 --- a/lib/Service/GitlabAPIService.php +++ b/lib/Service/GitlabAPIService.php @@ -19,11 +19,11 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\ServerException; use OCA\Gitlab\AppInfo\Application; +use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IL10N; use OCP\PreConditionNotMetException; use Psr\Log\LoggerInterface; -use OCP\Http\Client\IClientService; class GitlabAPIService { /** @@ -464,7 +464,12 @@ public function request(?string $userId, string $endPoint, array $params = [], s if ($userId !== null) { $this->checkTokenExpiration($userId); } - $baseUrl = $this->getConnectedGitlabUrl($userId); + $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; + if ($userId === null) { + $baseUrl = $adminOauthUrl; + } else { + $baseUrl = $this->config->getUserValue($userId, Application::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl; + } try { $url = $baseUrl . '/api/v4/' . $endPoint; $options = [ @@ -553,7 +558,7 @@ private function checkTokenExpiration(string $userId): void { * @throws PreConditionNotMetException */ private function refreshToken(string $userId): bool { - $baseUrl = $this->getConnectedGitlabUrl($userId); + $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; $clientID = $this->config->getAppValue(Application::APP_ID, 'client_id'); $clientSecret = $this->config->getAppValue(Application::APP_ID, 'client_secret'); $redirect_uri = $this->config->getUserValue($userId, Application::APP_ID, 'redirect_uri'); @@ -562,7 +567,7 @@ private function refreshToken(string $userId): bool { $this->logger->error('No GitLab refresh token found', ['app' => Application::APP_ID]); return false; } - $result = $this->requestOAuthAccessToken($baseUrl, [ + $result = $this->requestOAuthAccessToken($adminOauthUrl, [ 'client_id' => $clientID, 'client_secret' => $clientSecret, 'grant_type' => 'refresh_token', @@ -573,6 +578,7 @@ private function refreshToken(string $userId): bool { $this->logger->info('GitLab access token successfully refreshed', ['app' => Application::APP_ID]); $accessToken = $result['access_token']; $refreshToken = $result['refresh_token']; + $this->config->setUserValue($userId, Application::APP_ID, 'url', $adminOauthUrl); $this->config->setUserValue($userId, Application::APP_ID, 'token', $accessToken); $this->config->setUserValue($userId, Application::APP_ID, 'refresh_token', $refreshToken); if (isset($result['expires_in'])) { @@ -593,28 +599,19 @@ private function refreshToken(string $userId): bool { } } - /** - * @param string $userId - * @return string - */ - public function getConnectedGitlabUrl(string $userId): string { - $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; - return $this->config->getUserValue($userId, Application::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl; - } - /** * @param string $userId * @return array */ public function revokeOauthToken(string $userId): array { - $gitlabUrl = $this->getConnectedGitlabUrl($userId); + $adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', Application::DEFAULT_GITLAB_URL) ?: Application::DEFAULT_GITLAB_URL; $accessToken = $this->config->getUserValue($userId, Application::APP_ID, 'token'); $clientId = $this->config->getAppValue(Application::APP_ID, 'client_id'); $clientSecret = $this->config->getAppValue(Application::APP_ID, 'client_secret'); $endPoint = 'oauth/revoke'; try { - $url = $gitlabUrl . '/' . $endPoint; + $url = $adminOauthUrl . '/' . $endPoint; $options = [ 'headers' => [ 'User-Agent' => 'Nextcloud GitLab integration',