Skip to content

Commit 3974f73

Browse files
committed
初步适配trilium next
1 parent 2229f6f commit 3974f73

7 files changed

+216
-3041
lines changed

1.init.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
VERSION_INFO_OVERRIDE_BETA,
1616
force_version_info_beta,
1717
)
18+
import zipfile
1819

1920
# disable warning if we use proxy
2021
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
2122

2223

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'
2526
# 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'
2829

2930
CMD_STOP_SERVICE = """pkill -9 trilium"""
3031

@@ -84,8 +85,8 @@ def backup_old_service():
8485
os.mkdir(backup_dir)
8586

8687
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}"')
8990

9091

9192
def download_file(url, file_name=None):
@@ -110,9 +111,9 @@ def stop_service():
110111

111112

112113
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/')
116117

117118

118119
def decompress_package(file_name):
@@ -125,6 +126,8 @@ def decompress_package(file_name):
125126
os.system(f'tar -xf {file_name[:-3]}')
126127
if DO_DELETE:
127128
os.system(f'rm -f {file_name[:-3]}')
129+
if file_name.endswith('.zip'):
130+
decompress_source_package(file_name)
128131

129132

130133
def decompress_source_package(file_name):

0 commit comments

Comments
 (0)