├── requirements.txt
├── ex_app
├── js
│ ├── flow-main.js.map.license
│ └── flow-main.js.license
├── img
│ ├── app-dark.svg
│ └── app.svg
├── src
│ ├── constants
│ │ └── AppAPI.js
│ ├── main.js
│ ├── App.vue
│ ├── bootstrap.js
│ └── views
│ │ └── IframeView.vue
└── lib
│ └── main.py
├── screenshots
├── flow_1.png
├── flow_2.png
├── flow_3.png
├── flow_1.png.license
├── flow_2.png.license
└── flow_3.png.license
├── krankerl.toml
├── babel.config.js
├── stylelint.config.js
├── ex_app_scripts
├── install_pgsql.sh
├── set_workers_num.sh
├── init_pgsql.sh
├── common_pgsql.sh
└── entrypoint.sh
├── .github
├── CODE_OF_CONDUCT.md
├── dependabot.yml
└── workflows
│ ├── reuse.yml
│ ├── analysis-coverage.yml
│ ├── publish-docker.yml
│ └── appstore-build-publish.yml
├── .eslintrc.js
├── REUSE.toml
├── LICENSES
├── ISC.txt
├── MIT.txt
├── BSD-2-Clause.txt
├── BSD-3-Clause.txt
├── CC0-1.0.txt
├── Apache-2.0.txt
├── AGPL-3.0-or-later.txt
└── GPL-3.0-or-later.txt
├── .nextcloudignore
├── CODE_OF_CONDUCT.md
├── .pre-commit-config.yaml
├── pyproject.toml
├── .gitignore
├── webpack.config.js
├── CHANGELOG.md
├── package.json
├── Makefile
├── appinfo
└── info.xml
├── README.md
└── Dockerfile
/requirements.txt:
--------------------------------------------------------------------------------
1 | nc_py_api[app]==0.20.2
2 |
--------------------------------------------------------------------------------
/ex_app/js/flow-main.js.map.license:
--------------------------------------------------------------------------------
1 | flow-main.js.license
--------------------------------------------------------------------------------
/screenshots/flow_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nextcloud/flow/HEAD/screenshots/flow_1.png
--------------------------------------------------------------------------------
/screenshots/flow_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nextcloud/flow/HEAD/screenshots/flow_2.png
--------------------------------------------------------------------------------
/screenshots/flow_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nextcloud/flow/HEAD/screenshots/flow_3.png
--------------------------------------------------------------------------------
/screenshots/flow_1.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | SPDX-License-Identifier: MIT
3 |
--------------------------------------------------------------------------------
/screenshots/flow_2.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | SPDX-License-Identifier: MIT
3 |
--------------------------------------------------------------------------------
/screenshots/flow_3.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | SPDX-License-Identifier: MIT
3 |
--------------------------------------------------------------------------------
/krankerl.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | [package]
4 | before_cmds = []
5 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | const babelConfig = require('@nextcloud/babel-config')
7 |
8 | module.exports = babelConfig
9 |
--------------------------------------------------------------------------------
/stylelint.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | const stylelintConfig = require('@nextcloud/stylelint-config')
7 |
8 | module.exports = stylelintConfig
9 |
--------------------------------------------------------------------------------
/ex_app_scripts/install_pgsql.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | # SPDX-License-Identifier: MIT
4 |
5 | source /ex_app_scripts/common_pgsql.sh
6 |
7 | ensure_postgres_installed
8 | init_and_start_postgres
9 |
--------------------------------------------------------------------------------
/ex_app/img/app-dark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ex_app/img/app.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ex_app/src/constants/AppAPI.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | export const EX_APP_ID = 'flow'
7 | export const EX_APP_MENU_ENTRY_NAME = 'flow'
8 | export const APP_API_PROXY_URL_PREFIX = '/apps/app_api/proxy'
9 | export const APP_API_ROUTER_BASE = '/apps/app_api/embedded'
10 |
--------------------------------------------------------------------------------
/ex_app/src/main.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | import './bootstrap.js'
7 | import Vue from 'vue'
8 | import App from './App.vue'
9 | import { Tooltip } from '@nextcloud/vue'
10 |
11 | Vue.directive('tooltip', Tooltip)
12 |
13 | export default new Vue({
14 | el: '#content',
15 | render: h => h(App),
16 | })
17 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
5 | # Code of Conduct
6 |
7 | Be openness, as well as friendly and didactic in discussions.
8 |
9 | Treat everybody equally, and value their contributions.
10 |
11 | Decisions are made based on technical merit and consensus.
12 |
13 | Try to follow most principles described here: https://nextcloud.com/code-of-conduct/
14 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | module.exports = {
7 | globals: {
8 | appVersion: true
9 | },
10 | parserOptions: {
11 | requireConfigFile: false
12 | },
13 | extends: [
14 | '@nextcloud'
15 | ],
16 | rules: {
17 | 'jsdoc/require-jsdoc': 'off',
18 | 'jsdoc/tag-lines': 'off',
19 | 'vue/first-attribute-linebreak': 'off',
20 | 'import/extensions': 'off'
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ex_app_scripts/set_workers_num.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | # SPDX-License-Identifier: MIT
4 |
5 | if [ -z "$NUM_WORKERS" ]; then
6 | NUM_WORKERS=$(nproc)
7 | NUM_WORKERS=$((NUM_WORKERS * 2))
8 |
9 | # Check if NUM_WORKERS is already in /etc/environment, if not, add it
10 | if ! grep -q "^export NUM_WORKERS=" /etc/environment; then
11 | echo "export NUM_WORKERS=\"$NUM_WORKERS\"" >> /etc/environment
12 | fi
13 |
14 | echo "NUM_WORKERS was not set. It is now set to: $NUM_WORKERS"
15 | else
16 | echo "NUM_WORKERS is already set to: $NUM_WORKERS"
17 | fi
18 |
--------------------------------------------------------------------------------
/ex_app/src/App.vue:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
27 |
--------------------------------------------------------------------------------
/ex_app/src/bootstrap.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | import Vue from 'vue'
7 | import { translate, translatePlural } from '@nextcloud/l10n'
8 | import { generateUrl } from '@nextcloud/router'
9 | import { APP_API_PROXY_URL_PREFIX, EX_APP_ID } from './constants/AppAPI.js'
10 | import { getCSPNonce } from '@nextcloud/auth'
11 |
12 | Vue.prototype.t = translate
13 | Vue.prototype.n = translatePlural
14 | Vue.prototype.OC = window.OC
15 | Vue.prototype.OCA = window.OCA
16 |
17 | __webpack_public_path__ = generateUrl(`${APP_API_PROXY_URL_PREFIX}/${EX_APP_ID}/js/`) // eslint-disable-line
18 | __webpack_nonce__ = getCSPNonce() // eslint-disable-line
19 |
--------------------------------------------------------------------------------
/REUSE.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | version = 1
4 | SPDX-PackageName = "flow"
5 | SPDX-PackageSupplier = "Nextcloud "
6 | SPDX-PackageDownloadLocation = "https://github.com/nextcloud/flow"
7 |
8 | [[annotations]]
9 | path = [".github/renovate.json", ".run/NC 30.run.xml", "package-lock.json", "package.json", "requirements.txt"]
10 | precedence = "aggregate"
11 | SPDX-FileCopyrightText = "2024 Nextcloud GmbH and Nextcloud contributors"
12 | SPDX-License-Identifier = "AGPL-3.0-or-later"
13 |
14 | [[annotations]]
15 | path = ["ex_app/img/app-dark.svg", "ex_app/img/app.svg"]
16 | precedence = "aggregate"
17 | SPDX-FileCopyrightText = "2018-2024 Google LLC"
18 | SPDX-License-Identifier = "Apache-2.0"
19 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
5 | #
6 | # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: CC0-1.0
8 |
9 | version: 2
10 | updates:
11 | - package-ecosystem: "github-actions"
12 | directory: ".github/workflows"
13 | schedule:
14 | interval: weekly
15 | day: saturday
16 | time: "03:00"
17 | timezone: Europe/Berlin
18 | open-pull-requests-limit: 10
19 |
--------------------------------------------------------------------------------
/LICENSES/ISC.txt:
--------------------------------------------------------------------------------
1 | ISC License:
2 |
3 | Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
4 | Copyright (c) 1995-2003 by Internet Software Consortium
5 |
6 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9 |
--------------------------------------------------------------------------------
/.github/workflows/reuse.yml:
--------------------------------------------------------------------------------
1 | # This workflow is provided via the organization template repository
2 | #
3 | # https://github.com/nextcloud/.github
4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5 |
6 | # SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V.
7 | #
8 | # SPDX-License-Identifier: CC0-1.0
9 |
10 | name: REUSE Compliance Check
11 |
12 | on: [pull_request]
13 |
14 | jobs:
15 | reuse-compliance-check:
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: Checkout
19 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20 | with:
21 | persist-credentials: false
22 |
23 | - name: REUSE Compliance Check
24 | uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
25 |
--------------------------------------------------------------------------------
/.nextcloudignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | .git
4 | .github
5 | .gitignore
6 | .tx
7 | .vscode
8 | .php-cs-fixer.*
9 | /.codecov.yml
10 | /.eslintrc.js
11 | /.gitattributes
12 | /.gitignore
13 | /.l10nignore
14 | /.nextcloudignore
15 | /.travis.yml
16 | /.pre-commit-config.yaml
17 | /.run
18 | /babel.config.js
19 | /build
20 | /APPS.md
21 | /HOW_TO_INSTALL.md
22 | /README.md
23 | /composer.*
24 | /node_modules
25 | /screenshots
26 | /examples
27 | /docs
28 | /src
29 | /vendor/bin
30 | /jest.config.js
31 | /Makefile
32 | /krankerl.toml
33 | /package-lock.json
34 | /package.json
35 | /postcss.config.js
36 | /psalm.xml
37 | /pyproject.toml
38 | /renovate.json
39 | /stylelint.config.js
40 | /webpack.*
41 | /requirements.txt
42 | /Dockerfile
43 | /results
44 | /ex_app/js
45 | /ex_app/lib
46 | /ex_app/src
47 | /ex_app_scripts
48 | /translationtool.phar
49 | tests
50 |
--------------------------------------------------------------------------------
/.github/workflows/analysis-coverage.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | name: Analysis & Coverage
4 |
5 | on:
6 | pull_request:
7 | push:
8 | branches: [main]
9 |
10 | permissions:
11 | contents: read
12 |
13 | concurrency:
14 | group: ana_cov-${{ github.head_ref || github.run_id }}
15 | cancel-in-progress: true
16 |
17 | jobs:
18 | analysis:
19 | runs-on: ubuntu-22.04
20 | name: Analysis
21 |
22 | steps:
23 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24 | - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
25 | with:
26 | python-version: "3.10"
27 |
28 | - name: Install from source
29 | run: |
30 | python3 -m pip install -r requirements.txt
31 |
32 | - name: Run Analysis
33 | run: |
34 | python3 -m pip install pylint
35 | python3 -m pylint --recursive=y "ex_app/lib/"
36 |
--------------------------------------------------------------------------------
/LICENSES/MIT.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
5 | In the Nextcloud community, participants from all over the world come together to create Free Software for a free internet. This is made possible by the support, hard work and enthusiasm of thousands of people, including those who create and use Nextcloud software.
6 |
7 | Our code of conduct offers some guidance to ensure Nextcloud participants can cooperate effectively in a positive and inspiring atmosphere, and to explain how together we can strengthen and support each other.
8 |
9 | The Code of Conduct is shared by all contributors and users who engage with the Nextcloud team and its community services. It presents a summary of the shared values and “common sense” thinking in our community.
10 |
11 | You can find our full code of conduct on our website: https://nextcloud.com/code-of-conduct/
12 |
13 | Please, keep our CoC in mind when you contribute! That way, everyone can be a part of our community in a productive, positive, creative and fun way.
14 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | ci:
4 | skip: [pylint]
5 |
6 | exclude: '^ex_app/(img|js)/|.*\.phar'
7 | repos:
8 | - repo: https://github.com/pre-commit/pre-commit-hooks
9 | rev: v5.0.0
10 | hooks:
11 | - id: check-yaml
12 | - id: end-of-file-fixer
13 | - id: trailing-whitespace
14 | - id: mixed-line-ending
15 |
16 | - repo: https://github.com/PyCQA/isort
17 | rev: 6.0.1
18 | hooks:
19 | - id: isort
20 | files: ex_app/lib/
21 |
22 | - repo: https://github.com/psf/black
23 | rev: 25.1.0
24 | hooks:
25 | - id: black
26 | files: ex_app/lib/
27 |
28 | - repo: https://github.com/astral-sh/ruff-pre-commit
29 | rev: v0.12.4
30 | hooks:
31 | - id: ruff
32 |
33 | - repo: local
34 | hooks:
35 | - id: pylint
36 | name: pylint
37 | entry: pylint --recursive=y "ex_app/lib/"
38 | language: system
39 | types: [ python ]
40 | pass_filenames: false
41 | args:
42 | [
43 | "-rn", # Only display messages
44 | "-sn", # Don't display the score
45 | ]
46 |
--------------------------------------------------------------------------------
/LICENSES/BSD-2-Clause.txt:
--------------------------------------------------------------------------------
1 | Copyright (c)
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | [tool.black]
4 | line-length = 120
5 | target-versions = ["py310"]
6 | preview = true
7 |
8 | [tool.ruff]
9 | line-length = 120
10 | target-version = "py310"
11 | lint.select = ["A", "B", "C", "D", "E", "F", "G", "I", "S", "SIM", "PIE", "Q", "RET", "RUF", "UP" , "W"]
12 | lint.extend-ignore = ["D101", "D102", "D103", "D105", "D107", "D203", "D213", "D401", "I001", "RUF100", "D400", "D415", "S105"]
13 |
14 | [tool.isort]
15 | profile = "black"
16 |
17 | [tool.pylint]
18 | master.py-version = "3.10"
19 | master.extension-pkg-allow-list = ["pydantic"]
20 | design.max-attributes = 8
21 | design.max-locals = 16
22 | design.max-branches = 16
23 | design.max-returns = 8
24 | design.max-args = 7
25 | basic.good-names = [
26 | "a", "b", "c", "d", "e", "f", "i", "j", "k", "r", "v",
27 | "ex", "_", "fp", "im", "nc", "ui",
28 | ]
29 | reports.output-format = "colorized"
30 | similarities.ignore-imports = "yes"
31 | similarities.min-similarity-lines = 6
32 | messages_control.disable = [
33 | "missing-class-docstring",
34 | "missing-function-docstring",
35 | "line-too-long",
36 | "too-few-public-methods",
37 | "too-many-public-methods",
38 | "global-statement",
39 | "broad-exception-caught",
40 | "cell-var-from-loop",
41 | "protected-access",
42 | ]
43 |
--------------------------------------------------------------------------------
/LICENSES/BSD-3-Clause.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | .DS_Store
4 | node_modules/
5 | npm-debug.log*
6 | yarn-debug.log*
7 | yarn-error.log*
8 |
9 | # Editor directories and files
10 | .idea
11 | .vscode
12 | *.suo
13 | *.ntvs*
14 | *.njsproj
15 | *.sln
16 |
17 | .marginalia
18 |
19 | build/
20 | coverage/
21 | vendor
22 | .php-cs-fixer.cache
23 | .phpunit.result.cache
24 |
25 | /out
26 | /dev/
27 | local
28 | tmp
29 | .phpdoc
30 | clover.unit.xml
31 | clover.integration.xml
32 | proto/thrift/gen-*
33 |
34 | # Python Part
35 |
36 | # Byte-compiled / optimized / DLL files
37 | __pycache__/
38 | *.py[cod]
39 | *$py.class
40 |
41 | # Pycharm settings
42 | .idea/
43 |
44 | # mypy
45 | .mypy_cache/
46 | .dmypy.json
47 | dmypy.json
48 |
49 | # Pyre type checker
50 | .pyre/
51 |
52 | # pytype static type analyzer
53 | .pytype/
54 |
55 | # Environments
56 | .env
57 | .venv
58 | env/
59 | venv/
60 | ENV/
61 | env.bak/
62 | venv.bak/
63 |
64 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
65 | __pypackages__/
66 |
67 | # Scrapy stuff:
68 | .scrapy
69 |
70 | # Sphinx documentation
71 | docs/_build/
72 |
73 | # PyBuilder
74 | .pybuilder/
75 | target/
76 |
77 | # Distribution / packaging
78 | .Python
79 | develop-eggs/
80 | dist/
81 | downloads/
82 | eggs/
83 | .eggs/
84 | lib64/
85 | parts/
86 | sdist/
87 | var/
88 | wheels/
89 | share/python-wheels/
90 | *.egg-info/
91 | .installed.cfg
92 | *.egg
93 | MANIFEST
94 | converted/
95 |
96 | geckodriver.log
97 | /windmill_tmp/
98 | /windmill_src/
99 | /windmill_selfhosted/
100 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | * SPDX-License-Identifier: MIT
4 | */
5 |
6 | const path = require('path')
7 | const webpackConfig = require('@nextcloud/webpack-vue-config')
8 | const webpackRules = require('@nextcloud/webpack-vue-config/rules')
9 | const ESLintPlugin = require('eslint-webpack-plugin')
10 | const StyleLintPlugin = require('stylelint-webpack-plugin')
11 |
12 | const buildMode = process.env.NODE_ENV
13 | const isDev = buildMode === 'development'
14 | webpackConfig.devtool = isDev ? 'cheap-source-map' : 'source-map'
15 |
16 | webpackConfig.stats = {
17 | colors: true,
18 | modules: false,
19 | }
20 |
21 | const appId = 'flow'
22 |
23 | webpackConfig.entry = {
24 | main: { import: path.join(__dirname, 'ex_app', 'src', 'main.js'), filename: appId + '-main.js' },
25 | }
26 |
27 | webpackConfig.module.rules = Object.values(webpackRules)
28 |
29 | webpackConfig.plugins.push(
30 | new ESLintPlugin({
31 | extensions: ['js', 'vue'],
32 | files: 'ex_app/src',
33 | failOnError: !isDev,
34 | })
35 | )
36 |
37 | webpackConfig.plugins.push(
38 | new StyleLintPlugin({
39 | files: 'ex_app/src/**/*.{css,scss,vue}',
40 | failOnError: !isDev,
41 | }),
42 | )
43 |
44 | webpackConfig.output = {
45 | path: path.resolve(__dirname, 'ex_app/js'),
46 | }
47 |
48 | // Generate reuse license files if not in development mode
49 | if (!isDev) {
50 | const WebpackSPDXPlugin = require('./build-js/WebpackSPDXPlugin.js')
51 | webpackConfig.plugins.push(new WebpackSPDXPlugin({
52 | override: {
53 | select2: 'MIT',
54 | },
55 | }))
56 |
57 | webpackConfig.optimization.minimizer = [{
58 | apply: (compiler) => {
59 | // Lazy load the Terser plugin
60 | const TerserPlugin = require('terser-webpack-plugin')
61 | new TerserPlugin({
62 | extractComments: false,
63 | terserOptions: {
64 | format: {
65 | comments: false,
66 | },
67 | compress: {
68 | passes: 2,
69 | },
70 | },
71 | }).apply(compiler)
72 | },
73 | }]
74 | }
75 |
76 | module.exports = webpackConfig
77 |
--------------------------------------------------------------------------------
/ex_app_scripts/init_pgsql.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | # SPDX-License-Identifier: MIT
4 |
5 | # Environment variables
6 | DB_NAME=${APP_ID:-windmill}
7 | DB_USER=${APP_ID:-windmilluser}
8 | DB_PASS=${APP_ID:-windmillpass}
9 |
10 | # Check if EXTERNAL_DATABASE is set
11 | if [ -n "${EXTERNAL_DATABASE}" ]; then
12 | DATABASE_URL="${EXTERNAL_DATABASE}"
13 | echo "Using external database. DATABASE_URL is set to: $DATABASE_URL"
14 |
15 | # Check if DATABASE_URL is already in /etc/environment, if not, add it
16 | if ! grep -q "^export DATABASE_URL=" /etc/environment; then
17 | echo "export DATABASE_URL=\"$EXTERNAL_DATABASE\"" >> /etc/environment
18 | fi
19 |
20 | # Reload environment variables
21 | . /etc/environment
22 | exit 0
23 | fi
24 |
25 | source /ex_app_scripts/common_pgsql.sh
26 |
27 | ensure_postgres_installed
28 | init_and_start_postgres
29 |
30 | # Check if the user exists and create if not
31 | sudo -u postgres $PG_SQL -c "SELECT 1 FROM pg_user WHERE usename = '$DB_USER'" | grep -q 1 || \
32 | sudo -u postgres $PG_SQL -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" && \
33 | sudo -u postgres $PG_SQL -c "ALTER USER $DB_USER WITH SUPERUSER;"
34 |
35 | # Check if the database exists and create if not
36 | sudo -u postgres $PG_SQL -c "SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'" | grep -q 1 || \
37 | sudo -u postgres $PG_SQL -c "CREATE DATABASE $DB_NAME OWNER $DB_USER;"
38 |
39 | if [ -z "${DATABASE_URL}" ]; then
40 | # Set DATABASE_URL environment variable
41 | DATABASE_URL="postgresql://$DB_USER:$DB_PASS@%2Fvar%2Frun%2Fpostgresql/$DB_NAME?sslmode=disable"
42 |
43 | # Check if DATABASE_URL is already in /etc/environment, if not, add it
44 | if ! grep -q "^export DATABASE_URL=" /etc/environment; then
45 | echo "export DATABASE_URL=\"postgresql://$DB_USER:$DB_PASS@%2Fvar%2Frun%2Fpostgresql/$DB_NAME?sslmode=disable\"" >> /etc/environment
46 | fi
47 |
48 | echo "DATABASE_URL was not set. It is now set to: $DATABASE_URL"
49 | else
50 | echo "DATABASE_URL is already set to: $DATABASE_URL"
51 | fi
52 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
5 | # Change Log
6 |
7 | All notable changes to this project will be documented in this file.
8 |
9 | The format is based on [Keep a Changelog](http://keepachangelog.com/)
10 | and this project adheres to [Semantic Versioning](http://semver.org/).
11 |
12 | ## [1.2.2 - 2025-12-07]
13 |
14 | ### Added
15 |
16 | - Nextcloud 33 support.
17 |
18 | ## [1.2.0 - 2025-05-20]
19 |
20 | ### Added
21 |
22 | - Nextcloud 32 HaRP support. #48
23 | - Ability to specify Windmill worker count during deploying. #54
24 | - Ability to specify Windmill log level during deploying. #55
25 | - Automatic configure Windmill instance URL in Settings. #56
26 |
27 | ### Fixed
28 |
29 | - The app now should now additionally show up in the Flow category in the AppStore. #52
30 | - New installations will use bundled PgSQL over socket for easier deployment with `network=host`. #53
31 |
32 | ## [1.1.0 - 2025-01-14]
33 |
34 | ### Added
35 |
36 | - Initialization of the `baseUrl` value in the Nextcloud Auth resource. #35
37 | - Synchronization of `AA_VERSION` and `APP_VERSION` values in the Nextcloud Auth resource. #32
38 |
39 | ### Changed
40 |
41 | - Python version updated from `3.10` to `3.12`. #33
42 |
43 | ### Fixed
44 |
45 | - The PgSQL database now comes preinstalled in the Docker image instead of being installed during ExApp startup. #30
46 |
47 | ## [1.0.1 - 2024-10-10]
48 |
49 | ### Added
50 |
51 | - More logging for faster problem diagnosis. [commit](https://github.com/nextcloud/flow/commit/e52c501144761e73b81b156423af034c191797aa)
52 |
53 | ### Fixed
54 |
55 | - Warning "sudo: unable to resolve host" during container startup. #11
56 | - Incorrect handling Windmill scripts with no modules in it. [commit](https://github.com/nextcloud/flow/commit/c8bf8309e85b14c2b36913469a38291f2c480b53)
57 | - Unregister webhooks from the Nextcloud instance during ExApp disabling. #10
58 | - Error when username(userid) contained a space. #13
59 | - Updated NPM packages. #12
60 |
61 | ## [1.0.0 - 2024-09-13]
62 |
63 | ### Added
64 |
65 | - First release
66 |
--------------------------------------------------------------------------------
/ex_app/src/views/IframeView.vue:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
68 |
69 |
83 |
--------------------------------------------------------------------------------
/ex_app_scripts/common_pgsql.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | # SPDX-License-Identifier: MIT
4 |
5 | # Common environment variables
6 | PG_VERSION=15
7 | PG_BIN="/usr/lib/postgresql/${PG_VERSION}/bin"
8 | PG_SQL="/usr/lib/postgresql/${PG_VERSION}/bin/psql"
9 | BASE_DIR="${APP_PERSISTENT_STORAGE:-/nc_app_${APP_ID:-flow}_data}"
10 | DATA_DIR="${BASE_DIR}/pgsql"
11 |
12 | # Function to ensure PostgreSQL is installed
13 | ensure_postgres_installed() {
14 | # Check if PostgreSQL is installed by checking for the existence of binary files
15 | if [ -d "$PG_BIN" ]; then
16 | echo "PostgreSQL binaries found."
17 | else
18 | echo "PostgreSQL binaries not found."
19 | echo "Adding the PostgreSQL APT repository..."
20 | apt-get update && apt-get install -y gnupg
21 | wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
22 | echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
23 | echo "Installing PostgreSQL..."
24 | apt-get update && apt-get install -y postgresql-$PG_VERSION
25 | fi
26 | }
27 |
28 | # Function to initialize the database (if needed) and start PostgreSQL
29 | init_and_start_postgres() {
30 | # Ensure the directory exists and has the correct permissions
31 | mkdir -p "$DATA_DIR"
32 | chown -R postgres:postgres "$DATA_DIR"
33 |
34 | if [ ! -d "$DATA_DIR/base" ]; then
35 | echo "Initializing the PostgreSQL database..."
36 | sudo -u postgres ${PG_BIN}/initdb -D "$DATA_DIR"
37 | PG_CONF="${DATA_DIR}/postgresql.conf"
38 | if ! grep -q "^listen_addresses\s*=\s*''" "$PG_CONF"; then
39 | echo "Updating PostgreSQL configuration to disable TCP/IP connections..."
40 | echo "listen_addresses = ''" >> "$PG_CONF"
41 | fi
42 | fi
43 |
44 | echo "Starting PostgreSQL..."
45 | sudo -u postgres ${PG_BIN}/pg_ctl -D "$DATA_DIR" -l "${DATA_DIR}/logfile" start
46 |
47 | echo "Waiting for PostgreSQL to start..."
48 | until sudo -u postgres ${PG_SQL} -c "SELECT 1" > /dev/null 2>&1; do
49 | sleep 1
50 | echo -n "."
51 | done
52 | echo "PostgreSQL is up and running."
53 | }
54 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flow",
3 | "description": "Workflow Engine in your Nextcloud",
4 | "version": "1.0.0",
5 | "homepage": "https://github.com/nextcloud/flow",
6 | "bugs": {
7 | "url": "https://github.com/nextcloud/flow/issues"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/nextcloud/flow"
12 | },
13 | "license": "MIT",
14 | "private": true,
15 | "author": "Alexander Piskun ",
16 | "contributors": [
17 | "Marcel Klehr " ,
18 | "Julien Veyssier ",
19 | "Alexander Piskun "
20 | ],
21 | "scripts": {
22 | "build": "NODE_OPTIONS=--max_old_space_size=1024 webpack --node-env production --progress",
23 | "postbuild": "build-js/npm-post-build.sh",
24 | "dev": "webpack --node-env development --progress",
25 | "watch": "webpack --node-env development --progress --watch",
26 | "lint": "eslint --ext .js,.vue src",
27 | "lint:fix": "eslint --ext .js,.vue src --fix",
28 | "stylelint": "stylelint css/*.css src/**/*.vue",
29 | "stylelint:fix": "stylelint css/*.css src/**/*.vue --fix",
30 | "serve": "NODE_ENV=development webpack serve --allowed-hosts all --config webpack.config.js"
31 | },
32 | "browserslist": [
33 | "extends @nextcloud/browserslist-config"
34 | ],
35 | "dependencies": {
36 | "@nextcloud/auth": "^2.5.1",
37 | "@nextcloud/axios": "^2.5.1",
38 | "@nextcloud/dialogs": "^5.3.1",
39 | "@nextcloud/event-bus": "^3.3.2",
40 | "@nextcloud/files": "^3.10.2",
41 | "@nextcloud/initial-state": "^2.2.0",
42 | "@nextcloud/l10n": "^2.2.0",
43 | "@nextcloud/moment": "^1.3.4",
44 | "@nextcloud/router": "^3.0.1",
45 | "@nextcloud/vue": "^8.27.0",
46 | "vue": "^2.7.14",
47 | "vue-material-design-icons": "^5.3.1",
48 | "vue-router": "^3.5.3",
49 | "vue-template-compiler": "^2.7.16",
50 | "vuex": "^3.6.2",
51 | "vuex-router-sync": "^5.0.0"
52 | },
53 | "devDependencies": {
54 | "@nextcloud/babel-config": "^1.0.0",
55 | "@nextcloud/browserslist-config": "^3.0.1",
56 | "@nextcloud/eslint-config": "^8.3.0",
57 | "@nextcloud/stylelint-config": "^2.4.0",
58 | "@nextcloud/webpack-vue-config": "^6.0.1",
59 | "eslint-webpack-plugin": "^4.1.0",
60 | "stylelint-webpack-plugin": "^5.0.0"
61 | },
62 | "engines": {
63 | "node": ">=16.0.0",
64 | "npm": "^7.0.0 || ^8.0.0"
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/ex_app_scripts/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3 | # SPDX-License-Identifier: MIT
4 |
5 | set -e
6 |
7 | # Only create a config file if HP_SHARED_KEY is set.
8 | if [ -n "$HP_SHARED_KEY" ]; then
9 | echo "HP_SHARED_KEY is set, creating /frpc.toml configuration file..."
10 | if [ -d "/certs/frp" ]; then
11 | echo "Found /certs/frp directory. Creating configuration with TLS certificates."
12 | cat < /frpc.toml
13 | serverAddr = "$HP_FRP_ADDRESS"
14 | serverPort = $HP_FRP_PORT
15 | loginFailExit = false
16 |
17 | transport.tls.enable = true
18 | transport.tls.certFile = "/certs/frp/client.crt"
19 | transport.tls.keyFile = "/certs/frp/client.key"
20 | transport.tls.trustedCaFile = "/certs/frp/ca.crt"
21 | transport.tls.serverName = "harp.nc"
22 |
23 | metadatas.token = "$HP_SHARED_KEY"
24 |
25 | [[proxies]]
26 | remotePort = $APP_PORT
27 | type = "tcp"
28 | name = "$APP_ID"
29 | [proxies.plugin]
30 | type = "unix_domain_socket"
31 | unixPath = "/tmp/exapp.sock"
32 | EOF
33 | else
34 | echo "Directory /certs/frp not found. Creating configuration without TLS certificates."
35 | cat < /frpc.toml
36 | serverAddr = "$HP_FRP_ADDRESS"
37 | serverPort = $HP_FRP_PORT
38 | loginFailExit = false
39 |
40 | transport.tls.enable = false
41 |
42 | metadatas.token = "$HP_SHARED_KEY"
43 |
44 | [[proxies]]
45 | remotePort = $APP_PORT
46 | type = "tcp"
47 | name = "$APP_ID"
48 | [proxies.plugin]
49 | type = "unix_domain_socket"
50 | unixPath = "/tmp/exapp.sock"
51 | EOF
52 | fi
53 | else
54 | echo "HP_SHARED_KEY is not set. Skipping FRP configuration."
55 | fi
56 |
57 | # If we have a configuration file and the shared key is present, start the FRP client
58 | if [ -f /frpc.toml ] && [ -n "$HP_SHARED_KEY" ]; then
59 | echo "Starting frpc in the background..."
60 | frpc -c /frpc.toml &
61 | fi
62 |
63 | # Read environment variables
64 | . /etc/environment
65 |
66 | # Ensure hostname is in /etc/hosts
67 | HOSTNAME=$(cat /etc/hostname)
68 | if ! grep -q "$HOSTNAME" /etc/hosts; then
69 | echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
70 | echo "Added $HOSTNAME to /etc/hosts"
71 | else
72 | echo "$HOSTNAME is already in /etc/hosts"
73 | fi
74 |
75 | # Execute the custom scripts
76 | /ex_app_scripts/init_pgsql.sh
77 | /ex_app_scripts/set_workers_num.sh
78 |
79 | # Reloading environment variables to reflect changes if were
80 | . /etc/environment
81 |
82 | # Run all arguments after "first" in the background
83 | main_command=$1
84 | shift # Remove the first argument, which is "the name of main binary"
85 |
86 | for arg in "$@"; do
87 | echo "Starting $arg in background..."
88 | if [ "$arg" = "caddy" ]; then
89 | caddy run --config /etc/caddy/Caddyfile &
90 | elif [ "${arg##*.}" = "py" ]; then
91 | python3 "$arg" &
92 | elif echo "$arg" | grep -q '^sleep'; then
93 | sleep_duration=$(echo "$arg" | grep -o '[0-9]*')
94 | echo "Sleeping for $sleep_duration seconds..."
95 | sleep "$sleep_duration"
96 | else
97 | eval "$arg" &
98 | fi
99 | done
100 |
101 | # Check if the main command is a Python script
102 | if [ "${main_command##*.}" = "py" ]; then
103 | echo "Starting main command as a Python script: $main_command"
104 | exec python3 "$main_command"
105 | else
106 | echo "Starting main command: $main_command"
107 | exec "$main_command"
108 | fi
109 |
--------------------------------------------------------------------------------
/.github/workflows/publish-docker.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | name: Publish Docker Image
4 |
5 | on:
6 | workflow_dispatch:
7 |
8 | jobs:
9 | push_to_registry:
10 | name: Build image
11 | runs-on: ubuntu-22.04
12 | if: ${{ github.repository_owner == 'nextcloud' }}
13 | permissions:
14 | packages: write
15 | contents: read
16 | steps:
17 | - name: Set app env
18 | run: |
19 | # Split and keep last
20 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
21 | echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
22 |
23 | - name: Checkout
24 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v3
25 | with:
26 | path: ${{ env.APP_NAME }}
27 |
28 | - name: Read package.json node and npm engines version
29 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
30 | id: versions
31 | # Continue if no package.json
32 | continue-on-error: true
33 | with:
34 | path: ${{ env.APP_NAME }}
35 | fallbackNode: "^20"
36 | fallbackNpm: "^10"
37 |
38 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
39 | # Skip if no package.json
40 | if: ${{ steps.versions.outputs.nodeVersion }}
41 | uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v3
42 | with:
43 | node-version: ${{ steps.versions.outputs.nodeVersion }}
44 |
45 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
46 | # Skip if no package.json
47 | if: ${{ steps.versions.outputs.npmVersion }}
48 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
49 |
50 | - name: Build ${{ env.APP_NAME }}
51 | # Skip if no package.json
52 | if: ${{ steps.versions.outputs.nodeVersion }}
53 | run: |
54 | cd ${{ env.APP_NAME }}
55 | npm ci
56 | npm run build
57 |
58 | - name: Set up QEMU
59 | uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
60 | - name: Set up Docker Buildx
61 | uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
62 |
63 | - name: Log in to GitHub Container Registry
64 | uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
65 | with:
66 | registry: ghcr.io
67 | username: ${{ github.actor }}
68 | password: ${{ secrets.GITHUB_TOKEN }}
69 |
70 | - name: Available platforms
71 | run: echo ${{ steps.buildx.outputs.platforms }}
72 |
73 | - name: Install xmlstarlet
74 | run: sudo apt-get update && sudo apt-get install -y xmlstarlet
75 |
76 | - name: Extract version from XML
77 | id: extract_version
78 | run: |
79 | cd ${{ env.APP_NAME }}
80 | VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
81 | echo "VERSION=$VERSION" >> $GITHUB_ENV
82 |
83 | - name: Log version
84 | run: |
85 | echo "Extracted version: ${{ env.VERSION }}"
86 |
87 | - name: Build container image
88 | uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
89 | with:
90 | push: true
91 | context: ./${{ env.APP_NAME }}
92 | platforms: linux/amd64,linux/arm64
93 | tags: ghcr.io/${{ github.repository_owner }}/${{ env.APP_NAME }}:${{ env.VERSION }}
94 | build-args: |
95 | BUILD_TYPE=cpu
96 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | .DEFAULT_GOAL := help
4 |
5 | APP_ID := flow
6 | APP_NAME := Flow
7 | APP_VERSION := $$(xmlstarlet sel -t -v "//version" appinfo/info.xml)
8 | JSON_INFO := "{\"id\":\"$(APP_ID)\",\"name\":\"$(APP_NAME)\",\"daemon_config_name\":\"manual_install\",\"version\":\"$(APP_VERSION)\",\"secret\":\"12345\",\"port\":27100, \"routes\": [{\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\"^api\\\/w\\\/nextcloud\\\/jobs_u\\\/.*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":0, \"headers_to_exclude\":[], \"bruteforce_protection\":[401]}, {\"url\":\".*\", \"verb\":\"GET, POST, PUT, DELETE\", \"access_level\":2, \"headers_to_exclude\":[]}]}"
9 |
10 |
11 | .PHONY: help
12 | help:
13 | @echo " Welcome to $(APP_NAME) $(APP_VERSION)!"
14 | @echo " "
15 | @echo " Please use \`make \` where is one of"
16 | @echo " "
17 | @echo " init clones Windmill repo to 'windmill_src' folder and copy ExApp inside it"
18 | @echo " static_frontend builds Windmill's 'static_frontend' folder for 'manual_install'"
19 | @echo " build-push builds app docker image and uploads it to ghcr.io"
20 | @echo " "
21 | @echo " > Next commands are only for the dev environment with nextcloud-docker-dev!"
22 | @echo " > They should run from the host you are developing on(with activated venv) and not in the container with Nextcloud!"
23 | @echo " "
24 | @echo " run30 installs $(APP_NAME) for Nextcloud 30"
25 | @echo " run installs $(APP_NAME) for Nextcloud Latest"
26 | @echo " "
27 | @echo " > Commands for manual registration of ExApp($(APP_NAME) should be running!):"
28 | @echo " "
29 | @echo " register30 performs registration of running $(APP_NAME) into the 'manual_install' deploy daemon."
30 | @echo " register performs registration of running $(APP_NAME) into the 'manual_install' deploy daemon."
31 |
32 |
33 | .PHONY: init
34 | init:
35 | rm -rf windmill_src
36 | git -c advice.detachedHead=False clone -b v1.394.4 https://github.com/windmill-labs/windmill.git windmill_src
37 | cp Dockerfile requirements.txt windmill_src/
38 |
39 | cp -r ex_app windmill_src/
40 | cp -r ex_app_scripts windmill_src/
41 |
42 | .PHONY: static_frontend
43 | static_frontend:
44 | rm -rf static_frontend
45 | pushd windmill_src && \
46 | DOCKER_BUILDKIT=1 docker buildx build \
47 | --build-arg VITE_BASE_URL=/index.php/apps/app_api/proxy/flow \
48 | --platform linux/amd64 \
49 | --target export_frontend \
50 | --output type=local,dest=../static_frontend . && \
51 | popd
52 |
53 | .PHONY: build-push
54 | build-push:
55 | docker login ghcr.io
56 | docker buildx build --push \
57 | --build-arg VITE_BASE_URL=/index.php/apps/app_api/proxy/flow \
58 | --platform linux/arm64/v8,linux/amd64 \
59 | --tag ghcr.io/nextcloud/$(APP_ID):$(APP_VERSION) \
60 | --file windmill_src/Dockerfile \
61 | windmill_src
62 |
63 | .PHONY: run30
64 | run30:
65 | docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
66 | docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) \
67 | --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml
68 |
69 | .PHONY: run
70 | run:
71 | docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
72 | docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) \
73 | --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml
74 |
75 | .PHONY: register30
76 | register30:
77 | docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
78 | docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --wait-finish
79 |
80 | .PHONY: register
81 | register:
82 | docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
83 | docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --wait-finish
84 |
--------------------------------------------------------------------------------
/appinfo/info.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | flow
8 | Flow
9 | Automate and Streamline Your Workflows in Nextcloud
10 |
11 |
27 | 1.2.2
28 | agpl
29 | Julien Veyssier
30 | Marcel Klehr
31 | Alexander Piskun
32 | PyAppV2_flow
33 | tools
34 | workflow
35 | https://github.com/nextcloud/flow
36 | https://github.com/nextcloud/flow/issues
37 | https://github.com/nextcloud/flow
38 | https://raw.githubusercontent.com/nextcloud/flow/main/screenshots/flow_1.png
39 | https://raw.githubusercontent.com/nextcloud/flow/main/screenshots/flow_2.png
40 | https://raw.githubusercontent.com/nextcloud/flow/main/screenshots/flow_3.png
41 |
42 |
43 |
44 |
45 |
46 | ghcr.io
47 | nextcloud/flow
48 | 1.2.0
49 |
50 |
51 |
52 | ^api\/w\/nextcloud\/jobs\/.*
53 | GET,POST,PUT,DELETE
54 | PUBLIC
55 | []
56 | [401]
57 |
58 |
59 | ^api\/w\/nextcloud\/jobs_u\/.*
60 | GET,POST,PUT,DELETE
61 | PUBLIC
62 | []
63 | [401]
64 |
65 |
66 | .*
67 | GET,POST,PUT,DELETE
68 | ADMIN
69 | []
70 |
71 |
72 |
73 |
74 | NUM_WORKERS
75 | Number of workers
76 | Override the default count of Windmill workers
77 |
78 |
79 | EXTERNAL_DATABASE
80 | External database
81 | External database URL in format: postgres://db_user:db_pass@db_address:5432/db_name
82 |
83 |
84 | RUST_LOG
85 | Windmill log level
86 | Possible values: debug, info, warn, error
87 | warn
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/.github/workflows/appstore-build-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow is provided via the organization template repository
2 | #
3 | # https://github.com/nextcloud/.github
4 | # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5 | #
6 | # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7 | # SPDX-License-Identifier: MIT
8 |
9 | name: Build and publish app release
10 |
11 | on:
12 | release:
13 | types: [published]
14 |
15 | env:
16 | PHP_VERSION: 8.1
17 |
18 | jobs:
19 | build_and_publish:
20 | runs-on: ubuntu-latest
21 | if: ${{ github.repository_owner == 'nextcloud-releases' }}
22 | steps:
23 | - name: Check actor permission
24 | uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
25 | with:
26 | require: write
27 |
28 | - name: Set app env
29 | run: |
30 | # Split and keep last
31 | echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
32 | echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
33 |
34 | - name: Checkout
35 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v3
36 | with:
37 | path: ${{ env.APP_NAME }}
38 |
39 | - name: Get appinfo data
40 | id: appinfo
41 | uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
42 | with:
43 | filename: ${{ env.APP_NAME }}/appinfo/info.xml
44 | expression: "//info//dependencies//nextcloud/@min-version"
45 |
46 | - name: Read package.json node and npm engines version
47 | uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
48 | id: versions
49 | # Continue if no package.json
50 | continue-on-error: true
51 | with:
52 | path: ${{ env.APP_NAME }}
53 | fallbackNode: "^20"
54 | fallbackNpm: "^8"
55 |
56 | - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
57 | # Skip if no package.json
58 | if: ${{ steps.versions.outputs.nodeVersion }}
59 | uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v3
60 | with:
61 | node-version: ${{ steps.versions.outputs.nodeVersion }}
62 |
63 | - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
64 | # Skip if no package.json
65 | if: ${{ steps.versions.outputs.npmVersion }}
66 | run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
67 |
68 | - name: Set up php ${{ env.PHP_VERSION }}
69 | uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2
70 | with:
71 | php-version: ${{ env.PHP_VERSION }}
72 | coverage: none
73 | env:
74 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75 |
76 | - name: Check composer.json
77 | id: check_composer
78 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
79 | with:
80 | files: "${{ env.APP_NAME }}/composer.json"
81 |
82 | - name: Install composer dependencies
83 | if: steps.check_composer.outputs.files_exists == 'true'
84 | run: |
85 | cd ${{ env.APP_NAME }}
86 | composer install --no-dev
87 |
88 | - name: Build ${{ env.APP_NAME }}
89 | # Skip if no package.json
90 | if: ${{ steps.versions.outputs.nodeVersion }}
91 | run: |
92 | cd ${{ env.APP_NAME }}
93 | npm ci
94 | npm run build
95 |
96 | - name: Check Krankerl config
97 | id: krankerl
98 | uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99 | with:
100 | files: ${{ env.APP_NAME }}/krankerl.toml
101 |
102 | - name: Install Krankerl
103 | if: steps.krankerl.outputs.files_exists == 'true'
104 | run: |
105 | wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
106 | sudo dpkg -i krankerl_0.14.0_amd64.deb
107 |
108 | - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with krankerl
109 | if: steps.krankerl.outputs.files_exists == 'true'
110 | run: |
111 | cd ${{ env.APP_NAME }}
112 | krankerl package
113 |
114 | - name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with makefile
115 | if: steps.krankerl.outputs.files_exists != 'true'
116 | run: |
117 | cd ${{ env.APP_NAME }}
118 | make appstore
119 |
120 | - name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
121 | continue-on-error: true
122 | id: server-checkout
123 | run: |
124 | NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
125 | wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
126 | unzip latest-$NCVERSION.zip
127 |
128 | - name: Checkout server master fallback
129 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v3
130 | if: ${{ steps.server-checkout.outcome != 'success' }}
131 | with:
132 | submodules: true
133 | repository: nextcloud/server
134 | path: nextcloud
135 |
136 | - name: Sign app
137 | run: |
138 | # Extracting release
139 | cd ${{ env.APP_NAME }}/build/artifacts
140 | tar -xvf ${{ env.APP_NAME }}.tar.gz
141 | cd ../../../
142 | # Setting up keys
143 | echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
144 | wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145 | # Signing
146 | php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
147 | # Rebuilding archive
148 | cd ${{ env.APP_NAME }}/build/artifacts
149 | tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150 |
151 | - name: Attach tarball to github release
152 | uses: svenstaro/upload-release-action@5e35e583720436a2cc5f9682b6f55657101c1ea1 # v2
153 | id: attach_to_release
154 | with:
155 | repo_token: ${{ secrets.GITHUB_TOKEN }}
156 | file: ${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}.tar.gz
157 | asset_name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}.tar.gz
158 | tag: ${{ github.ref }}
159 | overwrite: true
160 |
161 | - name: Upload app to Nextcloud appstore
162 | uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
163 | with:
164 | app_name: ${{ env.APP_NAME }}
165 | appstore_token: ${{ secrets.APPSTORE_TOKEN }}
166 | download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
167 | app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
168 |
--------------------------------------------------------------------------------
/LICENSES/CC0-1.0.txt:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
5 | # Flow: Seamless Automation for Nextcloud
6 |
7 | [](https://api.reuse.software/info/github.com/nextcloud/flow)
8 |
9 | Nextcloud Flow is a set of intuitive automation components that allow organizations to automate and streamline internal workflows.
10 |
11 | Through easy low-code and no-code interfaces it enables users to effortlessly automate routine tasks, ease data entry and manipulation and reduce manual work.
12 |
13 | It includes components designed for a variety of businesses needs and at various scales, from SME to large enterprises.
14 |
15 | 1. Users can build simple mini-apps to manage structured data through the no-code interface in the Tables app.
16 | 2. Users can automate actions on a variety of triggers through no-code interfaces in the Flow user settings.
17 | 3. Administrators can additionally configure file access controls to automatically block unauthorized access to sensitive data.
18 | 4. Business process annalists and administrators have access to the powerful business automation features built on the open source **Windmill** tool, capable of modeling large business processes that require interaction with internal and external services.
19 |
20 | This app provides an easy way to install the Windmill based Business Process Automation component of Flow.
21 |
22 | > **Note:**
23 | > **Requires the `AppAPI` and `webhooks_listener` apps to be enabled to work properly.**
24 |
25 | ## Getting Started
26 |
27 | Flow is designed to be easy to set up and use. Follow these steps to get started:
28 |
29 | To install Flow, navigate to the Nextcloud App Store and search for **Flow**. Install the app and [follow the instructions](https://docs.nextcloud.com/server/latest/admin_manual/windmill_workflows/index.html) to complete the setup.
30 |
31 | ## Advanced Features
32 |
33 | For users familiar with Windmill, Flow offers additional advanced features that enhance automation capabilities within Nextcloud:
34 |
35 | - **API Integrations**: Connect Flow with external applications through API integrations, allowing for even more customization and control.
36 | - **Custom Scripting**: Write custom scripts to add to workflows, giving you full control over your automation processes.
37 | - **Error Handling**: Flow includes error detection and handling mechanisms that ensure smooth execution and notify you of any issues during workflow execution.
38 |
39 | ## FAQ
40 |
41 | ### Specific Environment Options to Control ExApp Behavior
42 |
43 | > **Note:**
44 | >
45 | > This is only supported starting from Nextcloud version `31.0.4`
46 |
47 | **Q: How can I control the number of Windmill workers?**
48 | **A:** You can set the `NUM_WORKERS` environment variable. The default value is `number_of_cpu_cores * 2`.
49 |
50 | **Q: I want to use an external PostgreSQL database instead of the bundled one in the container. Can I?**
51 | **A:** Yes, you can configure it by setting the `EXTERNAL_DATABASE` environment variable in the following format:
52 | `postgres://DB_USER:DB_PASS@localhost:5432/DB_NAME`
53 |
54 | ### Manual Deployment
55 |
56 | > **Note:**
57 | >
58 | > This method can also be used for enterprise or custom scaled Windmill setups.
59 |
60 | **Prerequisites:**
61 |
62 | - Nextcloud instance with `AppAPI` and `webhooks_listener` apps enabled.
63 | - Python 3.10 or higher installed on the server.
64 | - Git installed on the server.
65 |
66 | Follow these steps to manually deploy Flow without Docker:
67 |
68 | 1. **Register the Deploy Daemon in AppAPI**
69 |
70 | First, register the Deploy Daemon in AppAPI with the `manual-install` type. Refer to the Nextcloud documentation for detailed instructions: [AppAPI Manual Install](todo)
71 |
72 | 2. **Clone the Repository and Install Dependencies**
73 |
74 | Clone the Flow repository:
75 |
76 | ```bash
77 | git clone https://github.com/nextcloud/flow.git
78 | ```
79 |
80 | Navigate into the cloned directory, create a Python virtual environment, and install the required dependencies:
81 |
82 | ```bash
83 | cd flow
84 | python3 -m venv venv
85 | source venv/bin/activate
86 | pip install -r requirements.txt
87 | ```
88 |
89 | 3. **Install Windmill**
90 |
91 | Install Windmill by following the official instructions: [Setup Windmill on Localhost](https://www.windmill.dev/docs/advanced/self_host#setup-windmill-on-localhost)
92 |
93 | **Note:** Windmill should be in its default state, with the default user `admin@windmill.dev` and password `changeme`. If you have changed the administrator username/password, adjust the `DEFAULT_USER_EMAIL` and `DEFAULT_USER_PASSWORD` variables in the `ex_app/lib/main.py` file accordingly.
94 |
95 | 4. **Configure ExApp Environment Variables**
96 |
97 | Set the required ExApp environment variables (`NEXTCLOUD_URL`, `APP_HOST`, `APP_PORT`, `APP_SECRET`) or modify them directly in the script at the top of `ex_app/lib/main.py`. Refer to the Nextcloud documentation for more details: [ExApp Configuration](todo)
98 |
99 | 5. **Set the `WINDMILL_URL` Environment Variable**
100 |
101 | Define the `WINDMILL_URL` environment variable or set it in the script. This variable specifies the location of the Windmill instance you deployed in step 3.
102 |
103 | 6. **Adjust Windmill Version (Optional)**
104 |
105 | **Note:** If you are using a non-standard version of Windmill from the ExApp, please adjust its version in the `Makefile` by editing the line under the `init` target:
106 |
107 | ```makefile
108 | git -c advice.detachedHead=False clone -b v1.394.4 https://github.com/windmill-labs/windmill.git windmill_src
109 | ```
110 |
111 | Replace `v1.394.4` with your desired Windmill version.
112 |
113 | 7. **Initialize Windmill Source and Build Frontend**
114 |
115 | Run the following commands from the cloned `flow` repository to clone Windmill into the `windmill_src` folder and build the frontend:
116 |
117 | ```bash
118 | make init
119 | make static_frontend
120 | ```
121 |
122 | These commands will:
123 |
124 | - Clone the Windmill source code into `windmill_src`.
125 | - Build the frontend assets and create the `static_frontend` folder, which will be served by ExApp as the Windmill frontend.
126 |
127 | 8. **Run the ExApp and Register with Nextcloud**
128 |
129 | Start the ExApp main script:
130 |
131 | ```bash
132 | python ex_app/lib/main.py
133 | ```
134 |
135 | In a new terminal window (while keeping the ExApp running), execute the registration command to register the ExApp with Nextcloud:
136 |
137 | ```bash
138 | make register
139 | ```
140 |
141 | This registers the ExApp in Nextcloud for operation without Docker.
142 |
143 | 9. **Access Windmill in Nextcloud**
144 |
145 | Windmill should now appear within your Nextcloud instance, accessible via the Flow app.
146 |
147 | ### Notes for Development Setup
148 |
149 | *Windmill will be deployed as per its official documentation. The following steps simplify its integration with Nextcloud's development setup.*
150 |
151 | 1. In the `.env` file used for deploying Windmill's Docker Compose containers, set the desired Windmill version. The current version can be found in the `Makefile` (e.g., `1.394.4`). Adjust the following line accordingly:
152 |
153 | ```bash
154 | WM_IMAGE=ghcr.io/windmill-labs/windmill:1.394.4
155 | ```
156 |
157 | 2. Add the `master_default` network (or the network name used for Nextcloud in your Julius `nextcloud-docker-dev` setup) to each container in Windmill's `docker-compose.yml`.
158 |
159 | Additionally, append the following lines to the bottom of Windmill's `docker-compose.yml` file:
160 |
161 | ```yaml
162 | networks:
163 | master_default:
164 | external: true
165 | ```
166 |
167 | 3. Change the `Caddy` exposed port in Windmill's `docker-compose.yml` from `80` to `8388` (the port that is set in `main.py` script)
168 | 4. Deploy Windmill, then proceed to step 8 in the Manual Deployment section described above.
169 |
170 | ## Contributing
171 |
172 | We welcome contributions from the community! If you're interested in helping improve Flow, please feel free to submit a pull request or open an issue on our GitHub repository. We’re constantly working to improve the functionality and capabilities of Flow, and your feedback is invaluable.
173 |
--------------------------------------------------------------------------------
/ex_app/js/flow-main.js.license:
--------------------------------------------------------------------------------
1 | SPDX-License-Identifier: MIT
2 | SPDX-License-Identifier: ISC
3 | SPDX-License-Identifier: GPL-3.0-or-later
4 | SPDX-License-Identifier: BSD-3-Clause
5 | SPDX-License-Identifier: BSD-2-Clause
6 | SPDX-License-Identifier: AGPL-3.0-or-later
7 | SPDX-FileCopyrightText: xiaokai
8 | SPDX-FileCopyrightText: rhysd
9 | SPDX-FileCopyrightText: inline-style-parser developers
10 | SPDX-FileCopyrightText: escape-html developers
11 | SPDX-FileCopyrightText: debounce developers
12 | SPDX-FileCopyrightText: Tobias Koppers @sokra
13 | SPDX-FileCopyrightText: Titus Wormer (https://wooorm.com)
14 | SPDX-FileCopyrightText: T. Jameson Little
15 | SPDX-FileCopyrightText: Stefan Thomas (http://www.justmoon.net)
16 | SPDX-FileCopyrightText: Sindre Sorhus
17 | SPDX-FileCopyrightText: Roman Shtylman
18 | SPDX-FileCopyrightText: Rob Cresswell
19 | SPDX-FileCopyrightText: Paul Vorbach (http://paul.vorba.ch)
20 | SPDX-FileCopyrightText: Paul Vorbach (http://vorb.de)
21 | SPDX-FileCopyrightText: Max
22 | SPDX-FileCopyrightText: Matt Zabriskie
23 | SPDX-FileCopyrightText: Mark
24 | SPDX-FileCopyrightText: Mapbox
25 | SPDX-FileCopyrightText: John Molakvoæ (skjnldsv)
26 | SPDX-FileCopyrightText: Jeff Sagal
27 | SPDX-FileCopyrightText: GitHub Inc.
28 | SPDX-FileCopyrightText: Feross Aboukhadijeh
29 | SPDX-FileCopyrightText: Evan You
30 | SPDX-FileCopyrightText: Eugene Sharygin
31 | SPDX-FileCopyrightText: Eric Norris (https://github.com/ericnorris)
32 | SPDX-FileCopyrightText: Denis Pushkarev
33 | SPDX-FileCopyrightText: Christoph Wurst
34 | SPDX-FileCopyrightText: Borys Serebrov
35 | SPDX-FileCopyrightText: Arnout Kazemier
36 | SPDX-FileCopyrightText: Antoni Andre
37 | SPDX-FileCopyrightText: Andrea Giammarchi
38 | SPDX-FileCopyrightText: Alexander Piskun
39 |
40 |
41 | This file is generated from multiple sources. Included packages:
42 | - unist-util-is
43 | - version: 3.0.0
44 | - license: MIT
45 | - unist-util-visit-parents
46 | - version: 2.1.2
47 | - license: MIT
48 | - unist-util-visit
49 | - version: 1.4.1
50 | - license: MIT
51 | - @mapbox/hast-util-table-cell-style
52 | - version: 0.2.1
53 | - license: BSD-2-Clause
54 | - @nextcloud/browser-storage
55 | - version: 0.4.0
56 | - license: GPL-3.0-or-later
57 | - semver
58 | - version: 7.6.3
59 | - license: ISC
60 | - @nextcloud/router
61 | - version: 2.2.1
62 | - license: GPL-3.0-or-later
63 | - @nextcloud/vue-select
64 | - version: 3.25.1
65 | - license: MIT
66 | - @nextcloud/vue
67 | - version: 8.27.0
68 | - license: AGPL-3.0-or-later
69 | - @ungap/structured-clone
70 | - version: 1.2.0
71 | - license: ISC
72 | - axios
73 | - version: 1.7.7
74 | - license: MIT
75 | - bail
76 | - version: 2.0.2
77 | - license: MIT
78 | - base64-js
79 | - version: 1.5.1
80 | - license: MIT
81 | - buffer
82 | - version: 6.0.3
83 | - license: MIT
84 | - charenc
85 | - version: 0.0.2
86 | - license: BSD-3-Clause
87 | - comma-separated-tokens
88 | - version: 2.0.3
89 | - license: MIT
90 | - core-js
91 | - version: 3.37.0
92 | - license: MIT
93 | - crypt
94 | - version: 0.0.2
95 | - license: BSD-3-Clause
96 | - css-loader
97 | - version: 7.1.2
98 | - license: MIT
99 | - debounce
100 | - version: 2.2.0
101 | - license: MIT
102 | - decode-named-character-reference
103 | - version: 1.1.0
104 | - license: MIT
105 | - devlop
106 | - version: 1.1.0
107 | - license: MIT
108 | - emoji-mart-vue-fast
109 | - version: 15.0.4
110 | - license: BSD-3-Clause
111 | - escape-html
112 | - version: 1.0.3
113 | - license: MIT
114 | - extend
115 | - version: 3.0.2
116 | - license: MIT
117 | - hast-to-hyperscript
118 | - version: 10.0.3
119 | - license: MIT
120 | - hast-util-is-element
121 | - version: 3.0.0
122 | - license: MIT
123 | - hast-util-whitespace
124 | - version: 2.0.1
125 | - license: MIT
126 | - ieee754
127 | - version: 1.2.1
128 | - license: BSD-3-Clause
129 | - inline-style-parser
130 | - version: 0.1.1
131 | - license: MIT
132 | - is-absolute-url
133 | - version: 4.0.1
134 | - license: MIT
135 | - is-buffer
136 | - version: 1.1.6
137 | - license: MIT
138 | - md5
139 | - version: 2.3.0
140 | - license: BSD-3-Clause
141 | - mdast-squeeze-paragraphs
142 | - version: 6.0.0
143 | - license: MIT
144 | - escape-string-regexp
145 | - version: 5.0.0
146 | - license: MIT
147 | - mdast-util-find-and-replace
148 | - version: 3.0.1
149 | - license: MIT
150 | - mdast-util-from-markdown
151 | - version: 2.0.2
152 | - license: MIT
153 | - mdast-util-newline-to-break
154 | - version: 2.0.0
155 | - license: MIT
156 | - mdast-util-to-hast
157 | - version: 13.2.0
158 | - license: MIT
159 | - mdast-util-to-string
160 | - version: 4.0.0
161 | - license: MIT
162 | - micromark-core-commonmark
163 | - version: 2.0.3
164 | - license: MIT
165 | - micromark-factory-destination
166 | - version: 2.0.1
167 | - license: MIT
168 | - micromark-factory-label
169 | - version: 2.0.1
170 | - license: MIT
171 | - micromark-factory-space
172 | - version: 2.0.1
173 | - license: MIT
174 | - micromark-factory-title
175 | - version: 2.0.1
176 | - license: MIT
177 | - micromark-factory-whitespace
178 | - version: 2.0.1
179 | - license: MIT
180 | - micromark-util-character
181 | - version: 2.1.0
182 | - license: MIT
183 | - micromark-util-chunked
184 | - version: 2.0.1
185 | - license: MIT
186 | - micromark-util-classify-character
187 | - version: 2.0.1
188 | - license: MIT
189 | - micromark-util-combine-extensions
190 | - version: 2.0.1
191 | - license: MIT
192 | - micromark-util-decode-numeric-character-reference
193 | - version: 2.0.2
194 | - license: MIT
195 | - micromark-util-decode-string
196 | - version: 2.0.1
197 | - license: MIT
198 | - micromark-util-encode
199 | - version: 2.0.0
200 | - license: MIT
201 | - micromark-util-html-tag-name
202 | - version: 2.0.1
203 | - license: MIT
204 | - micromark-util-normalize-identifier
205 | - version: 2.0.1
206 | - license: MIT
207 | - micromark-util-resolve-all
208 | - version: 2.0.1
209 | - license: MIT
210 | - micromark-util-sanitize-uri
211 | - version: 2.0.0
212 | - license: MIT
213 | - micromark-util-subtokenize
214 | - version: 2.1.0
215 | - license: MIT
216 | - micromark
217 | - version: 4.0.2
218 | - license: MIT
219 | - eventemitter3
220 | - version: 5.0.1
221 | - license: MIT
222 | - process
223 | - version: 0.11.10
224 | - license: MIT
225 | - property-information
226 | - version: 6.5.0
227 | - license: MIT
228 | - rehype-external-links
229 | - version: 3.0.0
230 | - license: MIT
231 | - rehype-react
232 | - version: 7.2.0
233 | - license: MIT
234 | - remark-breaks
235 | - version: 4.0.0
236 | - license: MIT
237 | - remark-parse
238 | - version: 11.0.0
239 | - license: MIT
240 | - remark-rehype
241 | - version: 11.1.0
242 | - license: MIT
243 | - remark-unlink-protocols
244 | - version: 1.0.0
245 | - license: MIT
246 | - space-separated-tokens
247 | - version: 2.0.2
248 | - license: MIT
249 | - splitpanes
250 | - version: 2.4.1
251 | - license: MIT
252 | - striptags
253 | - version: 3.2.0
254 | - license: MIT
255 | - style-loader
256 | - version: 4.0.0
257 | - license: MIT
258 | - style-to-object
259 | - version: 0.4.4
260 | - license: MIT
261 | - trim-lines
262 | - version: 3.0.1
263 | - license: MIT
264 | - trough
265 | - version: 2.2.0
266 | - license: MIT
267 | - is-plain-obj
268 | - version: 4.1.0
269 | - license: MIT
270 | - unified
271 | - version: 11.0.5
272 | - license: MIT
273 | - unist-builder
274 | - version: 4.0.0
275 | - license: MIT
276 | - unist-util-is
277 | - version: 6.0.0
278 | - license: MIT
279 | - unist-util-position
280 | - version: 5.0.0
281 | - license: MIT
282 | - unist-util-stringify-position
283 | - version: 4.0.0
284 | - license: MIT
285 | - unist-util-visit-parents
286 | - version: 6.0.1
287 | - license: MIT
288 | - unist-util-visit
289 | - version: 5.0.0
290 | - license: MIT
291 | - vfile-message
292 | - version: 4.0.2
293 | - license: MIT
294 | - vfile
295 | - version: 6.0.3
296 | - license: MIT
297 | - vue-color
298 | - version: 2.8.1
299 | - license: MIT
300 | - vue-material-design-icons
301 | - version: 5.3.0
302 | - license: MIT
303 | - vue
304 | - version: 2.7.16
305 | - license: MIT
306 | - web-namespaces
307 | - version: 2.0.1
308 | - license: MIT
309 | - webpack
310 | - version: 5.94.0
311 | - license: MIT
312 | - flow
313 | - version: 1.0.0
314 | - license: MIT
315 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | ARG DEBIAN_IMAGE=debian:bookworm-slim
4 | ARG RUST_IMAGE=rust:1.80-slim-bookworm
5 | ARG PYTHON_IMAGE=python:3.12-slim
6 |
7 | FROM ${RUST_IMAGE} AS rust_base
8 |
9 | RUN apt-get update && apt-get install -y git libssl-dev pkg-config npm
10 |
11 | RUN apt-get -y update \
12 | && apt-get install -y \
13 | curl nodejs
14 |
15 | RUN rustup component add rustfmt
16 |
17 | RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo install cargo-chef --version ^0.1
18 | RUN cargo install sccache --version ^0.8
19 | ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/backend/sccache
20 |
21 | WORKDIR /windmill
22 |
23 | ENV SQLX_OFFLINE=true
24 | # ENV CARGO_INCREMENTAL=1
25 |
26 | FROM node:20-alpine as frontend
27 |
28 | # install dependencies
29 | WORKDIR /frontend
30 | COPY ./frontend/package.json ./frontend/package-lock.json ./
31 | RUN npm ci
32 |
33 | # Copy all local files into the image.
34 | COPY frontend .
35 | RUN mkdir /backend
36 | COPY /backend/windmill-api/openapi.yaml /backend/windmill-api/openapi.yaml
37 | COPY /openflow.openapi.yaml /openflow.openapi.yaml
38 | COPY /backend/windmill-api/build_openapi.sh /backend/windmill-api/build_openapi.sh
39 |
40 | RUN cd /backend/windmill-api && . ./build_openapi.sh
41 | COPY /backend/parsers/windmill-parser-wasm/pkg/ /backend/parsers/windmill-parser-wasm/pkg/
42 | COPY /typescript-client/docs/ /frontend/static/tsdocs/
43 |
44 | RUN npm run generate-backend-client
45 | RUN sed -i "s|BASE: '/api'|BASE: '/index.php/apps/app_api/proxy/flow/api'|" /frontend/src/lib/gen/core/OpenAPI.ts
46 | ENV NODE_OPTIONS "--max-old-space-size=8192"
47 | ARG VITE_BASE_URL ""
48 | RUN npm run build
49 |
50 | FROM scratch AS export_frontend
51 | COPY --from=frontend /frontend/build/ /
52 |
53 | FROM rust_base AS planner
54 |
55 | COPY ./openflow.openapi.yaml /openflow.openapi.yaml
56 | COPY ./backend ./
57 |
58 | RUN --mount=type=cache,target=/usr/local/cargo/registry \
59 | --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
60 | CARGO_NET_GIT_FETCH_WITH_CLI=true cargo chef prepare --recipe-path recipe.json
61 |
62 | FROM rust_base AS builder
63 | ARG features=""
64 |
65 | COPY --from=planner /windmill/recipe.json recipe.json
66 |
67 | RUN apt-get update && apt-get install -y libxml2-dev=2.9.* libxmlsec1-dev=1.2.* clang=1:14.0-55.* libclang-dev=1:14.0-55.* cmake=3.25.* && \
68 | apt-get clean && \
69 | rm -rf /var/lib/apt/lists/*
70 |
71 | RUN --mount=type=cache,target=/usr/local/cargo/registry \
72 | --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
73 | CARGO_NET_GIT_FETCH_WITH_CLI=true RUST_BACKTRACE=1 cargo chef cook --release --features "$features" --recipe-path recipe.json
74 |
75 | COPY ./openflow.openapi.yaml /openflow.openapi.yaml
76 | COPY ./backend ./
77 |
78 | RUN mkdir -p /frontend
79 |
80 | COPY --from=frontend /frontend/build /frontend/build
81 | COPY --from=frontend /backend/windmill-api/openapi-deref.yaml ./windmill-api/openapi-deref.yaml
82 | COPY .git/ .git/
83 |
84 | RUN --mount=type=cache,target=/usr/local/cargo/registry \
85 | --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
86 | CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --release --features "$features"
87 |
88 |
89 | FROM ${PYTHON_IMAGE}
90 |
91 | ARG TARGETPLATFORM
92 | ARG POWERSHELL_VERSION=7.3.5
93 | ARG POWERSHELL_DEB_VERSION=7.3.5-1
94 | ARG KUBECTL_VERSION=1.28.7
95 | ARG HELM_VERSION=3.14.3
96 | ARG GO_VERSION=1.22.5
97 | ARG APP=/usr/src/app
98 | ARG WITH_POWERSHELL=true
99 | ARG WITH_KUBECTL=true
100 | ARG WITH_HELM=true
101 | ARG WITH_GIT=true
102 |
103 | RUN apt-get update \
104 | && apt-get install -y ca-certificates wget curl jq unzip build-essential unixodbc xmlsec1 software-properties-common \
105 | && apt-get clean \
106 | && rm -rf /var/lib/apt/lists/*
107 |
108 | RUN if [ "$WITH_GIT" = "true" ]; then \
109 | apt-get update -y \
110 | && apt-get install -y git \
111 | && apt-get clean \
112 | && rm -rf /var/lib/apt/lists/*; \
113 | else echo 'Building the image without git'; fi;
114 |
115 | RUN if [ "$WITH_POWERSHELL" = "true" ]; then \
116 | if [ "$TARGETPLATFORM" = "linux/amd64" ]; then apt-get update -y && apt install libicu-dev -y && wget -O 'pwsh.deb' "https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell_${POWERSHELL_DEB_VERSION}.deb_amd64.deb" && apt-get clean \
117 | && rm -rf /var/lib/apt/lists/* && \
118 | dpkg --install 'pwsh.deb' && \
119 | rm 'pwsh.deb'; \
120 | elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then apt-get update -y && apt install libicu-dev -y && wget -O powershell.tar.gz "https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-linux-arm64.tar.gz" && apt-get clean \
121 | && rm -rf /var/lib/apt/lists/* && \
122 | mkdir -p /opt/microsoft/powershell/7 && \
123 | tar zxf powershell.tar.gz -C /opt/microsoft/powershell/7 && \
124 | chmod +x /opt/microsoft/powershell/7/pwsh && \
125 | ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh && \
126 | rm powershell.tar.gz; \
127 | else echo 'Could not install pwshell, not on amd64 or arm64'; fi; \
128 | else echo 'Building the image without powershell'; fi
129 |
130 | RUN if [ "$WITH_HELM" = "true" ]; then \
131 | arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
132 | wget "https://get.helm.sh/helm-v${HELM_VERSION}-linux-$arch.tar.gz" && \
133 | tar -zxvf "helm-v${HELM_VERSION}-linux-$arch.tar.gz" && \
134 | mv linux-$arch/helm /usr/local/bin/helm &&\
135 | chmod +x /usr/local/bin/helm; \
136 | else echo 'Building the image without helm'; fi
137 |
138 | RUN if [ "$WITH_KUBECTL" = "true" ]; then \
139 | arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
140 | curl -LO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/$arch/kubectl" && \
141 | install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl; \
142 | else echo 'Building the image without kubectl'; fi
143 |
144 |
145 | RUN set -eux; \
146 | arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
147 | case "$arch" in \
148 | "amd64") \
149 | targz="go${GO_VERSION}.linux-amd64.tar.gz"; \
150 | ;; \
151 | "arm64") \
152 | targz="go${GO_VERSION}.linux-arm64.tar.gz"; \
153 | ;; \
154 | "armhf") \
155 | targz="go${GO_VERSION}.linux-armv6l.tar.gz"; \
156 | ;; \
157 | *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
158 | esac; \
159 | wget "https://golang.org/dl/$targz" -nv && tar -C /usr/local -xzf "$targz" && rm "$targz";
160 |
161 | ENV PATH="${PATH}:/usr/local/go/bin"
162 | ENV GO_PATH=/usr/local/go/bin/go
163 |
164 | RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
165 | RUN apt-get -y update && apt-get install -y curl nodejs awscli && apt-get clean \
166 | && rm -rf /var/lib/apt/lists/*
167 |
168 | # go build is slower the first time it is ran, so we prewarm it in the build
169 | RUN mkdir -p /tmp/gobuildwarm && cd /tmp/gobuildwarm && go mod init gobuildwarm && printf "package foo\nimport (\"fmt\")\nfunc main() { fmt.Println(42) }" > warm.go && go mod tidy && go build -x && rm -rf /tmp/gobuildwarm
170 |
171 | ENV TZ=Etc/UTC
172 |
173 | RUN /usr/local/bin/python3 -m pip install pip-tools
174 |
175 | COPY --from=builder /frontend/build /static_frontend
176 | COPY --from=builder /windmill/target/release/windmill ${APP}/windmill
177 |
178 | COPY --from=denoland/deno:1.46.3 --chmod=755 /usr/bin/deno /usr/bin/deno
179 |
180 | COPY --from=oven/bun:1.1.25 /usr/local/bin/bun /usr/bin/bun
181 |
182 | COPY --from=php:8.3.7-cli /usr/local/bin/php /usr/bin/php
183 | COPY --from=composer:2.7.6 /usr/bin/composer /usr/bin/composer
184 |
185 | # add the docker client to call docker from a worker if enabled
186 | COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
187 |
188 | ENV RUSTUP_HOME="/usr/local/rustup"
189 | ENV CARGO_HOME="/usr/local/cargo"
190 |
191 | WORKDIR ${APP}
192 |
193 | RUN ln -s ${APP}/windmill /usr/local/bin/windmill
194 |
195 | COPY ./frontend/src/lib/hubPaths.json ${APP}/hubPaths.json
196 |
197 | RUN windmill cache ${APP}/hubPaths.json && rm ${APP}/hubPaths.json && chmod -R 777 /tmp/windmill
198 |
199 | EXPOSE 8000
200 |
201 | RUN apt-get update && \
202 | apt-get install -y \
203 | curl nodejs sudo wget procps nano && \
204 | rm -rf /var/lib/apt/lists/*
205 |
206 | # HaRP: download and install FRP client
207 | RUN set -ex; \
208 | ARCH=$(uname -m); \
209 | if [ "$ARCH" = "aarch64" ]; then \
210 | FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/main/exapps_dev/frp_0.61.1_linux_arm64.tar.gz"; \
211 | else \
212 | FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/main/exapps_dev/frp_0.61.1_linux_amd64.tar.gz"; \
213 | fi; \
214 | echo "Downloading FRP client from $FRP_URL"; \
215 | curl -L "$FRP_URL" -o /tmp/frp.tar.gz; \
216 | tar -C /tmp -xzf /tmp/frp.tar.gz; \
217 | mv /tmp/frp_0.61.1_linux_* /tmp/frp; \
218 | cp /tmp/frp/frpc /usr/local/bin/frpc; \
219 | chmod +x /usr/local/bin/frpc; \
220 | rm -rf /tmp/frp /tmp/frp.tar.gz
221 |
222 | COPY ex_app_scripts/common_pgsql.sh /ex_app_scripts/common_pgsql.sh
223 | COPY ex_app_scripts/install_pgsql.sh /ex_app_scripts/install_pgsql.sh
224 | COPY ex_app_scripts/init_pgsql.sh /ex_app_scripts/init_pgsql.sh
225 | COPY ex_app_scripts/set_workers_num.sh /ex_app_scripts/set_workers_num.sh
226 | COPY ex_app_scripts/entrypoint.sh /ex_app_scripts/entrypoint.sh
227 |
228 | RUN chmod +x /ex_app_scripts/*.sh && /ex_app_scripts/install_pgsql.sh && rm /ex_app_scripts/install_pgsql.sh
229 |
230 | COPY requirements.txt /ex_app_requirements.txt
231 |
232 | ADD ex_app/cs[s] /ex_app/css
233 | ADD ex_app/im[g] /ex_app/img
234 | ADD ex_app/j[s] /ex_app/js
235 | ADD ex_app/l10[n] /ex_app/l10n
236 | ADD ex_app/li[b] /ex_app/lib
237 |
238 | RUN python3 -m pip install -r /ex_app_requirements.txt
239 | RUN chmod +x /ex_app/lib/main.py
240 |
241 | CMD ["/bin/sh", "/ex_app_scripts/entrypoint.sh", "/ex_app/lib/main.py", "windmill"]
242 |
--------------------------------------------------------------------------------
/LICENSES/Apache-2.0.txt:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10 |
11 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12 |
13 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14 |
15 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16 |
17 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18 |
19 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20 |
21 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22 |
23 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24 |
25 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26 |
27 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28 |
29 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30 |
31 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32 |
33 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34 |
35 | (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36 |
37 | (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38 |
39 | (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40 |
41 | (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42 |
43 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44 |
45 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46 |
47 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48 |
49 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50 |
51 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52 |
53 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54 |
55 | END OF TERMS AND CONDITIONS
56 |
57 | APPENDIX: How to apply the Apache License to your work.
58 |
59 | To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60 |
61 | Copyright [yyyy] [name of copyright owner]
62 |
63 | Licensed under the Apache License, Version 2.0 (the "License");
64 | you may not use this file except in compliance with the License.
65 | You may obtain a copy of the License at
66 |
67 | http://www.apache.org/licenses/LICENSE-2.0
68 |
69 | Unless required by applicable law or agreed to in writing, software
70 | distributed under the License is distributed on an "AS IS" BASIS,
71 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72 | See the License for the specific language governing permissions and
73 | limitations under the License.
74 |
--------------------------------------------------------------------------------
/ex_app/lib/main.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2 | # SPDX-License-Identifier: MIT
3 | """Windmill as an ExApp"""
4 |
5 | import asyncio
6 | import contextlib
7 | import json
8 | import logging
9 | import os
10 | import random
11 | import string
12 | import typing
13 | from base64 import b64decode
14 | from contextlib import asynccontextmanager
15 | from pathlib import Path
16 | from time import sleep
17 |
18 | import httpx
19 | from fastapi import BackgroundTasks, Depends, FastAPI, Request, responses
20 | from nc_py_api import NextcloudApp, NextcloudException
21 | from nc_py_api.ex_app import (
22 | nc_app,
23 | persistent_storage,
24 | run_app,
25 | setup_nextcloud_logging,
26 | )
27 | from nc_py_api.ex_app.integration_fastapi import AppAPIAuthMiddleware, fetch_models_task
28 | from starlette.responses import FileResponse, Response
29 |
30 | # ---------Start of configuration values for manual deploy---------
31 |
32 | # Uncommenting the following lines may be useful when installing manually.
33 |
34 | # os.environ["NEXTCLOUD_URL"] = "http://nextcloud.local/index.php"
35 | # os.environ["APP_HOST"] = "0.0.0.0"
36 | # os.environ["APP_PORT"] = "27100"
37 | # os.environ["APP_ID"] = "flow"
38 | # os.environ["APP_SECRET"] = "12345" # noqa
39 | # os.environ["AA_VERSION"] = "4.0.0" # value but should not be greater than minimal required AppAPI version
40 | # os.environ["APP_VERSION"] = "1.2.0"
41 | # os.environ["HP_SHARED_KEY"] = "1" # uncomment ONLY for "manual-install" with HaRP
42 |
43 | WINDMILL_URL = os.environ.get("WINDMILL_URL", "http://127.0.0.1:8000")
44 | # WINDMILL_URL = "http://localhost:8388" # uncomment this for dev (Windmill should be available at port 8388)
45 |
46 | # ---------End of configuration values for manual deploy---------
47 |
48 | logging.basicConfig(
49 | level=logging.WARNING,
50 | format="[%(funcName)s]: %(message)s",
51 | datefmt="%H:%M:%S",
52 | )
53 | LOGGER = logging.getLogger("flow")
54 | LOGGER.setLevel(logging.DEBUG)
55 | HARP_ENABLED = bool(os.environ.get("HP_SHARED_KEY"))
56 |
57 | DEFAULT_USER_EMAIL = "admin@windmill.dev"
58 | DEFAULT_USER_PASSWORD = "changeme"
59 | USERS_STORAGE_PATH = Path(persistent_storage()).joinpath("windmill_users_config.json")
60 | USERS_STORAGE = {}
61 | print("[DEBUG]: USERS_STORAGE_PATH=", str(USERS_STORAGE_PATH), flush=True)
62 | if USERS_STORAGE_PATH.exists():
63 | with open(USERS_STORAGE_PATH, encoding="utf-8") as __f:
64 | USERS_STORAGE.update(json.load(__f))
65 |
66 | PROJECT_ROOT_FOLDER = Path(__file__).parent.parent.parent
67 | STATIC_FRONTEND_FOLDER = PROJECT_ROOT_FOLDER.joinpath("static_frontend")
68 | STATIC_FRONTEND_PRESENT = STATIC_FRONTEND_FOLDER.is_dir()
69 | print("[DEBUG]: PROJECT_ROOT_FOLDER=", PROJECT_ROOT_FOLDER, flush=True)
70 | print("[DEBUG]: STATIC_FRONTEND_PRESENT=", STATIC_FRONTEND_PRESENT, flush=True)
71 |
72 |
73 | def get_user_email(user_name: str) -> str:
74 | user_name = user_name.replace(" ", "__UNIQUE_SPACE__")
75 | return f"{user_name}@windmill.dev"
76 |
77 |
78 | def add_user_to_storage(user_email: str, password: str, token: str = "") -> None:
79 | USERS_STORAGE[user_email] = {"password": password, "token": token}
80 | with open(USERS_STORAGE_PATH, "w", encoding="utf-8") as f:
81 | json.dump(USERS_STORAGE, f, indent=4)
82 |
83 |
84 | async def create_user(user_name: str) -> str:
85 | LOGGER.info(user_name)
86 | password = generate_random_string()
87 | user_email = get_user_email(user_name)
88 | async with httpx.AsyncClient() as client:
89 | await client.request(
90 | method="POST",
91 | url=f"{WINDMILL_URL}/api/users/create",
92 | json={
93 | "email": user_email,
94 | "password": password,
95 | "super_admin": True,
96 | "name": user_name,
97 | },
98 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
99 | )
100 | r = await client.post(
101 | url=f"{WINDMILL_URL}/api/auth/login",
102 | json={"email": user_email, "password": password},
103 | )
104 | add_user_to_storage(user_email, password, r.text)
105 | return r.text
106 |
107 |
108 | async def login_user(user_email: str, password: str) -> str:
109 | LOGGER.debug(user_email)
110 | async with httpx.AsyncClient() as client:
111 | r = await client.post(
112 | url=f"{WINDMILL_URL}/api/auth/login",
113 | json={"email": user_email, "password": password},
114 | )
115 | if r.status_code >= 400:
116 | LOGGER.error("login_user(%s) error: %s", user_email, r.text)
117 | raise RuntimeError(f"login_user: {r.text}")
118 | return r.text
119 |
120 |
121 | def login_user_sync(user_email: str, password: str) -> str:
122 | LOGGER.debug(user_email)
123 | with httpx.Client() as client:
124 | r = client.post(
125 | url=f"{WINDMILL_URL}/api/auth/login",
126 | json={"email": user_email, "password": password},
127 | )
128 | if r.status_code >= 400:
129 | LOGGER.error("login_user(%s) error: %s", user_email, r.text)
130 | raise RuntimeError(f"login_user: {r.text}")
131 | return r.text
132 |
133 |
134 | async def check_token(token: str) -> bool:
135 | async with httpx.AsyncClient() as client:
136 | r = await client.get(f"{WINDMILL_URL}/api/users/whoami", cookies={"token": token})
137 | return bool(r.status_code < 400)
138 |
139 |
140 | def check_token_sync(token: str) -> bool:
141 | with httpx.Client() as client:
142 | r = client.get(f"{WINDMILL_URL}/api/users/whoami", cookies={"token": token})
143 | return bool(r.status_code < 400)
144 |
145 |
146 | def get_valid_user_token_sync(user_email: str) -> str:
147 | token = USERS_STORAGE[user_email]["token"]
148 | if check_token_sync(token):
149 | return token
150 | user_password = USERS_STORAGE[user_email]["password"]
151 | token = login_user_sync(user_email, user_password)
152 | add_user_to_storage(user_email, user_password, token)
153 | return token
154 |
155 |
156 | async def provision_user(request: Request, create_missing_user: bool) -> None:
157 | if "token" in request.cookies:
158 | LOGGER.debug("Token is present: %s", request.cookies["token"])
159 | if (await check_token(request.cookies["token"])) is True:
160 | return
161 | LOGGER.debug("Token is invalid: %s", request.cookies["token"])
162 |
163 | user_name = get_windmill_username_from_request(request)
164 | if not user_name:
165 | LOGGER.debug("`username` is missing in the request to ExApp. Headers: %s", request.headers)
166 | return
167 | user_email = get_user_email(user_name)
168 | if user_email in USERS_STORAGE:
169 | windmill_token_valid = await check_token(USERS_STORAGE[user_email]["token"])
170 | if not USERS_STORAGE[user_email]["token"] or windmill_token_valid is False:
171 | if not create_missing_user:
172 | LOGGER.debug("Do not creating user due to specified flag.")
173 | return
174 | user_password = USERS_STORAGE[user_email]["password"]
175 | add_user_to_storage(user_email, user_password, await login_user(user_email, user_password))
176 | else:
177 | await create_user(user_name)
178 | request.cookies["token"] = USERS_STORAGE[user_email]["token"]
179 | LOGGER.debug("Adding token(%s) to request", request.cookies["token"])
180 |
181 |
182 | @asynccontextmanager
183 | async def lifespan(_app: FastAPI):
184 | setup_nextcloud_logging("flow", logging_level=logging.WARNING)
185 | _t = asyncio.create_task(start_background_webhooks_syncing()) # noqa
186 | yield
187 |
188 |
189 | APP = FastAPI(lifespan=lifespan)
190 | APP.add_middleware(AppAPIAuthMiddleware) # noqa
191 |
192 |
193 | def get_windmill_username_from_request(request: Request) -> str:
194 | auth_aa = b64decode(request.headers.get("AUTHORIZATION-APP-API", "")).decode("UTF-8")
195 | try:
196 | username, _ = auth_aa.split(":", maxsplit=1)
197 | except ValueError:
198 | username = ""
199 | if not username:
200 | return ""
201 | if len("wapp_") + len(username) + len("@windmill.dev") > 50:
202 | # Length of the "email" field in Windmill is limited to 50 chars; do not append "wapp_" prefix in this case.
203 | # When we can do the breaking change, we can remove the "wapp_" prefix completely + use the shorter suffix.
204 | return username
205 | return "wapp_" + username
206 |
207 |
208 | def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
209 | if enabled:
210 | LOGGER.info("Hello from %s", nc.app_cfg.app_name)
211 | nc.ui.resources.set_script("top_menu", "flow", "ex_app/js/flow-main")
212 | nc.ui.top_menu.register("flow", "Workflow Engine", "ex_app/img/app.svg", True)
213 | else:
214 | LOGGER.info("Bye bye from %s", nc.app_cfg.app_name)
215 | nc.ui.resources.delete_script("top_menu", "flow", "ex_app/js/flow-main")
216 | nc.ui.top_menu.unregister("flow")
217 | nc.webhooks.unregister_all()
218 | return ""
219 |
220 |
221 | @APP.get("/heartbeat")
222 | async def heartbeat_callback():
223 | return responses.JSONResponse(content={"status": "ok"})
224 |
225 |
226 | @APP.post("/init")
227 | async def init_callback(b_tasks: BackgroundTasks, nc: typing.Annotated[NextcloudApp, Depends(nc_app)]):
228 | b_tasks.add_task(fetch_models_task, nc, {}, 0)
229 | return responses.JSONResponse(content={})
230 |
231 |
232 | @APP.put("/enabled")
233 | def enabled_callback(enabled: bool, nc: typing.Annotated[NextcloudApp, Depends(nc_app)]):
234 | return responses.JSONResponse(content={"error": enabled_handler(enabled, nc)})
235 |
236 |
237 | async def proxy_request_to_windmill(request: Request, path: str, path_prefix: str = ""):
238 | async with httpx.AsyncClient() as client:
239 | url = f"{WINDMILL_URL}{path_prefix}/{path}"
240 | headers = {key: value for key, value in request.headers.items() if key.lower() not in ("host", "cookie")}
241 | if request.method == "GET":
242 | response = await client.get(
243 | url,
244 | params=request.query_params,
245 | cookies=request.cookies,
246 | headers=headers,
247 | )
248 | else:
249 | response = await client.request(
250 | method=request.method,
251 | url=url,
252 | params=request.query_params,
253 | headers=headers,
254 | cookies=request.cookies,
255 | content=await request.body(),
256 | )
257 | LOGGER.debug("%s %s/%s -> %s", request.method, path_prefix, path, response.status_code)
258 | response_header = dict(response.headers)
259 | response_header.pop("transfer-encoding", None)
260 | return Response(content=response.content, status_code=response.status_code, headers=response_header)
261 |
262 |
263 | @APP.api_route("/api/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"])
264 | async def proxy_backend_requests(request: Request, path: str):
265 | LOGGER.debug("%s %s\nCookies: %s", request.method, path, request.cookies)
266 | await provision_user(request, False)
267 | return await proxy_request_to_windmill(request, path, "/api")
268 |
269 |
270 | @APP.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"])
271 | async def proxy_frontend_requests(request: Request, path: str):
272 | LOGGER.debug("%s %s\nCookies: %s", request.method, path, request.cookies)
273 | await provision_user(request, True)
274 | file_server_path = ""
275 | if path.startswith("ex_app"):
276 | file_server_path = PROJECT_ROOT_FOLDER.joinpath(path)
277 | elif STATIC_FRONTEND_PRESENT:
278 | if not path:
279 | file_server_path = STATIC_FRONTEND_FOLDER.joinpath("200.html")
280 | elif STATIC_FRONTEND_FOLDER.joinpath(path).is_file():
281 | file_server_path = STATIC_FRONTEND_FOLDER.joinpath(path)
282 |
283 | if file_server_path:
284 | LOGGER.debug("proxy_FRONTEND_requests: Returning: %s", file_server_path)
285 | response = FileResponse(str(file_server_path))
286 | else:
287 | if STATIC_FRONTEND_PRESENT:
288 | LOGGER.debug("proxy_FRONTEND_requests: Routing(%s) to the backend", path)
289 | response = await proxy_request_to_windmill(request, path)
290 | response.headers["content-security-policy"] = "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"
291 | return response
292 |
293 |
294 | def initialize_windmill() -> None:
295 | while True: # Let's wait until Windmill opens the port.
296 | with contextlib.suppress(httpx.ReadError, httpx.ConnectError, httpx.RemoteProtocolError):
297 | r = httpx.get(f"{WINDMILL_URL}/api/users/whoami")
298 | if r.status_code in (401, 403):
299 | break
300 | if not USERS_STORAGE_PATH.exists():
301 | r = httpx.post(
302 | url=f"{WINDMILL_URL}/api/auth/login", json={"email": DEFAULT_USER_EMAIL, "password": DEFAULT_USER_PASSWORD}
303 | )
304 | if r.status_code >= 400:
305 | LOGGER.error("initialize_windmill: can not login with default credentials: %s", r.text)
306 | raise RuntimeError(f"initialize_windmill: can not login with default credentials, {r.text}")
307 | default_token = r.text
308 | new_default_password = generate_random_string()
309 | r = httpx.post(
310 | url=f"{WINDMILL_URL}/api/users/setpassword",
311 | json={"password": new_default_password},
312 | cookies={"token": default_token},
313 | )
314 | if r.status_code >= 400:
315 | LOGGER.error("initialize_windmill: can not change default credentials password: %s", r.text)
316 | raise RuntimeError(f"initialize_windmill: can not change default credentials password, {r.text}")
317 | add_user_to_storage(DEFAULT_USER_EMAIL, new_default_password, default_token)
318 | r = httpx.post(
319 | url=f"{WINDMILL_URL}/api/users/tokens/create",
320 | json={"label": "NC_PERSISTENT"},
321 | cookies={"token": default_token},
322 | )
323 | if r.status_code >= 400:
324 | LOGGER.error("initialize_windmill: can not create persistent token: %s", r.text)
325 | raise RuntimeError(f"initialize_windmill: can not create persistent token, {r.text}")
326 | default_token = r.text
327 | add_user_to_storage(DEFAULT_USER_EMAIL, new_default_password, default_token)
328 | r = httpx.post(
329 | url=f"{WINDMILL_URL}/api/workspaces/create",
330 | json={"id": "nextcloud", "name": "nextcloud"},
331 | cookies={"token": default_token},
332 | )
333 | if r.status_code >= 400:
334 | LOGGER.error("initialize_windmill: can not create default workspace: %s", r.text)
335 | raise RuntimeError(f"initialize_windmill: can not create default workspace, {r.text}")
336 | r = httpx.post(
337 | url=f"{WINDMILL_URL}/api/w/nextcloud/workspaces/edit_auto_invite",
338 | json={"operator": False, "invite_all": True, "auto_add": True},
339 | cookies={"token": default_token},
340 | )
341 | if r.status_code >= 400:
342 | LOGGER.error("initialize_windmill: can not create default workspace: %s", r.text)
343 | raise RuntimeError(f"initialize_windmill: can not create default workspace, {r.text}")
344 |
345 |
346 | def generate_random_string(length=10):
347 | letters = string.ascii_letters + string.digits
348 | return "".join(random.choice(letters) for i in range(length)) # noqa
349 |
350 |
351 | async def start_background_webhooks_syncing():
352 | await asyncio.to_thread(webhooks_syncing)
353 |
354 |
355 | def webhooks_syncing():
356 | while True:
357 | try:
358 | _webhooks_syncing()
359 | except Exception: # noqa
360 | LOGGER.exception("Exception occurred", stack_info=True)
361 | sleep(60)
362 |
363 |
364 | def _webhooks_syncing():
365 | workspace = "nextcloud"
366 |
367 | while True:
368 | nc = NextcloudApp()
369 | if not nc.enabled_state:
370 | print("ExApp is disabled, sleeping for 5 minutes")
371 | sleep(5 * 60)
372 | continue
373 | LOGGER.debug("Running workflow sync")
374 | token = get_valid_user_token_sync(DEFAULT_USER_EMAIL)
375 | flow_paths = get_flow_paths(workspace, token)
376 | LOGGER.debug("flow_paths:\n%s", flow_paths)
377 | expected_listeners = get_expected_listeners(workspace, token, flow_paths)
378 | LOGGER.debug("expected_listeners:\n%s", json.dumps(expected_listeners, indent=4))
379 | registered_listeners = get_registered_listeners()
380 | LOGGER.debug("get_registered_listeners:\n%s", json.dumps(registered_listeners, indent=4))
381 | for expected_listener in expected_listeners:
382 | expected_listener["filters"] = _preprocess_webhook_event_filter(expected_listener["filters"])
383 | registered_listeners_for_uri = get_registered_listeners_for_uri(
384 | expected_listener["webhook"], registered_listeners
385 | )
386 | for event in expected_listener["events"]:
387 | listener = next(filter(lambda listener: listener["event"] == event, registered_listeners_for_uri), None)
388 | if listener is not None:
389 | listener["eventFilter"] = _preprocess_webhook_event_filter(listener["eventFilter"])
390 | if listener["eventFilter"] != expected_listener["filters"]:
391 | LOGGER.debug("before update_listener:\n%s", json.dumps(listener))
392 | update_listener(listener, expected_listener["filters"], token)
393 | else:
394 | register_listener(event, expected_listener["filters"], expected_listener["webhook"], token)
395 | for registered_listener in registered_listeners:
396 | if registered_listener["appId"] == nc.app_cfg.app_name: # noqa
397 | if (
398 | next(
399 | filter(
400 | lambda expected_listener: registered_listener["uri"] == expected_listener["webhook"]
401 | and registered_listener["event"] in expected_listener["events"],
402 | expected_listeners,
403 | ),
404 | None,
405 | )
406 | is None
407 | ):
408 | delete_listener(registered_listener)
409 | sleep(30)
410 |
411 |
412 | def _preprocess_webhook_event_filter(event_filter):
413 | if event_filter in (None, {}):
414 | return []
415 | return event_filter
416 |
417 |
418 | def get_flow_paths(workspace: str, token: str) -> list[str]:
419 | method = "GET"
420 | path = f"w/{workspace}/flows/list"
421 | flow_paths = []
422 | with httpx.Client() as client:
423 | url = f"{WINDMILL_URL}/api/{path}"
424 | headers = {"Authorization": f"Bearer {token}"}
425 | response = client.request(
426 | method=method,
427 | url=url,
428 | params={"per_page": 100},
429 | headers=headers,
430 | )
431 | LOGGER.debug("%s %s -> %s", method, path, response.status_code)
432 | try:
433 | response_data = json.loads(response.content)
434 | for flow in response_data:
435 | flow_paths.append(flow["path"])
436 | except json.JSONDecodeError:
437 | LOGGER.exception("Error parsing JSON", stack_info=True)
438 | return flow_paths
439 |
440 |
441 | def get_expected_listeners(workspace: str, token: str, flow_paths: list[str]) -> list[dict]:
442 | flows = []
443 | for flow_path in flow_paths:
444 | with httpx.Client() as client:
445 | method = "GET"
446 | path = f"w/{workspace}/flows/get/{flow_path}"
447 | url = f"{WINDMILL_URL}/api/{path}"
448 | headers = {"Authorization": f"Bearer {token}"}
449 | response = client.request(
450 | method=method,
451 | url=url,
452 | params={"per_page": 100},
453 | headers=headers,
454 | )
455 | LOGGER.debug("%s %s -> %s", method, path, response.status_code)
456 | try:
457 | response_data = json.loads(response.content)
458 | except json.JSONDecodeError:
459 | LOGGER.exception("Error parsing JSON", stack_info=True)
460 | return []
461 | if not response_data["value"].get("modules", []):
462 | LOGGER.debug("Flow %s has no modules in it, skipping,", flow_path)
463 | return flows
464 | first_module = response_data["value"]["modules"][0]
465 | if (
466 | first_module.get("summary", "") == "CORE:LISTEN_TO_EVENT"
467 | and first_module["value"]["input_transforms"]["events"]["type"] == "static"
468 | and first_module["value"]["input_transforms"]["filters"]["type"] == "static"
469 | ):
470 | webhook = f"/api/w/{workspace}/jobs/run/f/{flow_path}"
471 | input_transforms = first_module["value"]["input_transforms"]
472 | flows.append(
473 | {
474 | "webhook": webhook,
475 | "filters": input_transforms["filters"]["value"],
476 | # Remove backslashes from the beginning to yield canonical reference
477 | "events": [
478 | event[1:] if event.startswith("\\") else event
479 | for event in input_transforms["events"]["value"]
480 | ],
481 | }
482 | )
483 | return flows
484 |
485 |
486 | def get_registered_listeners_for_uri(webhook: str, registered_listeners: list) -> list:
487 | return [listener for listener in registered_listeners if listener["uri"] == webhook]
488 |
489 |
490 | def register_listener(event, event_filter, webhook, token: str) -> dict:
491 | LOGGER.debug("%s - %s: %s", webhook, event, json.dumps(event_filter, indent=4))
492 | try:
493 | r = NextcloudApp().webhooks.register(
494 | "POST",
495 | webhook,
496 | event,
497 | event_filter=event_filter,
498 | auth_method="header",
499 | auth_data={"Authorization": f"Bearer {token}"},
500 | )
501 | except NextcloudException:
502 | LOGGER.exception("Exception during registering webhook", stack_info=True)
503 | return {}
504 | LOGGER.debug(json.dumps(r._raw_data, indent=4)) # noqa
505 | return r._raw_data # noqa
506 |
507 |
508 | def update_listener(registered_listener: dict, event_filter, token: str) -> dict:
509 | LOGGER.debug(
510 | "%s - %s: %s", registered_listener["uri"], registered_listener["event"], json.dumps(event_filter, indent=4)
511 | )
512 | try:
513 | r = NextcloudApp().webhooks.update(
514 | registered_listener["id"],
515 | "POST",
516 | registered_listener["uri"],
517 | registered_listener["event"],
518 | event_filter=event_filter,
519 | auth_method="header",
520 | auth_data={"Authorization": f"Bearer {token}"},
521 | )
522 | except NextcloudException:
523 | LOGGER.exception("Exception during updating webhook", stack_info=True)
524 | return {}
525 | LOGGER.debug(json.dumps(r._raw_data, indent=4)) # noqa
526 | return r._raw_data # noqa
527 |
528 |
529 | def get_registered_listeners():
530 | nc = NextcloudApp()
531 | r = nc.ocs("GET", "/ocs/v1.php/apps/webhook_listeners/api/v1/webhooks")
532 | for i in r: # we need the same format as in `get_expected_listeners(workspace, token, flow_paths)`
533 | if not i["eventFilter"]:
534 | i["eventFilter"] = None # replace [] with None
535 | return r
536 |
537 |
538 | def delete_listener(registered_listener: dict) -> bool:
539 | r = NextcloudApp().webhooks.unregister(registered_listener["id"])
540 | if r:
541 | LOGGER.debug("removed registered listener with id=%d", registered_listener["id"])
542 | return r
543 |
544 |
545 | def create_or_update_variable(variable_name: str, env_var_key: str, is_secret: bool = False) -> bool:
546 | """Creates or updates a Windmill variable for the given env_var_key if it exists in os.environ.
547 |
548 | - variable_name is the path in Windmill (without 'u/admin/' prefix).
549 | - env_var_key is the environment variable name, e.g. "APP_SECRET".
550 | - is_secret indicates if the variable should be created as secret or not.
551 | Returns True if successful or if the environment variable isn't set (no action).
552 | """
553 | if env_var_key not in os.environ:
554 | LOGGER.warning("Environment variable %s not found, skipping creation", env_var_key)
555 | return True
556 |
557 | # Check existence
558 | r = httpx.get(
559 | url=f"{WINDMILL_URL}/api/w/nextcloud/variables/exists/u/admin/{variable_name}",
560 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
561 | )
562 | if r.status_code >= 400:
563 | LOGGER.critical("Can not check for variable %s: %s %s", variable_name, r.status_code, r.text)
564 | return False
565 |
566 | var_exists = r.text.lower() == "true"
567 | env_value = os.environ[env_var_key]
568 |
569 | if not var_exists:
570 | # Create variable
571 | LOGGER.info("Creating variable '%s' from env '%s'.", variable_name, env_var_key)
572 | r = httpx.post(
573 | url=f"{WINDMILL_URL}/api/w/nextcloud/variables/create",
574 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
575 | json={
576 | "path": f"u/admin/{variable_name}",
577 | "value": env_value,
578 | "is_secret": is_secret,
579 | "is_oauth": False,
580 | "description": f"ExApp var from env {env_var_key}",
581 | },
582 | )
583 | if r.status_code >= 400:
584 | LOGGER.critical("Could not create variable %s: %s %s", variable_name, r.status_code, r.text)
585 | return False
586 | return True
587 |
588 | # Check if existing value differs
589 | r = httpx.get(
590 | url=f"{WINDMILL_URL}/api/w/nextcloud/variables/get_value/u/admin/{variable_name}",
591 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
592 | )
593 | if r.status_code >= 400:
594 | LOGGER.critical("Can not get variable value %s: %s %s", variable_name, r.status_code, r.text)
595 | return False
596 | current_val = r.text.strip("'\"")
597 |
598 | if current_val != env_value:
599 | LOGGER.info("Updating variable '%s' from env '%s'.", variable_name, env_var_key)
600 | r = httpx.post(
601 | url=f"{WINDMILL_URL}/api/w/nextcloud/variables/update/u/admin/{variable_name}",
602 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
603 | json={"value": env_value},
604 | )
605 | if r.status_code >= 400:
606 | LOGGER.critical("Could not update variable %s: %s %s", variable_name, r.status_code, r.text)
607 | return False
608 | return True
609 |
610 |
611 | def create_or_update_exapp_resource() -> bool:
612 | """Creates or updates the Nextcloud resource in Windmill to include references to all four variables."""
613 | # Check existence of resource
614 | r = httpx.get(
615 | url=f"{WINDMILL_URL}/api/w/nextcloud/resources/exists/u/admin/exapp_resource",
616 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
617 | )
618 | if r.status_code >= 400:
619 | LOGGER.critical("Can not check for Nextcloud Auth Resource: %s %s", r.status_code, r.text)
620 | return False
621 |
622 | resource_exists = r.text.lower() == "true"
623 |
624 | # The resource "value" references each variable via $var:...
625 | desired_resource_value = {
626 | "password": "$var:u/admin/exapp_token",
627 | "aa_version": "$var:u/admin/exapp_aaversion",
628 | "app_id": "$var:u/admin/exapp_appid",
629 | "app_version": "$var:u/admin/exapp_appversion",
630 | }
631 |
632 | if not resource_exists:
633 | LOGGER.info("Creating Nextcloud Auth Resource with references to all exapp variables...")
634 | r = httpx.post(
635 | url=f"{WINDMILL_URL}/api/w/nextcloud/resources/create",
636 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
637 | json={
638 | "path": "u/admin/exapp_resource",
639 | "resource_type": "nextcloud",
640 | "description": "ExApp Authentication Resource",
641 | "value": {
642 | "username": "flow_app",
643 | **desired_resource_value,
644 | "baseUrl": os.environ["NEXTCLOUD_URL"].removesuffix("index.php").removesuffix("/"),
645 | },
646 | },
647 | )
648 | if r.status_code >= 400:
649 | LOGGER.critical("Can not create Nextcloud Auth Resource: %s %s", r.status_code, r.text)
650 | return False
651 | return True
652 |
653 | # Fetch the existing resource to see if an update is needed
654 | check_resp = httpx.get(
655 | url=f"{WINDMILL_URL}/api/w/nextcloud/resources/get/u/admin/exapp_resource",
656 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
657 | )
658 | if check_resp.status_code >= 400:
659 | LOGGER.critical(
660 | "Could not get existing resource exapp_resource: %s %s", check_resp.status_code, check_resp.text
661 | )
662 | return False
663 |
664 | existing_data = check_resp.json()
665 | existing_value = existing_data.get("value", {})
666 |
667 | # Filter existing_value to only include keys present in desired_resource_value
668 | filtered_existing_value = {key: existing_value[key] for key in desired_resource_value if key in existing_value}
669 |
670 | # Compare only "value" for now. Do not compare "username" or "baseUrl" as it can be changed by user manually.
671 | if filtered_existing_value == desired_resource_value:
672 | LOGGER.debug("Resource exapp_resource is already up to date, skipping update.")
673 | return True
674 |
675 | # If mismatched, we do an update
676 | LOGGER.info("Updating Nextcloud Auth Resource to keep references in sync...")
677 | r = httpx.post(
678 | url=f"{WINDMILL_URL}/api/w/nextcloud/resources/update/u/admin/exapp_resource",
679 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
680 | json={
681 | "description": "ExApp Authentication Resource",
682 | "value": {
683 | "username": existing_value.get("username"),
684 | **desired_resource_value,
685 | "baseUrl": existing_value.get("baseUrl"),
686 | },
687 | },
688 | )
689 | if r.status_code >= 400:
690 | LOGGER.critical("Can not update Nextcloud Auth Resource: %s %s", r.status_code, r.text)
691 | return False
692 | return True
693 |
694 |
695 | def create_nextcloud_resource() -> bool:
696 | """Create or update the necessary Windmill variables and resources."""
697 | if not create_or_update_variable("exapp_token", "APP_SECRET", is_secret=True):
698 | return False
699 | create_or_update_variable("exapp_aaversion", "AA_VERSION", is_secret=False)
700 | create_or_update_variable("exapp_appid", "APP_ID", is_secret=False)
701 | create_or_update_variable("exapp_appversion", "APP_VERSION", is_secret=False)
702 |
703 | return create_or_update_exapp_resource()
704 |
705 |
706 | def set_instance_core_base_url() -> bool:
707 | """Set Public base url of the instance to the possible url of Nextcloud if it has value of http(s)://localhost"""
708 | r = httpx.get(
709 | url=f"{WINDMILL_URL}/api/settings/global/base_url",
710 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
711 | )
712 | if r.status_code >= 400:
713 | LOGGER.critical("Can not check for default instance url: %s %s", r.status_code, r.text)
714 | return False
715 |
716 | instance_base_url = r.text.strip('"')
717 | if instance_base_url != "null":
718 | return True
719 |
720 | flow_base_instance_url = os.environ["NEXTCLOUD_URL"].removesuffix("index.php").removesuffix("/")
721 | if HARP_ENABLED:
722 | flow_base_instance_url += "/exapps/flow"
723 | else:
724 | flow_base_instance_url += "/index.php/apps/app_api/proxy/flow"
725 |
726 | LOGGER.debug("Setting base URL of instance to the %s", flow_base_instance_url)
727 | r = httpx.post(
728 | url=f"{WINDMILL_URL}/api/settings/global/base_url",
729 | cookies={"token": USERS_STORAGE[DEFAULT_USER_EMAIL]["token"]},
730 | json={
731 | "value": flow_base_instance_url,
732 | },
733 | )
734 | if r.status_code >= 400:
735 | LOGGER.critical("Can not set default instance url: %s %s", r.status_code, r.text)
736 | return False
737 | return True
738 |
739 |
740 | if __name__ == "__main__":
741 | initialize_windmill()
742 | create_nextcloud_resource()
743 | set_instance_core_base_url()
744 | # Current working dir is set for the Service we are wrapping, so change we first for ExApp default one
745 | os.chdir(Path(__file__).parent)
746 | run_app(APP, log_level="info") # Calling wrapper around `uvicorn.run`.
747 |
--------------------------------------------------------------------------------
/LICENSES/AGPL-3.0-or-later.txt:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 |
6 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
11 |
12 | 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.
13 |
14 | 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.
15 |
16 | 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.
17 |
18 | 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.
19 |
20 | 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.
21 |
22 | 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.
23 |
24 | The precise terms and conditions for copying, distribution and modification follow.
25 |
26 | TERMS AND CONDITIONS
27 |
28 | 0. Definitions.
29 |
30 | "This License" refers to version 3 of the GNU Affero General Public License.
31 |
32 | "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
33 |
34 | "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.
35 |
36 | 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.
37 |
38 | A "covered work" means either the unmodified Program or a work based on the Program.
39 |
40 | 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.
41 |
42 | 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.
43 |
44 | 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.
45 |
46 | 1. Source Code.
47 | 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.
48 |
49 | 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.
50 |
51 | 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.
52 |
53 | 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
54 | subprograms and other parts of the work.
55 |
56 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
57 |
58 | The Corresponding Source for a work in source code form is that same work.
59 |
60 | 2. Basic Permissions.
61 | 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.
62 |
63 | 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.
64 |
65 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
66 |
67 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
68 | 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.
69 |
70 | 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.
71 |
72 | 4. Conveying Verbatim Copies.
73 | 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.
74 |
75 | 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.
76 |
77 | 5. Conveying Modified Source Versions.
78 | 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:
79 |
80 | a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
81 |
82 | 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".
83 |
84 | 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.
85 |
86 | 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.
87 |
88 | 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.
89 |
90 | 6. Conveying Non-Source Forms.
91 | 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:
92 |
93 | 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.
94 |
95 | 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.
96 |
97 | 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.
98 |
99 | 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.
100 |
101 | 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.
102 |
103 | 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.
104 |
105 | 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.
106 |
107 | "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.
108 |
109 | 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).
110 |
111 | 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.
112 |
113 | 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.
114 |
115 | 7. Additional Terms.
116 | "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.
117 |
118 | 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.
119 |
120 | 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:
121 |
122 | a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
123 |
124 | 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
125 |
126 | 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
127 |
128 | d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
129 |
130 | e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
131 |
132 | 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.
133 |
134 | 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.
135 |
136 | 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.
137 |
138 | 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.
139 |
140 | 8. Termination.
141 |
142 | 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).
143 |
144 | 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.
145 |
146 | 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.
147 |
148 | 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.
149 |
150 | 9. Acceptance Not Required for Having Copies.
151 |
152 | 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.
153 |
154 | 10. Automatic Licensing of Downstream Recipients.
155 |
156 | 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.
157 |
158 | 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.
159 |
160 | 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.
161 |
162 | 11. Patents.
163 |
164 | 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".
165 |
166 | 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.
167 |
168 | 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.
169 |
170 | 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.
171 |
172 | 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
173 | 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.
174 |
175 | 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.
176 |
177 | 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.
178 |
179 | 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.
180 |
181 | 12. No Surrender of Others' Freedom.
182 |
183 | 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
184 | 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.
185 |
186 | 13. Remote Network Interaction; Use with the GNU General Public License.
187 |
188 | 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.
189 |
190 | 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.
191 |
192 | 14. Revised Versions of this License.
193 |
194 | 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.
195 |
196 | 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.
197 |
198 | 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.
199 |
200 | 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.
201 |
202 | 15. Disclaimer of Warranty.
203 |
204 | 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.
205 |
206 | 16. Limitation of Liability.
207 |
208 | 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.
209 |
210 | 17. Interpretation of Sections 15 and 16.
211 |
212 | 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.
213 |
214 | END OF TERMS AND CONDITIONS
215 |
216 | How to Apply These Terms to Your New Programs
217 |
218 | 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.
219 |
220 | 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.
221 |
222 |
223 | Copyright (C)
224 |
225 | 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.
226 |
227 | 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.
228 |
229 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
230 |
231 | Also add information on how to contact you by electronic and paper mail.
232 |
233 | 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.
234 |
235 | 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 .
236 |
--------------------------------------------------------------------------------
/LICENSES/GPL-3.0-or-later.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright © 2007 Free Software Foundation, Inc.
5 |
6 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for software and other kinds of works.
11 |
12 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is 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. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
13 |
14 | 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.
15 |
16 | To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
17 |
18 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
19 |
20 | Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
21 |
22 | For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
23 |
24 | Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
25 |
26 | Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
27 |
28 | The precise terms and conditions for copying, distribution and modification follow.
29 |
30 | TERMS AND CONDITIONS
31 |
32 | 0. Definitions.
33 |
34 | “This License” refers to version 3 of the GNU General Public License.
35 |
36 | “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
37 |
38 | “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.
39 |
40 | 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.
41 |
42 | A “covered work” means either the unmodified Program or a work based on the Program.
43 |
44 | 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.
45 |
46 | 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.
47 |
48 | 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.
49 |
50 | 1. Source Code.
51 | 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.
52 |
53 | 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.
54 |
55 | 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.
56 |
57 | 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.
58 |
59 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
60 |
61 | The Corresponding Source for a work in source code form is that same work.
62 |
63 | 2. Basic Permissions.
64 | 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.
65 |
66 | 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.
67 |
68 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
69 |
70 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
71 | 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.
72 |
73 | 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.
74 |
75 | 4. Conveying Verbatim Copies.
76 | 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.
77 |
78 | 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.
79 |
80 | 5. Conveying Modified Source Versions.
81 | 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:
82 |
83 | a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
84 |
85 | 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”.
86 |
87 | 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.
88 |
89 | 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.
90 |
91 | 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.
92 |
93 | 6. Conveying Non-Source Forms.
94 | 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:
95 |
96 | 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.
97 |
98 | 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.
99 |
100 | 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.
101 |
102 | 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.
103 |
104 | 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.
105 |
106 | 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.
107 |
108 | 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.
109 |
110 | “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.
111 |
112 | 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).
113 |
114 | 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.
115 |
116 | 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.
117 |
118 | 7. Additional Terms.
119 | “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.
120 |
121 | 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.
122 |
123 | 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:
124 |
125 | a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
126 |
127 | 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
128 |
129 | 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
130 |
131 | d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
132 |
133 | e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
134 |
135 | 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.
136 |
137 | 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.
138 |
139 | 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.
140 |
141 | 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.
142 |
143 | 8. Termination.
144 | 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).
145 |
146 | 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.
147 |
148 | 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.
149 |
150 | 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.
151 |
152 | 9. Acceptance Not Required for Having Copies.
153 | 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.
154 |
155 | 10. Automatic Licensing of Downstream Recipients.
156 | 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.
157 |
158 | 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.
159 |
160 | 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.
161 |
162 | 11. Patents.
163 | 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”.
164 |
165 | 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.
166 |
167 | 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.
168 |
169 | 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.
170 |
171 | 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.
172 |
173 | 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.
174 |
175 | 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.
176 |
177 | 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.
178 |
179 | 12. No Surrender of Others' Freedom.
180 | 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.
181 |
182 | 13. Use with the GNU Affero General Public License.
183 | 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 Affero 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 special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
184 |
185 | 14. Revised Versions of this License.
186 | The Free Software Foundation may publish revised and/or new versions of the GNU 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.
187 |
188 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU 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 General Public License, you may choose any version ever published by the Free Software Foundation.
189 |
190 | If the Program specifies that a proxy can decide which future versions of the GNU 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.
191 |
192 | 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.
193 |
194 | 15. Disclaimer of Warranty.
195 | 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.
196 |
197 | 16. Limitation of Liability.
198 | 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.
199 |
200 | 17. Interpretation of Sections 15 and 16.
201 | 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.
202 |
203 | END OF TERMS AND CONDITIONS
204 |
205 | How to Apply These Terms to Your New Programs
206 |
207 | 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.
208 |
209 | 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.
210 |
211 |
212 | Copyright (C)
213 |
214 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
215 |
216 | 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 General Public License for more details.
217 |
218 | You should have received a copy of the GNU General Public License along with this program. If not, see .
219 |
220 | Also add information on how to contact you by electronic and paper mail.
221 |
222 | If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
223 |
224 | Copyright (C)
225 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
226 | This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
227 |
228 | The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
229 |
230 | 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 GPL, see .
231 |
232 | The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .
233 |
--------------------------------------------------------------------------------