Skip to content

Conversation

@RadND
Copy link

@RadND RadND commented Aug 6, 2025

windows的部分还是以前的逻辑没动

certpath = Path(setting.config['certpath'])
return

if sys.platform.startswith('win') or sys.platform.startswith('mac'):
Copy link
Contributor

@Sving1024 Sving1024 Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macos 也是类 unix,应该和 unix 一样处理。(别问为什么上周 review 的现在才发,问就是才知道要 submit)

@RadND
Copy link
Author

RadND commented Aug 16, 2025

初始化顺序需要修改,目前certpath会在import时决定,但命令行参数要到main函数运行才会初始化
这么说已有的两个命令行参数没人用过,不然早发现了,可以删去吗? @URenko

@RadND
Copy link
Author

RadND commented Aug 17, 2025

不想修初始化的bug,先把命令行参数去掉了
无法指定state目录,手动处理root以便继续支持systemd

@Sving1024
Copy link
Contributor

初始化顺序需要修改,目前certpath会在import时决定,但命令行参数要到main函数运行才会初始化 这么说已有的两个命令行参数没人用过,不然早发现了,可以删去吗? @URenko

这两个在判断的时候都是直接引用 settings.config 的,应该没什么理由用不了。可以考虑把 state 也放到 settings.config 里,在使用时直接引用 settings.config 即可。不过这个选项去掉了也没什么关系(很多软件都这样做),现在这样也挺好的。

@RadND
Copy link
Author

RadND commented Aug 17, 2025

@Sving1024 命令行参数用不了,程序用配置时候只读了配置文件,没有读命令行参数

@Sving1024
Copy link
Contributor

@Sving1024 命令行参数用不了,程序用配置时候只读了配置文件,没有读命令行参数

这些函数的调用都是在 settings.parse_args 调用之后才调用的。

setting.parse_args()

importca.import_ca()

await asyncio.gather(
asyncio.to_thread(update_checker),
proxy()
)

sysproxy.set_pac(f"http://localhost:{setting.config['server']['port']}/pac/?t={random.randrange(2**16)}")

@RadND
Copy link
Author

RadND commented Aug 17, 2025

@Sving1024 命令行参数用不了,程序用配置时候只读了配置文件,没有读命令行参数

这些函数的调用都是在 settings.parse_args 调用之后才调用的。

setting.parse_args()

importca.import_ca()

await asyncio.gather(
asyncio.to_thread(update_checker),
proxy()
)

sysproxy.set_pac(f"http://localhost:{setting.config['server']['port']}/pac/?t={random.randrange(2**16)}")

这样一开始是配置文件的值,然后变成命令行的值,潜在问题更大了。。

@Sving1024
Copy link
Contributor

不就是很正常的让命令行选项覆盖配置文件的设置。

@RadND
Copy link
Author

RadND commented Aug 17, 2025

from . import setting
from .setting import basepath
if setting.config["importca"]:
certpath = os.path.join(basepath, "CERT")
else:
certpath = "CERT"
if not os.path.exists(certpath):
os.makedirs(certpath, exist_ok=True)

像这里就是命令行参数还没读,已经用了配置文件里的值

@Sving1024
Copy link
Contributor

Sving1024 commented Aug 17, 2025

那至少 --nosetproxxy 是可以正常使用的。你如果不想修的话可以先把这个功能加上,之后另开一个 issue/pr 来解决这个问题。

@RadND RadND changed the title 添加certpath 启动参数和*nix上对xdg spec的处理 添加*nix上对xdg spec的处理 Aug 24, 2025
@URenko URenko merged commit 33d498b into URenko:master Aug 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants