Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ jobs:
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Checkout AppEcosystemV2
- name: Checkout AppAPI
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
path: apps/app_ecosystem_v2
repository: cloud-py-api/app_ecosystem_v2
path: apps/app_api
repository: cloud-py-api/app_api

- name: Install AppEcosystemV2
- name: Install AppAPI
run: |
patch -p 1 -i apps/app_ecosystem_v2/base_php.patch
php occ app:enable app_ecosystem_v2
patch -p 1 -i apps/app_api/base_php.patch
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
Expand Down Expand Up @@ -272,18 +272,18 @@ jobs:
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Checkout AppEcosystemV2
- name: Checkout AppAPI
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
if: ${{ !startsWith(matrix.nextcloud, '26.') }}
with:
path: apps/app_ecosystem_v2
repository: cloud-py-api/app_ecosystem_v2
path: apps/app_api
repository: cloud-py-api/app_api

- name: Install AppEcosystemV2
- name: Install AppAPI
if: ${{ !startsWith(matrix.nextcloud, '26.') }}
run: |
patch -p 1 -i apps/app_ecosystem_v2/base_php.patch
php occ app:enable app_ecosystem_v2
patch -p 1 -i apps/app_api/base_php.patch
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
Expand Down Expand Up @@ -416,16 +416,16 @@ jobs:
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Checkout AppEcosystemV2
- name: Checkout AppAPI
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
path: apps/app_ecosystem_v2
repository: cloud-py-api/app_ecosystem_v2
path: apps/app_api
repository: cloud-py-api/app_api

- name: Install AppEcosystemV2
- name: Install AppAPI
run: |
patch -p 1 -i apps/app_ecosystem_v2/base_php.patch
php occ app:enable app_ecosystem_v2
patch -p 1 -i apps/app_api/base_php.patch
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
Expand Down Expand Up @@ -536,15 +536,15 @@ jobs:
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Checkout AppEcosystemV2
- name: Checkout AppAPI
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
path: apps/app_ecosystem_v2
repository: cloud-py-api/app_ecosystem_v2
path: apps/app_api
repository: cloud-py-api/app_api

- name: Install AppEcosystemV2
- name: Install AppAPI
run: |
php occ app:enable app_ecosystem_v2
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
Expand Down Expand Up @@ -705,7 +705,7 @@ jobs:
coverage run --data-file=.coverage.at_the_end -m pytest tests/_tests_at_the_end.py
coverage combine && coverage xml && coverage html
env:
SKIP_AE_TESTS: 1
SKIP_AA_TESTS: 1
NPA_NC_CERT: ''

- name: HTML coverage to artifacts
Expand Down Expand Up @@ -799,19 +799,19 @@ jobs:
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Checkout AppEcosystemV2
- name: Checkout AppAPI
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
path: apps/app_ecosystem_v2
repository: cloud-py-api/app_ecosystem_v2
path: apps/app_api
repository: cloud-py-api/app_api

- name: Patch base.php
if: ${{ startsWith(matrix.nextcloud, 'stable26') }}
run: patch -p 1 -i apps/app_ecosystem_v2/base_php.patch
run: patch -p 1 -i apps/app_api/base_php.patch

- name: Install AppEcosystemV2
- name: Install AppAPI
run: |
php occ app:enable app_ecosystem_v2
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install.py &
echo $! > /tmp/_install.pid
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## [0.2.0 - 2023-09-11]

### Changed

- AppEcosystem_V2 Project was renamed to App_API, adjust all routes, examples, and docs for this.
- The Application Authentication mechanism was changed to a much simple one.

## [0.1.0 - 2023-09-06]

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The **Nextcloud** class functions as a standard Nextcloud client,
enabling you to make API requests using a username and password.

On the other hand, the **NextcloudApp** class is designed for creating applications for Nextcloud.<br>
It uses the [AppEcosystem](https://github.com/cloud-py-api/app_ecosystem_v2) to allow
It uses the [AppAPI](https://github.com/cloud-py-api/app_api) to allow
applications to impersonate users through a separate authentication mechanism.

Both classes offer most of the same APIs,
Expand Down
4 changes: 2 additions & 2 deletions docs/DevSetup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Suggested IDE: **PyCharm**, but of course you can use any IDE you like for this
Steps to setup up the development environment:

#. Setup Nextcloud locally or remotely.
#. Install `AppEcosystem <https://github.com/cloud-py-api/app_ecosystem_v2>`_, follow it's steps to register ``deploy daemon`` if needed.
#. Install `AppAPI <https://github.com/cloud-py-api/app_api>`_, follow it's steps to register ``deploy daemon`` if needed.
#. Clone the `nc_py_api <https://github.com/cloud-py-api/nc_py_api>`_ with :command:`shell`::

git clone https://github.com/cloud-py-api/nc_py_api.git
Expand Down Expand Up @@ -39,7 +39,7 @@ Steps to setup up the development environment:

pre-commit install

#. If ``deploy daemon`` is registered for AppEcosystem, register **nc_py_api** as an application with :command:`shell`::
#. If ``deploy daemon`` is registered for AppAPI, register **nc_py_api** as an application with :command:`shell`::

make register28

Expand Down
16 changes: 8 additions & 8 deletions docs/NextcloudApp.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Writing a Nextcloud Application
===============================

This chapter assumes that you are already familiar with the `concepts <https://cloud-py-api.github.io/app_ecosystem_v2/Concepts.html>`_ of the AppEcosystem.
This chapter assumes that you are already familiar with the `concepts <https://cloud-py-api.github.io/app_api/Concepts.html>`_ of the AppAPI.

As a first step, let's take a look at the structure of a basic Python application.

Expand Down Expand Up @@ -47,7 +47,7 @@ First register ``manual_install`` daemon:

.. code-block:: shell

php occ app_ecosystem_v2:daemon:register manual_install "Manual Install" manual-install 0 0 0
php occ app_api:daemon:register manual_install "Manual Install" manual-install 0 0 0

Then, launch your application. Since this is a manual deployment, it's your responsibility to set minimum of the environment variables.
Here they are:
Expand All @@ -56,7 +56,7 @@ Here they are:
* APP_PORT - Port on which application listen for the requests from the Nextcloud.
* APP_SECRET - Secret for ``hmac`` signature generation.
* APP_VERSION - Version of the application.
* AE_VERSION - Version of the AppEcosystem.
* AE_VERSION - Version of the AppAPI.
* NEXTCLOUD_URL - URL at which the application can access the Nextcloud API.

You can find values for these environment variables in the **Skeleton** or **ToGif** run configurations.
Expand All @@ -65,7 +65,7 @@ After launching your application, execute the following command in the Nextcloud

.. code-block:: shell

php occ app_ecosystem_v2:app:register YOUR_APP_ID manual_install --json-info \
php occ app_api:app:register YOUR_APP_ID manual_install --json-info \
"{\"appid\":\"YOUR_APP_ID\",\"name\":\"YOUR_APP_DISPLAY_NAME\",\"daemon_config_name\":\"manual_install\",\"version\":\"YOU_APP_VERSION\",\"secret\":\"YOUR_APP_SECRET\",\"host\":\"host.docker.internal\",\"scopes\":{\"required\":[2, 10, 11],\"optional\":[30, 31, 32, 33]},\"port\":SELECTED_PORT,\"protocol\":\"http\",\"system_app\":0}" \
-e --force-scopes

Expand All @@ -79,7 +79,7 @@ Examples for such Makefiles can be found in this repository:
`ToGif <https://github.com/cloud-py-api/nc_py_api/blob/main/examples/as_app/to_gif/Makefile>`_ ,
`nc_py_api <https://github.com/cloud-py-api/nc_py_api/blob/main/scripts/dev_register.sh>`_

During the execution of `php occ app_ecosystem_v2:app:register`, the **enabled_handler** will be called,
During the execution of `php occ app_api:app:register`, the **enabled_handler** will be called,
as we pass the flag ``-e``, meaning ``enable after registration``.

This is likely all you need to start debugging and developing an application for Nextcloud.
Expand All @@ -89,7 +89,7 @@ Pack & Deploy

Before reading this chapter, please review the basic information about deployment
and the currently supported types of
`deployments configurations <https://cloud-py-api.github.io/app_ecosystem_v2/DeployConfigurations.html>`_ in the AppEcosystem documentation.
`deployments configurations <https://cloud-py-api.github.io/app_api/DeployConfigurations.html>`_ in the AppAPI documentation.

Docker Deploy Daemon
""""""""""""""""""""
Expand Down Expand Up @@ -140,7 +140,7 @@ First of all, we modernize info.ixml, add the API groups we need for this to wor
</optional>
</scopes>

.. note:: Full list of avalaible API scopes can be found `here <https://cloud-py-api.github.io/app_ecosystem_v2/tech_details/ApiScopes.html>`_.
.. note:: Full list of avalaible API scopes can be found `here <https://cloud-py-api.github.io/app_api/tech_details/ApiScopes.html>`_.

After that we extend the **enabled** handler and include there registration of the drop-down list element:

Expand Down Expand Up @@ -194,7 +194,7 @@ heavy calculations and we cannot guarantee a fast completion time, it is recomme
an empty response (which will be a status of 200) and in the background already slowly perform operations.

The last parameter is a structure describing the action and the file on which it needs to be performed,
which is passed by the Appecosystem when clicking on the drop-down context menu of the file.
which is passed by the AppAPI when clicking on the drop-down context menu of the file.

We use the built method :py:meth:`~nc_py_api.ex_app.ui.files.UiActionFileInfo.to_fs_node` into the structure to convert it
into a standard :py:class:`~nc_py_api.files.FsNode` class that describes the file and pass the FsNode class instance to the background task.
Expand Down
2 changes: 1 addition & 1 deletion docs/NextcloudTalkBot.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Nextcloud Talk Bot API in Applications
======================================

The AppEcosystem is an excellent choice for developing and deploying bots for Nextcloud Talk.
The AppAPI is an excellent choice for developing and deploying bots for Nextcloud Talk.

Bots for Nextcloud Talk, in essence, don't differ significantly from regular external applications.
The functionality of an external application can include just the bot or provide additional functionalities as well.
Expand Down
18 changes: 9 additions & 9 deletions docs/benchmarks/AppEcosystem.rst → docs/benchmarks/AppAPI.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
AppEcosystem Benchmarks
=======================
AppAPI Benchmarks
=================

In the current implementation, applications written and using the AppEcosystem
In the current implementation, applications written and using the AppAPI
so far in most cases will be authenticated at the beginning of each action.

*A future enhancement that can be implemented is the addition of a session cache.
This feature would eliminate the need for re-authorization for subsequent actions performed
by the same user within a certain time frame.
The implementation of this session cache would be seamless for developers and require no additional actions.*

It is important to note that the AppEcosystem authentication type is currently the fastest among available options.
It is important to note that the AppAPI authentication type is currently the fastest among available options.
Compared to traditional username/password authentication and app password authentication,
both of which are considerably slower, the AppEcosystem provides a significant advantage in terms of speed.
both of which are considerably slower, the AppAPI provides a significant advantage in terms of speed.

When considering data transfer speed, it is worth mentioning
that the AppEcosystem's upload speed may be slightly lower, around 6-8 percent, for large data transfers.
that the AppAPI's upload speed may be slightly lower, around 6-8 percent, for large data transfers.
This decrease in speed is due to the authentication process, which involves hashing all data.
However, for loading any data, there is no slowdown compared to standard methods.

Expand All @@ -26,14 +26,14 @@ this aspect is beyond the scope of the discussed issue.
Conclusion
----------

In summary, the AppEcosystem authentication offers fast and secure access to user data.
In summary, the AppAPI authentication offers fast and secure access to user data.
With the potential addition of a session cache in the future, the authentication process can become even more efficient
and seamless for users. The slight decrease in upload speed for large data transfers
is a trade-off for the enhanced security provided by the authentication process.

Overall, the AppEcosystem authentication proves to be a reliable and effective method for application authentication.
Overall, the AppAPI authentication proves to be a reliable and effective method for application authentication.

.. _appecosystem-bench-results:
.. _appapi-bench-results:

Detailed Benchmark Results
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Have a great time with Python and Nextcloud!
Options
reference/index.rst
DevSetup
benchmarks/AppEcosystem.rst
benchmarks/AppAPI.rst

Indices and tables
==================
Expand Down
14 changes: 7 additions & 7 deletions examples/as_app/skeleton/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ build-push:

.PHONY: deploy
deploy:
docker exec master-nextcloud-1 sudo -u www-data php occ app_ecosystem_v2:app:deploy skeleton docker_dev \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy skeleton docker_dev \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: run28
run28:
docker exec master-nextcloud-1 sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_ecosystem_v2:app:register skeleton docker_dev -e --force-scopes \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev -e --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: run27
run27:
docker exec master-stable27-1 sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent || true
docker exec master-stable27-1 sudo -u www-data php occ app_ecosystem_v2:app:register skeleton docker_dev -e --force-scopes \
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent || true
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev -e --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml

.PHONY: manual_register
manual_register:
docker exec master-nextcloud-1 sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_ecosystem_v2:app:register skeleton manual_install --json-info \
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent || true
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"host\":\"host.docker.internal\",\"port\":9030,\"scopes\":{\"required\":[],\"optional\":[]},\"protocol\":\"http\",\"system_app\":0}" \
-e --force-scopes
10 changes: 5 additions & 5 deletions examples/as_app/talk_bot/HOW_TO_INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
How To Install
==============

Currently, while AppEcosystem hasn't been published on the App Store, and App Store support hasn't been added yet,
Currently, while AppAPI hasn't been published on the App Store, and App Store support hasn't been added yet,
installation is a little bit tricky.

Steps to Install:

1. [Install AppEcosystem](https://cloud-py-api.github.io/app_ecosystem_v2/Installation.html)
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_ecosystem_v2/CreationOfDeployDaemon.html#create-deploy-daemon) of the Appecosystem
3. php occ app_ecosystem_v2:app:deploy talk_bot "daemon_deploy_name" \
1. [Install AppEcosystem](https://cloud-py-api.github.io/app_api/Installation.html)
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html#create-deploy-daemon) of the AppPI
3. php occ app_api:app:deploy talk_bot "daemon_deploy_name" \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

to deploy a docker image with Bot to docker.

4. php occ app_ecosystem_v2:app:register talk_bot "daemon_deploy_name" -e --force-scopes \
4. php occ app_api:app:register talk_bot "daemon_deploy_name" -e --force-scopes \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml

to call its **enable** handler and accept all required API scopes by default.
Expand Down
Loading