Skip to content

Commit bbf3007

Browse files
edward-lybigcat88
andauthored
chore(examples): update to_gif app (AppAPI 5.0.0) (#302)
Signed-off-by: Edward Ly <[email protected]> Co-authored-by: Alexander Piskun <[email protected]>
1 parent fabe8ea commit bbf3007

File tree

4 files changed

+66
-30
lines changed

4 files changed

+66
-30
lines changed

examples/as_app/to_gif/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-bookworm
1+
FROM python:3-bookworm
22

33
COPY requirements.txt /
44

examples/as_app/to_gif/Makefile

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,82 @@
11
.DEFAULT_GOAL := help
22

3+
GITHUB_USERNAME := cloud-py-api
4+
5+
APP_ID := to_gif
6+
APP_NAME := ToGif
7+
APP_VERSION := 1.0.0
8+
APP_SECRET := 12345
9+
APP_PORT := 9031
10+
11+
JSON_INFO := "{\"id\":\"$(APP_ID)\",\"name\":\"$(APP_NAME)\",\"daemon_config_name\":\"manual_install\",\"version\":\"$(APP_VERSION)\",\"secret\":\"$(APP_SECRET)\",\"port\":$(APP_PORT),\"routes\":[{\"url\":\".*\",\"verb\":\"GET, POST, PUT, DELETE\",\"access_level\":1,\"headers_to_exclude\":[]}]}"
12+
313
.PHONY: help
414
help:
5-
@echo "Welcome to ToGif example. Please use \`make <target>\` where <target> is one of"
15+
@echo "Welcome to $(APP_NAME). Please use \`make <target>\` where <target> is one of"
616
@echo " "
717
@echo " Next commands are only for dev environment with nextcloud-docker-dev!"
818
@echo " They should run from the host you are developing on(with activated venv) and not in the container with Nextcloud!"
919
@echo " "
1020
@echo " build-push build image and upload to ghcr.io"
1121
@echo " "
12-
@echo " run28 install ToGif for Nextcloud 28"
13-
@echo " run install ToGif for Nextcloud Last"
22+
@echo " run28 install $(APP_NAME) for Nextcloud 28"
23+
@echo " run29 install $(APP_NAME) for Nextcloud 29"
24+
@echo " run30 install $(APP_NAME) for Nextcloud 30"
25+
@echo " run install $(APP_NAME) for Nextcloud Latest"
1426
@echo " "
15-
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
16-
@echo " First run 'ToGif' and then 'make registerXX', after that you can use/debug/develop it and easy test."
27+
@echo " For development of this example use PyCharm run configurations. Development is always set to the latest version of Nextcloud."
28+
@echo " First run '$(APP_NAME)' and then 'make registerXX', after that you can use/debug/develop it and easy test."
1729
@echo " "
18-
@echo " register28 perform registration of running 'to_gif' into the 'manual_install' deploy daemon."
19-
@echo " register perform registration of running 'to_gif' into the 'manual_install' deploy daemon."
30+
@echo " register28 perform registration of running '$(APP_ID)' into the 'manual_install' deploy daemon."
31+
@echo " register29 perform registration of running '$(APP_ID)' into the 'manual_install' deploy daemon."
32+
@echo " register30 perform registration of running '$(APP_ID)' into the 'manual_install' deploy daemon."
33+
@echo " register perform registration of running '$(APP_ID)' into the 'manual_install' deploy daemon."
2034

2135
.PHONY: build-push
2236
build-push:
2337
docker login ghcr.io
24-
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/to_gif:latest .
38+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/$(GITHUB_USERNAME)/$(APP_ID):latest .
2539

2640
.PHONY: run28
2741
run28:
28-
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
29-
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register to_gif --force-scopes \
30-
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/to_gif/appinfo/info.xml
42+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
43+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
44+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/$(APP_ID)/appinfo/info.xml
45+
46+
.PHONY: run29
47+
run29:
48+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
49+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
50+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/$(APP_ID)/appinfo/info.xml
51+
52+
.PHONY: run30
53+
run30:
54+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
55+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
56+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/$(APP_ID)/appinfo/info.xml
3157

3258
.PHONY: run
3359
run:
34-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
35-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register to_gif --force-scopes \
36-
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/to_gif/appinfo/info.xml
60+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
61+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
62+
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/$(APP_ID)/appinfo/info.xml
3763

3864
.PHONY: register28
3965
register28:
40-
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
41-
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register to_gif manual_install --json-info \
42-
"{\"id\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":[\"FILES\", \"NOTIFICATIONS\"]}" \
43-
--force-scopes --wait-finish
66+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
67+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
68+
69+
.PHONY: register29
70+
register29:
71+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
72+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
73+
74+
.PHONY: register30
75+
register30:
76+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
77+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
4478

4579
.PHONY: register
4680
register:
47-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
48-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register to_gif manual_install --json-info \
49-
"{\"id\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":[\"FILES\", \"NOTIFICATIONS\"]}" \
50-
--force-scopes --wait-finish
81+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
82+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish

examples/as_app/to_gif/appinfo/info.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<name>ToGif</name>
55
<summary>Nextcloud To Gif Example</summary>
66
<description>
7-
<![CDATA[Example of the Nextcloud application written in python]]>
7+
<![CDATA[Example of a Nextcloud application written in Python]]>
88
</description>
99
<version>1.0.0</version>
1010
<licence>MIT</licence>
@@ -16,17 +16,21 @@
1616
<bugs>https://github.com/cloud-py-api/nc_py_api/issues</bugs>
1717
<repository type="git">https://github.com/cloud-py-api/nc_py_api</repository>
1818
<dependencies>
19-
<nextcloud min-version="28" max-version="30"/>
19+
<nextcloud min-version="28" max-version="31"/>
2020
</dependencies>
2121
<external-app>
2222
<docker-install>
2323
<registry>ghcr.io</registry>
2424
<image>cloud-py-api/to_gif</image>
2525
<image-tag>latest</image-tag>
2626
</docker-install>
27-
<scopes>
28-
<value>FILES</value>
29-
<value>NOTIFICATIONS</value>
30-
</scopes>
27+
<routes>
28+
<route>
29+
<url>.*</url>
30+
<verb>GET,POST,PUT,DELETE</verb>
31+
<access_level>USER</access_level>
32+
<headers_to_exclude>[]</headers_to_exclude>
33+
</route>
34+
</routes>
3135
</external-app>
3236
</info>

examples/as_app/to_gif/lib/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
8585
if enabled:
8686
nc.ui.files_dropdown_menu.register_ex(
8787
"to_gif",
88-
"TO GIF",
88+
"To GIF",
8989
"/video_to_gif",
9090
mime="video",
9191
icon="img/icon.svg",

0 commit comments

Comments
 (0)