Skip to content

Commit 987c99e

Browse files
committed
corrections for AppAPI 1.4 (1)
1 parent e0d1353 commit 987c99e

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

Makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,51 @@ help:
99
@echo " "
1010
@echo " build-push build image and upload to ghcr.io"
1111
@echo " "
12-
@echo " deploy28 deploy example to registered 'docker_dev' for Nextcloud 28"
12+
@echo " deploy deploy example to registered 'docker_dev' for Nextcloud Last"
1313
@echo " deploy27 deploy example to registered 'docker_dev' for Nextcloud 27"
1414
@echo " "
15-
@echo " run28 install UpScaler for Nextcloud 28"
15+
@echo " run install UpScaler for Nextcloud Last"
1616
@echo " run27 install UpScaler for Nextcloud 27"
1717
@echo " "
1818
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
1919
@echo " First run 'upscaler_example' and then 'make register', after that you can use/debug/develop it and easy test."
2020
@echo " "
21-
@echo " register28 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
21+
@echo " register perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
2222
@echo " register27 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
2323

2424
.PHONY: build-push
2525
build-push:
2626
docker login ghcr.io
27-
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/upscaler_example:1.2.0 --tag ghcr.io/cloud-py-api/upscaler_example:latest .
27+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/upscaler_example:1.3.0 --tag ghcr.io/cloud-py-api/upscaler_example:latest .
2828

29-
.PHONY: deploy28
30-
deploy28:
29+
.PHONY: deploy
30+
deploy:
3131
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
3232
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy upscaler_example docker_dev \
3333
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml
3434

35-
.PHONY: run28
36-
run28:
37-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
38-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register upscaler_example docker_dev \
39-
--force-scopes \
40-
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml
41-
4235
.PHONY: deploy27
4336
deploy27:
4437
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
4538
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy upscaler_example docker_dev \
4639
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml
4740

41+
.PHONY: run
42+
run:
43+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
44+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register upscaler_example docker_dev \
45+
--force-scopes \
46+
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml
47+
4848
.PHONY: run27
4949
run27:
5050
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
5151
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register upscaler_example docker_dev \
5252
--force-scopes \
5353
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml
5454

55-
.PHONY: register28
56-
register28:
55+
.PHONY: register
56+
register:
5757
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
5858
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register upscaler_example manual_install --json-info \
5959
"{\"appid\":\"upscaler_example\",\"name\":\"upscaler_example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"host\":\"host.docker.internal\",\"port\":10050,\"scopes\":{\"required\":[\"FILES\", \"NOTIFICATIONS\"],\"optional\":[]},\"protocol\":\"http\",\"system_app\":0}" \

src/main.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ class UiActionFileInfo(BaseModel):
3535
instanceId: typing.Optional[str]
3636

3737

38-
class UiFileActionHandlerInfo(BaseModel):
39-
actionName: str
40-
actionHandler: str
41-
actionFile: UiActionFileInfo
42-
43-
4438
def random_string(size: int) -> str:
4539
return "".join(choice(ascii_lowercase + ascii_uppercase + digits) for _ in range(size))
4640

@@ -166,7 +160,7 @@ def gfpgan_background(input_file: UiActionFileInfo, user_id: str):
166160

167161
@APP.post("/gfpgan_upscale")
168162
async def gfpgan_upscale(
169-
file: UiFileActionHandlerInfo,
163+
file: UiActionFileInfo,
170164
request: Request,
171165
background_tasks: BackgroundTasks,
172166
):
@@ -190,7 +184,7 @@ def enabled_handler(enabled: bool, request: Request):
190184
if enabled:
191185
result = ocs_call(
192186
"POST",
193-
"/ocs/v1.php/apps/app_api/api/v1/files/actions/menu",
187+
"/ocs/v1.php/apps/app_api/api/v1/ui/files-actions-menu",
194188
json_data={
195189
"fileActionMenuParams": {
196190
"name": "upscale",
@@ -208,7 +202,7 @@ def enabled_handler(enabled: bool, request: Request):
208202
else:
209203
ocs_call(
210204
"DELETE",
211-
"/ocs/v1.php/apps/app_api/api/v1/files/actions/menu",
205+
"/ocs/v1.php/apps/app_api/api/v1/ui/files-actions-menu",
212206
json_data={"fileActionMenuName": "upscale"},
213207
)
214208
except Exception as e:

0 commit comments

Comments
 (0)