File tree Expand file tree Collapse file tree 18 files changed +78
-28
lines changed Expand file tree Collapse file tree 18 files changed +78
-28
lines changed Original file line number Diff line number Diff line change 2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+ ## [ 0.3.0 - 2023-09-28]
6
+
7
+ ### Added
8
+
9
+ - NextcloudApp: The ` ex_app.verify_version ` function to simply check whether the application has been updated.
10
+
11
+ ### Changed
12
+
13
+ - NextcloudApp: Updated ` info.xml ` in examples to reflect upcoming changes in the [ AppStore] ( https://github.com/nextcloud/appstore/pull/1145 )
14
+
5
15
## [ 0.2.2 - 2023-09-26]
6
16
7
17
### Added
Original file line number Diff line number Diff line change 1
1
.. py :currentmodule :: nc_py_api.ex_app
2
2
3
- External Application
4
- ====================
3
+ AppAPI Application
4
+ ==================
5
5
6
6
Constants
7
7
---------
@@ -17,6 +17,8 @@ Special functions
17
17
18
18
.. autofunction :: persistent_storage
19
19
20
+ .. autofunction :: verify_version
21
+
20
22
User Interface(UI)
21
23
------------------
22
24
@@ -26,7 +28,7 @@ UI methods should be accessed with the help of :class:`~nc_py_api.nextcloud.Next
26
28
27
29
# this is an example, in most cases you will get `NextcloudApp` class instance as input param.
28
30
nc = NextcloudApp()
29
- nc.ui.files_dropdown_menu.register(... )
31
+ nc.ex_app. ui.files_dropdown_menu.register(... )
30
32
31
33
.. autoclass :: nc_py_api.ex_app.ui.ui.UiApi
32
34
:members:
Original file line number Diff line number Diff line change 3
3
Nextcloud
4
4
=========
5
5
6
- Two base classes for working with NextCloud . The first for working as a client, the second as an application.
6
+ Two base classes for working with Nextcloud . The first for working as a client, the second as an application.
7
7
8
8
All required functionality is incorporated in them, they contains all other classes required to work with the Nextcloud.
9
9
Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ Reference
5
5
:maxdepth: 2
6
6
7
7
Nextcloud
8
+ ExApp
8
9
Apps
9
10
ActivityApp
10
11
Files/index.rst
11
12
Users/index.rst
12
- ExApp
13
13
Exceptions
14
14
Talk
15
15
TalkBot
Original file line number Diff line number Diff line change 18
18
<dependencies >
19
19
<nextcloud min-version =" 27" max-version =" 28" />
20
20
</dependencies >
21
- <ex -app >
21
+ <external -app >
22
22
<docker-install >
23
23
<registry >ghcr.io</registry >
24
24
<image >cloud-py-api/skeleton</image >
31
31
</optional >
32
32
</scopes >
33
33
<protocol >http</protocol >
34
- <system >0 </system >
35
- </ex -app >
34
+ <system >false </system >
35
+ </external -app >
36
36
</info >
Original file line number Diff line number Diff line change 1
- nc_py_api [app ]>= 0.2 .0
1
+ nc_py_api [app ]>= 0.3 .0
Original file line number Diff line number Diff line change 18
18
<dependencies >
19
19
<nextcloud min-version =" 27" max-version =" 28" />
20
20
</dependencies >
21
- <ex -app >
21
+ <external -app >
22
22
<docker-install >
23
23
<registry >ghcr.io</registry >
24
24
<image >cloud-py-api/talk_bot</image >
33
33
</optional >
34
34
</scopes >
35
35
<protocol >http</protocol >
36
- <system >0 </system >
37
- </ex -app >
36
+ <system >false </system >
37
+ </external -app >
38
38
</info >
Original file line number Diff line number Diff line change 1
- nc_py_api [app ]>= 0.2 .0
1
+ nc_py_api [app ]>= 0.3 .0
Original file line number Diff line number Diff line change 18
18
<dependencies >
19
19
<nextcloud min-version =" 27" max-version =" 28" />
20
20
</dependencies >
21
- <ex -app >
21
+ <external -app >
22
22
<docker-install >
23
23
<registry >ghcr.io</registry >
24
24
<image >cloud-py-api/talk_bot_ai</image >
33
33
</optional >
34
34
</scopes >
35
35
<protocol >http</protocol >
36
- <system >0 </system >
37
- </ex -app >
36
+ <system >false </system >
37
+ </external -app >
38
38
</info >
Original file line number Diff line number Diff line change 1
- nc_py_api [app ]>= 0.2.1
1
+ nc_py_api [app ]>= 0.3.0
2
2
transformers >= 4.33
3
3
torch
4
4
torchvision
Original file line number Diff line number Diff line change 18
18
<dependencies >
19
19
<nextcloud min-version =" 27" max-version =" 28" />
20
20
</dependencies >
21
- <ex -app >
21
+ <external -app >
22
22
<docker-install >
23
23
<registry >ghcr.io</registry >
24
24
<image >cloud-py-api/talk_bot_multi</image >
33
33
</optional >
34
34
</scopes >
35
35
<protocol >http</protocol >
36
- <system >0 </system >
37
- </ex -app >
36
+ <system >false </system >
37
+ </external -app >
38
38
</info >
Original file line number Diff line number Diff line change 1
- nc_py_api [app ]>= 0.2 .0
1
+ nc_py_api [app ]>= 0.3 .0
Original file line number Diff line number Diff line change 18
18
<dependencies >
19
19
<nextcloud min-version =" 27" max-version =" 28" />
20
20
</dependencies >
21
- <ex -app >
21
+ <external -app >
22
22
<docker-install >
23
23
<registry >ghcr.io</registry >
24
24
<image >cloud-py-api/to_gif</image >
33
33
</optional >
34
34
</scopes >
35
35
<protocol >http</protocol >
36
- <system >0 </system >
37
- </ex -app >
36
+ <system >false </system >
37
+ </external -app >
38
38
</info >
Original file line number Diff line number Diff line change 1
- nc_py_api [app ]>= 0.2 .0
1
+ nc_py_api [app ]>= 0.3 .0
2
2
pygifsicle
3
3
imageio
4
4
opencv-python
Original file line number Diff line number Diff line change 1
1
"""Version of nc_py_api."""
2
2
3
- __version__ = "0.2.2 "
3
+ __version__ = "0.3.0.dev0 "
Original file line number Diff line number Diff line change 1
1
"""All possible ExApp stuff for NextcloudApp that can be used."""
2
2
from .defs import ApiScope , LogLvl
3
3
from .integration_fastapi import nc_app , set_handlers , talk_bot_app
4
- from .misc import persistent_storage
4
+ from .misc import persistent_storage , verify_version
5
5
from .ui .files import UiActionFileInfo , UiFileActionHandlerInfo
6
6
from .uvicorn_fastapi import run_app
Original file line number Diff line number Diff line change 1
1
"""Different miscellaneous optimization/helper functions for the Nextcloud Applications."""
2
2
3
3
import os
4
+ import typing
4
5
from sys import platform
5
6
6
7
@@ -23,3 +24,23 @@ def _get_app_cache_dir() -> str:
23
24
r = os .path .join (root_cache_path , os .environ ["APP_ID" ])
24
25
os .makedirs (r , exist_ok = True )
25
26
return r
27
+
28
+
29
+ def verify_version (finalize_update : bool = True ) -> typing .Optional [tuple [str , str ]]:
30
+ """Returns tuple with an old version and new version or ``None`` if there was no update taken.
31
+
32
+ :param finalize_update: Flag indicating whether update information should be updated.
33
+ If ``True``, all subsequent calls to this function will return that there is no update.
34
+ """
35
+ version_file_path = os .path .join (persistent_storage (), "_version.info" )
36
+ r = None
37
+ with open (version_file_path , "a+t" , encoding = "UTF-8" ) as version_file :
38
+ version_file .seek (0 )
39
+ old_version = version_file .read ()
40
+ if old_version != os .environ ["APP_VERSION" ]:
41
+ r = (old_version , os .environ ["APP_VERSION" ])
42
+ if finalize_update :
43
+ version_file .seek (0 )
44
+ version_file .write (os .environ ["APP_VERSION" ])
45
+ version_file .truncate ()
46
+ return r
Original file line number Diff line number Diff line change 3
3
4
4
import pytest
5
5
6
- from nc_py_api import NextcloudException
6
+ from nc_py_api import NextcloudException , ex_app
7
7
from nc_py_api ._deffered_error import DeferredError # noqa
8
8
from nc_py_api ._exceptions import check_error # noqa
9
9
from nc_py_api ._misc import nc_iso_time_to_datetime , require_capabilities # noqa
@@ -74,3 +74,20 @@ def test_persist_transformers_cache(nc_app):
74
74
from nc_py_api .ex_app import persist_transformers_cache # noqa
75
75
76
76
assert os .environ ["TRANSFORMERS_CACHE" ]
77
+ os .environ .pop ("TRANSFORMERS_CACHE" )
78
+
79
+
80
+ def test_verify_version (nc_app ):
81
+ version_file_path = os .path .join (ex_app .persistent_storage (), "_version.info" )
82
+ if os .path .exists (version_file_path ):
83
+ os .remove (version_file_path )
84
+ r = ex_app .verify_version (False )
85
+ assert not os .path .getsize (version_file_path )
86
+ assert isinstance (r , tuple )
87
+ assert r [0 ] == ""
88
+ assert r [1 ] == os .environ ["APP_VERSION" ]
89
+ r = ex_app .verify_version (True )
90
+ assert os .path .getsize (version_file_path )
91
+ assert r [0 ] == ""
92
+ assert r [1 ] == os .environ ["APP_VERSION" ]
93
+ assert ex_app .verify_version () is None
You can’t perform that action at this time.
0 commit comments