├── .babelrc.js ├── .eslintignore ├── .eslintrc.js ├── .github ├── dependabot.yml └── workflows │ ├── appstore-build-publish.yml │ ├── dependabot-approve.yml │ ├── fixup.yml │ ├── lint-eslint.yml │ ├── lint-php.yml │ ├── node.yml │ ├── phpunit-mysql.yml │ ├── phpunit-oci.yml │ ├── phpunit-pgsql.yml │ ├── phpunit-sqlite.yml │ └── static-analysis.yml ├── .gitignore ├── .nextcloudignore ├── .stylelintrc.js ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── appinfo ├── info.xml └── routes.php ├── babel.config.js ├── composer.json ├── composer.lock ├── krankerl.toml ├── lib ├── AppInfo │ └── Application.php ├── Command │ └── ListShares.php ├── Controller │ └── ApiController.php ├── Listener │ └── LoadSidebarScript.php └── Service │ └── SharesList.php ├── package-lock.json ├── package.json ├── psalm.xml ├── src ├── assets │ └── share-folder.svg ├── components │ └── SharingEntrySimple.vue ├── main.js └── views │ └── SharedSubfolders.vue ├── tests ├── bootstrap.php ├── phpunit.xml ├── psalm-baseline.xml └── stub.phpstub └── webpack.js /.babelrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['@babel/plugin-syntax-dynamic-import'], 3 | presets: ['@babel/preset-env'] 4 | } 5 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /js/tests/* 2 | /js/vendor/* 3 | /js/legacy/* 4 | /js/node_modules/* 5 | /js/public/* 6 | /karma.conf.js 7 | /tests/* 8 | /l10n/* 9 | 10 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | '@nextcloud', 4 | ], 5 | rules: { 6 | 'jsdoc/require-param-description': ['off'], 7 | 'jsdoc/require-param-type': ['off'], 8 | 'jsdoc/check-param-names': ['off'], 9 | 'jsdoc/no-undefined-types': ['off'], 10 | 'jsdoc/require-property-description' : ['off'] 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | day: saturday 8 | time: "03:00" 9 | timezone: Europe/Paris 10 | open-pull-requests-limit: 10 11 | - package-ecosystem: composer 12 | directory: "/" 13 | schedule: 14 | interval: daily 15 | time: "03:00" 16 | timezone: Europe/Paris 17 | open-pull-requests-limit: 10 18 | reviewers: 19 | - CarlSchwan 20 | -------------------------------------------------------------------------------- /.github/workflows/appstore-build-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: Build and publish app release 7 | 8 | on: 9 | release: 10 | types: [published] 11 | 12 | env: 13 | PHP_VERSION: 8.2 14 | 15 | jobs: 16 | build_and_publish: 17 | runs-on: ubuntu-latest 18 | 19 | # Only allowed to be run on nextcloud-releases repositories 20 | if: ${{ github.repository_owner == 'nextcloud-releases' }} 21 | 22 | steps: 23 | - name: Check actor permission 24 | uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1 25 | with: 26 | require: write 27 | 28 | - name: Set app env 29 | run: | 30 | # Split and keep last 31 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV 32 | echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV 33 | 34 | - name: Checkout 35 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 36 | with: 37 | path: ${{ env.APP_NAME }} 38 | 39 | - name: Get appinfo data 40 | id: appinfo 41 | uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master 42 | with: 43 | filename: ${{ env.APP_NAME }}/appinfo/info.xml 44 | expression: "//info//dependencies//nextcloud/@min-version" 45 | 46 | - name: Read package.json node and npm engines version 47 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 48 | id: versions 49 | # Continue if no package.json 50 | continue-on-error: true 51 | with: 52 | path: ${{ env.APP_NAME }} 53 | fallbackNode: '^20' 54 | fallbackNpm: '^9' 55 | 56 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }} 57 | # Skip if no package.json 58 | if: ${{ steps.versions.outputs.nodeVersion }} 59 | uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 60 | with: 61 | node-version: ${{ steps.versions.outputs.nodeVersion }} 62 | 63 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }} 64 | # Skip if no package.json 65 | if: ${{ steps.versions.outputs.npmVersion }} 66 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" 67 | 68 | - name: Set up php ${{ env.PHP_VERSION }} 69 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 70 | with: 71 | php-version: ${{ env.PHP_VERSION }} 72 | coverage: none 73 | env: 74 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 75 | 76 | - name: Check composer.json 77 | id: check_composer 78 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 79 | with: 80 | files: "${{ env.APP_NAME }}/composer.json" 81 | 82 | - name: Install composer dependencies 83 | if: steps.check_composer.outputs.files_exists == 'true' 84 | run: | 85 | cd ${{ env.APP_NAME }} 86 | composer install --no-dev 87 | 88 | - name: Build ${{ env.APP_NAME }} 89 | # Skip if no package.json 90 | if: ${{ steps.versions.outputs.nodeVersion }} 91 | env: 92 | CYPRESS_INSTALL_BINARY: 0 93 | run: | 94 | cd ${{ env.APP_NAME }} 95 | npm ci 96 | npm run build 97 | 98 | - name: Check Krankerl config 99 | id: krankerl 100 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 101 | with: 102 | files: ${{ env.APP_NAME }}/krankerl.toml 103 | 104 | - name: Install Krankerl 105 | if: steps.krankerl.outputs.files_exists == 'true' 106 | run: | 107 | wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb 108 | sudo dpkg -i krankerl_0.14.0_amd64.deb 109 | 110 | - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with krankerl 111 | if: steps.krankerl.outputs.files_exists == 'true' 112 | run: | 113 | cd ${{ env.APP_NAME }} 114 | krankerl package 115 | 116 | - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with makefile 117 | if: steps.krankerl.outputs.files_exists != 'true' 118 | run: | 119 | cd ${{ env.APP_NAME }} 120 | make appstore 121 | 122 | - name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }} 123 | continue-on-error: true 124 | id: server-checkout 125 | run: | 126 | NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }} 127 | wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip 128 | unzip latest-$NCVERSION.zip 129 | 130 | - name: Checkout server master fallback 131 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 132 | if: ${{ steps.server-checkout.outcome != 'success' }} 133 | with: 134 | submodules: true 135 | repository: nextcloud/server 136 | path: nextcloud 137 | 138 | - name: Sign app 139 | run: | 140 | # Extracting release 141 | cd ${{ env.APP_NAME }}/build/artifacts 142 | tar -xvf ${{ env.APP_NAME }}.tar.gz 143 | cd ../../../ 144 | # Setting up keys 145 | echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key 146 | wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt" 147 | # Signing 148 | 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 }} 149 | # Rebuilding archive 150 | cd ${{ env.APP_NAME }}/build/artifacts 151 | tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }} 152 | 153 | - name: Attach tarball to github release 154 | uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2 155 | id: attach_to_release 156 | with: 157 | repo_token: ${{ secrets.GITHUB_TOKEN }} 158 | file: ${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}.tar.gz 159 | asset_name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}.tar.gz 160 | tag: ${{ github.ref }} 161 | overwrite: true 162 | 163 | - name: Upload app to Nextcloud appstore 164 | uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1 165 | with: 166 | app_name: ${{ env.APP_NAME }} 167 | appstore_token: ${{ secrets.APPSTORE_TOKEN }} 168 | download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} 169 | app_private_key: ${{ secrets.APP_PRIVATE_KEY }} 170 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-approve.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: Dependabot 7 | 8 | on: 9 | pull_request_target: 10 | branches: 11 | - main 12 | - master 13 | - stable* 14 | 15 | permissions: 16 | contents: read 17 | 18 | concurrency: 19 | group: dependabot-approve-merge-${{ github.head_ref || github.run_id }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | auto-approve-merge: 24 | if: github.actor == 'dependabot[bot]' 25 | runs-on: ubuntu-latest 26 | permissions: 27 | # for hmarr/auto-approve-action to approve PRs 28 | pull-requests: write 29 | 30 | steps: 31 | # Github actions bot approve 32 | - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 33 | with: 34 | github-token: ${{ secrets.GITHUB_TOKEN }} 35 | 36 | # Nextcloud bot approve and merge request 37 | - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2 38 | with: 39 | target: minor 40 | github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }} 41 | -------------------------------------------------------------------------------- /.github/workflows/fixup.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: Block fixup and squash commits 7 | 8 | on: 9 | pull_request: 10 | types: [opened, ready_for_review, reopened, synchronize] 11 | 12 | permissions: 13 | contents: read 14 | 15 | concurrency: 16 | group: fixup-${{ github.head_ref || github.run_id }} 17 | cancel-in-progress: true 18 | 19 | jobs: 20 | commit-message-check: 21 | if: github.event.pull_request.draft == false 22 | 23 | permissions: 24 | pull-requests: write 25 | name: Block fixup and squash commits 26 | 27 | runs-on: ubuntu-latest 28 | 29 | steps: 30 | - name: Run check 31 | uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1 32 | with: 33 | repo-token: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/lint-eslint.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | # 6 | # Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions 7 | # https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks 8 | 9 | name: Lint eslint 10 | 11 | on: pull_request 12 | 13 | permissions: 14 | contents: read 15 | 16 | concurrency: 17 | group: lint-eslint-${{ github.head_ref || github.run_id }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | changes: 22 | runs-on: ubuntu-latest 23 | 24 | outputs: 25 | src: ${{ steps.changes.outputs.src}} 26 | 27 | steps: 28 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 29 | id: changes 30 | continue-on-error: true 31 | with: 32 | filters: | 33 | src: 34 | - '.github/workflows/**' 35 | - 'src/**' 36 | - 'appinfo/info.xml' 37 | - 'package.json' 38 | - 'package-lock.json' 39 | - 'tsconfig.json' 40 | - '.eslintrc.*' 41 | - '.eslintignore' 42 | - '**.js' 43 | - '**.ts' 44 | - '**.vue' 45 | 46 | lint: 47 | runs-on: ubuntu-latest 48 | 49 | needs: changes 50 | if: needs.changes.outputs.src != 'false' 51 | 52 | name: NPM lint 53 | 54 | steps: 55 | - name: Checkout 56 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 57 | 58 | - name: Read package.json node and npm engines version 59 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 60 | id: versions 61 | with: 62 | fallbackNode: '^20' 63 | fallbackNpm: '^9' 64 | 65 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }} 66 | uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 67 | with: 68 | node-version: ${{ steps.versions.outputs.nodeVersion }} 69 | 70 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }} 71 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" 72 | 73 | - name: Install dependencies 74 | env: 75 | CYPRESS_INSTALL_BINARY: 0 76 | PUPPETEER_SKIP_DOWNLOAD: true 77 | run: npm ci 78 | 79 | - name: Lint 80 | run: npm run lint 81 | 82 | summary: 83 | permissions: 84 | contents: none 85 | runs-on: ubuntu-latest 86 | needs: [changes, lint] 87 | 88 | if: always() 89 | 90 | # This is the summary, we just avoid to rename it so that branch protection rules still match 91 | name: eslint 92 | 93 | steps: 94 | - name: Summary status 95 | run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi 96 | -------------------------------------------------------------------------------- /.github/workflows/lint-php.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: Lint php 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: lint-php-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | php-lint: 19 | runs-on: ubuntu-latest 20 | strategy: 21 | matrix: 22 | php-versions: [ '8.0', '8.1', '8.2', '8.3' ] 23 | 24 | name: php-lint 25 | 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 29 | 30 | - name: Set up php ${{ matrix.php-versions }} 31 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 32 | with: 33 | php-version: ${{ matrix.php-versions }} 34 | coverage: none 35 | ini-file: development 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | 39 | - name: Lint 40 | run: composer run lint 41 | 42 | summary: 43 | permissions: 44 | contents: none 45 | runs-on: ubuntu-latest 46 | needs: php-lint 47 | 48 | if: always() 49 | 50 | name: php-lint-summary 51 | 52 | steps: 53 | - name: Summary status 54 | run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi 55 | -------------------------------------------------------------------------------- /.github/workflows/node.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: Node 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: node-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | changes: 19 | runs-on: ubuntu-latest 20 | 21 | outputs: 22 | src: ${{ steps.changes.outputs.src}} 23 | 24 | steps: 25 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 26 | id: changes 27 | continue-on-error: true 28 | with: 29 | filters: | 30 | src: 31 | - '.github/workflows/**' 32 | - 'src/**' 33 | - 'appinfo/info.xml' 34 | - 'package.json' 35 | - 'package-lock.json' 36 | - 'tsconfig.json' 37 | - '**.js' 38 | - '**.ts' 39 | - '**.vue' 40 | 41 | build: 42 | runs-on: ubuntu-latest 43 | 44 | needs: changes 45 | if: needs.changes.outputs.src != 'false' 46 | 47 | name: NPM build 48 | steps: 49 | - name: Checkout 50 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 51 | 52 | - name: Read package.json node and npm engines version 53 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 54 | id: versions 55 | with: 56 | fallbackNode: '^20' 57 | fallbackNpm: '^9' 58 | 59 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }} 60 | uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 61 | with: 62 | node-version: ${{ steps.versions.outputs.nodeVersion }} 63 | 64 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }} 65 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" 66 | 67 | - name: Install dependencies & build 68 | env: 69 | CYPRESS_INSTALL_BINARY: 0 70 | PUPPETEER_SKIP_DOWNLOAD: true 71 | run: | 72 | npm ci 73 | npm run build --if-present 74 | 75 | - name: Check webpack build changes 76 | run: | 77 | bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)" 78 | 79 | - name: Show changes on failure 80 | if: failure() 81 | run: | 82 | git status 83 | git --no-pager diff 84 | exit 1 # make it red to grab attention 85 | 86 | summary: 87 | permissions: 88 | contents: none 89 | runs-on: ubuntu-latest 90 | needs: [changes, build] 91 | 92 | if: always() 93 | 94 | # This is the summary, we just avoid to rename it so that branch protection rules still match 95 | name: node 96 | 97 | steps: 98 | - name: Summary status 99 | run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi 100 | -------------------------------------------------------------------------------- /.github/workflows/phpunit-mysql.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: PHPUnit MySQL 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: phpunit-mysql-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | changes: 19 | runs-on: ubuntu-latest 20 | 21 | outputs: 22 | src: ${{ steps.changes.outputs.src}} 23 | 24 | steps: 25 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 26 | id: changes 27 | continue-on-error: true 28 | with: 29 | filters: | 30 | src: 31 | - '.github/workflows/**' 32 | - 'appinfo/**' 33 | - 'lib/**' 34 | - 'templates/**' 35 | - 'tests/**' 36 | - 'vendor/**' 37 | - 'vendor-bin/**' 38 | - '.php-cs-fixer.dist.php' 39 | - 'composer.json' 40 | - 'composer.lock' 41 | 42 | phpunit-mysql: 43 | runs-on: ubuntu-latest 44 | 45 | needs: changes 46 | if: needs.changes.outputs.src != 'false' 47 | 48 | strategy: 49 | matrix: 50 | php-versions: ['8.0', '8.1', '8.2', '8.3'] 51 | server-versions: ['master'] 52 | mysql-versions: ['8.1'] 53 | 54 | name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} 55 | 56 | services: 57 | mysql: 58 | image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest 59 | ports: 60 | - 4444:3306/tcp 61 | env: 62 | MYSQL_ROOT_PASSWORD: rootpassword 63 | options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 64 | 65 | steps: 66 | - name: Set app env 67 | run: | 68 | # Split and keep last 69 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV 70 | 71 | - name: Checkout server 72 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 73 | with: 74 | submodules: true 75 | repository: nextcloud/server 76 | ref: ${{ matrix.server-versions }} 77 | 78 | - name: Checkout app 79 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 80 | with: 81 | path: apps/${{ env.APP_NAME }} 82 | 83 | - name: Set up php ${{ matrix.php-versions }} 84 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 85 | with: 86 | php-version: ${{ matrix.php-versions }} 87 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation 88 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql 89 | coverage: none 90 | ini-file: development 91 | env: 92 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 93 | 94 | - name: Enable ONLY_FULL_GROUP_BY MySQL option 95 | run: | 96 | echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword 97 | echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword 98 | 99 | - name: Check composer file existence 100 | id: check_composer 101 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 102 | with: 103 | files: apps/${{ env.APP_NAME }}/composer.json 104 | 105 | - name: Set up dependencies 106 | # Only run if phpunit config file exists 107 | if: steps.check_composer.outputs.files_exists == 'true' 108 | working-directory: apps/${{ env.APP_NAME }} 109 | run: composer i 110 | 111 | - name: Set up Nextcloud 112 | env: 113 | DB_PORT: 4444 114 | run: | 115 | mkdir data 116 | ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin 117 | ./occ app:enable --force ${{ env.APP_NAME }} 118 | 119 | - name: Check PHPUnit script is defined 120 | id: check_phpunit 121 | continue-on-error: true 122 | working-directory: apps/${{ env.APP_NAME }} 123 | run: | 124 | composer run --list | grep "^ test:unit " | wc -l | grep 1 125 | 126 | - name: PHPUnit 127 | # Only run if phpunit config file exists 128 | if: steps.check_phpunit.outcome == 'success' 129 | working-directory: apps/${{ env.APP_NAME }} 130 | run: composer run test:unit 131 | 132 | - name: Check PHPUnit integration script is defined 133 | id: check_integration 134 | continue-on-error: true 135 | working-directory: apps/${{ env.APP_NAME }} 136 | run: | 137 | composer run --list | grep "^ test:integration " | wc -l | grep 1 138 | 139 | - name: Run Nextcloud 140 | # Only run if phpunit integration config file exists 141 | if: steps.check_integration.outcome == 'success' 142 | run: php -S localhost:8080 & 143 | 144 | - name: PHPUnit integration 145 | # Only run if phpunit integration config file exists 146 | if: steps.check_integration.outcome == 'success' 147 | working-directory: apps/${{ env.APP_NAME }} 148 | run: composer run test:integration 149 | 150 | - name: Print logs 151 | if: always() 152 | run: | 153 | cat data/nextcloud.log 154 | 155 | - name: Skipped 156 | # Fail the action when neither unit nor integration tests ran 157 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' 158 | run: | 159 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' 160 | exit 1 161 | 162 | summary: 163 | permissions: 164 | contents: none 165 | runs-on: ubuntu-latest 166 | needs: [changes, phpunit-mysql] 167 | 168 | if: always() 169 | 170 | name: phpunit-mysql-summary 171 | 172 | steps: 173 | - name: Summary status 174 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi 175 | -------------------------------------------------------------------------------- /.github/workflows/phpunit-oci.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: PHPUnit OCI 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: phpunit-oci-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | changes: 19 | runs-on: ubuntu-latest 20 | 21 | outputs: 22 | src: ${{ steps.changes.outputs.src}} 23 | 24 | steps: 25 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 26 | id: changes 27 | continue-on-error: true 28 | with: 29 | filters: | 30 | src: 31 | - '.github/workflows/**' 32 | - 'appinfo/**' 33 | - 'lib/**' 34 | - 'templates/**' 35 | - 'tests/**' 36 | - 'vendor/**' 37 | - 'vendor-bin/**' 38 | - '.php-cs-fixer.dist.php' 39 | - 'composer.json' 40 | - 'composer.lock' 41 | 42 | phpunit-oci: 43 | runs-on: ubuntu-22.04 44 | 45 | needs: changes 46 | if: needs.changes.outputs.src != 'false' 47 | 48 | strategy: 49 | matrix: 50 | php-versions: ['8.2'] 51 | server-versions: ['master'] 52 | 53 | services: 54 | oracle: 55 | image: ghcr.io/gvenzl/oracle-xe:11 56 | 57 | # Provide passwords and other environment variables to container 58 | env: 59 | ORACLE_RANDOM_PASSWORD: true 60 | APP_USER: autotest 61 | APP_USER_PASSWORD: owncloud 62 | 63 | # Forward Oracle port 64 | ports: 65 | - 1521:1521/tcp 66 | 67 | # Provide healthcheck script options for startup 68 | options: >- 69 | --health-cmd healthcheck.sh 70 | --health-interval 10s 71 | --health-timeout 5s 72 | --health-retries 10 73 | 74 | steps: 75 | - name: Set app env 76 | run: | 77 | # Split and keep last 78 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV 79 | 80 | - name: Checkout server 81 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 82 | with: 83 | submodules: true 84 | repository: nextcloud/server 85 | ref: ${{ matrix.server-versions }} 86 | 87 | - name: Checkout app 88 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 89 | with: 90 | path: apps/${{ env.APP_NAME }} 91 | 92 | - name: Set up php ${{ matrix.php-versions }} 93 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 94 | with: 95 | php-version: ${{ matrix.php-versions }} 96 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation 97 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 98 | coverage: none 99 | ini-file: development 100 | env: 101 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 102 | 103 | - name: Check composer file existence 104 | id: check_composer 105 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 106 | with: 107 | files: apps/${{ env.APP_NAME }}/composer.json 108 | 109 | - name: Set up dependencies 110 | # Only run if phpunit config file exists 111 | if: steps.check_composer.outputs.files_exists == 'true' 112 | working-directory: apps/${{ env.APP_NAME }} 113 | run: composer i 114 | 115 | - name: Set up Nextcloud 116 | env: 117 | DB_PORT: 1521 118 | run: | 119 | mkdir data 120 | ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin 121 | ./occ app:enable --force ${{ env.APP_NAME }} 122 | 123 | - name: Check PHPUnit script is defined 124 | id: check_phpunit 125 | continue-on-error: true 126 | working-directory: apps/${{ env.APP_NAME }} 127 | run: | 128 | composer run --list | grep "^ test:unit " | wc -l | grep 1 129 | 130 | - name: PHPUnit 131 | # Only run if phpunit config file exists 132 | if: steps.check_phpunit.outcome == 'success' 133 | working-directory: apps/${{ env.APP_NAME }} 134 | run: composer run test:unit 135 | 136 | - name: Check PHPUnit integration script is defined 137 | id: check_integration 138 | continue-on-error: true 139 | working-directory: apps/${{ env.APP_NAME }} 140 | run: | 141 | composer run --list | grep "^ test:integration " | wc -l | grep 1 142 | 143 | - name: Run Nextcloud 144 | # Only run if phpunit integration config file exists 145 | if: steps.check_integration.outcome == 'success' 146 | run: php -S localhost:8080 & 147 | 148 | - name: PHPUnit integration 149 | # Only run if phpunit integration config file exists 150 | if: steps.check_integration.outcome == 'success' 151 | working-directory: apps/${{ env.APP_NAME }} 152 | run: composer run test:integration 153 | 154 | - name: Print logs 155 | if: always() 156 | run: | 157 | cat data/nextcloud.log 158 | 159 | - name: Skipped 160 | # Fail the action when neither unit nor integration tests ran 161 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' 162 | run: | 163 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' 164 | exit 1 165 | 166 | summary: 167 | permissions: 168 | contents: none 169 | runs-on: ubuntu-latest 170 | needs: [changes, phpunit-oci] 171 | 172 | if: always() 173 | 174 | name: phpunit-oci-summary 175 | 176 | steps: 177 | - name: Summary status 178 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi 179 | -------------------------------------------------------------------------------- /.github/workflows/phpunit-pgsql.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: PHPUnit pgsql 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: phpunit-pgsql-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | changes: 19 | runs-on: ubuntu-latest 20 | 21 | outputs: 22 | src: ${{ steps.changes.outputs.src}} 23 | 24 | steps: 25 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 26 | id: changes 27 | continue-on-error: true 28 | with: 29 | filters: | 30 | src: 31 | - '.github/workflows/**' 32 | - 'appinfo/**' 33 | - 'lib/**' 34 | - 'templates/**' 35 | - 'tests/**' 36 | - 'vendor/**' 37 | - 'vendor-bin/**' 38 | - '.php-cs-fixer.dist.php' 39 | - 'composer.json' 40 | - 'composer.lock' 41 | 42 | phpunit-pgsql: 43 | runs-on: ubuntu-latest 44 | 45 | needs: changes 46 | if: needs.changes.outputs.src != 'false' 47 | 48 | strategy: 49 | matrix: 50 | php-versions: ['8.2'] 51 | server-versions: ['master'] 52 | 53 | services: 54 | postgres: 55 | image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest 56 | ports: 57 | - 4444:5432/tcp 58 | env: 59 | POSTGRES_USER: root 60 | POSTGRES_PASSWORD: rootpassword 61 | POSTGRES_DB: nextcloud 62 | options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 63 | 64 | steps: 65 | - name: Set app env 66 | run: | 67 | # Split and keep last 68 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV 69 | 70 | - name: Checkout server 71 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 72 | with: 73 | submodules: true 74 | repository: nextcloud/server 75 | ref: ${{ matrix.server-versions }} 76 | 77 | - name: Checkout app 78 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 79 | with: 80 | path: apps/${{ env.APP_NAME }} 81 | 82 | - name: Set up php ${{ matrix.php-versions }} 83 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 84 | with: 85 | php-version: ${{ matrix.php-versions }} 86 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation 87 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql 88 | coverage: none 89 | ini-file: development 90 | env: 91 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 92 | 93 | - name: Check composer file existence 94 | id: check_composer 95 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 96 | with: 97 | files: apps/${{ env.APP_NAME }}/composer.json 98 | 99 | - name: Set up dependencies 100 | # Only run if phpunit config file exists 101 | if: steps.check_composer.outputs.files_exists == 'true' 102 | working-directory: apps/${{ env.APP_NAME }} 103 | run: composer i 104 | 105 | - name: Set up Nextcloud 106 | env: 107 | DB_PORT: 4444 108 | run: | 109 | mkdir data 110 | ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin 111 | ./occ app:enable --force ${{ env.APP_NAME }} 112 | 113 | - name: Check PHPUnit script is defined 114 | id: check_phpunit 115 | continue-on-error: true 116 | working-directory: apps/${{ env.APP_NAME }} 117 | run: | 118 | composer run --list | grep "^ test:unit " | wc -l | grep 1 119 | 120 | - name: PHPUnit 121 | # Only run if phpunit config file exists 122 | if: steps.check_phpunit.outcome == 'success' 123 | working-directory: apps/${{ env.APP_NAME }} 124 | run: composer run test:unit 125 | 126 | - name: Check PHPUnit integration script is defined 127 | id: check_integration 128 | continue-on-error: true 129 | working-directory: apps/${{ env.APP_NAME }} 130 | run: | 131 | composer run --list | grep "^ test:integration " | wc -l | grep 1 132 | 133 | - name: Run Nextcloud 134 | # Only run if phpunit integration config file exists 135 | if: steps.check_integration.outcome == 'success' 136 | run: php -S localhost:8080 & 137 | 138 | - name: PHPUnit integration 139 | # Only run if phpunit integration config file exists 140 | if: steps.check_integration.outcome == 'success' 141 | working-directory: apps/${{ env.APP_NAME }} 142 | run: composer run test:integration 143 | 144 | - name: Print logs 145 | if: always() 146 | run: | 147 | cat data/nextcloud.log 148 | 149 | - name: Skipped 150 | # Fail the action when neither unit nor integration tests ran 151 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' 152 | run: | 153 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' 154 | exit 1 155 | 156 | summary: 157 | permissions: 158 | contents: none 159 | runs-on: ubuntu-latest 160 | needs: [changes, phpunit-pgsql] 161 | 162 | if: always() 163 | 164 | name: phpunit-pgsql-summary 165 | 166 | steps: 167 | - name: Summary status 168 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi 169 | -------------------------------------------------------------------------------- /.github/workflows/phpunit-sqlite.yml: -------------------------------------------------------------------------------- 1 | # This workflow is provided via the organization template repository 2 | # 3 | # https://github.com/nextcloud/.github 4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization 5 | 6 | name: PHPUnit sqlite 7 | 8 | on: pull_request 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: phpunit-sqlite-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | changes: 19 | runs-on: ubuntu-latest 20 | 21 | outputs: 22 | src: ${{ steps.changes.outputs.src}} 23 | 24 | steps: 25 | - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 26 | id: changes 27 | continue-on-error: true 28 | with: 29 | filters: | 30 | src: 31 | - '.github/workflows/**' 32 | - 'appinfo/**' 33 | - 'lib/**' 34 | - 'templates/**' 35 | - 'tests/**' 36 | - 'vendor/**' 37 | - 'vendor-bin/**' 38 | - '.php-cs-fixer.dist.php' 39 | - 'composer.json' 40 | - 'composer.lock' 41 | 42 | phpunit-sqlite: 43 | runs-on: ubuntu-latest 44 | 45 | needs: changes 46 | if: needs.changes.outputs.src != 'false' 47 | 48 | strategy: 49 | matrix: 50 | php-versions: ['8.2'] 51 | server-versions: ['master'] 52 | 53 | steps: 54 | - name: Set app env 55 | run: | 56 | # Split and keep last 57 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV 58 | 59 | - name: Checkout server 60 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 61 | with: 62 | submodules: true 63 | repository: nextcloud/server 64 | ref: ${{ matrix.server-versions }} 65 | 66 | - name: Checkout app 67 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 68 | with: 69 | path: apps/${{ env.APP_NAME }} 70 | 71 | - name: Set up php ${{ matrix.php-versions }} 72 | uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 73 | with: 74 | php-version: ${{ matrix.php-versions }} 75 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation 76 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite 77 | coverage: none 78 | ini-file: development 79 | env: 80 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 81 | 82 | - name: Check composer file existence 83 | id: check_composer 84 | uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 85 | with: 86 | files: apps/${{ env.APP_NAME }}/composer.json 87 | 88 | - name: Set up dependencies 89 | # Only run if phpunit config file exists 90 | if: steps.check_composer.outputs.files_exists == 'true' 91 | working-directory: apps/${{ env.APP_NAME }} 92 | run: composer i 93 | 94 | - name: Set up Nextcloud 95 | env: 96 | DB_PORT: 4444 97 | run: | 98 | mkdir data 99 | ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin 100 | ./occ app:enable --force ${{ env.APP_NAME }} 101 | 102 | - name: Check PHPUnit script is defined 103 | id: check_phpunit 104 | continue-on-error: true 105 | working-directory: apps/${{ env.APP_NAME }} 106 | run: | 107 | composer run --list | grep "^ test:unit " | wc -l | grep 1 108 | 109 | - name: PHPUnit 110 | # Only run if phpunit config file exists 111 | if: steps.check_phpunit.outcome == 'success' 112 | working-directory: apps/${{ env.APP_NAME }} 113 | run: composer run test:unit 114 | 115 | - name: Check PHPUnit integration script is defined 116 | id: check_integration 117 | continue-on-error: true 118 | working-directory: apps/${{ env.APP_NAME }} 119 | run: | 120 | composer run --list | grep "^ test:integration " | wc -l | grep 1 121 | 122 | - name: Run Nextcloud 123 | # Only run if phpunit integration config file exists 124 | if: steps.check_integration.outcome == 'success' 125 | run: php -S localhost:8080 & 126 | 127 | - name: PHPUnit integration 128 | # Only run if phpunit integration config file exists 129 | if: steps.check_integration.outcome == 'success' 130 | working-directory: apps/${{ env.APP_NAME }} 131 | run: composer run test:integration 132 | 133 | - name: Print logs 134 | if: always() 135 | run: | 136 | cat data/nextcloud.log 137 | 138 | - name: Skipped 139 | # Fail the action when neither unit nor integration tests ran 140 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' 141 | run: | 142 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' 143 | exit 1 144 | 145 | summary: 146 | permissions: 147 | contents: none 148 | runs-on: ubuntu-latest 149 | needs: [changes, phpunit-sqlite] 150 | 151 | if: always() 152 | 153 | name: phpunit-sqlite-summary 154 | 155 | steps: 156 | - name: Summary status 157 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi 158 | -------------------------------------------------------------------------------- /.github/workflows/static-analysis.yml: -------------------------------------------------------------------------------- 1 | name: Static analysis 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | - stable* 9 | 10 | jobs: 11 | static-psalm-analysis: 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | matrix: 16 | ocp-version: [ 'dev-stable24' ] 17 | 18 | name: Nextcloud ${{ matrix.ocp-version }} 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@master 22 | 23 | - name: Set up php 24 | uses: shivammathur/setup-php@v2 25 | with: 26 | php-version: 7.4 27 | coverage: none 28 | 29 | - name: Install dependencies 30 | run: composer install --dev 31 | 32 | - name: Run coding standards check 33 | run: composer run psalm 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /vendor 3 | node_modules 4 | js 5 | -------------------------------------------------------------------------------- /.nextcloudignore: -------------------------------------------------------------------------------- 1 | /AUTHORS.md 2 | /build 3 | /.babelrc 4 | /.eslintrc.js 5 | /.jshintrc 6 | /.git 7 | /.github 8 | /.gitignore 9 | /.nextcloudignore 10 | /.php_cs.dist 11 | /.travis.yml 12 | /.tx 13 | /.scrutinizer.yml 14 | /CONTRIBUTING.md 15 | /composer.* 16 | /karma.conf.js 17 | /krankerl.toml 18 | /l10n/no-php 19 | /Makefile 20 | /nbproject 21 | /node_modules 22 | /package* 23 | /psalm.xml 24 | /screenshots 25 | /src 26 | /tests 27 | /vendor/bin 28 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: 'stylelint-config-recommended-scss', 3 | rules: { 4 | indentation: 'tab', 5 | 'selector-type-no-unknown': null, 6 | 'number-leading-zero': null, 7 | 'rule-empty-line-before': [ 8 | 'always', 9 | { 10 | ignore: ['after-comment', 'inside-block'] 11 | } 12 | ], 13 | 'declaration-empty-line-before': [ 14 | 'never', 15 | { 16 | ignore: ['after-declaration'] 17 | } 18 | ], 19 | 'comment-empty-line-before': null, 20 | 'selector-type-case': null, 21 | 'selector-list-comma-newline-after': null, 22 | 'no-descending-specificity': null, 23 | 'string-quotes': 'single' 24 | }, 25 | plugins: ['stylelint-scss'] 26 | } 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.2.0 2 | 3 | - Added compatibility with Nextcloud 26-29 4 | - Removed compatibility with Nextcloud 22-25 5 | - Show share expiration if it exists 6 | - Fix log flood 7 | - Add CSV output format 8 | - Fix getAllShares 9 | - Update workflows and lib dependencies 10 | 11 | ## 1.1.1 12 | 13 | - Make the command work 14 | 15 | ## 1.1.0 16 | 17 | - Added compatibility with Nextcloud 24 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for building the project 2 | 3 | app_name=sharelisting 4 | project_dir=$(CURDIR)/../$(app_name) 5 | build_dir=$(CURDIR)/build/artifacts 6 | sign_dir=$(build_dir)/sign 7 | appstore_dir=$(build_dir)/appstore 8 | source_dir=$(build_dir)/source 9 | package_name=$(app_name) 10 | cert_dir=$(HOME)/.nextcloud/certificates 11 | 12 | all: dev-setup lint build-js-production 13 | 14 | # Dev env management 15 | dev-setup: clean clean-dev npm-init composer-init 16 | 17 | composer-init: 18 | composer install --no-dev 19 | 20 | npm-init: 21 | npm install 22 | 23 | npm-update: 24 | npm update 25 | 26 | # Building 27 | build-js: 28 | npm run dev 29 | 30 | build-js-production: 31 | npm run build 32 | 33 | watch-js: 34 | npm run watch 35 | 36 | # Linting 37 | lint: 38 | npm run lint 39 | 40 | lint-fix: 41 | npm run lint:fix 42 | 43 | # Style linting 44 | stylelint: 45 | npm run stylelint 46 | 47 | stylelint-fix: 48 | npm run stylelint:fix 49 | 50 | # Cleaning 51 | clean: 52 | rm -rf js 53 | 54 | clean-dev: 55 | rm -rf node_modules 56 | 57 | appstore: 58 | mkdir -p $(sign_dir) 59 | rsync -a \ 60 | --exclude=.git \ 61 | --exclude=build \ 62 | --exclude=.gitignore \ 63 | --exclude=.travis.yml \ 64 | --exclude=.scrutinizer.yml \ 65 | --exclude=CONTRIBUTING.md \ 66 | --exclude=composer.json \ 67 | --exclude=composer.lock \ 68 | --exclude=composer.phar \ 69 | --exclude=l10n/.tx \ 70 | --exclude=l10n/no-php \ 71 | --exclude=Makefile \ 72 | --exclude=nbproject \ 73 | --exclude=screenshots \ 74 | --exclude=phpunit*xml \ 75 | --exclude=tests \ 76 | --exclude=vendor/bin \ 77 | $(project_dir) $(sign_dir) 78 | @echo "Signing…" 79 | tar -czf $(build_dir)/$(app_name).tar.gz \ 80 | -C $(sign_dir) $(app_name) 81 | openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShareListing 2 | 3 | This app allows generating reports of shares on the system. 4 | 5 | ## Usage 6 | 7 | ### Command 8 | 9 | ```sh 10 | ./occ sharing:list [-u|--user [USER]] [-p|--path [PATH]] [-t|--token [TOKEN]] [-f|--filter [FILTER]] [-o|--output FORMAT] 11 | ``` 12 | 13 | Without options, the command yields the unfiltered list of all shares.\ 14 | With options, the list is narrowed down using the filters set. 15 | 16 | ### Options 17 | 18 | * `-u [USER]` or `--user [USER]`\ 19 | List only shares of the given user. 20 | * `-p [PATH]` or `--path [PATH]`\ 21 | List only shares within the given path. 22 | * `-t [TOKEN]` or `--token [TOKEN]`\ 23 | List only shares that use a token that (at least partly) matches the argument. 24 | * `-f [FILTER]` or `--filter [FILTER]`\ 25 | List only shares where the TYPE matches the argument.\ 26 | Possible values for the filter argument: {owner, initiator, recipient} 27 | * `-o FORMAT` or `--output FORMAT`\ 28 | Set the output format (json or csv, default is json). 29 | 30 | ## Examples 31 | 32 | To better illustrate how the app work see the examples below: 33 | 34 | ### Example 1 35 | 36 | Listing all shares user0 is a participant in (be it owner, initiator or recipient): 37 | 38 | `./occ sharing:list --user user0` 39 | 40 | ```json 41 | [ 42 | { 43 | "owner": "admin", 44 | "initiator": "user0", 45 | "time": "2018-04-24T08:29:26+00:00", 46 | "permissions": 31, 47 | "path": "\/F1", 48 | "type": "user", 49 | "recipient": "user1" 50 | }, 51 | { 52 | "owner": "admin", 53 | "initiator": "admin", 54 | "time": "2018-04-24T07:34:58+00:00", 55 | "permissions": 31, 56 | "path": "\/F2", 57 | "type": "user", 58 | "recipient": "user0" 59 | }, 60 | { 61 | "owner": "admin", 62 | "initiator": "admin", 63 | "time": "2018-04-24T07:35:02+00:00", 64 | "permissions": 31, 65 | "path": "\/F1", 66 | "type": "user", 67 | "recipient": "user0" 68 | }, 69 | { 70 | "owner": "admin", 71 | "initiator": "user0", 72 | "time": "2018-04-24T08:29:43+00:00", 73 | "permissions": 1, 74 | "path": "\/F1\/SF1", 75 | "type": "link", 76 | "token": "eoT8kF5B9jtmMda" 77 | } 78 | ] 79 | ``` 80 | 81 | ### Example 2 82 | 83 | Listing all shares user0 is a participant in (be it owner, initiator or recipient) limited to the path `F1` 84 | 85 | `./occ sharing:list --user user0 --path F1` 86 | 87 | ```json 88 | [ 89 | { 90 | "owner": "admin", 91 | "initiator": "user0", 92 | "time": "2018-04-24T08:29:26+00:00", 93 | "permissions": 31, 94 | "path": "\/F1", 95 | "type": "user", 96 | "recipient": "user1" 97 | }, 98 | { 99 | "owner": "admin", 100 | "initiator": "admin", 101 | "time": "2018-04-24T07:35:02+00:00", 102 | "permissions": 31, 103 | "path": "\/F1", 104 | "type": "user", 105 | "recipient": "user0" 106 | }, 107 | { 108 | "owner": "admin", 109 | "initiator": "user0", 110 | "time": "2018-04-24T08:29:43+00:00", 111 | "permissions": 1, 112 | "path": "\/F1\/SF1", 113 | "type": "link", 114 | "token": "eoT8kF5B9jtmMda" 115 | } 116 | ] 117 | ``` 118 | 119 | ### Example 3 120 | 121 | List all info about all shares 122 | 123 | `./occ sharing:list` 124 | 125 | ```json 126 | [ 127 | { 128 | "owner": "admin", 129 | "initiator": "admin", 130 | "time": "2018-04-24T07:34:58+00:00", 131 | "permissions": 31, 132 | "path": "\/F2", 133 | "type": "user", 134 | "recipient": "user0" 135 | }, 136 | { 137 | "owner": "admin", 138 | "initiator": "admin", 139 | "time": "2018-04-24T07:35:02+00:00", 140 | "permissions": 31, 141 | "path": "\/F1", 142 | "type": "user", 143 | "recipient": "user0" 144 | }, 145 | { 146 | "owner": "admin", 147 | "initiator": "user0", 148 | "time": "2018-04-24T08:29:26+00:00", 149 | "permissions": 31, 150 | "path": "\/F1", 151 | "type": "user", 152 | "recipient": "user1" 153 | }, 154 | { 155 | "owner": "admin", 156 | "initiator": "user0", 157 | "time": "2018-04-24T08:29:43+00:00", 158 | "permissions": 1, 159 | "path": "\/F1\/SF1", 160 | "type": "link", 161 | "token": "eoT8kF5B9jtmMda" 162 | }, 163 | { 164 | "owner": "admin", 165 | "initiator": "user0", 166 | "time": "2018-04-24T08:29:26+00:00", 167 | "permissions": 31, 168 | "path": "\/F1", 169 | "type": "user", 170 | "recipient": "user1" 171 | }, 172 | { 173 | "owner": "admin", 174 | "initiator": "admin", 175 | "time": "2018-04-24T07:34:58+00:00", 176 | "permissions": 31, 177 | "path": "\/F2", 178 | "type": "user", 179 | "recipient": "user0" 180 | }, 181 | { 182 | "owner": "admin", 183 | "initiator": "admin", 184 | "time": "2018-04-24T07:35:02+00:00", 185 | "permissions": 31, 186 | "path": "\/F1", 187 | "type": "user", 188 | "recipient": "user0" 189 | }, 190 | { 191 | "owner": "admin", 192 | "initiator": "user0", 193 | "time": "2018-04-24T08:29:43+00:00", 194 | "permissions": 1, 195 | "path": "\/F1\/SF1", 196 | "type": "link", 197 | "token": "eoT8kF5B9jtmMda" 198 | } 199 | ] 200 | ``` 201 | 202 | #### Example 4 203 | 204 | List all shares that user0 is the initiator of in the path F1 (of that user). 205 | 206 | `./occ sharing:list --user user0 --path F1 --filter initiator` 207 | 208 | ```json 209 | [ 210 | { 211 | "owner": "admin", 212 | "initiator": "user0", 213 | "time": "2018-04-24T08:29:26+00:00", 214 | "permissions": 31, 215 | "path": "\/F1", 216 | "type": "user", 217 | "recipient": "user1" 218 | }, 219 | { 220 | "owner": "admin", 221 | "initiator": "user0", 222 | "time": "2018-04-24T08:29:43+00:00", 223 | "permissions": 1, 224 | "path": "\/F1\/SF1", 225 | "type": "link", 226 | "token": "eoT8kF5B9jtmMda" 227 | } 228 | ] 229 | ``` 230 | -------------------------------------------------------------------------------- /appinfo/info.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | sharelisting 5 | Share Listing 6 | List shares on the command line 7 | The application generates a list of shares for display at the command line 8 | 1.2.0 9 | agpl 10 | Roeland Jago Douma 11 | ShareListing 12 | tools 13 | https://github.com/rullzer/sharelisting/issues 14 | 15 | 16 | 17 | 18 | 19 | OCA\ShareListing\Command\ListShares 20 | 21 | 22 | -------------------------------------------------------------------------------- /appinfo/routes.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author John Molakvoæ 7 | * 8 | * @license GNU AGPL version 3 or any later version 9 | * 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as 12 | * published by the Free Software Foundation, either version 3 of the 13 | * License, or (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | * 23 | */ 24 | 25 | return [ 26 | 'ocs' => [ 27 | [ 28 | 'name' => 'Api#getSharedSubfolders', 29 | 'url' => '/api/v1/sharedSubfolders', 30 | 'verb' => 'GET' 31 | ] 32 | ] 33 | ]; 34 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | const babelConfig = require('@nextcloud/babel-config') 2 | 3 | module.exports = babelConfig 4 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sharelisting/3rdparty", 3 | "description": "3rdparty components for sharelisting", 4 | "license": "MIT", 5 | "require": { 6 | "nikic/iter": "^2.2", 7 | "symfony/serializer": "^5.4" 8 | }, 9 | "require-dev": { 10 | "phpunit/phpunit": "^9", 11 | "sabre/dav": "^4.1", 12 | "sabre/xml": "^2.2", 13 | "symfony/event-dispatcher": "^5.3.11", 14 | "christophwurst/nextcloud": "dev-master@dev", 15 | "psalm/phar": "^4.10", 16 | "nextcloud/coding-standard": "^1.0" 17 | }, 18 | "scripts": { 19 | "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", 20 | "cs:check": "php-cs-fixer fix --dry-run --diff", 21 | "cs:fix": "php-cs-fixer fix", 22 | "psalm": "psalm.phar --threads=1", 23 | "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", 24 | "psalm:clear": "psalm.phar --clear-cache && psalm --clear-global-cache", 25 | "psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", 26 | "test:unit": "echo 'Only testing installation of the app'" 27 | }, 28 | "config": { 29 | "optimize-autoloader": true, 30 | "classmap-authoritative": true, 31 | "allow-plugins": { 32 | "composer/package-versions-deprecated": true 33 | }, 34 | "platform": { 35 | "php": "7.4" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /krankerl.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | before_cmds = [ 3 | "composer install --no-dev", 4 | "npm install --deps", 5 | "npm run build", 6 | ] 7 | -------------------------------------------------------------------------------- /lib/AppInfo/Application.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author Roeland Jago Douma 7 | * @author John Molakvoæ 8 | * 9 | * @license GNU AGPL version 3 or any later version 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Affero General Public License as 13 | * published by the Free Software Foundation, either version 3 of the 14 | * License, or (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Affero General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Affero General Public License 22 | * along with this program. If not, see . 23 | * 24 | */ 25 | 26 | namespace OCA\ShareListing\AppInfo; 27 | 28 | use OCA\Files\Event\LoadSidebar; 29 | use OCA\ShareListing\Listener\LoadSidebarScript; 30 | use OCP\AppFramework\App; 31 | use OCP\AppFramework\Bootstrap\IBootContext; 32 | use OCP\AppFramework\Bootstrap\IBootstrap; 33 | use OCP\AppFramework\Bootstrap\IRegistrationContext; 34 | use OCP\EventDispatcher\IEventDispatcher; 35 | 36 | include_once __DIR__ . '/../../vendor/autoload.php'; 37 | 38 | class Application extends App implements IBootstrap { 39 | 40 | const appID = 'sharelisting'; 41 | 42 | public function __construct() { 43 | parent::__construct(self::appID); 44 | } 45 | 46 | public function register(IRegistrationContext $context): void { 47 | $context->registerEventListener(LoadSidebar::class, LoadSidebarScript::class); 48 | // TODO: Implement register() method. 49 | } 50 | 51 | public function boot(IBootContext $context): void { 52 | // TODO: Implement boot() method. 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /lib/Command/ListShares.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author Florent Poinsaut 7 | * @author Roeland Jago Douma 8 | * @author John Molakvoæ 9 | * 10 | * @license GNU AGPL version 3 or any later version 11 | * 12 | * This program is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Affero General Public License as 14 | * published by the Free Software Foundation, either version 3 of the 15 | * License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Affero General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Affero General Public License 23 | * along with this program. If not, see . 24 | * 25 | */ 26 | 27 | namespace OCA\ShareListing\Command; 28 | 29 | use iter; 30 | use OCA\ShareListing\Service\SharesList; 31 | use OCP\Files\IRootFolder; 32 | use OCP\IUser; 33 | use OCP\IUserManager; 34 | use OCP\Share\IManager as ShareManager; 35 | use OC\Core\Command\Base; 36 | use Symfony\Component\Console\Command\Command; 37 | use Symfony\Component\Console\Input\InputInterface; 38 | use Symfony\Component\Console\Input\InputOption; 39 | use Symfony\Component\Console\Output\OutputInterface; 40 | 41 | class ListShares extends Base { 42 | 43 | /** @var ShareManager */ 44 | private $shareManager; 45 | 46 | /** @var IUserManager */ 47 | private $userManager; 48 | 49 | /** @var IRootFolder */ 50 | private $rootFolder; 51 | 52 | /** @var SharesList */ 53 | private $sharesList; 54 | 55 | public function __construct(ShareManager $shareManager, 56 | IUserManager $userManager, 57 | IRootFolder $rootFolder, 58 | SharesList $sharesList) { 59 | parent::__construct(); 60 | 61 | $this->shareManager = $shareManager; 62 | $this->userManager = $userManager; 63 | $this->rootFolder = $rootFolder; 64 | $this->sharesList = $sharesList; 65 | 66 | } 67 | 68 | public function configure() { 69 | $this->setName('sharing:list') 70 | ->setDescription('List who has access to shares by owner') 71 | ->addOption( 72 | 'user', 73 | 'u', 74 | InputOption::VALUE_OPTIONAL, 75 | 'Will list shares of the given user' 76 | ) 77 | ->addOption( 78 | 'path', 79 | 'p', 80 | InputOption::VALUE_OPTIONAL, 81 | 'Will only consider the given path' 82 | )->addOption( 83 | 'token', 84 | 't', 85 | InputOption::VALUE_OPTIONAL, 86 | 'Will only consider the given token' 87 | )->addOption( 88 | 'filter', 89 | 'f', 90 | InputOption::VALUE_OPTIONAL, 91 | 'Filter shares, possible values: owner, initiator, recipient, token, has-expiration, no-expiration' 92 | ) 93 | ->addOption( 94 | 'output', 95 | 'o', 96 | InputOption::VALUE_OPTIONAL, 97 | 'Output format (json or csv, default is json)', 98 | 'json' 99 | ); 100 | } 101 | 102 | protected function execute(InputInterface $input, OutputInterface $output): int { 103 | $user = $input->getOption('user'); 104 | $path = $input->getOption('path'); 105 | $token = $input->getOption('token'); 106 | $filter = $this->sharesList->filterStringToInt($input->getOption('filter')); 107 | $outputOpt = $input->getOption('output'); 108 | 109 | $shares = iter\toArray($this->sharesList->getFormattedShares($user, $filter, $path, $token)); 110 | 111 | $output->writeln($this->sharesList->getSerializedShares($shares, $outputOpt)); 112 | return 0; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /lib/Controller/ApiController.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author John Molakvoæ 7 | * 8 | * @license GNU AGPL version 3 or any later version 9 | * 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as 12 | * published by the Free Software Foundation, either version 3 of the 13 | * License, or (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | * 23 | */ 24 | 25 | namespace OCA\ShareListing\Controller; 26 | 27 | use iter; 28 | use OCA\ShareListing\Service\SharesList; 29 | use OCP\AppFramework\Http\DataResponse; 30 | use OCP\AppFramework\OCS\OCSException; 31 | use OCP\AppFramework\OCS\OCSNotFoundException; 32 | use OCP\AppFramework\OCSController; 33 | use OCP\IRequest; 34 | use OCP\IUserManager; 35 | use OCP\IUserSession; 36 | use OCP\Share; 37 | use OCP\Share\IShare; 38 | 39 | class ApiController extends OCSController { 40 | 41 | /** @var IUserSession */ 42 | protected $userSession; 43 | 44 | /** @var IUserManager */ 45 | private $userManager; 46 | 47 | /** @var SharesList */ 48 | protected $sharesList; 49 | 50 | /** 51 | * @param string $appName 52 | * @param IRequest $request 53 | * @param IUserSession $userSession 54 | * @param IUserManager $userManager 55 | * @param SharesList $sharesList 56 | */ 57 | public function __construct(string $appName, 58 | IRequest $request, 59 | IUserSession $userSession, 60 | IUserManager $userManager, 61 | SharesList $sharesList) { 62 | parent::__construct($appName, $request); 63 | 64 | $this->userSession = $userSession; 65 | $this->userManager = $userManager; 66 | $this->sharesList = $sharesList; 67 | } 68 | 69 | /** 70 | * @NoAdminRequired 71 | * 72 | * Get shared sub folders of a fiven path 73 | * 74 | * @param string $path path of the current folder 75 | * @return DataResponse 76 | */ 77 | public function getSharedSubfolders(string $path): DataResponse { 78 | $currentUser = $this->userSession->getUser(); 79 | 80 | // Check if the target user exists 81 | if ($currentUser === null) { 82 | throw new OCSNotFoundException('User does not exist'); 83 | } 84 | 85 | $shares = $this->sharesList->getSub($currentUser->getUID(), SharesList::FILTER_NONE, $path); 86 | 87 | // format results 88 | $formattedShares = iter\map(function (IShare $share) { 89 | return $this->sharesList->formatShare($share); 90 | }, $shares); 91 | 92 | // remove current folder 93 | $filteredShares = iter\filter(function($share) use ($path) { 94 | return $share['path'] !== $path; 95 | }, $formattedShares); 96 | 97 | // sort directories first 98 | $sortedShares = iter\toArray($filteredShares); 99 | usort($sortedShares, function($a, $b) { 100 | if ($a['is_directory'] && $b['is_directory']) { 101 | return strcmp($a['path'], $b['path']); 102 | } 103 | return $b['is_directory'] - $a['is_directory']; 104 | }); 105 | 106 | return new DataResponse($sortedShares); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /lib/Listener/LoadSidebarScript.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author John Molakvoæ 7 | * 8 | * @license GNU AGPL version 3 or any later version 9 | * 10 | * This program is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Affero General Public License as 12 | * published by the Free Software Foundation, either version 3 of the 13 | * License, or (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Affero General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Affero General Public License 21 | * along with this program. If not, see . 22 | * 23 | */ 24 | 25 | namespace OCA\ShareListing\Listener; 26 | 27 | use OCA\ShareListing\AppInfo\Application; 28 | use OCA\Files\Event\LoadSidebar; 29 | use OCP\EventDispatcher\Event; 30 | use OCP\EventDispatcher\IEventListener; 31 | use OCP\Util; 32 | 33 | class LoadSidebarScript implements IEventListener { 34 | public function handle(Event $event): void { 35 | if (!($event instanceof LoadSidebar)) { 36 | return; 37 | } 38 | 39 | Util::addScript(Application::appID, 'sharelisting-main'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/Service/SharesList.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * @author Florent Poinsaut 7 | * @author Roeland Jago Douma 8 | * @author John Molakvoæ 9 | * 10 | * @license GNU AGPL version 3 or any later version 11 | * 12 | * This program is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Affero General Public License as 14 | * published by the Free Software Foundation, either version 3 of the 15 | * License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Affero General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Affero General Public License 23 | * along with this program. If not, see . 24 | * 25 | */ 26 | 27 | namespace OCA\ShareListing\Service; 28 | 29 | use iter; 30 | use OC\User\NoUserException; 31 | use OCP\Files\Folder; 32 | use OCP\Files\IRootFolder; 33 | use OCP\Files\NotFoundException; 34 | use OCP\IUserManager; 35 | use OCP\Share; 36 | use OCP\Share\IManager as ShareManager; 37 | use OCP\Share\IShare; 38 | use Symfony\Component\Serializer\Encoder\JsonEncoder; 39 | use Symfony\Component\Serializer\Encoder\CsvEncoder; 40 | use Symfony\Component\Serializer\Serializer; 41 | 42 | class SharesList { 43 | 44 | const FILTER_NONE = 0; 45 | const FILTER_OWNER = 1; 46 | const FILTER_INITIATOR = 2; 47 | const FILTER_RECIPIENT = 3; 48 | const FILTER_TOKEN = 4; 49 | const FILTER_HAS_EXPIRATION = 5; 50 | const FILTER_NO_EXPIRATION = 6; 51 | 52 | /** @var ShareManager */ 53 | private $shareManager; 54 | 55 | /** @var IUserManager */ 56 | private $userManager; 57 | 58 | /** @var IRootFolder */ 59 | private $rootFolder; 60 | 61 | public function __construct(ShareManager $shareManager, 62 | IUserManager $userManager, 63 | IRootFolder $rootFolder) { 64 | $this->shareManager = $shareManager; 65 | $this->userManager = $userManager; 66 | $this->rootFolder = $rootFolder; 67 | } 68 | 69 | private function getShareTypes(): array { 70 | return [ 71 | IShare::TYPE_USER, 72 | IShare::TYPE_GROUP, 73 | IShare::TYPE_LINK, 74 | IShare::TYPE_EMAIL, 75 | IShare::TYPE_REMOTE, 76 | ]; 77 | } 78 | 79 | public function get(?string $userId, int $filter, string $path = null, string $token = null): \Iterator { 80 | $shares = $this->getShares($userId); 81 | 82 | // If path is set. Filter for the current user 83 | if ($path !== null) { 84 | $userFolder = $this->rootFolder->getUserFolder($userId); 85 | try { 86 | $node = $userFolder->get($path); 87 | } catch (NotFoundException $e) { 88 | // Path is not valid for user so nothing to report; 89 | return new \EmptyIterator(); 90 | } 91 | $shares = iter\filter(function (IShare $share) use ($node) { 92 | if ($node->getId() === $share->getNodeId()) { 93 | return true; 94 | } 95 | if ($node instanceof Folder) { 96 | return !empty($node->getById($share->getNodeId())); 97 | } 98 | return false; 99 | }, $shares); 100 | } 101 | if ($token !== null) { 102 | $shares = [$this->shareManager->getShareByToken($token)]; 103 | } 104 | 105 | if ($filter === self::FILTER_OWNER) { 106 | $shares = iter\filter(function (IShare $share) use ($userId) { 107 | return $share->getShareOwner() === $userId; 108 | }, $shares); 109 | } 110 | if ($filter === self::FILTER_INITIATOR) { 111 | $shares = iter\filter(function (IShare $share) use ($userId) { 112 | return $share->getSharedBy() === $userId; 113 | }, $shares); 114 | } 115 | if ($filter === self::FILTER_RECIPIENT) { 116 | // We can't check the recipient since this might be a group share etc. However you can't share to yourself 117 | $shares = iter\filter(function (IShare $share) use ($userId) { 118 | return $share->getShareOwner() !== $userId && $share->getSharedBy() !== $userId; 119 | }, $shares); 120 | } 121 | 122 | if ($filter === self::FILTER_HAS_EXPIRATION) { 123 | $shares = iter\filter(function (IShare $share) use ($userId): bool { 124 | return $share->getExpirationDate() !== null; 125 | }, $shares); 126 | } 127 | 128 | if ($filter === self::FILTER_NO_EXPIRATION) { 129 | $shares = iter\filter(function (IShare $share) use ($userId): bool { 130 | return $share->getExpirationDate() === null; 131 | }, $shares); 132 | } 133 | 134 | $shares = iter\filter(function (IShare $share): bool { 135 | try { 136 | $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner()); 137 | } catch (NoUserException $e) { 138 | return false; 139 | } catch (\Throwable $e) { 140 | return false; 141 | } 142 | $nodes = $userFolder->getById($share->getNodeId()); 143 | 144 | return $nodes !== []; 145 | }, $shares); 146 | 147 | return $shares; 148 | } 149 | 150 | /** 151 | * Get all subshares of the current path 152 | * Get all shares. And filter them by being a subpath of the current path. 153 | * This allows us to build a list of subfiles/folder that are shared 154 | * as well 155 | */ 156 | public function getSub(string $userId, int $filter, string $path): \Iterator { 157 | $shares = $this->shareManager->getAllShares(); 158 | 159 | // If path is set. Filter for the current user 160 | $userFolder = $this->rootFolder->getUserFolder($userId); 161 | try { 162 | $node = $userFolder->get($path); 163 | } catch (NotFoundException $e) { 164 | // Path is not valid for user so nothing to report; 165 | return new \EmptyIterator(); 166 | } 167 | 168 | $shares = iter\filter(function (IShare $share) use ($node) { 169 | if ($node->getId() === $share->getNodeId()) { 170 | return false; 171 | } 172 | if ($node instanceof Folder) { 173 | return !empty($node->getById($share->getNodeId())); 174 | } 175 | return false; 176 | }, $shares); 177 | 178 | if ($filter === self::FILTER_OWNER) { 179 | $shares = iter\filter(function (IShare $share) use ($userId) { 180 | return $share->getShareOwner() === $userId; 181 | }, $shares); 182 | } 183 | if ($filter === self::FILTER_INITIATOR) { 184 | $shares = iter\filter(function (IShare $share) use ($userId) { 185 | return $share->getSharedBy() === $userId; 186 | }, $shares); 187 | } 188 | if ($filter === self::FILTER_RECIPIENT) { 189 | // We can't check the recipient since this might be a group share etc. However you can't share to yourself 190 | $shares = iter\filter(function (IShare $share) use ($userId) { 191 | return $share->getShareOwner() !== $userId && $share->getSharedBy() !== $userId; 192 | }, $shares); 193 | } 194 | 195 | $shares = iter\filter(function (IShare $share) { 196 | try { 197 | $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner()); 198 | } catch (NoUserException $e) { 199 | return false; 200 | } catch (\Throwable $e) { 201 | return false; 202 | } 203 | $nodes = $userFolder->getById($share->getNodeId()); 204 | 205 | return $nodes !== []; 206 | }, $shares); 207 | 208 | return $shares; 209 | } 210 | 211 | public function getFormattedShares(string $userId = null, int $filter = self::FILTER_NONE, string $path = null, string $token = null): \Iterator { 212 | $shares = $this->get($userId, $filter, $path, $token); 213 | 214 | $formattedShares = iter\map(function (IShare $share): array { 215 | return $this->formatShare($share); 216 | }, $shares); 217 | 218 | return $formattedShares; 219 | } 220 | 221 | private function getShares(?string $userId): \Iterator { 222 | if (empty($userId)) { 223 | $shares = $this->shareManager->getAllShares(); 224 | } else { 225 | $shareTypes = $this->getShareTypes(); 226 | 227 | foreach ($shareTypes as $shareType) { 228 | $shares = $this->shareManager->getSharesBy($userId, $shareType, null, true, -1, 0); 229 | 230 | if ($shareType !== \OCP\Share\IShare::TYPE_LINK) { 231 | foreach ($shares as $share) { 232 | yield $share; 233 | } 234 | 235 | $shares = $this->shareManager->getSharedWith($userId, $shareType, null, -1, 0); 236 | } 237 | } 238 | } 239 | 240 | foreach ($shares as $share) { 241 | yield $share; 242 | } 243 | } 244 | 245 | public function formatShare(IShare $share): array { 246 | $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner()); 247 | 248 | $data = [ 249 | 'id' => $share->getId(), 250 | 'file_id' => $share->getNodeId(), 251 | 'owner' => $share->getShareOwner(), 252 | 'initiator' => $share->getSharedBy(), 253 | 'time' => $share->getShareTime()->format(\DATE_ATOM), 254 | 'permissions' => $share->getPermissions(), 255 | ]; 256 | 257 | $nodes = $userFolder->getById($share->getNodeId()); 258 | $node = array_shift($nodes); 259 | $data['path'] = $userFolder->getRelativePath($node->getPath()); 260 | $data['name'] = $node->getName(); 261 | $data['is_directory'] = $node->getType() === 'dir'; 262 | 263 | 264 | 265 | if ($share->getShareType() === IShare::TYPE_USER) { 266 | $data['type'] = 'user'; 267 | $data['recipient'] = $share->getSharedWith(); 268 | } 269 | if ($share->getShareType() === IShare::TYPE_GROUP) { 270 | $data['type'] = 'group'; 271 | $data['recipient'] = $share->getSharedWith(); 272 | } 273 | if ($share->getShareType() === IShare::TYPE_LINK) { 274 | $data['type'] = 'link'; 275 | $data['token'] = $share->getToken(); 276 | } 277 | if ($share->getShareType() === IShare::TYPE_EMAIL) { 278 | $data['type'] = 'email'; 279 | $data['recipient'] = $share->getSharedWith(); 280 | $data['token'] = $share->getToken(); 281 | } 282 | if ($share->getShareType() === IShare::TYPE_REMOTE) { 283 | $data['type'] = 'federated'; 284 | $data['recipient'] = $share->getSharedWith(); 285 | } 286 | 287 | if ($share->getExpirationDate() !== null) { 288 | $data['expiration'] = $share->getExpirationDate()->format('Y-m-d H:i:s'); 289 | } 290 | 291 | return $data; 292 | } 293 | 294 | public function filterStringToInt(?string $filterString): int { 295 | switch ($filterString) { 296 | case 'owner': 297 | $filter = SharesList::FILTER_OWNER; 298 | break; 299 | case 'initiator': 300 | $filter = SharesList::FILTER_INITIATOR; 301 | break; 302 | case 'recipient': 303 | $filter = SharesList::FILTER_RECIPIENT; 304 | break; 305 | case 'has-expiration': 306 | $filter = SharesList::FILTER_HAS_EXPIRATION; 307 | break; 308 | case 'no-expiration': 309 | $filter = SharesList::FILTER_NO_EXPIRATION; 310 | break; 311 | default: 312 | $filter = SharesList::FILTER_NONE; 313 | break; 314 | } 315 | 316 | return $filter; 317 | } 318 | 319 | public function getSerializedShares(array $shares, ?string $format = 'json'): string 320 | { 321 | switch ($format) { 322 | case 'csv': 323 | $encoders = [new CsvEncoder()]; 324 | $context = []; 325 | break; 326 | default: 327 | $encoders = [new JsonEncoder()]; 328 | $format = 'json'; 329 | $context = ['json_encode_options' => JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE]; 330 | break; 331 | } 332 | 333 | $serializer = new Serializer([], $encoders); 334 | return $serializer->serialize($shares, $format, $context); 335 | } 336 | } 337 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sharelisting", 3 | "version": "1.2.0", 4 | "description": "This app allows generating reports of shares on the system.", 5 | "main": "main.js", 6 | "private": true, 7 | "scripts": { 8 | "build": "NODE_ENV=production webpack --progress --config webpack.js", 9 | "dev": "NODE_ENV=development webpack --progress --config webpack.js", 10 | "watch": "NODE_ENV=development webpack --progress --watch --config webpack.js", 11 | "lint": "eslint --ext .js,.vue src", 12 | "lint:fix": "eslint --ext .js,.vue src --fix", 13 | "stylelint": "stylelint src", 14 | "stylelint:fix": "stylelint src --fix" 15 | }, 16 | "dependencies": { 17 | "@nextcloud/axios": "^2.5.1", 18 | "@nextcloud/l10n": "^2.1.0", 19 | "@nextcloud/router": "^2.2.1", 20 | "@nextcloud/vue": "^8.27.0", 21 | "vue": "^2.7.14" 22 | }, 23 | "devDependencies": { 24 | "@nextcloud/babel-config": "^1.2.0", 25 | "@nextcloud/browserslist-config": "^2.3.0", 26 | "@nextcloud/eslint-config": "^8.4.2", 27 | "@nextcloud/stylelint-config": "^2.4.0", 28 | "@nextcloud/webpack-vue-config": "^6.3.0", 29 | "@relative-ci/agent": "^4.3.1", 30 | "vue-template-compiler": "^2.7.16" 31 | }, 32 | "browserslist": [ 33 | "extends @nextcloud/browserslist-config" 34 | ], 35 | "repository": { 36 | "type": "git", 37 | "url": "git+https://github.com/rullzer/sharelisting.git" 38 | }, 39 | "keywords": [], 40 | "author": "", 41 | "license": "AGPL", 42 | "bugs": { 43 | "url": "https://github.com/rullzer/sharelisting/issues" 44 | }, 45 | "homepage": "https://github.com/rullzer/sharelisting#readme", 46 | "engines": { 47 | "node": "^16.0.0", 48 | "npm": "^7.0.0 || ^8.0.0" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /psalm.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/assets/share-folder.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/components/SharingEntrySimple.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 37 | 38 | 72 | 73 | 99 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @copyright Copyright (c) 2018 John Molakvoæ 3 | * 4 | * @author John Molakvoæ 5 | * 6 | * @license AGPL-3.0-or-later 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Affero General Public License as 10 | * published by the Free Software Foundation, either version 3 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Affero General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Affero General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | import Vue from 'vue' 23 | import { translate, translatePlural } from '@nextcloud/l10n' 24 | 25 | Vue.prototype.t = translate 26 | Vue.prototype.n = translatePlural 27 | 28 | // eslint-disable-next-line 29 | __webpack_nonce__ = btoa(OC.requestToken) 30 | // eslint-disable-next-line 31 | __webpack_public_path__ = OC.linkTo('sharelisting', 'js/') 32 | 33 | window.addEventListener('DOMContentLoaded', () => { 34 | if (!OCA?.Sharing?.ShareTabSections) { 35 | return 36 | } 37 | 38 | // eslint-disable-next-line 39 | import(/* webpackChunkName: "sharing" */'./views/SharedSubfolders').then((Module) => { 40 | OCA.Sharing.ShareTabSections.registerSection((el, fileInfo) => { 41 | if (fileInfo.isDirectory() !== true) { 42 | return 43 | } 44 | return Module.default 45 | }) 46 | }) 47 | }) 48 | -------------------------------------------------------------------------------- /src/views/SharedSubfolders.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 50 | 51 | 166 | 167 | 191 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true); 8 | \OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true); 9 | 10 | OC_App::loadApp('sharelisting'); 11 | 12 | OC_Hook::clear(); 13 | -------------------------------------------------------------------------------- /tests/phpunit.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ../ 12 | 13 | 14 | ../tests 15 | 16 | 17 | 18 | 19 | 20 | 21 | . 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/psalm-baseline.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/stub.phpstub: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * @license GNU AGPL version 3 or any later version 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as 11 | * published by the Free Software Foundation, either version 3 of the 12 | * License, or (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | * 22 | */ 23 | 24 | namespace { 25 | 26 | use OCP\IServerContainer; 27 | 28 | class OC { 29 | static $CLI = false; 30 | /** @var IServerContainer */ 31 | static $server; 32 | } 33 | } 34 | 35 | namespace OC\User { 36 | class NoUserException extends \Exception {} 37 | } 38 | 39 | namespace OCA\Files\Event { 40 | class LoadSidebar extends \OCP\EventDispatcher\Event {} 41 | } 42 | 43 | namespace OC\Files\Node { 44 | use OCP\Files\FileInfo; 45 | abstract class Node implements \OCP\Files\Node { 46 | /** @return FileInfo|\ArrayAccess */ 47 | public function getFileInfo() {} 48 | 49 | /** @return \OCP\Files\Mount\IMountPoint */ 50 | public function getMountPoint() {} 51 | } 52 | } 53 | 54 | namespace OC\Hooks { 55 | class Emitter { 56 | public function emit(string $class, string $value, array $option) {} 57 | /** Closure $closure */ 58 | public function listen(string $class, string $value, $closure) {} 59 | } 60 | class BasicEmitter extends Emitter { 61 | } 62 | } 63 | 64 | namespace OC\Cache { 65 | class CappedMemoryCache { 66 | public function get($key) {} 67 | public function set($key, $value, $ttl = '') {} 68 | } 69 | } 70 | 71 | namespace OC\Core\Command { 72 | use Symfony\Component\Console\Input\InputInterface; 73 | use Symfony\Component\Console\Output\OutputInterface; 74 | class Base { 75 | public const OUTPUT_FORMAT_PLAIN = 'plain'; 76 | public const OUTPUT_FORMAT_JSON = 'json'; 77 | public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; 78 | 79 | public function __construct() {} 80 | protected function configure() {} 81 | protected function execute(InputInterface $input, OutputInterface $output): int {} 82 | public function setName(string $name) {} 83 | public function getHelper(string $name) {} 84 | protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { 85 | } 86 | } 87 | } 88 | 89 | namespace OC\Files\ObjectStore { 90 | class NoopScanner {} 91 | } 92 | 93 | namespace Symfony\Component\Console\Helper { 94 | use Symfony\Component\Console\Output\OutputInterface; 95 | class Table { 96 | public function __construct(OutputInterface $text) {} 97 | public function setHeaders(array $header) {} 98 | public function setRows(array $rows) {} 99 | public function render() {} 100 | } 101 | } 102 | 103 | namespace Symfony\Component\Console\Input { 104 | class InputInterface { 105 | public function getOption(string $key) {} 106 | public function getArgument(string $key) {} 107 | } 108 | class InputArgument { 109 | const REQUIRED = 0; 110 | const OPTIONAL = 1; 111 | const IS_ARRAY = 1; 112 | } 113 | class InputOption { 114 | const VALUE_NONE = 1; 115 | const VALUE_REQUIRED = 1; 116 | const VALUE_OPTIONAL = 1; 117 | } 118 | } 119 | 120 | namespace Symfony\Component\Console\Question { 121 | class ConfirmationQuestion { 122 | public function __construct(string $text, bool $default) {} 123 | } 124 | } 125 | 126 | namespace Symfony\Component\Console\Output { 127 | class OutputInterface { 128 | public const VERBOSITY_VERBOSE = 1; 129 | public function writeln(string $text, int $flat = 0) {} 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /webpack.js: -------------------------------------------------------------------------------- 1 | const webpackConfig = require('@nextcloud/webpack-vue-config') 2 | const path = require('path') 3 | 4 | webpackConfig.entry = { 5 | ...webpackConfig.entry, 6 | main: path.join(__dirname, 'src', 'main.js'), 7 | } 8 | 9 | webpackConfig.stats = { 10 | context: path.resolve(__dirname, 'src'), 11 | assets: true, 12 | entrypoints: true, 13 | chunks: true, 14 | modules: true, 15 | } 16 | 17 | module.exports = webpackConfig 18 | --------------------------------------------------------------------------------