15
15
VERSION_INFO_OVERRIDE_BETA ,
16
16
force_version_info_beta ,
17
17
)
18
+ import zipfile
18
19
19
20
# disable warning if we use proxy
20
21
urllib3 .disable_warnings (urllib3 .exceptions .InsecureRequestWarning )
21
22
22
23
23
- CLIENT_FOLDER = BASE_FOLDER + 'trilium -linux-x64'
24
- REPO_NAME = 'zadam/trilium '
24
+ CLIENT_FOLDER = BASE_FOLDER + 'TriliumNext Notes -linux-x64'
25
+ REPO_NAME = 'TriliumNext/Notes '
25
26
# regex match which file to download if multiple files exists
26
- PREFERRED_RELEASE_NAME_PATTERN = 'trilium- linux-x64-.*?.tar.xz '
27
- SOURCE_CODE_NAME_PATTERN = 'trilium- linux-x64-.*?.tar.xz '
27
+ PREFERRED_RELEASE_NAME_PATTERN = 'TriliumNextNotes-.*?- linux-x64.zip '
28
+ SOURCE_CODE_NAME_PATTERN = 'TriliumNextNotes-.*?- linux-x64.zip '
28
29
29
30
CMD_STOP_SERVICE = """pkill -9 trilium"""
30
31
@@ -84,8 +85,8 @@ def backup_old_service():
84
85
os .mkdir (backup_dir )
85
86
86
87
if os .path .exists (CLIENT_FOLDER ):
87
- os .system (f'mv { CLIENT_FOLDER } { CLIENT_FOLDER } { backup_suffix } ' )
88
- print (f'old version is moved to { CLIENT_FOLDER } { backup_suffix } ' )
88
+ os .system (f'mv " { CLIENT_FOLDER } " " { CLIENT_FOLDER } { backup_suffix } " ' )
89
+ print (f'old version is moved to " { CLIENT_FOLDER } { backup_suffix } " ' )
89
90
90
91
91
92
def download_file (url , file_name = None ):
@@ -110,9 +111,9 @@ def stop_service():
110
111
111
112
112
113
def clean_cache ():
113
- os .system ('rm -rf ~/.config/Trilium Notes/Cache/' )
114
- os .system ('rm -rf ~/.config/Trilium Notes/Code Cache/' )
115
- os .system ('rm -rf ~/.config/Trilium Notes/GPUCache/' )
114
+ os .system ('rm -rf ~/.config/TriliumNext Notes/Cache/' )
115
+ os .system ('rm -rf ~/.config/TriliumNext Notes/Code Cache/' )
116
+ os .system ('rm -rf ~/.config/TriliumNext Notes/GPUCache/' )
116
117
117
118
118
119
def decompress_package (file_name ):
@@ -125,6 +126,8 @@ def decompress_package(file_name):
125
126
os .system (f'tar -xf { file_name [:- 3 ]} ' )
126
127
if DO_DELETE :
127
128
os .system (f'rm -f { file_name [:- 3 ]} ' )
129
+ if file_name .endswith ('.zip' ):
130
+ decompress_source_package (file_name )
128
131
129
132
130
133
def decompress_source_package (file_name ):
0 commit comments