Update to new Nextcloud app template

This commit is contained in:
Ben 2023-10-11 21:55:03 +02:00
parent 39414f00dc
commit 020f19123e
Signed by: ben
GPG key ID: 0F54A7ED232D3319
70 changed files with 19282 additions and 25078 deletions

View file

@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
module.exports = { module.exports = {
extends: [ extends: [
'@nextcloud', '@nextcloud',

2
.gitattributes vendored
View file

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
/js/* binary /js/* binary
*.png -text *.png -text
*.epgz -text *.epgz -text

View file

@ -1,24 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
day: saturday
time: "03:00"
timezone: Europe/Paris
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: saturday
time: "03:00"
timezone: Europe/Paris
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies

View file

@ -1,117 +0,0 @@
name: Compile Command
on:
issue_comment:
types: [created]
jobs:
init:
runs-on: ubuntu-latest
# On pull requests and if the comment starts with `/compile`
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/compile')
outputs:
git_path: ${{ steps.git-path.outputs.path }}
arg1: ${{ steps.command.outputs.arg1 }}
arg2: ${{ steps.command.outputs.arg2 }}
head_ref: ${{ steps.comment-branch.outputs.head_ref }}
steps:
- name: Check actor permission
uses: skjnldsv/check-actor-permission@v2
with:
require: write
- name: Add reaction on start
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "+1"
- name: Parse command
uses: skjnldsv/parse-command-comment@master
id: command
# Init path depending on which command is run
- name: Init path
id: git-path
run: |
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg1}}"
else
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg2}}"
fi
- name: Init branch
uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
process:
runs-on: ubuntu-latest
needs: init
steps:
- name: Checkout ${{ needs.init.outputs.head_ref }}
uses: actions/checkout@v2
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
fetch-depth: 0
ref: ${{ needs.init.outputs.head_ref }}
- name: Setup git
run: |
git config --local user.email "nextcloud-command@users.noreply.github.com"
git config --local user.name "nextcloud-command"
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v1
id: package-engines-versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
cache: npm
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
- name: Install dependencies & build
run: |
npm ci
npm run build --if-present
- name: Commit and push default
if: ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
run: |
git add ${{ needs.init.outputs.git_path }}
git commit --signoff -m 'Compile assets'
git push origin ${{ needs.init.outputs.head_ref }}
- name: Commit and push fixup
if: ${{ needs.init.outputs.arg1 == 'fixup' }}
run: |
git add ${{ needs.init.outputs.git_path }}
git commit --fixup=HEAD --signoff
git push origin ${{ needs.init.outputs.head_ref }}
- name: Commit and push amend
if: ${{ needs.init.outputs.arg1 == 'amend' }}
run: |
git add ${{ needs.init.outputs.git_path }}
git commit --amend --no-edit --signoff
git push --force origin ${{ needs.init.outputs.head_ref }}
- name: Add reaction on failure
uses: peter-evans/create-or-update-comment@v1
if: failure()
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "-1"

View file

@ -1,46 +0,0 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Rebase command
on:
issue_comment:
types: created
jobs:
rebase:
runs-on: ubuntu-latest
# On pull requests and if the comment starts with `/rebase`
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
steps:
- name: Add reaction on start
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "+1"
- name: Checkout the latest code
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.COMMAND_BOT_PAT }}
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.5
env:
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
- name: Add reaction on failure
uses: peter-evans/create-or-update-comment@v1
if: failure()
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
repository: ${{ github.event.repository.full_name }}
comment-id: ${{ github.event.comment.id }}
reaction-type: "-1"

View file

@ -1,29 +0,0 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Dependabot
on:
pull_request_target:
branches:
- master
- stable*
jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
# Default github action approve
- uses: hmarr/auto-approve-action@v2
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Nextcloud bot approve and merge request
- uses: ahmadnassri/action-dependabot-auto-merge@v2
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
with:
target: minor
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}

View file

@ -1,12 +0,0 @@
name: Pull request checks
on: pull_request
jobs:
commit-message-check:
name: Block fixup and squash commits
runs-on: ubuntu-latest
steps:
- name: Run check
uses: xt0rted/block-autosquash-commits-action@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

47
.github/workflows/lint-eslint.yml vendored Normal file
View file

@ -0,0 +1,47 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Lint
on:
pull_request:
push:
branches:
- main
- master
- stable*
jobs:
lint:
runs-on: ubuntu-latest
name: eslint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v1.2
id: versions
with:
fallbackNode: '^16'
fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint

33
.github/workflows/lint-info-xml.yml vendored Normal file
View file

@ -0,0 +1,33 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
xml-linters:
runs-on: ubuntu-latest
name: info.xml lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download schema
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd

37
.github/workflows/lint-php-cs.yml vendored Normal file
View file

@ -0,0 +1,37 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
lint:
runs-on: ubuntu-latest
name: php-cs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none
- name: Install dependencies
run: composer i
- name: Lint
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

49
.github/workflows/lint-php.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
php-lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
name: php-lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: composer run lint
summary:
runs-on: ubuntu-latest
needs: php-lint
if: always()
name: php-lint-summary
steps:
- name: Summary status
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

View file

@ -2,8 +2,10 @@
# #
# https://github.com/nextcloud/.github # https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Node name: Lint
on: on:
pull_request: pull_request:
@ -13,20 +15,21 @@ on:
- stable* - stable*
jobs: jobs:
build: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: node name: stylelint
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Read package.json node and npm engines version - name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v1.1 uses: skjnldsv/read-package-engines-version-actions@v1.1
id: versions id: versions
with: with:
fallbackNode: '^12' fallbackNode: '^16'
fallbackNpm: '^6' fallbackNpm: '^7'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }} - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v2 uses: actions/setup-node@v2
@ -36,17 +39,8 @@ jobs:
- name: Set up npm ${{ steps.versions.outputs.npmVersion }} - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: Install dependencies & build - name: Install dependencies
run: | run: npm ci
npm ci
npm run build --if-present
- name: Check webpack build changes - name: Lint
run: | run: npm run stylelint
bash -c "[[ ! \"`git status --porcelain `\" ]] || exit 1"
- name: Show changes on failure
if: failure()
run: |
git status
git --no-pager diff

View file

@ -1,111 +0,0 @@
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
php:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.3", "7.4", "8.0"]
name: php${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: composer run lint
php-cs-fixer:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4"]
name: cs php${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Install dependencies
run: composer i
- name: Run coding standards check
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
node:
runs-on: ubuntu-latest
name: eslint node
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14
- name: Set up npm7
run: npm i -g npm@7
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
stylelint:
runs-on: ubuntu-latest
name: stylelint node
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14
- name: Set up npm7
run: npm i -g npm@7
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run stylelint
xml-linters:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download schema
run: wget https://apps.nextcloud.com/schema/apps/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd

115
.github/workflows/phpunit-mysql.yml vendored Normal file
View file

@ -0,0 +1,115 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
# Location of the phpunit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
jobs:
phpunit-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
server-versions: ['master']
services:
mysql:
image: mariadb:10.5
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Enable ONLY_FULL_GROUP_BY MySQL option
run: |
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
- name: Checkout server
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@v3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./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 password
./occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: Run Nextcloud
run: php -S localhost:8080 &
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
summary:
runs-on: ubuntu-latest
needs: phpunit-mysql
if: always()
name: phpunit-mysql-summary
steps:
- name: Summary status
run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

109
.github/workflows/phpunit-oci.yml vendored Normal file
View file

@ -0,0 +1,109 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
# Location of the phpunit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
jobs:
phpunit-oci:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['8.0']
server-versions: ['master']
services:
oracle:
image: deepdiver/docker-oracle-xe-11g # 'wnameless/oracle-xe-11g-r2'
ports:
- 1521:1521/tcp
steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@v3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8
tools: phpunit
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 1521
run: |
mkdir data
./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
./occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
summary:
runs-on: ubuntu-latest
needs: phpunit-oci
if: always()
name: phpunit-oci-summary
steps:
- name: Summary status
run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi

114
.github/workflows/phpunit-pgsql.yml vendored Normal file
View file

@ -0,0 +1,114 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
# Location of the phpunit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
jobs:
phpunit-pgsql:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.0']
server-versions: ['master']
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@v3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./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 password
./occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
summary:
runs-on: ubuntu-latest
needs: phpunit-pgsql
if: always()
name: phpunit-pgsql-summary
steps:
- name: Summary status
run: if ${{ needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi

103
.github/workflows/phpunit-sqlite.yml vendored Normal file
View file

@ -0,0 +1,103 @@
# SPDX-FileCopyrightText: Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
# Location of the phpunit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
jobs:
phpunit-sqlite:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.0']
server-versions: ['master']
steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
uses: actions/checkout@v3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./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 password
./occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
summary:
runs-on: ubuntu-latest
needs: phpunit-sqlite
if: always()
name: phpunit-sqlite-summary
steps:
- name: Summary status
run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi

View file

@ -1,215 +0,0 @@
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
APP_NAME: upschooling
jobs:
php:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4']
databases: ['sqlite']
server-versions: ['master']
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.xml
- name: PHPUnit integration
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
mysql:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.3', '7.4']
databases: ['mysql']
server-versions: ['master']
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
services:
mysql:
image: mariadb:10.5
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.xml
- name: PHPUnit integration
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
pgsql:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4']
databases: ['pgsql']
server-versions: ['master']
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.xml
- name: PHPUnit integration
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

15
.github/workflows/reuse.yml vendored Normal file
View file

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC0-1.0
name: REUSE Compliance Check
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1

214
.gitignore vendored
View file

@ -1,207 +1,11 @@
# Created by https://www.toptal.com/developers/gitignore/api/phpstorm+all,phpunit,composer,node,vue # SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
# Edit at https://www.toptal.com/developers/gitignore?templates=phpstorm+all,phpunit,composer,node,vue # SPDX-License-Identifier: AGPL-3.0-or-later
.idea
### Composer ###
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# webpack output
js/
### PhpStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PhpStorm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml *.iml
modules.xml /vendor/
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
### PHPUnit ###
# Covers PHPUnit
# Reference: https://phpunit.de/
# Generated files
.phpunit.result.cache
.phpunit.cache
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/ /build/
node_modules/
### Vue ### /.php_cs.cache
# gitignore template for Vue.js projects js/*hot-update.*
# /tests/.phpunit.result.cache
# Recommended template: Node.gitignore /js/
# TODO: where does this rule come from?
docs/_book
# TODO: where does this rule come from?
test/
# End of https://www.toptal.com/developers/gitignore/api/phpstorm+all,phpunit,composer,node,vue

View file

@ -1,6 +1,8 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
require_once './vendor/autoload.php'; require_once './vendor/autoload.php';
@ -9,6 +11,7 @@ use Nextcloud\CodingStandard\Config;
$config = new Config(); $config = new Config();
$config $config
->getFinder() ->getFinder()
->ignoreVCSIgnored(true)
->notPath('build') ->notPath('build')
->notPath('l10n') ->notPath('l10n')
->notPath('src') ->notPath('src')

12
.reuse/dep5 Normal file
View file

@ -0,0 +1,12 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: U Pschooling
Upstream-Contact: BVSC e.V. <no@example.com>
Source: https://github.com/nextcloud/profiler
Files: package-lock.json package.json composer.json composer.lock
Copyright: BVSC e.V. <no@example.com>
License: AGPL-3.0-or-later
Files: l10n/*.js l10n/*.json
Copyright: Nextcloud translators <https://www.transifex.com/nextcloud/>
License: AGPL-3.0-or-later

View file

@ -1,12 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.0.2] - 2017-07-31
### Added
- First release

661
COPYING
View file

@ -1,661 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View file

@ -0,0 +1,235 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on the Program.
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.

121
LICENSES/CC0-1.0.txt Normal file
View file

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

184
Makefile
View file

@ -1,17 +1,71 @@
# This file is licensed under the Affero General Public License version 3 or # SPDX-FileCopyrightText: Bernhard Posselt <dev@bernhard-posselt.com>
# later. See the COPYING file. # SPDX-License-Identifier: AGPL-3.0-or-later
# Generic Makefile for building and packaging a Nextcloud app which uses npm and
# Composer.
#
# Dependencies:
# * make
# * which
# * curl: used if phpunit and composer are not installed to fetch them from the web
# * tar: for building the archive
# * npm: for building and testing everything JS
#
# If no composer.json is in the app root directory, the Composer step
# will be skipped. The same goes for the package.json which can be located in
# the app root or the js/ directory.
#
# The npm command by launches the npm build script:
#
# npm run build
#
# The npm test command launches the npm test script:
#
# npm run test
#
# The idea behind this is to be completely testing and build tool agnostic. All
# build tools and additional package managers should be installed locally in
# your project, since this won't pollute people's global namespace.
#
# The following npm scripts in your package.json install and update the bower
# and npm dependencies and use gulp as build system (notice how everything is
# run from the node_modules folder):
#
# "scripts": {
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
# "build": "node node_modules/gulp-cli/bin/gulp.js"
# },
app_name=$(notdir $(CURDIR)) app_name=$(notdir $(CURDIR))
build_tools_directory=$(CURDIR)/build/tools build_tools_directory=$(CURDIR)/build/tools
source_build_directory=$(CURDIR)/build/artifacts/source
source_package_name=$(source_build_directory)/$(app_name)
appstore_build_directory=$(CURDIR)/build/artifacts
appstore_package_name=$(appstore_build_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null) composer=$(shell which composer 2> /dev/null)
all: dev-setup lint build-js-production test all: build
# Dev env management
dev-setup: clean clean-dev composer npm-init
# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json
# is present, the composer step is skipped, if no package.json or js/package.json
# is present, the npm step is skipped
.PHONY: build
build:
ifneq (,$(wildcard $(CURDIR)/composer.json))
make composer
endif
ifneq (,$(wildcard $(CURDIR)/package.json))
make npm
endif
ifneq (,$(wildcard $(CURDIR)/js/package.json))
make npm
endif
# Installs and updates the composer dependencies. If composer is not installed # Installs and updates the composer dependencies. If composer is not installed
# a copy is fetched from the web # a copy is fetched from the web
.PHONY: composer
composer: composer:
ifeq (, $(composer)) ifeq (, $(composer))
@echo "No composer command available, downloading a copy from the web" @echo "No composer command available, downloading a copy from the web"
@ -19,53 +73,91 @@ ifeq (, $(composer))
curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_directory) mv composer.phar $(build_tools_directory)
php $(build_tools_directory)/composer.phar install --prefer-dist php $(build_tools_directory)/composer.phar install --prefer-dist
php $(build_tools_directory)/composer.phar update --prefer-dist
else else
composer install --prefer-dist composer install --prefer-dist
composer update --prefer-dist
endif endif
npm-init: # Installs npm dependencies
npm ci .PHONY: npm
npm:
npm-update: ifeq (,$(wildcard $(CURDIR)/package.json))
npm update cd js && $(npm) run build
else
# Building
build-js:
npm run dev
build-js-production:
npm run build npm run build
endif
watch-js: # Removes the appstore build
npm run watch .PHONY: clean
serve-js:
npm run serve
# Linting
lint:
npm run lint
lint-fix:
npm run lint:fix
# Style linting
stylelint:
npm run stylelint
stylelint-fix:
npm run stylelint:fix
# Cleaning
clean: clean:
rm -rf js/* rm -rf ./build
clean-dev: # Same as clean but also removes dependencies installed by composer, bower and
# npm
.PHONY: distclean
distclean: clean
rm -rf vendor
rm -rf node_modules rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules
# Tests # Builds the source and appstore package
test: .PHONY: dist
./vendor/phpunit/phpunit/phpunit -c phpunit.xml dist:
./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml make source
make appstore
# Builds the source package
.PHONY: source
source:
rm -rf $(source_build_directory)
mkdir -p $(source_build_directory)
tar cvzf $(source_package_name).tar.gz \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/node_modules" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/js/*.log" \
../$(app_name) \
# Builds the source package for the app store, ignores php tests, js tests
# and build related folders that are unnecessary for an appstore release
.PHONY: appstore
appstore:
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_build_directory)
tar cvzf $(appstore_package_name).tar.gz \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/tests" \
--exclude="../$(app_name)/Makefile" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/phpunit*xml" \
--exclude="../$(app_name)/composer.*" \
--exclude="../$(app_name)/node_modules" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/js/tests" \
--exclude="../$(app_name)/js/test" \
--exclude="../$(app_name)/js/*.log" \
--exclude="../$(app_name)/js/package.json" \
--exclude="../$(app_name)/js/bower.json" \
--exclude="../$(app_name)/js/karma.*" \
--exclude="../$(app_name)/js/protractor.*" \
--exclude="../$(app_name)/package.json" \
--exclude="../$(app_name)/bower.json" \
--exclude="../$(app_name)/karma.*" \
--exclude="../$(app_name)/protractor\.*" \
--exclude="../$(app_name)/.*" \
--exclude="../$(app_name)/js/.*" \
--exclude="../$(app_name)/webpack.config.js" \
--exclude="../$(app_name)/stylelint.config.js" \
--exclude="../$(app_name)/CHANGELOG.md" \
--exclude="../$(app_name)/README.md" \
--exclude="../$(app_name)/package-lock.json" \
--exclude="../$(app_name)/LICENSES" \
../$(app_name) \
.PHONY: test
test: composer
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml

View file

@ -1,12 +1,61 @@
# UPschooling <!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: CC0-1.0
-->
# UPschooling
Place this app in **nextcloud/apps/** Place this app in **nextcloud/apps/**
[![PHPUnit GitHub Action](https://github.com/nextcloud/app-tutorial/workflows/PHPUnit/badge.svg)](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3APHPUnit) ## Building the app
[![Node GitHub Action](https://github.com/nextcloud/app-tutorial/workflows/Node/badge.svg)](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3ANode)
[![Lint GitHub Action](https://github.com/nextcloud/app-tutorial/workflows/Lint/badge.svg)](https://github.com/nextcloud/app-tutorial/actions?query=workflow%3ALint) The app can be built by using the provided Makefile by running:
make
This requires the following things to be present:
* make
* which
* tar: for building the archive
* curl: used if phpunit and composer are not installed to fetch them from the web
* npm: for building and testing everything JS, only required if a package.json is placed inside the **js/** folder
The make command will install or update Composer dependencies if a composer.json is present and also **npm run build** if a package.json is present in the **js/** folder. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.:
**package.json**:
```json
"scripts": {
"test": "node node_modules/gulp-cli/bin/gulp.js karma",
"prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
"build": "node node_modules/gulp-cli/bin/gulp.js"
}
```
## Publish to App Store
First get an account for the [App Store](http://apps.nextcloud.com/) then run:
make && make appstore
The archive is located in build/artifacts/appstore and can then be uploaded to the App Store.
## Running tests
You can use the provided Makefile to run all tests by using:
make test
This will run the PHP unit and integration tests and if a package.json is present in the **js/** folder will execute **npm run test**
Of course you can also install [PHPUnit](http://phpunit.de/getting-started.html) and use the configurations directly:
phpunit -c phpunit.xml
or:
phpunit -c phpunit.integration.xml
for integration tests
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.
## Development ## Development
@ -19,20 +68,13 @@ Other than that composer and npm/nodejs must be installed.
brew install coreutils brew install coreutils
``` ```
### All
```shell
npm install
make
```
### Start dev environment ### Start dev environment
Starting the development environment with your container runtime should be as easy as Starting the development environment with your container runtime should be as easy as
```shell ```shell
./run.sh ./run.sh
make watch-js docker/podman exec -it --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make watch-js'
``` ```

View file

@ -1,18 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" <info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: CC0-1.0
-->
<id>upschooling</id> <id>upschooling</id>
<name>UPschooling</name> <name>UPschooling</name>
<summary>UPschooling Support Platform</summary> <summary>UPschooling Support Platform</summary>
<description><![CDATA[Ticketsystem für UPschooling]]></description> <description><![CDATA[Ticketsystem für UPschooling]]></description>
<version>0.0.1</version> <version>0.0.1</version>
<licence>agpl</licence> <licence>agpl</licence>
<author mail="upschooling@rs485.network" >UPschooling</author> <author mail="no@example.com" homepage="https://gitea.rs485.network/UPschooling/Nextcloud-App">BVSC e.V.</author>
<namespace>UPschooling</namespace> <namespace>UPschooling</namespace>
<category>organization</category>
<category>social</category>
<category>tools</category> <category>tools</category>
<bugs>https://gitea.rs485.network/UPschooling/Nextcloud-App/issues</bugs> <bugs>https://gitea.rs485.network/UPschooling/Nextcloud-App/issues</bugs>
<dependencies> <dependencies>
<nextcloud min-version="20" max-version="22"/> <nextcloud min-version="27" max-version="27"/>
</dependencies> </dependencies>
<navigations> <navigations>
<navigation> <navigation>

View file

@ -1,14 +1,26 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
/**
* Create your routes in here. The name is the lowercase name of the controller
* without the controller part, the stuff after the hash is the method.
* e.g. page#index -> OCA\UPschooling\Controller\PageController->index()
*
* The controller class has to be registered in the application.php file since
* it's instantiated in there
*/
return [ return [
'resources' => [ 'resources' => [
// 'ticket' => ['url' => '/tickets'],
'ticket_api' => ['url' => '/api/v1/tickets'] 'ticket_api' => ['url' => '/api/v1/tickets']
], ],
'routes' => [ 'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
[ [
'name' => 'ticket_api#preflighted_cors', 'name' => 'ticket_api#preflighted_cors',
'url' => '/api/v1/tickets', 'url' => '/api/v1/{path}',
'verb' => 'OPTIONS', 'verb' => 'OPTIONS',
'requirements' => ['path' => '.+'], 'requirements' => ['path' => '.+'],
], ],

View file

@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
const babelConfig = require('@nextcloud/babel-config') const babelConfig = require('@nextcloud/babel-config')
module.exports = babelConfig module.exports = babelConfig

View file

@ -1,6 +1,6 @@
{ {
"name": "upschooling/upschooling", "name": "nextcloud/upschooling",
"description": "UPschooling Support Platform", "description": "Nextcloud app for UPschooling Support Platform",
"type": "project", "type": "project",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"authors": [ "authors": [
@ -20,19 +20,30 @@
"ext-json": "*" "ext-json": "*"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.5", "phpunit/phpunit": "^9",
"nextcloud/coding-standard": "^0.5.0" "sabre/dav": "^4.1",
"sabre/xml": "^2.2",
"symfony/event-dispatcher": "^5.3.11",
"nextcloud/ocp": "dev-stable27",
"psalm/phar": "^4.10",
"nextcloud/coding-standard": "^1.0"
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "psalm.phar --threads=1",
"psalm:update-baseline": "psalm.phar --threads=1 --update-baseline",
"psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"psalm:clear": "psalm.phar --clear-cache && psalm --clear-global-cache",
"psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
}, },
"config": { "config": {
"optimize-autoloader": true, "allow-plugins": {
"classmap-authoritative": true, "composer/package-versions-deprecated": true
},
"platform": { "platform": {
"php": "7.4" "php": "7.4"
} }
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix"
} }
} }

3499
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,6 @@ die Anforderungspunkte 2 und 3 der [Zielstellungen].
Anforderung 2 schützt die Nextcloud (und Authentifikationssysteme) Anforderung 2 schützt die Nextcloud (und Authentifikationssysteme)
der Schule und ließe zu diese Systeme mit Daten der Schüler\*innen der Schule und ließe zu diese Systeme mit Daten der Schüler\*innen
nur aus internen Netzen der Schule erreichbar zu machen. nur aus internen Netzen der Schule erreichbar zu machen.
Bedingt dadurch ist allerdings eine technische Kommunikationsschnittstelle Die technische Kommunikationsschnittstelle muss und
notwendig, welche den weiteren technischen Anforderungen genügt und
eine sichere Kommunikation zwischen Helfenden und Schüler\*innen zulässt. eine sichere Kommunikation zwischen Helfenden und Schüler\*innen zulässt.

View file

@ -19,7 +19,7 @@
"uisi_autorageshake_app": "element-auto-uisi", "uisi_autorageshake_app": "element-auto-uisi",
"defaultCountryCode": "DE", "defaultCountryCode": "DE",
"showLabsSettings": false, "showLabsSettings": false,
"features": { }, "features": {},
"default_federate": true, "default_federate": true,
"default_theme": "light", "default_theme": "light",
"roomDirectory": { "roomDirectory": {

View file

@ -12,8 +12,9 @@ server {
location /upschooling/element-web { location /upschooling/element-web {
rewrite ^/upschooling/element-web/(.*)$ /$1 break; rewrite ^/upschooling/element-web/(.*)$ /$1 break;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host localhost:8080;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass "http://127.0.0.1:8082"; proxy_pass "http://127.0.0.1:8082";
} }
location /.well-known/matrix { location /.well-known/matrix {
@ -23,18 +24,15 @@ server {
default_type application/json; default_type application/json;
# TODO: Add missing matrix well-known files # TODO: Add missing matrix well-known files
proxy_set_header Host localhost:8008; proxy_set_header Host localhost:8080;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect http://localhost:8008/.well-known/matrix http://localhost:8080/.well-known/matrix; proxy_redirect http://localhost:8008/.well-known/matrix http://localhost:8080/.well-known/matrix;
proxy_pass "http://127.0.0.1:8008$uri"; proxy_pass "http://127.0.0.1:8008$request_uri";
} }
location / { location / {
proxy_set_header Host localhost:8080; proxy_set_header Host localhost:8080;
proxy_set_header X-Real-IP $remote_addr; proxy_pass "http://127.0.0.1:80$request_uri";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
proxy_pass "http://127.0.0.1:80$uri";
} }
} }

2
img/app.svg.license Normal file
View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\AppInfo; namespace OCA\UPschooling\AppInfo;
@ -10,18 +13,19 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
class Application extends App implements IBootstrap { class Application extends App implements IBootstrap {
public const APP_ID = 'upschooling'; public const APP_ID = 'upschooling';
public function __construct() { public function __construct()
{
parent::__construct(self::APP_ID); parent::__construct(self::APP_ID);
} }
public function register(IRegistrationContext $context): void public function register(IRegistrationContext $context): void
{ {
// Register the composer autoloader for packages shipped by this app, if applicable // Register the composer autoloader for packages shipped by this app, if applicable
include_once __DIR__ . '/../../vendor/autoload.php'; include_once __DIR__ . '/../../vendor/autoload.php';
} }
public function boot(IBootContext $context): void public function boot(IBootContext $context): void
{ {
// nothing to boot? // nothing to boot?
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Controller; namespace OCA\UPschooling\Controller;

View file

@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Controller;
use OCA\UPschooling\AppInfo\Application;
use OCA\UPschooling\Service\NoteService;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
class NoteApiController extends ApiController {
private NoteService $service;
private ?string $userId;
use Errors;
public function __construct(IRequest $request,
NoteService $service,
?string $userId) {
parent::__construct(Application::APP_ID, $request);
$this->service = $service;
$this->userId = $userId;
}
/**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired
*/
public function index(): DataResponse {
return new DataResponse($this->service->findAll($this->userId));
}
/**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired
*/
public function show(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->find($id, $this->userId);
});
}
/**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired
*/
public function create(string $title, string $content): DataResponse {
return new DataResponse($this->service->create($title, $content,
$this->userId));
}
/**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired
*/
public function update(int $id, string $title,
string $content): DataResponse {
return $this->handleNotFound(function () use ($id, $title, $content) {
return $this->service->update($id, $title, $content, $this->userId);
});
}
/**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired
*/
public function destroy(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->delete($id, $this->userId);
});
}
}

View file

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Controller;
use OCA\UPschooling\AppInfo\Application;
use OCA\UPschooling\Service\NoteService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
class NoteController extends Controller {
private NoteService $service;
private ?string $userId;
use Errors;
public function __construct(IRequest $request,
NoteService $service,
?string $userId) {
parent::__construct(Application::APP_ID, $request);
$this->service = $service;
$this->userId = $userId;
}
/**
* @NoAdminRequired
*/
public function index(): DataResponse {
return new DataResponse($this->service->findAll($this->userId));
}
/**
* @NoAdminRequired
*/
public function show(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->find($id, $this->userId);
});
}
/**
* @NoAdminRequired
*/
public function create(string $title, string $content): DataResponse {
return new DataResponse($this->service->create($title, $content,
$this->userId));
}
/**
* @NoAdminRequired
*/
public function update(int $id, string $title,
string $content): DataResponse {
return $this->handleNotFound(function () use ($id, $title, $content) {
return $this->service->update($id, $title, $content, $this->userId);
});
}
/**
* @NoAdminRequired
*/
public function destroy(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->delete($id, $this->userId);
});
}
}

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Controller; namespace OCA\UPschooling\Controller;
@ -19,7 +22,7 @@ class PageController extends Controller {
* *
* Render default template * Render default template
*/ */
public function index() { public function index(): TemplateResponse {
Util::addScript(Application::APP_ID, 'upschooling-main'); Util::addScript(Application::APP_ID, 'upschooling-main');
return new TemplateResponse(Application::APP_ID, 'main'); return new TemplateResponse(Application::APP_ID, 'main');

View file

@ -31,8 +31,7 @@ class TicketApiController extends ApiController
/** @var TicketMapper */ /** @var TicketMapper */
private $ticketMapper; private $ticketMapper;
/** @var string */ private ?string $userId;
private $userId;
use Errors; use Errors;
@ -43,7 +42,7 @@ class TicketApiController extends ApiController
TicketMapper $ticketMapper, TicketMapper $ticketMapper,
MatrixService $matrixService, MatrixService $matrixService,
ChatService $chatService, ChatService $chatService,
string $userId ?string $userId
) { ) {
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
$this->logger = $logger; $this->logger = $logger;
@ -55,6 +54,8 @@ class TicketApiController extends ApiController
} }
/** /**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*/ */
public function index(): DataResponse public function index(): DataResponse
@ -63,6 +64,8 @@ class TicketApiController extends ApiController
} }
/** /**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*/ */
public function show(int $id): DataResponse public function show(int $id): DataResponse
@ -73,6 +76,8 @@ class TicketApiController extends ApiController
} }
/** /**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*/ */
public function fetchChat(int $id): DataResponse public function fetchChat(int $id): DataResponse
@ -93,6 +98,8 @@ class TicketApiController extends ApiController
} }
/** /**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*/ */
public function create(string $title, string $content): DataResponse public function create(string $title, string $content): DataResponse
@ -101,6 +108,8 @@ class TicketApiController extends ApiController
} }
/** /**
* @CORS
* @NoCSRFRequired
* @NoAdminRequired * @NoAdminRequired
*/ */
public function update(int $id): DataResponse public function update(int $id): DataResponse

View file

@ -1,17 +1,34 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Db; namespace OCA\UPschooling\Db;
use JsonSerializable; use JsonSerializable;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
/**
* @method getId(): int
* @method getMatrixControlRoom(): string
* @method setMatrixControlRoom(string $roomId): void
* @method getMatrixAssistedUser(): string
* @method setMatrixAssistedUser(string $userId): void
* @method getMatrixHelperUser(): ?string
* @method setMatrixHelperUser(?string $userId): void
* @method getStatus(): string
* @method setStatus(string $status): void
* @method getVersion(): int
* @method setVersion(int $version): void
*/
class MatrixTicket extends Entity implements JsonSerializable class MatrixTicket extends Entity implements JsonSerializable
{ {
protected string $matrixControlRoom; protected string $matrixControlRoom = '';
protected string $matrixAssistedUser; // The ID of the person who created the ticket. Usually the person who needs help. protected string $matrixAssistedUser = ''; // The ID of the person who created the ticket. Usually the person who needs help.
protected string $matrixHelperUser; protected ?string $matrixHelperUser = null;
protected string $status; protected string $status = '';
protected int $version; protected int $version = 0;
public function jsonSerialize(): array public function jsonSerialize(): array
{ {

View file

@ -1,14 +1,26 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Db; namespace OCA\UPschooling\Db;
use JsonSerializable; use JsonSerializable;
use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\Entity;
/**
* @method getId(): int
* @method getUserId(): string
* @method setUserId(string $userId): void
* @method getMatrixUser(): string
* @method setMatrixUser(string $matrixUser): void
* @method getMatrixToken(): string
* @method setMatrixToken(string $matrixToken): void
*/
class MatrixUser extends Entity implements JsonSerializable { class MatrixUser extends Entity implements JsonSerializable {
protected $userId; protected string $userId = "";
protected $matrixUser; protected string $matrixUser = "";
protected $matrixToken; protected string $matrixToken = "";
public function jsonSerialize(): array public function jsonSerialize(): array
{ {

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Db; namespace OCA\UPschooling\Db;
@ -8,6 +11,9 @@ use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
/**
* @template-extends QBMapper<MatrixTicket>
*/
class TicketMapper extends QBMapper class TicketMapper extends QBMapper
{ {
public function __construct(IDBConnection $db) public function __construct(IDBConnection $db)
@ -16,8 +22,6 @@ class TicketMapper extends QBMapper
} }
/** /**
* @param int $id
* @return Entity|MatrixTicket
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws DoesNotExistException * @throws DoesNotExistException
*/ */
@ -32,9 +36,6 @@ class TicketMapper extends QBMapper
} }
/** /**
* @param int $id
* @param string $userId
* @return Entity|MatrixTicket
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws DoesNotExistException * @throws DoesNotExistException
*/ */

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Exceptions; namespace OCA\UPschooling\Exceptions;
@ -7,7 +10,7 @@ use OC\OCS\Result;
class TicketNotFoundException extends Exception class TicketNotFoundException extends Exception
{ {
public function __construct($ticketId) public function __construct(int $ticketId)
{ {
parent::__construct(new Result(null, 404, 'Ticket with id ' . $ticketId . ' not found')); parent::__construct(new Result(null, 404, 'Ticket with id ' . $ticketId . ' not found'));
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Service; namespace OCA\UPschooling\Service;

37244
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,52 +1,52 @@
{ {
"name": "upschooling", "name": "upschooling",
"description": "A simple Nextcloud app tutorial for building a notes app", "description": "A simple Nextcloud app tutorial for building a notes app",
"version": "22.0.0", "version": "27.0.0",
"author": "UPschooling", "author": "BVSC e.V. <no@example.com>",
"contributors": [ "contributors": [
"Finn", "Finn",
"Ben", "Ben",
"Caluera" "Caluera"
], ],
"bugs": { "bugs": {
"url": "https://gitea.rs485.network/UPschooling/Nextcloud-App/issues" "url": "https://gitea.rs485.network/UPschooling/Nextcloud-App/issues"
}, },
"repository": { "repository": {
"url": "https://gitea.rs485.network/UPschooling/Nextcloud-App.git", "url": "https://gitea.rs485.network/UPschooling/Nextcloud-App.git",
"type": "git" "type": "git"
}, },
"homepage": "https://gitea.rs485.network/UPschooling/Nextcloud-App", "homepage": "https://gitea.rs485.network/UPschooling/Nextcloud-App",
"license": "AGPL-3.0-or-later", "license": "agpl",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.js", "build": "NODE_ENV=production webpack --progress --config webpack.config.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.js", "dev": "NODE_ENV=development webpack --progress --config webpack.config.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js", "watch": "NODE_ENV=development webpack --progress --watch --config webpack.config.js",
"serve": "NODE_ENV=development webpack serve --progress --config webpack.js", "serve": "NODE_ENV=development webpack serve --progress --config webpack.config.js",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix", "lint:fix": "eslint --ext .js,.vue src --fix",
"stylelint": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue", "stylelint": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue",
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix" "stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix"
}, },
"dependencies": { "dependencies": {
"@nextcloud/axios": "^1.10.0", "@nextcloud/axios": "^1.10.0",
"@nextcloud/dialogs": "^3.1.4", "@nextcloud/dialogs": "^3.1.4",
"@nextcloud/router": "^2.0.0", "@nextcloud/router": "^2.0.0",
"@nextcloud/vue": "^5.3.1", "@nextcloud/vue": "^5.4.0",
"vue": "^2.6.14" "vue": "^2.7.0"
}, },
"browserslist": [ "browserslist": [
"extends @nextcloud/browserslist-config" "extends @nextcloud/browserslist-config"
], ],
"engines": { "engines": {
"node": ">=14.0.0", "node": "^16.0.0 || ^18.0.0",
"npm": ">=7.0.0" "npm": "^7.0.0 || ^8.0.0 || ^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@nextcloud/babel-config": "^1.0.0", "@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^2.2.0", "@nextcloud/browserslist-config": "^2.2.0",
"@nextcloud/eslint-config": "^6.1.2", "@nextcloud/eslint-config": "^8.0.0",
"@nextcloud/stylelint-config": "^2.1.2", "@nextcloud/stylelint-config": "^2.1.2",
"@nextcloud/webpack-vue-config": "^4.3.2" "@nextcloud/webpack-vue-config": "^5.2.1"
} }
} }

View file

@ -1,7 +0,0 @@
<phpunit bootstrap="tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="integration">
<directory>./tests/Integration</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -1,7 +0,0 @@
<phpunit bootstrap="tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="unit">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>

38
psalm.xml Normal file
View file

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
>
<!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: CC0-1.0
-->
<projectFiles>
<directory name="lib" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<extraFiles>
<directory name="vendor" />
<ignoreFiles>
<directory name="vendor/phpunit/php-code-coverage" />
<directory name="vendor/psalm" />
</ignoreFiles>
</extraFiles>
<issueHandlers>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="OC\AppFramework\OCS\BaseResponse"/>
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
</psalm>

45
run.sh
View file

@ -28,10 +28,6 @@ if $CONTAINER_RUNTIME inspect --type container nextcloud 1> /dev/null; then
$CONTAINER_RUNTIME rm -f nextcloud $CONTAINER_RUNTIME rm -f nextcloud
fi fi
if [[ ! -d vendor ]]; then
make composer
fi
$CONTAINER_RUNTIME run -d \ $CONTAINER_RUNTIME run -d \
--name=nextcloud \ --name=nextcloud \
-p 8080:8080 \ -p 8080:8080 \
@ -40,32 +36,38 @@ $CONTAINER_RUNTIME run -d \
-p 8008:8008 \ -p 8008:8008 \
-p 2280:22 \ -p 2280:22 \
-e PHP_MEMORY_LIMIT=512M \ -e PHP_MEMORY_LIMIT=512M \
-e APACHE_RUN_USER=www-data \
-e APACHE_RUN_GROUP=root \
-v "$DIR:/var/www/html/custom_apps/upschooling" \ -v "$DIR:/var/www/html/custom_apps/upschooling" \
--add-host "synapse:127.0.0.1" \ --add-host "synapse:127.0.0.1" \
docker.io/nextcloud docker.io/nextcloud:stable
export APACHE_RUN_USER=33 # uid of www-data, as selected above
export APACHE_RUN_GROUP=0 # gid of root, as selected above
echo -e "Nextcloud has started. \e[1;38;5;2mOK\033[0m" echo -e "Nextcloud has started. \e[1;38;5;2mOK\033[0m"
$CONTAINER_RUNTIME exec nextcloud bash -c 'apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y git openssh-server' $CONTAINER_RUNTIME exec nextcloud bash -c 'apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y debianutils bash vim git openssh-server make curl tar npm'
# sets www-data password to extrasecret # sets www-data password to extrasecret
$CONTAINER_RUNTIME exec nextcloud usermod \ $CONTAINER_RUNTIME exec nextcloud usermod \
--password '$6$bpNXAZwf$Xt.BzPV.mNTx5qVJQLK9Lut4VqMcrotgDHdcSZ0SwMxz2k9KVMSpAU7QmCv5vqj87ykIErYGpj9.Hb0A/XpX81' \ --password '$6$bpNXAZwf$Xt.BzPV.mNTx5qVJQLK9Lut4VqMcrotgDHdcSZ0SwMxz2k9KVMSpAU7QmCv5vqj87ykIErYGpj9.Hb0A/XpX81' \
--shell '/bin/bash' \ --shell '/bin/bash' \
www-data www-data
$CONTAINER_RUNTIME exec nextcloud /etc/init.d/ssh start $CONTAINER_RUNTIME exec nextcloud /etc/init.d/ssh start
$CONTAINER_RUNTIME exec nextcloud chown -R 33 /var/www/html/custom_apps $CONTAINER_RUNTIME exec nextcloud chown -R "$APACHE_RUN_USER" /var/www/html/custom_apps
if [[ $(id -u) -ne 0 && $RUNTIME_IS_PODMAN == "true" ]]; then if [[ $(id -u) -ne 0 && $RUNTIME_IS_PODMAN == "true" ]]; then
$CONTAINER_RUNTIME unshare -- chown -R 33 "$DIR" $CONTAINER_RUNTIME unshare -- chown -R "$APACHE_RUN_USER" "$DIR"
$CONTAINER_RUNTIME unshare -- chgrp -R 0 "$DIR" $CONTAINER_RUNTIME unshare -- chgrp -R "$APACHE_RUN_GROUP" "$DIR"
$CONTAINER_RUNTIME unshare -- chmod -R ug+rw "$DIR" $CONTAINER_RUNTIME unshare -- chmod -R ug+rwX "$DIR"
fi fi
$CONTAINER_RUNTIME exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make composer' $CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && npm install && make'
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ maintenance:install --database sqlite --admin-user admin --admin-pass admin $CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud ./occ maintenance:install --verbose --database sqlite --admin-user admin --admin-pass admin
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ config:system:set --value=true --type=boolean debug $CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud ./occ config:system:set --value=true --type=boolean debug
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ log:manage --level=debug $CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud ./occ log:manage --level=debug
$CONTAINER_RUNTIME exec --user 33 nextcloud php occ app:enable --force upschooling $CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud ./occ app:disable firstrunwizard
$CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud ./occ app:enable --force upschooling
echo -e "Nextcloud and app was configured. \e[1;38;5;2mOK\033[0m" echo -e "Nextcloud and app was configured. \e[1;38;5;2mOK\033[0m"
@ -97,9 +99,9 @@ fi
LOCAL_SYNAPSE_DATA_PATH="$($CONTAINER_RUNTIME volume inspect --format "{{.Mountpoint}}" synapse-data)" LOCAL_SYNAPSE_DATA_PATH="$($CONTAINER_RUNTIME volume inspect --format "{{.Mountpoint}}" synapse-data)"
SED_ARGS=(-i 's|registration_shared_secret: .*|registration_shared_secret: "oyYh_iEJ7Aim.iB+ye.Xk;Gl3iHFab5*8K,zv~IulT85P=c-38"|' "$LOCAL_SYNAPSE_DATA_PATH/homeserver.yaml") SED_ARGS=(-i 's|registration_shared_secret: .*|registration_shared_secret: "oyYh_iEJ7Aim.iB+ye.Xk;Gl3iHFab5*8K,zv~IulT85P=c-38"|' "$LOCAL_SYNAPSE_DATA_PATH/homeserver.yaml")
if [[ $(id -u) -eq 0 || $RUNTIME_IS_PODMAN != "true" ]]; then if [[ $(id -u) -eq 0 || $RUNTIME_IS_PODMAN != "true" ]]; then
sed ${SED_ARGS[@]} sed "${SED_ARGS[@]}"
else else
podman unshare -- sed ${SED_ARGS[@]} podman unshare -- sed "${SED_ARGS[@]}"
fi fi
$CONTAINER_RUNTIME run -d \ $CONTAINER_RUNTIME run -d \
@ -121,7 +123,7 @@ for ((i = 0 ; i < $MAX_TRIES ; i++)); do
done done
if [[ $i -ge $MAX_TRIES ]]; then if [[ $i -ge $MAX_TRIES ]]; then
echo "Synapse did not start in time! Use \`$CONTAINER_RUNTIME logs synapse\` to investigate" echo "Synapse did not start in time! Use '$CONTAINER_RUNTIME logs synapse' to investigate"
exit 1 exit 1
fi fi
@ -151,7 +153,10 @@ $CONTAINER_RUNTIME run -d \
--hostname elementweb \ --hostname elementweb \
docker.io/vectorim/element-web docker.io/vectorim/element-web
set +x
echo -e "Element Web has started. \e[1;38;5;2mOK\033[0m" echo -e "Element Web has started. \e[1;38;5;2mOK\033[0m"
# for nextcloud logs use $CONTAINER_RUNTIME exec --user 33 -it nextcloud ./occ log:watch echo
# for webserver logs use $CONTAINER_RUNTIME logs -f elementweb echo "To view Nextcloud logs, use '$CONTAINER_RUNTIME exec --user "'"'"${APACHE_RUN_USER}:${APACHE_RUN_GROUP}"'"'" -it nextcloud ./occ log:watch'"
echo "To view Nginx logs of the reverse proxy, use '$CONTAINER_RUNTIME logs -f elementweb'"
echo "Run 'xdg-open "'"'"http://localhost:8080/apps/upschooling/"'"'"' to open the Nextcloud app in your default browser"

View file

@ -1,4 +1,8 @@
<template> <template>
<!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<div id="content" class="app-upschooling"> <div id="content" class="app-upschooling">
<AppNavigation> <AppNavigation>
<AppNavigationCaption title="Meine Support-Tickets" /> <AppNavigationCaption title="Meine Support-Tickets" />

View file

@ -1,24 +1,8 @@
/** /**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com> * SPDX-FileCopyrightText: 2018 John Molakvoæ <skjnldsv@protonmail.com>
* * SPDX-License-Identifier: AGPL-3.0-or-later
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
import { generateFilePath } from '@nextcloud/router' import { generateFilePath } from '@nextcloud/router'
import Vue from 'vue' import Vue from 'vue'

View file

@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: Nextcloud contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
const stylelintConfig = require('@nextcloud/stylelint-config') const stylelintConfig = require('@nextcloud/stylelint-config')
module.exports = stylelintConfig module.exports = stylelintConfig

View file

@ -1 +1,6 @@
<?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
?>
<div id="content"></div> <div id="content"></div>

View file

@ -3,11 +3,8 @@
set -xeuo pipefail set -xeuo pipefail
IFS=$'\n\t' IFS=$'\n\t'
DIR="$(realpath ${0%/*})"
RUNTIME_IS_PODMAN="false"
if [[ -x "$(command -v podman)" ]]; then if [[ -x "$(command -v podman)" ]]; then
CONTAINER_RUNTIME="$(command -v podman 2> /dev/null)" CONTAINER_RUNTIME="$(command -v podman 2> /dev/null)"
RUNTIME_IS_PODMAN="true"
elif [[ -x "$(command -v docker)" ]]; then elif [[ -x "$(command -v docker)" ]]; then
CONTAINER_RUNTIME="$(command -v docker 2> /dev/null)" CONTAINER_RUNTIME="$(command -v docker 2> /dev/null)"
else else
@ -15,4 +12,7 @@ else
exit 1 exit 1
fi fi
$CONTAINER_RUNTIME exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make test' export APACHE_RUN_USER=33
export APACHE_RUN_GROUP=0
$CONTAINER_RUNTIME exec --user "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make test'

View file

@ -1,59 +0,0 @@
<?php
namespace OCA\UPschooling\Tests\Integration\Controller;
use OCA\UPschooling\Controller\TicketApiController;
use OCA\UPschooling\Db\MatrixTicket;
use OCA\UPschooling\Db\TicketMapper;
use OCP\AppFramework\App;
use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class MatrixTicketIntegrationTest extends TestCase {
private $controller;
private $mapper;
private $userId = 'john';
public function setUp(): void {
$app = new App('upschooling');
$container = $app->getContainer();
// only replace the user id
$container->registerService('userId', function () {
return $this->userId;
});
// we do not care about the request but the controller needs it
$container->registerService(IRequest::class, function () {
return $this->createMock(IRequest::class);
});
$this->controller = $container->query(TicketApiController::class);
$this->mapper = $container->query(TicketMapper::class);
}
public function testUpdate() {
// create a new note that should be updated
$note = new MatrixTicket();
$note->setTitle('old_title');
$note->setContent('old_content');
$note->setUserId($this->userId);
$id = $this->mapper->insert($note)->getId();
// fromRow does not set the fields as updated
$updatedNote = MatrixTicket::fromRow([
'id' => $id,
'user_id' => $this->userId
]);
$updatedNote->setContent('content');
$updatedNote->setTitle('title');
$result = $this->controller->update($id, 'title', 'content');
$this->assertEquals($updatedNote, $result->getData());
// clean up
$this->mapper->delete($result->getData());
}
}

View file

@ -1,48 +0,0 @@
<?php
namespace OCA\UPschooling\Tests\Integration\Controller;
use OCA\UPschooling\Db\MatrixUser;
use OCA\UPschooling\Db\UserMapper;
use OCP\AppFramework\App;
use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class MatrixUserIntegrationTest extends TestCase {
private $mapper;
private $userId = 'john';
private $matrixUserId = '@john:synapse';
public function setUp(): void {
$app = new App('upschooling');
$container = $app->getContainer();
// only replace the user id
$container->registerService('userId', function () {
return $this->userId;
});
// we do not care about the request but the controller needs it
$container->registerService(IRequest::class, function () {
return $this->createMock(IRequest::class);
});
$this->mapper = $container->query(UserMapper::class);
}
public function testUpdate() {
// create a new user
$user = new MatrixUser();
$user->setMatrixUser($this->matrixUserId);
$user->setUserId($this->userId);
$this->mapper->insert($user);
// test that user is in database
$result = $this->mapper->find($this->userId);
$this->assertEquals($user, $result->getData());
// clean up
$this->mapper->delete($result->getData());
}
}

View file

@ -3,41 +3,72 @@
namespace OCA\UPschooling\Tests\Unit\Controller; namespace OCA\UPschooling\Tests\Unit\Controller;
use OCA\UPschooling\Controller\TicketApiController; use OCA\UPschooling\Controller\TicketApiController;
use OCA\UPschooling\Db\TicketMapper;
use OCA\UPschooling\Service\ChatService;
use OCA\UPschooling\Service\MatrixService;
use OCA\UPschooling\Service\TicketService; use OCA\UPschooling\Service\TicketService;
use OCP\AppFramework\Http;
use OCP\IRequest; use OCP\IRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
class TicketApiControllerTest extends TestCase class TicketApiControllerTest extends TestCase
{ {
protected $controller; protected TicketApiController $controller;
protected $service; protected string $userId = 'john';
protected $userId = 'john'; protected TicketService $ticketService;
protected $request; protected TicketMapper $ticketMapper;
protected MatrixService $matrixService;
protected ChatService $chatService;
protected IRequest $request;
public function setUp(): void public function setUp(): void
{ {
$this->request = $this->getMockBuilder(IRequest::class)->getMock(); $this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->service = $this->getMockBuilder(TicketService::class) $this->ticketService = $this->getMockBuilder(TicketService::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->controller = new TicketApiController($this->request, $this->service, $this->userId); $this->ticketMapper = $this->getMockBuilder(TicketMapper::class)
->disableOriginalConstructor()
->getMock();
$this->matrixService = $this->getMockBuilder(MatrixService::class)
->disableOriginalConstructor()
->getMock();
$this->chatService = $this->getMockBuilder(ChatService::class)
->disableOriginalConstructor()
->getMock();
$this->controller = new TicketApiController(
$this->request,
new NullLogger(),
$this->ticketService,
$this->ticketMapper,
$this->matrixService,
$this->chatService,
$this->userId,
);
} }
public function testUpdate() public function testCreate()
{ {
$note = 'just check if this value is returned correctly'; $title = 'title here';
$this->service->expects($this->once()) $content = 'just check if this value is returned correctly';
->method('update') $ticketId = 1;
->with($this->equalTo(3),
$this->equalTo('title'),
$this->equalTo('content'),
$this->equalTo($this->userId))
->will($this->returnValue($note));
$result = $this->controller->update(3); $this->ticketService->expects($this->once())
->method('create')
->with($this->equalTo($title), $this->equalTo($content), $this->equalTo($this->userId))
->willReturn(array(
'ticketId' => $ticketId,
'status' => "open",
'lastModified' => $this->any(),
'title' => $title,
'description' => $content,
'matrixHelperName' => null,
'expirationDate' => $this->any(),
));
$this->assertEquals($note, $result->getData()); $response = $this->controller->create($title, $content);
$responseData = $response->getData();
$this->assertEquals($ticketId, $responseData['ticketId']);
} }
/* /*

View file

@ -1,20 +1,27 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\UPschooling\Tests\Unit\Service; namespace OCA\UPschooling\Tests\Unit\Service;
use OCA\UPschooling\Db\MatrixTicket; use OCA\UPschooling\Db\MatrixTicket;
use OCA\UPschooling\Db\MatrixUser;
use OCA\UPschooling\Db\TicketMapper; use OCA\UPschooling\Db\TicketMapper;
use OCA\UPschooling\Db\UserMapper; use OCA\UPschooling\Db\UserMapper;
use OCA\UPschooling\Exceptions\TicketNotFoundException;
use OCA\UPschooling\Service\MatrixService; use OCA\UPschooling\Service\MatrixService;
use OCA\UPschooling\Service\TicketService; use OCA\UPschooling\Service\TicketService;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IUser;
use OCP\IUserManager;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
class TicketServiceTest extends TestCase { class TicketServiceTest extends TestCase {
/** @var TicketService */ /** @var TicketService */
private $service; private $ticketService;
/** @var MatrixService */ /** @var MatrixService */
private $matrixService; private $matrixService;
@ -29,46 +36,80 @@ class TicketServiceTest extends TestCase {
private $userId = 'john'; private $userId = 'john';
public function setUp(): void { public function setUp(): void {
$this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->ticketMapper = $this->getMockBuilder(TicketMapper::class) $this->ticketMapper = $this->getMockBuilder(TicketMapper::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->userMapper = $this->getMockBuilder(UserMapper::class) $this->userMapper = $this->getMockBuilder(UserMapper::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->matrixService = new MatrixService(new NullLogger()); $this->matrixService = $this->getMockBuilder(MatrixService::class)
$this->service = new TicketService($this->matrixService, $this->ticketMapper, $this->userMapper); ->disableOriginalConstructor()
->getMock();
$this->ticketService = new TicketService(
$this->userManager,
$this->matrixService,
$this->ticketMapper,
$this->userMapper,
new NullLogger(),
);
} }
public function testUpdate() { public function testAssign() {
// the existing note $ticketId = 3;
$note = MatrixTicket::fromRow([ $matrixControlRoom = "!room:server";
'id' => 3, $assistedUserMatrixId = "@user:server";
$ticket = MatrixTicket::fromRow([
'id' => $ticketId,
'matrixControlRoom' => $matrixControlRoom,
'matrixAssistedUser' => $assistedUserMatrixId,
'matrixHelperUser' => null,
'status' => "open",
'version' => 1,
]); ]);
$this->ticketMapper->expects($this->once()) $this->ticketMapper->expects($this->once())
->method('find') ->method('findTicket')
->with($this->equalTo(3)) ->with($this->equalTo($ticketId))
->will($this->returnValue($note)); ->willReturn($ticket);
$stubTicket = new MatrixTicket();
// the note when updated $stubTicket->setId($ticketId);
$updatedNote = MatrixTicket::fromRow(['id' => 3]); $stubTicket->setMatrixControlRoom($matrixControlRoom);
$this->ticketMapper->expects($this->once()) $this->ticketMapper->expects($this->once())
->method('update') ->method('update')
->with($this->equalTo($updatedNote)) ->willReturn($stubTicket);
->will($this->returnValue($updatedNote));
$result = $this->service->update(3, 'title', 'content', $this->userId); $helperUserMatrixId = "@helper:server";
$helperUserName = "Expected Helper User Name";
$this->assertEquals($updatedNote, $result); $mockUser = $this->getMockBuilder(IUser::class)->getMock();
} $mockUser->expects($this->once())
->method('getDisplayName')
public function testUpdateNotFound() { ->willReturn($helperUserName);
// $this->expectException(NoteNotFound::class); $this->userManager->expects($this->once())
// test the correct status code if no note is found ->method('get')
$this->ticketMapper->expects($this->once()) ->with($this->equalTo($this->userId))
->willReturn($mockUser);
$helperMatrixUser = new MatrixUser();
$helperMatrixUser->setUserId($helperUserMatrixId);
$this->userMapper->expects($this->once())
->method('find') ->method('find')
->with($this->equalTo(3)) ->with($this->equalTo($this->userId))
->will($this->throwException(new DoesNotExistException(''))); ->willReturn($helperMatrixUser);
$this->service->update(3, 'title', 'content', $this->userId); $this->matrixService->expects($this->once())
->method('getProperty')
->with($this->equalTo($matrixControlRoom))
->willReturn(array(
'id' => $ticketId,
'title' => $this->any(),
'description' => $this->any(),
'matrixControlRoom' => $matrixControlRoom,
'matrixAssistedUser' => $assistedUserMatrixId,
'matrixHelperUser' => $helperUserMatrixId,
'matrixHelperName' => $helperUserName,
'expirationDate' => $this->any(),
));
$result = $this->ticketService->assign($ticketId, $this->userId);
$this->assertEquals($helperUserName, $result['matrixHelperName']);
} }
} }

View file

@ -1,10 +1,14 @@
<?php <?php
declare(strict_types=1);
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
require_once __DIR__ . '/../tests/bootstrap.php';
define('PHPUNIT_RUN', 1); define('PHPUNIT_RUN', 1);
$configDir = getenv('CONFIG_DIR'); $configDir = getenv('CONFIG_DIR');
if ($configDir) { if ($configDir) {
define('PHPUNIT_CONFIG_DIR', $configDir); define('PHPUNIT_CONFIG_DIR', $configDir);
} }
require_once __DIR__ . '/../../../lib/base.php'; require_once __DIR__ . '/../../../lib/base.php';

View file

@ -0,0 +1,9 @@
<phpunit bootstrap="bootstrap.php" colors="true">
<!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<testsuites>
</testsuites>
</phpunit>

11
tests/phpunit.xml Normal file
View file

@ -0,0 +1,11 @@
<phpunit bootstrap="bootstrap.php" colors="true">
<!--
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<testsuites>
<testsuite name="unit">
<directory>./Unit</directory>
</testsuite>
</testsuites>
</phpunit>

3
tests/psalm-baseline.xml Normal file
View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
</files>

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
SPDX-License-Identifier: CC0-1.0

5
webpack.config.js Normal file
View file

@ -0,0 +1,5 @@
// SPDX-FileCopyrightText: BVSC e.V. <no@example.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
const webpackConfig = require('@nextcloud/webpack-vue-config')
module.exports = webpackConfig

View file

@ -1,3 +0,0 @@
const webpackConfig = require('@nextcloud/webpack-vue-config')
module.exports = webpackConfig