├── .eslintrc.js
├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── command-compile.yml
│ ├── dependabot-approve-merge.yml
│ ├── fixup.yml
│ ├── lint-eslint.yml
│ ├── lint-info-xml.yml
│ ├── lint-php-cs.yml
│ ├── lint-php.yml
│ ├── lint-stylelint.yml
│ ├── node.yml
│ ├── phpunit-mariadb.yml
│ ├── phpunit-mysql.yml
│ ├── phpunit-oci.yml
│ ├── phpunit-pgsql.yml
│ └── phpunit-sqlite.yml
├── .gitignore
├── .php-cs-fixer.dist.php
├── CHANGELOG.md
├── COPYING
├── Makefile
├── README.md
├── appinfo
├── info.xml
└── routes.php
├── babel.config.js
├── composer.json
├── composer.lock
├── css
└── style.css
├── img
└── app.svg
├── js
├── notestutorial-main.js
├── notestutorial-main.js.LICENSE.txt
└── notestutorial-main.js.map
├── lib
├── AppInfo
│ └── Application.php
├── Controller
│ ├── Errors.php
│ ├── NoteApiController.php
│ ├── NoteController.php
│ └── PageController.php
├── Db
│ ├── Note.php
│ └── NoteMapper.php
├── Migration
│ └── Version000000Date20181013124731.php
└── Service
│ ├── NoteNotFound.php
│ └── NoteService.php
├── package-lock.json
├── package.json
├── src
├── App.vue
└── main.js
├── stylelint.config.js
├── templates
└── main.php
├── tests
├── Integration
│ └── NoteIntegrationTest.php
├── Unit
│ ├── Controller
│ │ ├── NoteApiControllerTest.php
│ │ ├── NoteControllerTest.php
│ │ └── PageControllerTest.php
│ └── Service
│ │ └── NoteServiceTest.php
├── bootstrap.php
├── phpunit.integration.xml
└── phpunit.unit.xml
└── webpack.config.js
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: [
3 | '@nextcloud',
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | /js/* binary
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: composer
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 | labels:
12 | - 3. to review
13 | - dependencies
14 | - package-ecosystem: npm
15 | directory: "/"
16 | schedule:
17 | interval: weekly
18 | day: saturday
19 | time: "03:00"
20 | timezone: Europe/Paris
21 | open-pull-requests-limit: 10
22 | labels:
23 | - 3. to review
24 | - dependencies
25 |
--------------------------------------------------------------------------------
/.github/workflows/command-compile.yml:
--------------------------------------------------------------------------------
1 | name: Compile Command
2 | on:
3 | issue_comment:
4 | types: [created]
5 |
6 | jobs:
7 | init:
8 | runs-on: ubuntu-latest
9 |
10 | # On pull requests and if the comment starts with `/compile`
11 | if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/compile')
12 |
13 | outputs:
14 | git_path: ${{ steps.git-path.outputs.path }}
15 | arg1: ${{ steps.command.outputs.arg1 }}
16 | arg2: ${{ steps.command.outputs.arg2 }}
17 | head_ref: ${{ steps.comment-branch.outputs.head_ref }}
18 | base_ref: ${{ steps.comment-branch.outputs.base_ref }}
19 |
20 | steps:
21 | - name: Get repository from pull request comment
22 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
23 | id: get-repository
24 | with:
25 | github-token: ${{secrets.GITHUB_TOKEN}}
26 | script: |
27 | const pull = await github.rest.pulls.get({
28 | owner: context.repo.owner,
29 | repo: context.repo.repo,
30 | pull_number: context.issue.number
31 | });
32 |
33 | const repositoryName = pull.data.head?.repo?.full_name
34 | console.log(repositoryName)
35 | return repositoryName
36 |
37 | - name: Disabled on forks
38 | if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
39 | run: |
40 | echo 'Can not execute /compile on forks'
41 | exit 1
42 |
43 | - name: Check actor permission
44 | uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
45 | with:
46 | require: write
47 |
48 | - name: Add reaction on start
49 | uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
50 | with:
51 | token: ${{ secrets.COMMAND_BOT_PAT }}
52 | repository: ${{ github.event.repository.full_name }}
53 | comment-id: ${{ github.event.comment.id }}
54 | reactions: "+1"
55 |
56 | - name: Parse command
57 | uses: skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
58 | id: command
59 |
60 | # Init path depending on which command is run
61 | - name: Init path
62 | id: git-path
63 | run: |
64 | if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
65 | echo "path=${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
66 | else
67 | echo "path=${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
68 | fi
69 |
70 | - name: Init branch
71 | uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
72 | id: comment-branch
73 |
74 | process:
75 | runs-on: ubuntu-latest
76 | needs: init
77 |
78 | steps:
79 | - name: Restore cached git repository
80 | uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
81 | with:
82 | path: .git
83 | key: git-repo
84 |
85 | - name: Checkout ${{ needs.init.outputs.head_ref }}
86 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87 | with:
88 | token: ${{ secrets.COMMAND_BOT_PAT }}
89 | fetch-depth: 0
90 | ref: ${{ needs.init.outputs.head_ref }}
91 |
92 | - name: Setup git
93 | run: |
94 | git config --local user.email "nextcloud-command@users.noreply.github.com"
95 | git config --local user.name "nextcloud-command"
96 |
97 | - name: Read package.json node and npm engines version
98 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
99 | id: package-engines-versions
100 | with:
101 | fallbackNode: '^20'
102 | fallbackNpm: '^10'
103 |
104 | - name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
105 | uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
106 | with:
107 | node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
108 | cache: npm
109 |
110 | - name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
111 | run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
112 |
113 | - name: Rebase to ${{ needs.init.outputs.base_ref }}
114 | if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
115 | run: |
116 | git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
117 | git rebase origin/${{ needs.init.outputs.base_ref }}
118 |
119 | - name: Install dependencies & build
120 | env:
121 | CYPRESS_INSTALL_BINARY: 0
122 | PUPPETEER_SKIP_DOWNLOAD: true
123 | run: |
124 | npm ci
125 | npm run build --if-present
126 |
127 | - name: Commit default
128 | if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
129 | run: |
130 | git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
131 | git commit --signoff -m 'chore(assets): Recompile assets'
132 |
133 | - name: Commit fixup
134 | if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
135 | run: |
136 | git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
137 | git commit --fixup=HEAD --signoff
138 |
139 | - name: Commit amend
140 | if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
141 | run: |
142 | git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
143 | git commit --amend --no-edit --signoff
144 | # Remove any [skip ci] from the amended commit
145 | git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
146 |
147 | - name: Push normally
148 | if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
149 | run: git push origin ${{ needs.init.outputs.head_ref }}
150 |
151 | - name: Force push
152 | if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
153 | run: git push --force origin ${{ needs.init.outputs.head_ref }}
154 |
155 | - name: Add reaction on failure
156 | uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
157 | if: failure()
158 | with:
159 | token: ${{ secrets.COMMAND_BOT_PAT }}
160 | repository: ${{ github.event.repository.full_name }}
161 | comment-id: ${{ github.event.comment.id }}
162 | reactions: "-1"
163 |
--------------------------------------------------------------------------------
/.github/workflows/dependabot-approve-merge.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 | - name: Disabled on forks
32 | if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
33 | run: |
34 | echo 'Can not approve PRs from forks'
35 | exit 1
36 |
37 | # Github actions bot approve
38 | - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
39 | with:
40 | github-token: ${{ secrets.GITHUB_TOKEN }}
41 |
42 | # Nextcloud bot approve and merge request
43 | - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
44 | with:
45 | target: minor
46 | github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
47 |
--------------------------------------------------------------------------------
/.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: Pull request checks
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: xt0rted/block-autosquash-commits-action@79880c36b4811fe549cfffe20233df88876024e7 # v2
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
10 |
11 | on:
12 | pull_request:
13 | paths:
14 | - '.github/workflows/**'
15 | - 'src/**'
16 | - 'appinfo/info.xml'
17 | - 'package.json'
18 | - 'package-lock.json'
19 | - 'tsconfig.json'
20 | - '.eslintrc.*'
21 | - '.eslintignore'
22 | - '**.js'
23 | - '**.ts'
24 | - '**.vue'
25 |
26 | permissions:
27 | contents: read
28 |
29 | concurrency:
30 | group: lint-eslint-${{ github.head_ref || github.run_id }}
31 | cancel-in-progress: true
32 |
33 | jobs:
34 | lint:
35 | runs-on: ubuntu-latest
36 |
37 | name: eslint
38 |
39 | steps:
40 | - name: Checkout
41 | uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
42 |
43 | - name: Read package.json node and npm engines version
44 | uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
45 | id: versions
46 | with:
47 | fallbackNode: '^16'
48 | fallbackNpm: '^7'
49 |
50 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
51 | uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
52 | with:
53 | node-version: ${{ steps.versions.outputs.nodeVersion }}
54 |
55 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
56 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
57 |
58 | - name: Install dependencies
59 | run: npm ci
60 |
61 | - name: Lint
62 | run: npm run lint
63 |
--------------------------------------------------------------------------------
/.github/workflows/lint-info-xml.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
7 |
8 | on:
9 | pull_request:
10 | push:
11 | branches:
12 | - main
13 | - master
14 | - stable*
15 |
16 | permissions:
17 | contents: read
18 |
19 | concurrency:
20 | group: lint-info-xml-${{ github.head_ref || github.run_id }}
21 | cancel-in-progress: true
22 |
23 | jobs:
24 | xml-linters:
25 | runs-on: ubuntu-latest
26 |
27 | name: info.xml lint
28 | steps:
29 | - name: Checkout
30 | uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
31 |
32 | - name: Download schema
33 | run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
34 |
35 | - name: Lint info.xml
36 | uses: ChristophWurst/xmllint-action@d18a551aab4728e4af449617638600634d7a48cb # v1
37 | with:
38 | xml-file: ./appinfo/info.xml
39 | xml-schema-file: ./info.xsd
40 |
--------------------------------------------------------------------------------
/.github/workflows/lint-php-cs.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
7 |
8 | on: pull_request
9 |
10 | permissions:
11 | contents: read
12 |
13 | concurrency:
14 | group: lint-php-cs-${{ github.head_ref || github.run_id }}
15 | cancel-in-progress: true
16 |
17 | jobs:
18 | lint:
19 | runs-on: ubuntu-latest
20 |
21 | name: php-cs
22 |
23 | steps:
24 | - name: Checkout
25 | uses: actions/checkout@v3
26 |
27 | - name: Set up php
28 | uses: shivammathur/setup-php@v2
29 | with:
30 | php-version: "8.1"
31 | coverage: none
32 |
33 | - name: Install dependencies
34 | run: composer i
35 |
36 | - name: Lint
37 | run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
38 |
--------------------------------------------------------------------------------
/.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
7 |
8 | on:
9 | pull_request:
10 | push:
11 | branches:
12 | - main
13 | - master
14 | - stable*
15 |
16 | permissions:
17 | contents: read
18 |
19 | concurrency:
20 | group: lint-php-${{ github.head_ref || github.run_id }}
21 | cancel-in-progress: true
22 |
23 | jobs:
24 | php-lint:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | matrix:
28 | php-versions: ["8.0", "8.1", "8.2"]
29 |
30 | name: php-lint
31 |
32 | steps:
33 | - name: Checkout
34 | uses: actions/checkout@v3
35 |
36 | - name: Set up php ${{ matrix.php-versions }}
37 | uses: shivammathur/setup-php@v2
38 | with:
39 | php-version: ${{ matrix.php-versions }}
40 | coverage: none
41 |
42 | - name: Lint
43 | run: composer run lint
44 |
45 | summary:
46 | permissions:
47 | contents: none
48 | runs-on: ubuntu-latest
49 | needs: php-lint
50 |
51 | if: always()
52 |
53 | name: php-lint-summary
54 |
55 | steps:
56 | - name: Summary status
57 | run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi
58 |
--------------------------------------------------------------------------------
/.github/workflows/lint-stylelint.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
7 |
8 | on: pull_request
9 |
10 | permissions:
11 | contents: read
12 |
13 | concurrency:
14 | group: lint-stylelint-${{ github.head_ref || github.run_id }}
15 | cancel-in-progress: true
16 |
17 | jobs:
18 | lint:
19 | runs-on: ubuntu-latest
20 |
21 | name: stylelint
22 |
23 | steps:
24 | - name: Checkout
25 | uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
26 |
27 | - name: Read package.json node and npm engines version
28 | uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
29 | id: versions
30 | with:
31 | fallbackNode: '^16'
32 | fallbackNpm: '^7'
33 |
34 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
35 | uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3
36 | with:
37 | node-version: ${{ steps.versions.outputs.nodeVersion }}
38 |
39 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
40 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
41 |
42 | - name: Install dependencies
43 | run: npm ci
44 |
45 | - name: Lint
46 | run: npm run stylelint
47 |
--------------------------------------------------------------------------------
/.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 | # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: Node
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: node-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | jobs:
21 | changes:
22 | runs-on: ubuntu-latest-low
23 | permissions:
24 | contents: read
25 | pull-requests: read
26 |
27 | outputs:
28 | src: ${{ steps.changes.outputs.src}}
29 |
30 | steps:
31 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32 | id: changes
33 | continue-on-error: true
34 | with:
35 | filters: |
36 | src:
37 | - '.github/workflows/**'
38 | - 'src/**'
39 | - 'appinfo/info.xml'
40 | - 'package.json'
41 | - 'package-lock.json'
42 | - 'tsconfig.json'
43 | - '**.js'
44 | - '**.ts'
45 | - '**.vue'
46 |
47 | build:
48 | runs-on: ubuntu-latest
49 |
50 | needs: changes
51 | if: needs.changes.outputs.src != 'false'
52 |
53 | name: NPM build
54 | steps:
55 | - name: Checkout
56 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57 | with:
58 | persist-credentials: false
59 |
60 | - name: Read package.json node and npm engines version
61 | uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
62 | id: versions
63 | with:
64 | fallbackNode: '^20'
65 | fallbackNpm: '^10'
66 |
67 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
68 | uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
69 | with:
70 | node-version: ${{ steps.versions.outputs.nodeVersion }}
71 |
72 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
73 | run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
74 |
75 | - name: Install dependencies & build
76 | env:
77 | CYPRESS_INSTALL_BINARY: 0
78 | PUPPETEER_SKIP_DOWNLOAD: true
79 | run: |
80 | npm ci
81 | npm run build --if-present
82 |
83 | - name: Check webpack build changes
84 | run: |
85 | bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
86 |
87 | - name: Show changes on failure
88 | if: failure()
89 | run: |
90 | git status
91 | git --no-pager diff
92 | exit 1 # make it red to grab attention
93 |
94 | summary:
95 | permissions:
96 | contents: none
97 | runs-on: ubuntu-latest-low
98 | needs: [changes, build]
99 |
100 | if: always()
101 |
102 | # This is the summary, we just avoid to rename it so that branch protection rules still match
103 | name: node
104 |
105 | steps:
106 | - name: Summary status
107 | run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi
108 |
--------------------------------------------------------------------------------
/.github/workflows/phpunit-mariadb.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 | # SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: PHPUnit MariaDB
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: phpunit-mariadb-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | env:
21 | APP_NAME: notestutorial
22 |
23 | jobs:
24 | matrix:
25 | runs-on: ubuntu-latest-low
26 | outputs:
27 | php-version: ${{ steps.versions.outputs.php-available-list }}
28 | server-max: ${{ steps.versions.outputs.branches-max-list }}
29 | steps:
30 | - name: Checkout app
31 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32 | with:
33 | persist-credentials: false
34 |
35 | - name: Get version matrix
36 | id: versions
37 | uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
38 |
39 | changes:
40 | runs-on: ubuntu-latest-low
41 | permissions:
42 | contents: read
43 | pull-requests: read
44 |
45 | outputs:
46 | src: ${{ steps.changes.outputs.src}}
47 |
48 | steps:
49 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
50 | id: changes
51 | continue-on-error: true
52 | with:
53 | filters: |
54 | src:
55 | - '.github/workflows/**'
56 | - 'appinfo/**'
57 | - 'lib/**'
58 | - 'templates/**'
59 | - 'tests/**'
60 | - 'vendor/**'
61 | - 'vendor-bin/**'
62 | - '.php-cs-fixer.dist.php'
63 | - 'composer.json'
64 | - 'composer.lock'
65 |
66 | phpunit-mariadb:
67 | runs-on: ubuntu-latest
68 |
69 | needs: [changes, matrix]
70 | if: needs.changes.outputs.src != 'false'
71 |
72 | strategy:
73 | matrix:
74 | php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
75 | server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
76 | mariadb-versions: ['10.6', '10.11']
77 |
78 | name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
79 |
80 | services:
81 | mariadb:
82 | image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest
83 | ports:
84 | - 4444:3306/tcp
85 | env:
86 | MYSQL_ROOT_PASSWORD: rootpassword
87 | options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
88 |
89 | steps:
90 | - name: Set app env
91 | if: ${{ env.APP_NAME == '' }}
92 | run: |
93 | # Split and keep last
94 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
95 |
96 | - name: Checkout server
97 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
98 | with:
99 | persist-credentials: false
100 | submodules: true
101 | repository: nextcloud/server
102 | ref: ${{ matrix.server-versions }}
103 |
104 | - name: Checkout app
105 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
106 | with:
107 | persist-credentials: false
108 | path: apps/${{ env.APP_NAME }}
109 |
110 | - name: Set up php ${{ matrix.php-versions }}
111 | uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
112 | with:
113 | php-version: ${{ matrix.php-versions }}
114 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
115 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
116 | coverage: none
117 | ini-file: development
118 | env:
119 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120 |
121 | - name: Enable ONLY_FULL_GROUP_BY MariaDB option
122 | run: |
123 | echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
124 | echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
125 |
126 | - name: Check composer file existence
127 | id: check_composer
128 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
129 | with:
130 | files: apps/${{ env.APP_NAME }}/composer.json
131 |
132 | - name: Set up dependencies
133 | # Only run if phpunit config file exists
134 | if: steps.check_composer.outputs.files_exists == 'true'
135 | working-directory: apps/${{ env.APP_NAME }}
136 | run: |
137 | composer remove nextcloud/ocp --dev
138 | composer i
139 |
140 | - name: Set up Nextcloud
141 | env:
142 | DB_PORT: 4444
143 | run: |
144 | mkdir data
145 | ./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
146 | ./occ app:enable --force ${{ env.APP_NAME }}
147 |
148 | - name: Check PHPUnit script is defined
149 | id: check_phpunit
150 | continue-on-error: true
151 | working-directory: apps/${{ env.APP_NAME }}
152 | run: |
153 | composer run --list | grep '^ test:unit ' | wc -l | grep 1
154 |
155 | - name: PHPUnit
156 | # Only run if phpunit config file exists
157 | if: steps.check_phpunit.outcome == 'success'
158 | working-directory: apps/${{ env.APP_NAME }}
159 | run: composer run test:unit
160 |
161 | - name: Check PHPUnit integration script is defined
162 | id: check_integration
163 | continue-on-error: true
164 | working-directory: apps/${{ env.APP_NAME }}
165 | run: |
166 | composer run --list | grep '^ test:integration ' | wc -l | grep 1
167 |
168 | - name: Run Nextcloud
169 | # Only run if phpunit integration config file exists
170 | if: steps.check_integration.outcome == 'success'
171 | run: php -S localhost:8080 &
172 |
173 | - name: PHPUnit integration
174 | # Only run if phpunit integration config file exists
175 | if: steps.check_integration.outcome == 'success'
176 | working-directory: apps/${{ env.APP_NAME }}
177 | run: composer run test:integration
178 |
179 | - name: Print logs
180 | if: always()
181 | run: |
182 | cat data/nextcloud.log
183 |
184 | - name: Skipped
185 | # Fail the action when neither unit nor integration tests ran
186 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
187 | run: |
188 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
189 | exit 1
190 |
191 | summary:
192 | permissions:
193 | contents: none
194 | runs-on: ubuntu-latest-low
195 | needs: [changes, phpunit-mariadb]
196 |
197 | if: always()
198 |
199 | name: phpunit-mariadb-summary
200 |
201 | steps:
202 | - name: Summary status
203 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mariadb.result != 'success' }}; then exit 1; fi
204 |
--------------------------------------------------------------------------------
/.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 | # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: PHPUnit MySQL
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: phpunit-mysql-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | env:
21 | APP_NAME: notestutorial
22 |
23 | jobs:
24 | matrix:
25 | runs-on: ubuntu-latest-low
26 | outputs:
27 | matrix: ${{ steps.versions.outputs.sparse-matrix }}
28 | steps:
29 | - name: Checkout app
30 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31 | with:
32 | persist-credentials: false
33 |
34 | - name: Get version matrix
35 | id: versions
36 | uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
37 | with:
38 | matrix: '{"mysql-versions": ["8.4"]}'
39 |
40 | changes:
41 | runs-on: ubuntu-latest-low
42 | permissions:
43 | contents: read
44 | pull-requests: read
45 |
46 | outputs:
47 | src: ${{ steps.changes.outputs.src}}
48 |
49 | steps:
50 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
51 | id: changes
52 | continue-on-error: true
53 | with:
54 | filters: |
55 | src:
56 | - '.github/workflows/**'
57 | - 'appinfo/**'
58 | - 'lib/**'
59 | - 'templates/**'
60 | - 'tests/**'
61 | - 'vendor/**'
62 | - 'vendor-bin/**'
63 | - '.php-cs-fixer.dist.php'
64 | - 'composer.json'
65 | - 'composer.lock'
66 |
67 | phpunit-mysql:
68 | runs-on: ubuntu-latest
69 |
70 | needs: [changes, matrix]
71 | if: needs.changes.outputs.src != 'false'
72 |
73 | strategy:
74 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
75 |
76 | name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
77 |
78 | services:
79 | mysql:
80 | image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest
81 | ports:
82 | - 4444:3306/tcp
83 | env:
84 | MYSQL_ROOT_PASSWORD: rootpassword
85 | options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
86 |
87 | steps:
88 | - name: Set app env
89 | if: ${{ env.APP_NAME == '' }}
90 | run: |
91 | # Split and keep last
92 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
93 |
94 | - name: Checkout server
95 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
96 | with:
97 | persist-credentials: false
98 | submodules: true
99 | repository: nextcloud/server
100 | ref: ${{ matrix.server-versions }}
101 |
102 | - name: Checkout app
103 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
104 | with:
105 | persist-credentials: false
106 | path: apps/${{ env.APP_NAME }}
107 |
108 | - name: Set up php ${{ matrix.php-versions }}
109 | uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
110 | with:
111 | php-version: ${{ matrix.php-versions }}
112 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
113 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
114 | coverage: none
115 | ini-file: development
116 | env:
117 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118 |
119 | - name: Enable ONLY_FULL_GROUP_BY MySQL option
120 | run: |
121 | echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
122 | echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
123 |
124 | - name: Check composer file existence
125 | id: check_composer
126 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
127 | with:
128 | files: apps/${{ env.APP_NAME }}/composer.json
129 |
130 | - name: Set up dependencies
131 | # Only run if phpunit config file exists
132 | if: steps.check_composer.outputs.files_exists == 'true'
133 | working-directory: apps/${{ env.APP_NAME }}
134 | run: |
135 | composer remove nextcloud/ocp --dev
136 | composer i
137 |
138 | - name: Set up Nextcloud
139 | env:
140 | DB_PORT: 4444
141 | run: |
142 | mkdir data
143 | ./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
144 | ./occ app:enable --force ${{ env.APP_NAME }}
145 |
146 | - name: Check PHPUnit script is defined
147 | id: check_phpunit
148 | continue-on-error: true
149 | working-directory: apps/${{ env.APP_NAME }}
150 | run: |
151 | composer run --list | grep '^ test:unit ' | wc -l | grep 1
152 |
153 | - name: PHPUnit
154 | # Only run if phpunit config file exists
155 | if: steps.check_phpunit.outcome == 'success'
156 | working-directory: apps/${{ env.APP_NAME }}
157 | run: composer run test:unit
158 |
159 | - name: Check PHPUnit integration script is defined
160 | id: check_integration
161 | continue-on-error: true
162 | working-directory: apps/${{ env.APP_NAME }}
163 | run: |
164 | composer run --list | grep '^ test:integration ' | wc -l | grep 1
165 |
166 | - name: Run Nextcloud
167 | # Only run if phpunit integration config file exists
168 | if: steps.check_integration.outcome == 'success'
169 | run: php -S localhost:8080 &
170 |
171 | - name: PHPUnit integration
172 | # Only run if phpunit integration config file exists
173 | if: steps.check_integration.outcome == 'success'
174 | working-directory: apps/${{ env.APP_NAME }}
175 | run: composer run test:integration
176 |
177 | - name: Print logs
178 | if: always()
179 | run: |
180 | cat data/nextcloud.log
181 |
182 | - name: Skipped
183 | # Fail the action when neither unit nor integration tests ran
184 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
185 | run: |
186 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
187 | exit 1
188 |
189 | summary:
190 | permissions:
191 | contents: none
192 | runs-on: ubuntu-latest-low
193 | needs: [changes, phpunit-mysql]
194 |
195 | if: always()
196 |
197 | name: phpunit-mysql-summary
198 |
199 | steps:
200 | - name: Summary status
201 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
202 |
--------------------------------------------------------------------------------
/.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 | # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: PHPUnit OCI
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: phpunit-oci-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | env:
21 | APP_NAME: notestutorial
22 |
23 | jobs:
24 | matrix:
25 | runs-on: ubuntu-latest-low
26 | outputs:
27 | php-version: ${{ steps.versions.outputs.php-available-list }}
28 | server-max: ${{ steps.versions.outputs.branches-max-list }}
29 | steps:
30 | - name: Checkout app
31 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32 | with:
33 | persist-credentials: false
34 |
35 | - name: Get version matrix
36 | id: versions
37 | uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
38 |
39 | changes:
40 | runs-on: ubuntu-latest-low
41 | permissions:
42 | contents: read
43 | pull-requests: read
44 |
45 | outputs:
46 | src: ${{ steps.changes.outputs.src }}
47 |
48 | steps:
49 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
50 | id: changes
51 | continue-on-error: true
52 | with:
53 | filters: |
54 | src:
55 | - '.github/workflows/**'
56 | - 'appinfo/**'
57 | - 'lib/**'
58 | - 'templates/**'
59 | - 'tests/**'
60 | - 'vendor/**'
61 | - 'vendor-bin/**'
62 | - '.php-cs-fixer.dist.php'
63 | - 'composer.json'
64 | - 'composer.lock'
65 |
66 | phpunit-oci:
67 | runs-on: ubuntu-latest
68 |
69 | needs: [changes, matrix]
70 | if: needs.changes.outputs.src != 'false'
71 |
72 | strategy:
73 | matrix:
74 | php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
75 | server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
76 |
77 | name: OCI PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
78 |
79 | services:
80 | oracle:
81 | image: ghcr.io/gvenzl/oracle-xe:11
82 |
83 | # Provide passwords and other environment variables to container
84 | env:
85 | ORACLE_RANDOM_PASSWORD: true
86 | APP_USER: autotest
87 | APP_USER_PASSWORD: owncloud
88 |
89 | # Forward Oracle port
90 | ports:
91 | - 1521:1521/tcp
92 |
93 | # Provide healthcheck script options for startup
94 | options: >-
95 | --health-cmd healthcheck.sh
96 | --health-interval 10s
97 | --health-timeout 5s
98 | --health-retries 10
99 |
100 | steps:
101 | - name: Set app env
102 | if: ${{ env.APP_NAME == '' }}
103 | run: |
104 | # Split and keep last
105 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
106 |
107 | - name: Checkout server
108 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
109 | with:
110 | persist-credentials: false
111 | submodules: true
112 | repository: nextcloud/server
113 | ref: ${{ matrix.server-versions }}
114 |
115 | - name: Checkout app
116 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
117 | with:
118 | persist-credentials: false
119 | path: apps/${{ env.APP_NAME }}
120 |
121 | - name: Set up php ${{ matrix.php-versions }}
122 | uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
123 | with:
124 | php-version: ${{ matrix.php-versions }}
125 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
126 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8
127 | coverage: none
128 | ini-file: development
129 | env:
130 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131 |
132 | - name: Check composer file existence
133 | id: check_composer
134 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
135 | with:
136 | files: apps/${{ env.APP_NAME }}/composer.json
137 |
138 | - name: Set up dependencies
139 | # Only run if phpunit config file exists
140 | if: steps.check_composer.outputs.files_exists == 'true'
141 | working-directory: apps/${{ env.APP_NAME }}
142 | run: |
143 | composer remove nextcloud/ocp --dev
144 | composer i
145 |
146 | - name: Set up Nextcloud
147 | env:
148 | DB_PORT: 1521
149 | run: |
150 | mkdir data
151 | ./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
152 | ./occ app:enable --force ${{ env.APP_NAME }}
153 |
154 | - name: Check PHPUnit script is defined
155 | id: check_phpunit
156 | continue-on-error: true
157 | working-directory: apps/${{ env.APP_NAME }}
158 | run: |
159 | composer run --list | grep '^ test:unit ' | wc -l | grep 1
160 |
161 | - name: PHPUnit
162 | # Only run if phpunit config file exists
163 | if: steps.check_phpunit.outcome == 'success'
164 | working-directory: apps/${{ env.APP_NAME }}
165 | run: composer run test:unit
166 |
167 | - name: Check PHPUnit integration script is defined
168 | id: check_integration
169 | continue-on-error: true
170 | working-directory: apps/${{ env.APP_NAME }}
171 | run: |
172 | composer run --list | grep '^ test:integration ' | wc -l | grep 1
173 |
174 | - name: Run Nextcloud
175 | # Only run if phpunit integration config file exists
176 | if: steps.check_integration.outcome == 'success'
177 | run: php -S localhost:8080 &
178 |
179 | - name: PHPUnit integration
180 | # Only run if phpunit integration config file exists
181 | if: steps.check_integration.outcome == 'success'
182 | working-directory: apps/${{ env.APP_NAME }}
183 | run: composer run test:integration
184 |
185 | - name: Print logs
186 | if: always()
187 | run: |
188 | cat data/nextcloud.log
189 |
190 | - name: Skipped
191 | # Fail the action when neither unit nor integration tests ran
192 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
193 | run: |
194 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
195 | exit 1
196 |
197 | summary:
198 | permissions:
199 | contents: none
200 | runs-on: ubuntu-latest-low
201 | needs: [changes, phpunit-oci]
202 |
203 | if: always()
204 |
205 | name: phpunit-oci-summary
206 |
207 | steps:
208 | - name: Summary status
209 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi
210 |
--------------------------------------------------------------------------------
/.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 | # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: PHPUnit PostgreSQL
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: phpunit-pgsql-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | env:
21 | APP_NAME: notestutorial
22 |
23 | jobs:
24 | matrix:
25 | runs-on: ubuntu-latest-low
26 | outputs:
27 | php-version: ${{ steps.versions.outputs.php-available-list }}
28 | server-max: ${{ steps.versions.outputs.branches-max-list }}
29 | steps:
30 | - name: Checkout app
31 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32 | with:
33 | persist-credentials: false
34 |
35 | - name: Get version matrix
36 | id: versions
37 | uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
38 |
39 | changes:
40 | runs-on: ubuntu-latest-low
41 | permissions:
42 | contents: read
43 | pull-requests: read
44 |
45 | outputs:
46 | src: ${{ steps.changes.outputs.src }}
47 |
48 | steps:
49 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
50 | id: changes
51 | continue-on-error: true
52 | with:
53 | filters: |
54 | src:
55 | - '.github/workflows/**'
56 | - 'appinfo/**'
57 | - 'lib/**'
58 | - 'templates/**'
59 | - 'tests/**'
60 | - 'vendor/**'
61 | - 'vendor-bin/**'
62 | - '.php-cs-fixer.dist.php'
63 | - 'composer.json'
64 | - 'composer.lock'
65 |
66 | phpunit-pgsql:
67 | runs-on: ubuntu-latest
68 |
69 | needs: [changes, matrix]
70 | if: needs.changes.outputs.src != 'false'
71 |
72 | strategy:
73 | matrix:
74 | php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
75 | server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
76 |
77 | name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
78 |
79 | services:
80 | postgres:
81 | image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
82 | ports:
83 | - 4444:5432/tcp
84 | env:
85 | POSTGRES_USER: root
86 | POSTGRES_PASSWORD: rootpassword
87 | POSTGRES_DB: nextcloud
88 | options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
89 |
90 | steps:
91 | - name: Set app env
92 | if: ${{ env.APP_NAME == '' }}
93 | run: |
94 | # Split and keep last
95 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
96 |
97 | - name: Checkout server
98 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99 | with:
100 | persist-credentials: false
101 | submodules: true
102 | repository: nextcloud/server
103 | ref: ${{ matrix.server-versions }}
104 |
105 | - name: Checkout app
106 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
107 | with:
108 | persist-credentials: false
109 | path: apps/${{ env.APP_NAME }}
110 |
111 | - name: Set up php ${{ matrix.php-versions }}
112 | uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
113 | with:
114 | php-version: ${{ matrix.php-versions }}
115 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
116 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
117 | coverage: none
118 | ini-file: development
119 | env:
120 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121 |
122 | - name: Check composer file existence
123 | id: check_composer
124 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
125 | with:
126 | files: apps/${{ env.APP_NAME }}/composer.json
127 |
128 | - name: Set up dependencies
129 | # Only run if phpunit config file exists
130 | if: steps.check_composer.outputs.files_exists == 'true'
131 | working-directory: apps/${{ env.APP_NAME }}
132 | run: |
133 | composer remove nextcloud/ocp --dev
134 | composer i
135 |
136 | - name: Set up Nextcloud
137 | env:
138 | DB_PORT: 4444
139 | run: |
140 | mkdir data
141 | ./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
142 | ./occ app:enable --force ${{ env.APP_NAME }}
143 |
144 | - name: Check PHPUnit script is defined
145 | id: check_phpunit
146 | continue-on-error: true
147 | working-directory: apps/${{ env.APP_NAME }}
148 | run: |
149 | composer run --list | grep '^ test:unit ' | wc -l | grep 1
150 |
151 | - name: PHPUnit
152 | # Only run if phpunit config file exists
153 | if: steps.check_phpunit.outcome == 'success'
154 | working-directory: apps/${{ env.APP_NAME }}
155 | run: composer run test:unit
156 |
157 | - name: Check PHPUnit integration script is defined
158 | id: check_integration
159 | continue-on-error: true
160 | working-directory: apps/${{ env.APP_NAME }}
161 | run: |
162 | composer run --list | grep '^ test:integration ' | wc -l | grep 1
163 |
164 | - name: Run Nextcloud
165 | # Only run if phpunit integration config file exists
166 | if: steps.check_integration.outcome == 'success'
167 | run: php -S localhost:8080 &
168 |
169 | - name: PHPUnit integration
170 | # Only run if phpunit integration config file exists
171 | if: steps.check_integration.outcome == 'success'
172 | working-directory: apps/${{ env.APP_NAME }}
173 | run: composer run test:integration
174 |
175 | - name: Print logs
176 | if: always()
177 | run: |
178 | cat data/nextcloud.log
179 |
180 | - name: Skipped
181 | # Fail the action when neither unit nor integration tests ran
182 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
183 | run: |
184 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
185 | exit 1
186 |
187 | summary:
188 | permissions:
189 | contents: none
190 | runs-on: ubuntu-latest-low
191 | needs: [changes, phpunit-pgsql]
192 |
193 | if: always()
194 |
195 | name: phpunit-pgsql-summary
196 |
197 | steps:
198 | - name: Summary status
199 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
200 |
--------------------------------------------------------------------------------
/.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 | # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: PHPUnit SQLite
10 |
11 | on: pull_request
12 |
13 | permissions:
14 | contents: read
15 |
16 | concurrency:
17 | group: phpunit-sqlite-${{ github.head_ref || github.run_id }}
18 | cancel-in-progress: true
19 |
20 | env:
21 | APP_NAME: notestutorial
22 |
23 | jobs:
24 | matrix:
25 | runs-on: ubuntu-latest-low
26 | outputs:
27 | php-version: ${{ steps.versions.outputs.php-available-list }}
28 | server-max: ${{ steps.versions.outputs.branches-max-list }}
29 | steps:
30 | - name: Checkout app
31 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32 | with:
33 | persist-credentials: false
34 |
35 | - name: Get version matrix
36 | id: versions
37 | uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
38 |
39 | changes:
40 | runs-on: ubuntu-latest-low
41 | permissions:
42 | contents: read
43 | pull-requests: read
44 |
45 | outputs:
46 | src: ${{ steps.changes.outputs.src}}
47 |
48 | steps:
49 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
50 | id: changes
51 | continue-on-error: true
52 | with:
53 | filters: |
54 | src:
55 | - '.github/workflows/**'
56 | - 'appinfo/**'
57 | - 'lib/**'
58 | - 'templates/**'
59 | - 'tests/**'
60 | - 'vendor/**'
61 | - 'vendor-bin/**'
62 | - '.php-cs-fixer.dist.php'
63 | - 'composer.json'
64 | - 'composer.lock'
65 |
66 | phpunit-sqlite:
67 | runs-on: ubuntu-latest
68 |
69 | needs: [changes, matrix]
70 | if: needs.changes.outputs.src != 'false'
71 |
72 | strategy:
73 | matrix:
74 | php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }}
75 | server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}
76 |
77 | name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }}
78 |
79 | steps:
80 | - name: Set app env
81 | if: ${{ env.APP_NAME == '' }}
82 | run: |
83 | # Split and keep last
84 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
85 |
86 | - name: Checkout server
87 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88 | with:
89 | persist-credentials: false
90 | submodules: true
91 | repository: nextcloud/server
92 | ref: ${{ matrix.server-versions }}
93 |
94 | - name: Checkout app
95 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
96 | with:
97 | persist-credentials: false
98 | path: apps/${{ env.APP_NAME }}
99 |
100 | - name: Set up php ${{ matrix.php-versions }}
101 | uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
102 | with:
103 | php-version: ${{ matrix.php-versions }}
104 | # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
105 | extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
106 | coverage: none
107 | ini-file: development
108 | env:
109 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110 |
111 | - name: Check composer file existence
112 | id: check_composer
113 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
114 | with:
115 | files: apps/${{ env.APP_NAME }}/composer.json
116 |
117 | - name: Set up dependencies
118 | # Only run if phpunit config file exists
119 | if: steps.check_composer.outputs.files_exists == 'true'
120 | working-directory: apps/${{ env.APP_NAME }}
121 | run: |
122 | composer remove nextcloud/ocp --dev
123 | composer i
124 |
125 | - name: Set up Nextcloud
126 | env:
127 | DB_PORT: 4444
128 | run: |
129 | mkdir data
130 | ./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
131 | ./occ app:enable --force ${{ env.APP_NAME }}
132 |
133 | - name: Check PHPUnit script is defined
134 | id: check_phpunit
135 | continue-on-error: true
136 | working-directory: apps/${{ env.APP_NAME }}
137 | run: |
138 | composer run --list | grep '^ test:unit ' | wc -l | grep 1
139 |
140 | - name: PHPUnit
141 | # Only run if phpunit config file exists
142 | if: steps.check_phpunit.outcome == 'success'
143 | working-directory: apps/${{ env.APP_NAME }}
144 | run: composer run test:unit
145 |
146 | - name: Check PHPUnit integration script is defined
147 | id: check_integration
148 | continue-on-error: true
149 | working-directory: apps/${{ env.APP_NAME }}
150 | run: |
151 | composer run --list | grep '^ test:integration ' | wc -l | grep 1
152 |
153 | - name: Run Nextcloud
154 | # Only run if phpunit integration config file exists
155 | if: steps.check_integration.outcome == 'success'
156 | run: php -S localhost:8080 &
157 |
158 | - name: PHPUnit integration
159 | # Only run if phpunit integration config file exists
160 | if: steps.check_integration.outcome == 'success'
161 | working-directory: apps/${{ env.APP_NAME }}
162 | run: composer run test:integration
163 |
164 | - name: Print logs
165 | if: always()
166 | run: |
167 | cat data/nextcloud.log
168 |
169 | - name: Skipped
170 | # Fail the action when neither unit nor integration tests ran
171 | if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
172 | run: |
173 | echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
174 | exit 1
175 |
176 | summary:
177 | permissions:
178 | contents: none
179 | runs-on: ubuntu-latest-low
180 | needs: [changes, phpunit-sqlite]
181 |
182 | if: always()
183 |
184 | name: phpunit-sqlite-summary
185 |
186 | steps:
187 | - name: Summary status
188 | run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
189 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | /vendor/
4 | /build/
5 | node_modules/
6 | /.php-cs-fixer.cache
7 | js/*hot-update.*
8 |
--------------------------------------------------------------------------------
/.php-cs-fixer.dist.php:
--------------------------------------------------------------------------------
1 | getFinder()
12 | ->notPath('build')
13 | ->notPath('l10n')
14 | ->notPath('src')
15 | ->notPath('vendor')
16 | ->in(__DIR__);
17 | return $config;
18 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6 |
7 |
8 | ## [0.0.2] - 2017-07-31
9 |
10 | ### Added
11 |
12 | - First release
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
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 by
637 | 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 | .
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # This file is licensed under the Affero General Public License version 3 or
2 | # later. See the COPYING file.
3 | app_name=$(notdir $(CURDIR))
4 | build_tools_directory=$(CURDIR)/build/tools
5 | composer=$(shell which composer 2> /dev/null)
6 |
7 | all: dev-setup lint build-js-production test
8 |
9 | # Dev env management
10 | dev-setup: clean clean-dev composer npm-init
11 |
12 |
13 | # Installs and updates the composer dependencies. If composer is not installed
14 | # a copy is fetched from the web
15 | composer:
16 | ifeq (, $(composer))
17 | @echo "No composer command available, downloading a copy from the web"
18 | mkdir -p $(build_tools_directory)
19 | curl -sS https://getcomposer.org/installer | php
20 | mv composer.phar $(build_tools_directory)
21 | php $(build_tools_directory)/composer.phar install --prefer-dist
22 | php $(build_tools_directory)/composer.phar update --prefer-dist
23 | else
24 | composer install --prefer-dist
25 | composer update --prefer-dist
26 | endif
27 |
28 | npm-init:
29 | npm ci
30 |
31 | npm-update:
32 | npm update
33 |
34 | # Building
35 | build-js:
36 | npm run dev
37 |
38 | build-js-production:
39 | npm run build
40 |
41 | watch-js:
42 | npm run watch
43 |
44 | serve-js:
45 | npm run serve
46 |
47 | # Linting
48 | lint:
49 | npm run lint
50 |
51 | lint-fix:
52 | npm run lint:fix
53 |
54 | # Style linting
55 | stylelint:
56 | npm run stylelint
57 |
58 | stylelint-fix:
59 | npm run stylelint:fix
60 |
61 | # Cleaning
62 | clean:
63 | rm -rf js/*
64 |
65 | clean-dev:
66 | rm -rf node_modules
67 |
68 | # Tests
69 | test:
70 | ./vendor/phpunit/phpunit/phpunit -c phpunit.xml
71 | ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
72 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nextcloud App Tutorial
2 |
3 | [](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3APHPUnit)
4 | [](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3ANode)
5 | [](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3ALint)
6 |
7 | This is the [tutorial app](https://docs.nextcloud.com/server/latest/developer_manual/app_development/tutorial.html) which shows how to develop a very simple notes app.
8 |
9 | ## Try it
10 | To install it change into your Nextcloud's apps directory:
11 |
12 | cd nextcloud/apps
13 |
14 | Then clone this repository into a folder named **notestutorial**¹:
15 |
16 | git clone https://github.com/nextcloud/app-tutorial.git notestutorial
17 |
18 | Then install the dependencies using:
19 |
20 | make composer
21 |
22 | ¹ It is important that the directory is named exactly like the app ID (see `appinfo/info.xml`).
23 |
24 | ## Frontend development
25 |
26 | The app tutorial also shows the very basic implementation of an app frontend using [Vue.js](https://vuejs.org/). To build the frontend code after doing changes to its source in `src/` requires to have Node and npm installed.
27 |
28 | - 👩💻 Run `make dev-setup` to install the frontend dependencies
29 | - 🏗 To build the Javascript whenever you make changes, run `make build-js`
30 |
31 | To continuously run the build when editing source files you can make use of the `make watch-js` command.
32 |
--------------------------------------------------------------------------------
/appinfo/info.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | notestutorial
5 | Notes Tutorial
6 | App for taking notes
7 |
8 | 20.0.0
9 | agpl
10 | Bernhard Posselt
11 | NotesTutorial
12 | office
13 | https://github.com/nextcloud/app-tutorial
14 |
15 |
16 |
17 |
18 |
19 | Notes Tutorial
20 | notestutorial.page.index
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/appinfo/routes.php:
--------------------------------------------------------------------------------
1 | [
5 | 'note' => ['url' => '/notes'],
6 | 'note_api' => ['url' => '/api/0.1/notes']
7 | ],
8 | 'routes' => [
9 | ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
10 | ['name' => 'note_api#preflighted_cors', 'url' => '/api/0.1/{path}',
11 | 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']]
12 | ]
13 | ];
14 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | const babelConfig = require('@nextcloud/babel-config')
2 |
3 | module.exports = babelConfig
4 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nextcloud/app-tutorial",
3 | "description": "Nextcloud App Tutorial",
4 | "type": "project",
5 | "license": "AGPL",
6 | "authors": [
7 | {
8 | "name": "Bernhard Posselt",
9 | "email": "dev@bernhard-posselt.com"
10 | }
11 | ],
12 | "require-dev": {
13 | "phpunit/phpunit": "^9.5",
14 | "nextcloud/coding-standard": "^1.0.0",
15 | "nextcloud/ocp": "dev-stable25"
16 | },
17 | "config": {
18 | "optimize-autoloader": true,
19 | "classmap-authoritative": true,
20 | "platform": {
21 | "php": "7.4"
22 | }
23 | },
24 | "scripts": {
25 | "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
26 | "cs:check": "php-cs-fixer fix --dry-run --diff",
27 | "cs:fix": "php-cs-fixer fix",
28 | "test:unit": "phpunit -c tests/phpunit.unit.xml",
29 | "test:integration": "phpunit -c tests/phpunit.integration.xml"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
1 | #app-content-wrapper {
2 | height: 100%;
3 | }
4 |
5 | #editor {
6 | height: 100%;
7 | width: 100%;
8 | }
9 |
10 | #editor .input {
11 | height: calc(100% - 51px);
12 | width: 100%;
13 | }
14 |
15 | #editor .save {
16 | height: 50px;
17 | width: 100%;
18 | text-align: center;
19 | border-top: 1px solid #ccc;
20 | background-color: #fafafa;
21 | }
22 |
23 | #editor textarea {
24 | height: 100%;
25 | width: 100%;
26 | border: 0;
27 | margin: 0;
28 | border-radius: 0;
29 | overflow-y: auto;
30 | }
31 |
32 | #editor button {
33 | height: 44px;
34 | }
--------------------------------------------------------------------------------
/img/app.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/js/notestutorial-main.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /*!
2 | * Determine if an object is a Buffer
3 | *
4 | * @author Feross Aboukhadijeh
5 | * @license MIT
6 | */
7 |
8 | /*!
9 | * The buffer module from node.js, for the browser.
10 | *
11 | * @author Feross Aboukhadijeh
12 | * @license MIT
13 | */
14 |
15 | /*!
16 | * The buffer module from node.js, for the browser.
17 | *
18 | * @author Feross Aboukhadijeh
19 | * @license MIT
20 | */
21 |
22 | /*!
23 | * Vue.js v2.7.14
24 | * (c) 2014-2022 Evan You
25 | * Released under the MIT License.
26 | */
27 |
28 | /*!
29 | * escape-html
30 | * Copyright(c) 2012-2013 TJ Holowaychuk
31 | * Copyright(c) 2015 Andreas Lubbe
32 | * Copyright(c) 2015 Tiancheng "Timothy" Gu
33 | * MIT Licensed
34 | */
35 |
36 | /*!
37 | * focus-trap 7.2.0
38 | * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
39 | */
40 |
41 | /*!
42 | * tabbable 6.0.1
43 | * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
44 | */
45 |
46 | /*! Hammer.JS - v2.0.7 - 2016-04-22
47 | * http://hammerjs.github.io/
48 | *
49 | * Copyright (c) 2016 Jorik Tangelder;
50 | * Licensed under the MIT license */
51 |
52 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */
53 |
54 | /**
55 | * @copyright Copyright (c) 2018 John Molakvoæ
56 | *
57 | * @author John Molakvoæ
58 | *
59 | * @license AGPL-3.0-or-later
60 | *
61 | * This program is free software: you can redistribute it and/or modify
62 | * it under the terms of the GNU Affero General Public License as
63 | * published by the Free Software Foundation, either version 3 of the
64 | * License, or (at your option) any later version.
65 | *
66 | * This program is distributed in the hope that it will be useful,
67 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
68 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69 | * GNU Affero General Public License for more details.
70 | *
71 | * You should have received a copy of the GNU Affero General Public License
72 | * along with this program. If not, see .
73 | *
74 | */
75 |
76 | /**
77 | * @copyright Copyright (c) 2019 Georg Ehrke
78 | *
79 | * @author Georg Ehrke
80 | *
81 | * @author Richard Steinmetz
82 | *
83 | * @license AGPL-3.0-or-later
84 | *
85 | * This program is free software: you can redistribute it and/or modify
86 | * it under the terms of the GNU Affero General Public License as
87 | * published by the Free Software Foundation, either version 3 of the
88 | * License, or (at your option) any later version.
89 | *
90 | * This program is distributed in the hope that it will be useful,
91 | * but WITHOUT ANY WARRANTY without even the implied warranty of
92 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 | * GNU Affero General Public License for more details.
94 | *
95 | * You should have received a copy of the GNU Affero General Public License
96 | * along with this program. If not, see .
97 | *
98 | */
99 |
100 | /**
101 | * @copyright Copyright (c) 2019 Georg Ehrke
102 | *
103 | * @author Georg Ehrke
104 | *
105 | * @license AGPL-3.0-or-later
106 | *
107 | * This program is free software: you can redistribute it and/or modify
108 | * it under the terms of the GNU Affero General Public License as
109 | * published by the Free Software Foundation, either version 3 of the
110 | * License, or (at your option) any later version.
111 | *
112 | * This program is distributed in the hope that it will be useful,
113 | * but WITHOUT ANY WARRANTY without even the implied warranty of
114 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115 | * GNU Affero General Public License for more details.
116 | *
117 | * You should have received a copy of the GNU Affero General Public License
118 | * along with this program. If not, see .
119 | *
120 | */
121 |
122 | /**
123 | * @copyright Copyright (c) 2021 Christoph Wurst
124 | *
125 | * @author Christoph Wurst
126 | *
127 | * @license AGPL-3.0-or-later
128 | *
129 | * This program is free software: you can redistribute it and/or modify
130 | * it under the terms of the GNU Affero General Public License as
131 | * published by the Free Software Foundation, either version 3 of the
132 | * License, or (at your option) any later version.
133 | *
134 | * This program is distributed in the hope that it will be useful,
135 | * but WITHOUT ANY WARRANTY without even the implied warranty of
136 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137 | * GNU Affero General Public License for more details.
138 | *
139 | * You should have received a copy of the GNU Affero General Public License
140 | * along with this program. If not, see .
141 | *
142 | */
143 |
--------------------------------------------------------------------------------
/lib/AppInfo/Application.php:
--------------------------------------------------------------------------------
1 | $e->getMessage()];
18 | return new DataResponse($message, Http::STATUS_NOT_FOUND);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/Controller/NoteApiController.php:
--------------------------------------------------------------------------------
1 | service = $service;
25 | $this->userId = $userId;
26 | }
27 |
28 | /**
29 | * @CORS
30 | * @NoCSRFRequired
31 | * @NoAdminRequired
32 | */
33 | public function index(): DataResponse {
34 | return new DataResponse($this->service->findAll($this->userId));
35 | }
36 |
37 | /**
38 | * @CORS
39 | * @NoCSRFRequired
40 | * @NoAdminRequired
41 | */
42 | public function show(int $id): DataResponse {
43 | return $this->handleNotFound(function () use ($id) {
44 | return $this->service->find($id, $this->userId);
45 | });
46 | }
47 |
48 | /**
49 | * @CORS
50 | * @NoCSRFRequired
51 | * @NoAdminRequired
52 | */
53 | public function create(string $title, string $content): DataResponse {
54 | return new DataResponse($this->service->create($title, $content,
55 | $this->userId));
56 | }
57 |
58 | /**
59 | * @CORS
60 | * @NoCSRFRequired
61 | * @NoAdminRequired
62 | */
63 | public function update(int $id, string $title,
64 | string $content): DataResponse {
65 | return $this->handleNotFound(function () use ($id, $title, $content) {
66 | return $this->service->update($id, $title, $content, $this->userId);
67 | });
68 | }
69 |
70 | /**
71 | * @CORS
72 | * @NoCSRFRequired
73 | * @NoAdminRequired
74 | */
75 | public function destroy(int $id): DataResponse {
76 | return $this->handleNotFound(function () use ($id) {
77 | return $this->service->delete($id, $this->userId);
78 | });
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/lib/Controller/NoteController.php:
--------------------------------------------------------------------------------
1 | service = $service;
25 | $this->userId = $userId;
26 | }
27 |
28 | /**
29 | * @NoAdminRequired
30 | */
31 | public function index(): DataResponse {
32 | return new DataResponse($this->service->findAll($this->userId));
33 | }
34 |
35 | /**
36 | * @NoAdminRequired
37 | */
38 | public function show(int $id): DataResponse {
39 | return $this->handleNotFound(function () use ($id) {
40 | return $this->service->find($id, $this->userId);
41 | });
42 | }
43 |
44 | /**
45 | * @NoAdminRequired
46 | */
47 | public function create(string $title, string $content): DataResponse {
48 | return new DataResponse($this->service->create($title, $content,
49 | $this->userId));
50 | }
51 |
52 | /**
53 | * @NoAdminRequired
54 | */
55 | public function update(int $id, string $title,
56 | string $content): DataResponse {
57 | return $this->handleNotFound(function () use ($id, $title, $content) {
58 | return $this->service->update($id, $title, $content, $this->userId);
59 | });
60 | }
61 |
62 | /**
63 | * @NoAdminRequired
64 | */
65 | public function destroy(int $id): DataResponse {
66 | return $this->handleNotFound(function () use ($id) {
67 | return $this->service->delete($id, $this->userId);
68 | });
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/Controller/PageController.php:
--------------------------------------------------------------------------------
1 | $this->id,
17 | 'title' => $this->title,
18 | 'content' => $this->content
19 | ];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/Db/NoteMapper.php:
--------------------------------------------------------------------------------
1 | db->getQueryBuilder();
26 | $qb->select('*')
27 | ->from('notestutorial')
28 | ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
29 | ->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
30 | return $this->findEntity($qb);
31 | }
32 |
33 | /**
34 | * @param string $userId
35 | * @return array
36 | */
37 | public function findAll(string $userId): array {
38 | /* @var $qb IQueryBuilder */
39 | $qb = $this->db->getQueryBuilder();
40 | $qb->select('*')
41 | ->from('notestutorial')
42 | ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
43 | return $this->findEntities($qb);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/Migration/Version000000Date20181013124731.php:
--------------------------------------------------------------------------------
1 | hasTable('notestutorial')) {
24 | $table = $schema->createTable('notestutorial');
25 | $table->addColumn('id', 'integer', [
26 | 'autoincrement' => true,
27 | 'notnull' => true,
28 | ]);
29 | $table->addColumn('title', 'string', [
30 | 'notnull' => true,
31 | 'length' => 200
32 | ]);
33 | $table->addColumn('user_id', 'string', [
34 | 'notnull' => true,
35 | 'length' => 200,
36 | ]);
37 | $table->addColumn('content', 'text', [
38 | 'notnull' => true,
39 | 'default' => ''
40 | ]);
41 |
42 | $table->setPrimaryKey(['id']);
43 | $table->addIndex(['user_id'], 'notestutorial_user_id_index');
44 | }
45 | return $schema;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/Service/NoteNotFound.php:
--------------------------------------------------------------------------------
1 | mapper = $mapper;
19 | }
20 |
21 | public function findAll(string $userId): array {
22 | return $this->mapper->findAll($userId);
23 | }
24 |
25 | private function handleException(Exception $e): void {
26 | if ($e instanceof DoesNotExistException ||
27 | $e instanceof MultipleObjectsReturnedException) {
28 | throw new NoteNotFound($e->getMessage());
29 | } else {
30 | throw $e;
31 | }
32 | }
33 |
34 | public function find($id, $userId) {
35 | try {
36 | return $this->mapper->find($id, $userId);
37 |
38 | // in order to be able to plug in different storage backends like files
39 | // for instance it is a good idea to turn storage related exceptions
40 | // into service related exceptions so controllers and service users
41 | // have to deal with only one type of exception
42 | } catch (Exception $e) {
43 | $this->handleException($e);
44 | }
45 | }
46 |
47 | public function create($title, $content, $userId) {
48 | $note = new Note();
49 | $note->setTitle($title);
50 | $note->setContent($content);
51 | $note->setUserId($userId);
52 | return $this->mapper->insert($note);
53 | }
54 |
55 | public function update($id, $title, $content, $userId) {
56 | try {
57 | $note = $this->mapper->find($id, $userId);
58 | $note->setTitle($title);
59 | $note->setContent($content);
60 | return $this->mapper->update($note);
61 | } catch (Exception $e) {
62 | $this->handleException($e);
63 | }
64 | }
65 |
66 | public function delete($id, $userId) {
67 | try {
68 | $note = $this->mapper->find($id, $userId);
69 | $this->mapper->delete($note);
70 | return $note;
71 | } catch (Exception $e) {
72 | $this->handleException($e);
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "notestutorial",
3 | "description": "A simple Nextcloud app tutorial for building a notes app",
4 | "version": "20.0.0",
5 | "author": "Julius Härtl "
8 | ],
9 | "bugs": {
10 | "url": "https://github.com/nextcloud/app-tutorial/issues"
11 | },
12 | "repository": {
13 | "url": "https://github.com/nextcloud/app-tutorial",
14 | "type": "git"
15 | },
16 | "homepage": "https://github.com/nextcloud/app-tutorial",
17 | "license": "agpl",
18 | "private": true,
19 | "scripts": {
20 | "build": "webpack --node-env production --progress",
21 | "dev": "webpack --node-env development --progress",
22 | "watch": "webpack --node-env development --progress --watch",
23 | "serve": "webpack --node-env development serve --progress",
24 | "lint": "eslint --ext .js,.vue src",
25 | "lint:fix": "eslint --ext .js,.vue src --fix",
26 | "stylelint": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue",
27 | "stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix"
28 | },
29 | "dependencies": {
30 | "@nextcloud/axios": "^2.3.0",
31 | "@nextcloud/dialogs": "^3.2.0",
32 | "@nextcloud/router": "^2.1.1",
33 | "@nextcloud/vue": "^7.4.0",
34 | "vue": "^2.7.14"
35 | },
36 | "browserslist": [
37 | "extends @nextcloud/browserslist-config"
38 | ],
39 | "engines": {
40 | "node": "^20.0.0",
41 | "npm": "^10.0.0"
42 | },
43 | "devDependencies": {
44 | "@nextcloud/babel-config": "^1.0.0",
45 | "@nextcloud/browserslist-config": "^2.3.0",
46 | "@nextcloud/eslint-config": "^8.2.1",
47 | "@nextcloud/stylelint-config": "^2.3.0",
48 | "@nextcloud/webpack-vue-config": "^5.4.0"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |