@hupan56/wlkj 3.1.5 → 3.1.6
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.
package/package.json
CHANGED
|
@@ -28,14 +28,20 @@ import sys
|
|
|
28
28
|
|
|
29
29
|
__all__ = ["get_developer", "auth_file", "get_token", "MEMBER_DIR"]
|
|
30
30
|
|
|
31
|
-
#
|
|
32
|
-
try
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
# v3.x: 统一用 foundation.core.paths (旧代码 from .paths / from paths 都不存在,
|
|
32
|
+
# 只因外层 try/except 兜底才没崩, 但 autotest_run 用 `from test.autotest_auth`
|
|
33
|
+
# 时相对导入失败 → 整个模块导入失败 → 单一真源形同虚设)。
|
|
34
|
+
# 路径自举: 找到 foundation/bootstrap.py 并 setup()
|
|
35
|
+
_COMMON_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
36
|
+
_f = _COMMON_DIR
|
|
37
|
+
for _ in range(10):
|
|
38
|
+
_f = os.path.dirname(_f)
|
|
39
|
+
_cp = os.path.join(_f, 'foundation')
|
|
40
|
+
if os.path.isfile(os.path.join(_cp, 'bootstrap.py')):
|
|
41
|
+
break
|
|
42
|
+
if _cp not in sys.path:
|
|
43
|
+
sys.path.insert(0, _f) # scripts/ 根, 让 foundation.* 可 import
|
|
44
|
+
from foundation.core.paths import get_repo_root, get_private_file # noqa: E402
|
|
39
45
|
|
|
40
46
|
|
|
41
47
|
def get_developer() -> str:
|
|
@@ -59,7 +65,6 @@ MEMBER_DIR = _member_dir # 模块级便捷别名 (首次 import 时解析)
|
|
|
59
65
|
def auth_file(dev: str = None) -> str:
|
|
60
66
|
"""成员的 auth-state.json 路径 (v3.0: 收进 .private/, 向后兼容)。"""
|
|
61
67
|
try:
|
|
62
|
-
from .paths import get_private_file
|
|
63
68
|
return str(get_private_file('auth-state.json', dev))
|
|
64
69
|
except Exception:
|
|
65
70
|
return os.path.join(_member_dir(dev), 'auth-state.json')
|
|
@@ -9,7 +9,7 @@ for _ in range(10):
|
|
|
9
9
|
break
|
|
10
10
|
if _cp not in _s.path: _s.path.insert(0, _cp)
|
|
11
11
|
from bootstrap import setup; setup()
|
|
12
|
-
from foundation.core.paths import get_repo_root
|
|
12
|
+
from foundation.core.paths import get_repo_root
|
|
13
13
|
|
|
14
14
|
"""
|
|
15
15
|
全自动登录: 获取验证码 → ddddocr识别 → 页面JS加密提交 → 保存token
|
|
@@ -32,14 +32,15 @@ CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
|
|
|
32
32
|
RSA_PUBLIC_KEY_B64 = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN/EkuOg1gq/t2/PUI8GpcJCsCFQgHkSHUEdk7ZPrEQYd8IM1hFkHmDJrCOQ+qUPqKHG9a5BAI44yE6FuPI9Vvqu2ZrCww/zryR7A+2n5jaKIG2rJG9KHDzT5mAVOJrlhBf8L2i7wZc8eWrNg0md0BlwEowQyVEEj9oIBlw/nqTwIDAQAB'
|
|
33
33
|
|
|
34
34
|
# 保存路径
|
|
35
|
-
SCRIPTS_DIR = get_repo_root()
|
|
35
|
+
SCRIPTS_DIR = get_repo_root()
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def _read_developer():
|
|
39
39
|
"""读 .qoder/.developer 拿当前开发者名, 用于身份隔离。
|
|
40
40
|
多人共用 workspace 时, auth-state 必须按开发者分目录, 否则会串登录态。
|
|
41
41
|
没有身份 → 抛异常 (绝不 fallback 到 hupan/default, 防串号)。"""
|
|
42
|
-
|
|
42
|
+
# SCRIPTS_DIR 已是仓库根 (get_repo_root()), 不能再 ../.. (会出仓库)。
|
|
43
|
+
dev_file = os.path.join(SCRIPTS_DIR, '.qoder', '.developer')
|
|
43
44
|
if os.path.isfile(dev_file):
|
|
44
45
|
for ln in open(dev_file, encoding='utf-8'):
|
|
45
46
|
if ln.strip().startswith('name='):
|
|
@@ -50,8 +51,10 @@ def _read_developer():
|
|
|
50
51
|
)
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
# auth-state 写到 .private/ (与读取方 autotest_auth.auth_file 对齐,
|
|
55
|
+
# 旧代码写到 workspace/members/<dev>/ 根 → 读取方读 .private/ → 永远读不到新 token)。
|
|
56
|
+
STATE_FILE = os.path.join(SCRIPTS_DIR, 'workspace', 'members',
|
|
57
|
+
_read_developer(), '.private', 'auth-state.json')
|
|
55
58
|
|
|
56
59
|
out = []
|
|
57
60
|
def log(s=''):
|