Skip to content

Commit

Permalink
Merge pull request #1 from cloud-py-api/appapi-1.1.0
Browse files Browse the repository at this point in the history
"/init" endpoint implementation
  • Loading branch information
bigcat88 authored Oct 23, 2023
2 parents c241060 + 7c59915 commit 5a3f7b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ help:
@echo " run27 install UpScaler for Nextcloud 27"
@echo " "
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
@echo " First run 'upscaler_example' and then 'make manual_register', after that you can use/debug/develop it and easy test."
@echo " First run 'upscaler_example' and then 'make register', after that you can use/debug/develop it and easy test."
@echo " "
@echo " manual_register28 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
@echo " manual_register27 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
@echo " register28 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."
@echo " register27 perform registration of running 'upscaler_example' into 'manual_install' deploy daemon."

.PHONY: build-push
build-push:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/upscaler_example:1.0.0 --tag ghcr.io/cloud-py-api/upscaler_example:latest .
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/upscaler_example:1.1.0 --tag ghcr.io/cloud-py-api/upscaler_example:latest .

.PHONY: deploy28
deploy28:
Expand All @@ -36,7 +36,7 @@ deploy28:
run28:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register upscaler_example docker_dev \
-e --force-scopes \
--force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml

.PHONY: deploy27
Expand All @@ -49,19 +49,19 @@ deploy27:
run27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register upscaler_example docker_dev \
-e --force-scopes \
--force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/upscaler_example/main/appinfo/info.xml

.PHONY: manual_register28
manual_register28:
.PHONY: register28
register28:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register upscaler_example manual_install --json-info \
"{\"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}" \
-e --force-scopes
--force-scopes

.PHONY: manual_register27
manual_register27:
.PHONY: register27
register27:
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister upscaler_example --silent || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register upscaler_example manual_install --json-info \
"{\"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}" \
-e --force-scopes
--force-scopes
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It shouldn't be difficult to use an even more advanced model based on this examp
Refer to [How to install](https://github.com/cloud-py-api/upscaler_example/blob/main/HOW_TO_INSTALL.md) to try it.
]]></description>
<version>1.0.0</version>
<version>1.1.0</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
Expand All @@ -30,7 +30,7 @@ Refer to [How to install](https://github.com/cloud-py-api/upscaler_example/blob/
<docker-install>
<registry>ghcr.io</registry>
<image>cloud-py-api/upscaler_example</image>
<image-tag>1.0.0</image-tag>
<image-tag>1.1.0</image-tag>
</docker-install>
<scopes>
<required>
Expand Down
6 changes: 6 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ def heartbeat_handler():
return responses.JSONResponse(content={"status": "ok"}, status_code=200)


@APP.post("/init")
def init_callback():
ocs_call(method="PUT", path=f"/index.php/apps/app_api/apps/status/{os.environ['APP_ID']}", json_data={"progress": 100})
return responses.JSONResponse(content={}, status_code=200)


if __name__ == "__main__":
uvicorn.run(
"main:APP", host=os.environ.get("APP_HOST", "127.0.0.1"), port=int(os.environ["APP_PORT"]), log_level="trace"
Expand Down

0 comments on commit 5a3f7b2

Please sign in to comment.