bcmd 0.6.18__tar.gz → 0.6.20__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.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

Files changed (41) hide show
  1. {bcmd-0.6.18 → bcmd-0.6.20}/PKG-INFO +2 -2
  2. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/docs.py +6 -13
  3. bcmd-0.6.20/bcmd/tasks/project.py +71 -0
  4. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/PKG-INFO +2 -2
  5. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/SOURCES.txt +1 -3
  6. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/requires.txt +1 -1
  7. {bcmd-0.6.18 → bcmd-0.6.20}/pyproject.toml +2 -2
  8. bcmd-0.6.18/bcmd/tasks/project.py +0 -34
  9. bcmd-0.6.18/bcmd/utils/utils.py +0 -9
  10. {bcmd-0.6.18 → bcmd-0.6.20}/MANIFEST.in +0 -0
  11. {bcmd-0.6.18 → bcmd-0.6.20}/README.md +0 -0
  12. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/__init__.py +0 -0
  13. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/common/__init__.py +0 -0
  14. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/common/func.py +0 -0
  15. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/common/secret.py +0 -0
  16. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/resources/project/main.py +0 -0
  17. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/__init__.py +0 -0
  18. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/bin.py +0 -0
  19. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/code.py +0 -0
  20. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/crypto.py +0 -0
  21. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/download.py +0 -0
  22. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/image.py +0 -0
  23. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/json.py +0 -0
  24. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/lib.py +0 -0
  25. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/math.py +0 -0
  26. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/mirror.py +0 -0
  27. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/pdf.py +0 -0
  28. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/proxy.py +0 -0
  29. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/time.py +0 -0
  30. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/upgrade.py +0 -0
  31. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/tasks/wasabi.py +0 -0
  32. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd/utils/__init__.py +0 -0
  33. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/dependency_links.txt +0 -0
  34. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/entry_points.txt +0 -0
  35. {bcmd-0.6.18 → bcmd-0.6.20}/bcmd.egg-info/top_level.txt +0 -0
  36. {bcmd-0.6.18 → bcmd-0.6.20}/setup.cfg +0 -0
  37. {bcmd-0.6.18 → bcmd-0.6.20}/test/__init__.py +0 -0
  38. {bcmd-0.6.18 → bcmd-0.6.20}/test/conftest.py +0 -0
  39. {bcmd-0.6.18 → bcmd-0.6.20}/test/test_pdf.py +0 -0
  40. {bcmd-0.6.18 → bcmd-0.6.20}/test/test_proxy.py +0 -0
  41. {bcmd-0.6.18 → bcmd-0.6.20}/test/test_wasabi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.18
3
+ Version: 0.6.20
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -8,7 +8,7 @@ Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
9
  Requires-Dist: aioconsole==0.8.1
10
10
  Requires-Dist: async-lru==2.0.5
11
- Requires-Dist: benimang==0.8.6
11
+ Requires-Dist: benimang==0.8.9
12
12
  Requires-Dist: cryptography==45.0.4
13
13
  Requires-Dist: nest-asyncio==1.6.0
14
14
  Requires-Dist: paramiko==3.5.1
@@ -1,5 +1,5 @@
1
- import asyncio
2
1
  import datetime
2
+ import json
3
3
  import pickle
4
4
  import tkinter as tk
5
5
  from contextlib import asynccontextmanager
@@ -14,8 +14,6 @@ from beni.bform import BForm
14
14
  from beni.bfunc import syncCall
15
15
  from typer import Argument
16
16
 
17
- from bcmd.utils.utils import decryptFileIgnoreError
18
-
19
17
  app: Final = btask.newSubApp('Vitepress 网站相关')
20
18
  conf: dict[str, Any] = {}
21
19
  isUpload: bool = False
@@ -90,7 +88,7 @@ async def userInput():
90
88
  def onBtn(self):
91
89
  password = self.varPassword.get()
92
90
  try:
93
- conf['server_info'] = bcrypto.decryptJson(conf['server_info'], password)
91
+ bcrypto.decryptJson(conf['server_info'], password)
94
92
  self.destroy()
95
93
  except:
96
94
  messagebox.showerror('密码错误', '密码错误,请重新输入')
@@ -103,12 +101,10 @@ async def userInput():
103
101
  btask.abort('用户取消操作')
104
102
  isUpload, password = result
105
103
 
106
- # 配置里面每个字段都尝试解密(实际效率较低但不影响使用)
104
+ # 将里面加密的内容解密
107
105
  for k, v in conf.items():
108
- try:
106
+ if str(v).startswith(bcrypto.FLAG):
109
107
  conf[k] = bcrypto.decryptText(v, password)
110
- except:
111
- pass
112
108
 
113
109
 
114
110
  async def vitepressBuild(outputPath: Path):
@@ -131,7 +127,6 @@ async def makeDeploy(outputPath: Path):
131
127
 
132
128
  # 文件名以及内容调整
133
129
  fileList = bpath.listFile(outputPath, True)
134
- await asyncio.gather(*[decryptFileIgnoreError(x, password) for x in fileList])
135
130
  for file in fileList:
136
131
 
137
132
  # 替换文件名
@@ -145,10 +140,8 @@ async def makeDeploy(outputPath: Path):
145
140
  # 替换文件内容
146
141
  content = await bfile.readText(file)
147
142
  oldContent = content
148
- try:
143
+ if content.startswith(bcrypto.FLAG):
149
144
  content = bcrypto.decryptText(content, password)
150
- except:
151
- pass
152
145
  for k, v in dataDict.items():
153
146
  content = content.replace(f'{{{k}}}', str(v))
154
147
  if oldContent != content:
@@ -168,7 +161,7 @@ async def sshClient():
168
161
  with bpath.useTempFile() as tempFile:
169
162
  await bfile.writeText(tempFile, conf['server_key'])
170
163
  client.connect(
171
- **conf['server_info'],
164
+ **json.loads(conf['server_info']),
172
165
  key_filename=str(tempFile),
173
166
  )
174
167
  yield client
@@ -0,0 +1,71 @@
1
+ import getpass
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Final
5
+
6
+ from beni import bcolor, bcrypto, bexecute, bfile, bpath, btask
7
+ from beni.bfunc import syncCall
8
+ from typer import Argument, Option
9
+
10
+ app: Final = btask.newSubApp('项目相关')
11
+
12
+
13
+ @app.command()
14
+ @syncCall
15
+ async def init(
16
+ path: Path = Argument(Path.cwd(), help='workspace 路径'),
17
+ deep: int = Option(3, '--deep', '-d', help='探索深度'),
18
+ ):
19
+ '找出项目执行初始化 pnpm install 和 uv sync --all-extras'
20
+
21
+ initSubFolder(path, deep)
22
+
23
+
24
+ @app.command()
25
+ @syncCall
26
+ async def https_cert(
27
+ path: Path = Argument(Path.cwd(), help='https证书路径'),
28
+ no_commit: bool = Option(False, '--no-commit', help='不执行提交操作'),
29
+ ):
30
+ '更新 https 证书,将证书文件加密并且改名为 {domain}.key 或 {domain}.pem,将下载下来的文件直接放到目录后执行'
31
+ fileList = list(path.glob('**/*.key')) + list(path.glob('**/*.pem'))
32
+ fileList = list(filter(lambda x: x.stem != '{domain}', fileList))
33
+ btask.assertTrue(fileList, '没有找到需要处理的证书文件')
34
+
35
+ # 处理密码输入
36
+ while True:
37
+ password = getpass.getpass('请输入密码:')
38
+ if not password:
39
+ continue
40
+ repassword = getpass.getpass('请重复输入密码:')
41
+ if password == repassword:
42
+ break
43
+ else:
44
+ bcolor.printRed('两次密码输入不一样')
45
+
46
+ # 文件加密处理
47
+ for file in fileList:
48
+ content = await bfile.readText(file)
49
+ content = bcrypto.encryptText(content, password)
50
+ toFile = file.parent / f'{{domain}}{file.suffix}'
51
+ bcolor.printGreen('更新文件', toFile)
52
+ await bfile.writeText(toFile, content)
53
+ bcolor.printYellow('删除文件', file)
54
+ bpath.remove(file)
55
+
56
+ if not no_commit:
57
+ await bexecute.run(f'TortoiseGitProc.exe /command:commit /path:{path}/ /logmsg:"更新https证书文件"')
58
+
59
+
60
+ def initSubFolder(path: Path, deep: int):
61
+ uvLockFile = path / 'uv.lock'
62
+ pnpmLockFile = path / 'pnpm-lock.yaml'
63
+ if uvLockFile.exists():
64
+ with bpath.changePath(path):
65
+ os.system('uv sync --all-extras')
66
+ elif pnpmLockFile.exists():
67
+ with bpath.changePath(path):
68
+ os.system('pnpm install')
69
+ elif deep > 1:
70
+ for subPath in bpath.listDir(path):
71
+ initSubFolder(subPath, deep - 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.18
3
+ Version: 0.6.20
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -8,7 +8,7 @@ Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
9
  Requires-Dist: aioconsole==0.8.1
10
10
  Requires-Dist: async-lru==2.0.5
11
- Requires-Dist: benimang==0.8.6
11
+ Requires-Dist: benimang==0.8.9
12
12
  Requires-Dist: cryptography==45.0.4
13
13
  Requires-Dist: nest-asyncio==1.6.0
14
14
  Requires-Dist: paramiko==3.5.1
@@ -24,7 +24,6 @@ pyproject.toml
24
24
  ./bcmd/tasks/upgrade.py
25
25
  ./bcmd/tasks/wasabi.py
26
26
  ./bcmd/utils/__init__.py
27
- ./bcmd/utils/utils.py
28
27
  ./test/__init__.py
29
28
  ./test/conftest.py
30
29
  ./test/test_pdf.py
@@ -58,5 +57,4 @@ bcmd/tasks/proxy.py
58
57
  bcmd/tasks/time.py
59
58
  bcmd/tasks/upgrade.py
60
59
  bcmd/tasks/wasabi.py
61
- bcmd/utils/__init__.py
62
- bcmd/utils/utils.py
60
+ bcmd/utils/__init__.py
@@ -1,6 +1,6 @@
1
1
  aioconsole==0.8.1
2
2
  async-lru==2.0.5
3
- benimang==0.8.6
3
+ benimang==0.8.9
4
4
  cryptography==45.0.4
5
5
  nest-asyncio==1.6.0
6
6
  paramiko==3.5.1
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.6.18'
6
+ version = '0.6.20'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
@@ -13,7 +13,7 @@ maintainers = [{ name = 'Beni Mang', email = 'benimang@126.com' }]
13
13
  dependencies = [
14
14
  "aioconsole==0.8.1",
15
15
  "async-lru==2.0.5",
16
- "benimang==0.8.6",
16
+ "benimang==0.8.9",
17
17
  "cryptography==45.0.4",
18
18
  "nest-asyncio==1.6.0",
19
19
  "paramiko==3.5.1",
@@ -1,34 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Final
4
-
5
- from beni import btask, bpath
6
- from beni.bfunc import syncCall
7
- from typer import Argument, Option
8
-
9
- app: Final = btask.newSubApp('项目相关')
10
-
11
-
12
- @app.command()
13
- @syncCall
14
- async def init(
15
- path: Path = Argument(Path.cwd(), help='workspace 路径'),
16
- deep: int = Option(3, '--deep', '-d', help='探索深度'),
17
- ):
18
- '找出项目执行初始化 pnpm install 和 uv sync --all-extras'
19
-
20
- initSubFolder(path, deep)
21
-
22
-
23
- def initSubFolder(path: Path, deep: int):
24
- uvLockFile = path / 'uv.lock'
25
- pnpmLockFile = path / 'pnpm-lock.yaml'
26
- if uvLockFile.exists():
27
- with bpath.changePath(path):
28
- os.system('uv sync --all-extras')
29
- elif pnpmLockFile.exists():
30
- with bpath.changePath(path):
31
- os.system('pnpm install')
32
- elif deep > 1:
33
- for subPath in bpath.listDir(path):
34
- initSubFolder(subPath, deep - 1)
@@ -1,9 +0,0 @@
1
- from beni import bcrypto
2
- from beni.btype import XPath
3
-
4
-
5
- async def decryptFileIgnoreError(file: XPath, password: str):
6
- try:
7
- await bcrypto.decryptFile(file, password)
8
- except:
9
- pass
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes