Skip to content

Commit 6b273c6

Browse files
committed
initial commit
0 parents  commit 6b273c6

40 files changed

+19679
-0
lines changed

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = tab
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.yml]
14+
indent_size = 2
15+
indent_style = space
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
19+
20+
[*.svg]
21+
insert_final_newline = false
22+
23+
[package*.json]
24+
indent_size = 2
25+
indent_style = space
26+
27+
[tests/psalm-baseline.xml]
28+
indent_size = 2
29+
indent_style = space

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
globals: {
3+
appVersion: true
4+
},
5+
parserOptions: {
6+
requireConfigFile: false
7+
},
8+
extends: [
9+
'@nextcloud'
10+
],
11+
rules: {
12+
'jsdoc/require-jsdoc': 'off',
13+
'jsdoc/tag-lines': 'off',
14+
'vue/first-attribute-linebreak': 'off',
15+
'import/extensions': 'off'
16+
}
17+
}

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Declare files that always have LF line endings on checkout
2+
* text eol=lf
3+
4+
# Denote all files that are truly binary and should not be modified
5+
js/* binary
6+
screenshots/* binary
7+
*.png binary
8+
*.hif binary
9+
10+
# Files to exclude from GitHub Languages statistics
11+
l10n/* linguist-vendored=true

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.DS_Store
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Editor directories and files
8+
.idea
9+
.vscode
10+
*.suo
11+
*.ntvs*
12+
*.njsproj
13+
*.sln
14+
15+
.marginalia
16+
17+
/js/
18+
build/
19+
coverage/
20+
vendor
21+
.php-cs-fixer.cache
22+
.phpunit.result.cache
23+
24+
__pycache__
25+
local
26+
.run/
27+
.venv
28+
venv

.l10nignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
js/
2+
vendor/

.nextcloudignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.git
2+
.github
3+
.tx
4+
.vscode
5+
/build
6+
/node_modules
7+
/screenshots
8+
/src
9+
tests
10+
/vendor
11+
/.codecov.yml
12+
/.eslintrc.js
13+
/.gitattributes
14+
/.gitignore
15+
/.l10nignore
16+
/.nextcloudignore
17+
.php-cs-fixer.*
18+
/.pre-commit-config.yaml
19+
/babel.config.js
20+
/CODE_OF_CONDUCT.md
21+
/composer.json
22+
/composer.lock
23+
/jest.config.js
24+
/Makefile
25+
/package-lock.json
26+
/package.json
27+
/postcss.config.js
28+
/psalm.xml
29+
/pyproject.toml
30+
/stylelint.config.js
31+
/webpack.config.js

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.11-slim-bookworm
2+
3+
COPY requirements.txt /
4+
5+
ADD cs[s] /app/css
6+
ADD im[g] /app/img
7+
ADD j[s] /app/js
8+
ADD l10[n] /app/l10n
9+
ADD li[b] /app/lib
10+
11+
RUN \
12+
python3 -m pip install -r requirements.txt && rm -rf ~/.cache && rm requirements.txt
13+
14+
WORKDIR /app/lib
15+
ENTRYPOINT ["python3", "main.py"]

Makefile

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
.DEFAULT_GOAL := help
2+
3+
.PHONY: help
4+
help:
5+
@echo "Welcome to UiExample example. Please use \`make <target>\` where <target> is one of"
6+
@echo " "
7+
@echo " Next commands are only for dev environment with nextcloud-docker-dev!"
8+
@echo " They should run from the host you are developing on(with activated venv) and not in the container with Nextcloud!"
9+
@echo " "
10+
@echo " build-push build image and upload to ghcr.io"
11+
@echo " "
12+
@echo " deploy27 deploy UiExample to registered 'docker_dev' for Nextcloud 27"
13+
@echo " deploy28 deploy UiExample to registered 'docker_dev' for Nextcloud 28"
14+
@echo " deploy deploy UiExample to registered 'docker_dev' for Nextcloud Last"
15+
@echo " "
16+
@echo " run27 install UiExample for Nextcloud 27"
17+
@echo " run28 install UiExample for Nextcloud 28"
18+
@echo " run install UiExample for Nextcloud Last"
19+
@echo " "
20+
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
21+
@echo " First run 'UiExample' and then 'make registerXX', after that you can use/debug/develop it and easy test."
22+
@echo " "
23+
@echo " register27 perform registration of running UiExample into the 'manual_install' deploy daemon."
24+
@echo " register28 perform registration of running UiExample into the 'manual_install' deploy daemon."
25+
@echo " register perform registration of running UiExample into the 'manual_install' deploy daemon."
26+
@echo " "
27+
@echo " L10N (for manual translation):"
28+
@echo " translation_templates extract translation strings from sources"
29+
@echo " convert_translations_nc convert translations to Nextcloud format files (json, js)"
30+
@echo " convert_to_locale copy translations to the common locale/<lang>/LC_MESSAGES/<appid>.(po|mo)"
31+
32+
.PHONY: build-push
33+
build-push:
34+
docker login ghcr.io
35+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/ui_example:latest .
36+
37+
.PHONY: deploy27
38+
deploy27:
39+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
40+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy ui_example docker_dev \
41+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
42+
43+
.PHONY: deploy28
44+
deploy28:
45+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
46+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:deploy ui_example docker_dev \
47+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
48+
49+
.PHONY: deploy
50+
deploy:
51+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
52+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy ui_example docker_dev \
53+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
54+
55+
.PHONY: run27
56+
run27:
57+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
58+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register ui_example docker_dev --force-scopes \
59+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
60+
61+
.PHONY: run28
62+
run28:
63+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
64+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register ui_example docker_dev --force-scopes \
65+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
66+
67+
.PHONY: run
68+
run:
69+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
70+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register ui_example docker_dev --force-scopes \
71+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/ui_example/appinfo/info.xml
72+
73+
.PHONY: register27
74+
register27:
75+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
76+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register ui_example manual_install --json-info \
77+
"{\"appid\":\"ui_example\",\"name\":\"UI Example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9035,\"scopes\":[],\"system_app\":0}" \
78+
--force-scopes --wait-finish
79+
80+
.PHONY: register28
81+
register28:
82+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
83+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register ui_example manual_install --json-info \
84+
"{\"appid\":\"ui_example\",\"name\":\"UI Example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9035,\"scopes\":[],\"system_app\":0}" \
85+
--force-scopes --wait-finish
86+
87+
.PHONY: register
88+
register:
89+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ui_example --silent --force || true
90+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register ui_example manual_install --json-info \
91+
"{\"appid\":\"ui_example\",\"name\":\"UI Example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9035,\"scopes\":[],\"system_app\":0}" \
92+
--force-scopes --wait-finish
93+
94+
.PHONY: translation_templates
95+
translation_templates:
96+
./translationtool.phar create-pot-files
97+
98+
.PHONY: convert_translations_nc
99+
convert_translations_nc:
100+
./translationtool.phar convert-po-files
101+
102+
.PHONY: convert_to_locale
103+
convert_to_locale:
104+
./scripts/convert_to_locale.sh

appinfo/info.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0"?>
2+
<info>
3+
<id>ui_example</id>
4+
<name>UI Example</name>
5+
<summary>Example of displaying UI elements with l10n support</summary>
6+
<description>
7+
<![CDATA[Simplest skeleton of the Nextcloud application written in Python]]>
8+
</description>
9+
<version>1.0.0</version>
10+
<licence>MIT</licence>
11+
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
12+
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
13+
<namespace>PyUIExampleL10N</namespace>
14+
<category>tools</category>
15+
<website>https://github.com/cloud-py-api/ui_example</website>
16+
<bugs>https://github.com/cloud-py-api/ui_example/issues</bugs>
17+
<repository type="git">https://github.com/cloud-py-api/ui_example</repository>
18+
<dependencies>
19+
<nextcloud min-version="27" max-version="29"/>
20+
</dependencies>
21+
<external-app>
22+
<docker-install>
23+
<registry>ghcr.io</registry>
24+
<image>cloud-py-api/ui_example</image>
25+
<image-tag>latest</image-tag>
26+
</docker-install>
27+
<scopes>
28+
</scopes>
29+
<system>false</system>
30+
</external-app>
31+
</info>

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const babelConfig = require('@nextcloud/babel-config')
2+
3+
module.exports = babelConfig

0 commit comments

Comments
 (0)