ryry-cli 5.4__tar.gz → 6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {ryry_cli-5.4/ryry_cli.egg-info → ryry_cli-6.0}/PKG-INFO +1 -1
  2. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/constant.py +2 -2
  3. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/main.py +32 -6
  4. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/ryry_webapi.py +3 -1
  5. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/ryry_widget.py +37 -10
  6. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/server_func.py +1 -0
  7. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/store.py +25 -2
  8. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/task.py +1 -1
  9. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/taskUtils.py +11 -3
  10. {ryry_cli-5.4 → ryry_cli-6.0/ryry_cli.egg-info}/PKG-INFO +1 -1
  11. {ryry_cli-5.4 → ryry_cli-6.0}/setup.py +1 -1
  12. {ryry_cli-5.4 → ryry_cli-6.0}/LICENSE +0 -0
  13. {ryry_cli-5.4 → ryry_cli-6.0}/README.md +0 -0
  14. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/__init__.py +0 -0
  15. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/daemon_base.py +0 -0
  16. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/daemon_manager.py +0 -0
  17. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/proxy_manager.py +0 -0
  18. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/ryry_server_socket.py +0 -0
  19. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/ryry_service.py +0 -0
  20. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/script_template/__init__.py +0 -0
  21. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/script_template/daemon.py +0 -0
  22. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/script_template/main.py +0 -0
  23. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/script_template/run.py +0 -0
  24. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/shared_memory.py +0 -0
  25. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/upload.py +0 -0
  26. {ryry_cli-5.4 → ryry_cli-6.0}/ryry/utils.py +0 -0
  27. {ryry_cli-5.4 → ryry_cli-6.0}/ryry_cli.egg-info/SOURCES.txt +0 -0
  28. {ryry_cli-5.4 → ryry_cli-6.0}/ryry_cli.egg-info/dependency_links.txt +0 -0
  29. {ryry_cli-5.4 → ryry_cli-6.0}/ryry_cli.egg-info/entry_points.txt +0 -0
  30. {ryry_cli-5.4 → ryry_cli-6.0}/ryry_cli.egg-info/requires.txt +0 -0
  31. {ryry_cli-5.4 → ryry_cli-6.0}/ryry_cli.egg-info/top_level.txt +0 -0
  32. {ryry_cli-5.4 → ryry_cli-6.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 5.4
3
+ Version: 6.0
4
4
  Summary: ryry tools
5
5
  Home-page: https://github.com/dalipenMedia
6
6
  Author: dalipen
@@ -1,6 +1,6 @@
1
1
  #!!!!! do not change this file !!!!!
2
- app_version="5.4"
3
- app_bulld_anchor="Noh_2025-09-28 22:05:40.262632"
2
+ app_version="6.0"
3
+ app_bulld_anchor="Noh_2025-11-13 15:57:58.455550"
4
4
  app_name="ryry-cli"
5
5
  import sys, os
6
6
  if getattr(sys, 'frozen', False):
@@ -8,6 +8,14 @@ from ryry import utils
8
8
  from ryry import taskUtils
9
9
  from ryry import proxy_manager
10
10
 
11
+ # 获取版本信息的兼容函数
12
+ def get_version():
13
+ try:
14
+ from importlib.metadata import version
15
+ return version("ryry-cli")
16
+ except ImportError:
17
+ from importlib_metadata import version
18
+ return version("ryry-cli")
11
19
  ll = 29
12
20
  def scr_str(s):
13
21
  return "| " + s + " |"
@@ -161,8 +169,7 @@ def widget_status(stdscr, idx):
161
169
  return idx
162
170
 
163
171
  def status():
164
- from pkg_resources import parse_version, get_distribution
165
- ver = get_distribution("ryry-cli").version
172
+ ver = get_version()
166
173
  deviceid = utils.generate_unique_id()
167
174
  import socket
168
175
  machine_name = socket.gethostname()
@@ -329,10 +336,6 @@ def get_widget_config_from_path(main_path):
329
336
  pass
330
337
  return None
331
338
 
332
-
333
-
334
-
335
-
336
339
  def widget():
337
340
  if len(sys.argv) <= 2:
338
341
  print('please set command! Usage: ryry widget [init|publish|list|add|remove|enable|disable|install]')
@@ -397,6 +400,23 @@ def widget():
397
400
  else:
398
401
  print("Unknown command:", command)
399
402
 
403
+ def token():
404
+ if len(sys.argv) <= 2:
405
+ print('please set command! Usage: ryry token [set/get]')
406
+ return
407
+
408
+ command = sys.argv[2]
409
+ if command == 'set':
410
+ user_token = sys.argv[3]
411
+ store.save_authorization(user_token)
412
+ print("✅ token saved")
413
+ elif command == 'get':
414
+ user_token, author = store.get_token_and_authorization()
415
+ print(f"Usertoken: {user_token}")
416
+ print(f"Authorization: {author}")
417
+ else:
418
+ print("Unknown command:", command)
419
+
400
420
  def proxy():
401
421
  """代理管理功能"""
402
422
  if len(sys.argv) <= 2:
@@ -447,6 +467,10 @@ def main():
447
467
  if len(sys.argv) >= 2:
448
468
  module = sys.argv[1]
449
469
  if module == "widget":
470
+ _, author = store.get_token_and_authorization()
471
+ if not author or len(author) < 3:
472
+ print("❌ token not found, please set token first")
473
+ sys.exit(0)
450
474
  widget()
451
475
  elif module == "service":
452
476
  service()
@@ -454,6 +478,8 @@ def main():
454
478
  status()
455
479
  elif module == "proxy":
456
480
  proxy()
481
+ elif module == "token":
482
+ token()
457
483
  else:
458
484
  print(f"Unknown command:{module}")
459
485
  sys.exit(0)
@@ -9,10 +9,12 @@ from urllib.parse import urlparse, urlunparse
9
9
 
10
10
  from ryry import store, utils, taskUtils, constant, task
11
11
 
12
+ user_token, author = store.get_token_and_authorization()
12
13
  def _domain_post(func, params, files={}, timeout=10, domain="api.dalipen.com"):
13
14
  headers = {
14
15
  'Connection': 'close',
15
- 'Usertoken': "0cce7cfe3629e16ee9b3ea8563305d3a15c524804da1861db07c2c867d79da63"
16
+ 'Usertoken': user_token,
17
+ 'Authorization': f"Bearer {author}"
16
18
  }
17
19
  url = f"https://{domain}/{func}"
18
20
  try:
@@ -1,11 +1,38 @@
1
- import os, json,sys,shutil,zipfile,pkg_resources,threading,time,requests
1
+ import os, json,sys,shutil,zipfile,threading,time,requests
2
2
  import random, uuid, re, subprocess, platform, zipfile
3
- from pkg_resources import get_distribution
4
3
  import socket
5
4
 
6
5
  from pathlib import Path
7
6
  from ryry import store, ryry_webapi, upload, taskUtils, utils, constant
8
7
 
8
+ # 获取版本信息的兼容函数
9
+ def get_version():
10
+ try:
11
+ from importlib.metadata import version
12
+ return version("ryry-cli")
13
+ except ImportError:
14
+ from importlib_metadata import version
15
+ return version("ryry-cli")
16
+
17
+ # 获取包信息的兼容函数
18
+ def get_package_info(package_name):
19
+ try:
20
+ from importlib.metadata import distribution
21
+ dist = distribution(package_name)
22
+ return {
23
+ 'version': dist.version,
24
+ 'project_name': dist.metadata['Name'],
25
+ 'location': dist.locate_file('')
26
+ }
27
+ except ImportError:
28
+ from importlib_metadata import distribution
29
+ dist = distribution(package_name)
30
+ return {
31
+ 'version': dist.version,
32
+ 'project_name': dist.metadata['Name'],
33
+ 'location': dist.locate_file('')
34
+ }
35
+
9
36
  def compare_versions(version1, version2):
10
37
  if len(version1) <= 0:
11
38
  version1 = "0"
@@ -127,11 +154,11 @@ def addWidgetToEnv(name_or_root, mute=False):
127
154
  #maybe pip package
128
155
  root = ""
129
156
  try:
130
- package = pkg_resources.get_distribution(name_or_root)
131
- local_version = package.version
132
- name = package.project_name
133
- version = package.version
134
- root = os.path.join(package.location, name.replace("-", "_"))
157
+ package_info = get_package_info(name_or_root)
158
+ local_version = package_info['version']
159
+ name = package_info['project_name']
160
+ version = package_info['version']
161
+ root = os.path.join(package_info['location'], name.replace("-", "_"))
135
162
  except:
136
163
  pass
137
164
 
@@ -262,7 +289,7 @@ def publishWidget(package_folder):
262
289
  def widgetUpdateNotify(widgetName, oldver, newver):
263
290
  device_id = utils.generate_unique_id()
264
291
  machine_name = socket.gethostname()
265
- ver = get_distribution("ryry-cli").version
292
+ ver = get_version()
266
293
  taskUtils.notifyWechatRobot({
267
294
  "msgtype": "text",
268
295
  "text": {
@@ -273,7 +300,7 @@ def widgetUpdateNotify(widgetName, oldver, newver):
273
300
  def widgetUninstallNotify(widgetName, newver):
274
301
  device_id = utils.generate_unique_id()
275
302
  machine_name = socket.gethostname()
276
- ver = get_distribution("ryry-cli").version
303
+ ver = get_version()
277
304
  taskUtils.notifyWechatRobot({
278
305
  "msgtype": "text",
279
306
  "text": {
@@ -284,7 +311,7 @@ def widgetUninstallNotify(widgetName, newver):
284
311
  def widgetInstallNotify(widgetName, newver):
285
312
  device_id = utils.generate_unique_id()
286
313
  machine_name = socket.gethostname()
287
- ver = get_distribution("ryry-cli").version
314
+ ver = get_version()
288
315
  taskUtils.notifyWechatRobot({
289
316
  "msgtype": "text",
290
317
  "text": {
@@ -49,6 +49,7 @@ class TaskThread(Thread):
49
49
  self.checkUUID = "local_" + ''.join(str(uuid.uuid4()).split('-'))
50
50
  self.params["task_id"] = self.checkUUID
51
51
  executeSuccess, result_obj = task.executeLocalPython(self.checkUUID, cmd, self.params, self.timeout)
52
+ print(f"============={result_obj}")
52
53
  if executeSuccess and result_obj["status"] == 0:
53
54
  self.call_back(self.idx, result_obj["result"])
54
55
  return
@@ -155,7 +155,7 @@ def extend():
155
155
  _genExtend()
156
156
  elif read_data["extend"].get("device_id", "") != read_data.get("deviceInfo", {}).get("device_id", ""):
157
157
  _genExtend()
158
- elif read_data["extend"].get("app", "") == "ryry-cli 5.4":
158
+ elif read_data["extend"].get("app", "") == "ryry-cli 6.0":
159
159
  _genExtend()
160
160
  else:
161
161
  _genExtend()
@@ -207,4 +207,27 @@ def save_multithread(n):
207
207
  with open(file, 'w', encoding='utf-8') as f:
208
208
  f.write(str(n))
209
209
  except:
210
- pass
210
+ pass
211
+
212
+ def get_token_and_authorization():
213
+ sp = Store()
214
+ read_data = sp.read()
215
+ author = "0ca0a929bfcb36faea0638bf991320972cac412d14c56aa9794c047441b671c4"
216
+ usertoken = ""
217
+ if "Authorization" in read_data:
218
+ author = read_data["Authorization"]
219
+ if "Usertoken" in read_data:
220
+ usertoken = read_data["Usertoken"]
221
+ return usertoken, author
222
+
223
+ def save_authorization(author):
224
+ sp = Store()
225
+ read_data = sp.read()
226
+ read_data["Authorization"] = author
227
+ sp.write(read_data)
228
+
229
+ def save_user_token(user_token):
230
+ sp = Store()
231
+ read_data = sp.read()
232
+ read_data["Authorization"] = user_token
233
+ sp.write(read_data)
@@ -188,7 +188,7 @@ def executeLocalPython(taskUUID, cmd, param, timeout=3600):
188
188
  }
189
189
  executeSuccess = False
190
190
  command = [sys.executable, cmd, "--run", inputArgs, "--out", outArgs]
191
- taskUtils.taskPrint(taskUUID, f"{current_thread().name}=== exec => {command}")
191
+ taskUtils.taskPrint(taskUUID, f"{current_thread().name}=== exec => {command} params => {json.dumps(param, ensure_ascii=False)}")
192
192
  process = None
193
193
  try:
194
194
  if timeout == 0:
@@ -9,7 +9,15 @@ import base64
9
9
  import calendar, time
10
10
  import hashlib
11
11
  from ryry import utils, constant
12
- from pkg_resources import get_distribution
12
+
13
+ # 获取版本信息的兼容函数
14
+ def get_version():
15
+ try:
16
+ from importlib.metadata import version
17
+ return version("ryry-cli")
18
+ except ImportError:
19
+ from importlib_metadata import version
20
+ return version("ryry-cli")
13
21
 
14
22
  task_config_file = os.path.join(constant.base_path, f"task_config.txt")
15
23
  def taskInfoWithFirstTask():
@@ -155,7 +163,7 @@ def idlingNotify(cnt):
155
163
  def onlineNotify():
156
164
  device_id = utils.generate_unique_id()
157
165
  machine_name = socket.gethostname()
158
- ver = get_distribution("ryry-cli").version
166
+ ver = get_version()
159
167
  notifyWechatRobot({
160
168
  "msgtype": "text",
161
169
  "text": {
@@ -176,7 +184,7 @@ def restartNotify(msg):
176
184
  def offlineNotify():
177
185
  device_id = utils.generate_unique_id()
178
186
  machine_name = socket.gethostname()
179
- ver = get_distribution("ryry-cli").version
187
+ ver = get_version()
180
188
  notifyWechatRobot({
181
189
  "msgtype": "text",
182
190
  "text": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 5.4
3
+ Version: 6.0
4
4
  Summary: ryry tools
5
5
  Home-page: https://github.com/dalipenMedia
6
6
  Author: dalipen
@@ -3,7 +3,7 @@ import os
3
3
  import subprocess
4
4
  import datetime
5
5
 
6
- ryry_version = "5.4"
6
+ ryry_version = "6.0"
7
7
  cur_dir = os.path.dirname(os.path.abspath(__file__))
8
8
  constanspy = os.path.join(cur_dir, "ryry", "constant.py")
9
9
  try:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes