xmu-rollcall-cli 3.1.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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 KrsMt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
4
+ recursive-include xmu_rollcall *.py
5
+
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: xmu-rollcall-cli
3
+ Version: 3.1.0
4
+ Summary: XMU Rollcall Bot CLI - Automated rollcall monitoring and answering for Xiamen University Tronclass
5
+ Home-page: https://github.com/KrsMt-0113/XMU-Rollcall-Bot
6
+ Author: KrsMt
7
+ Author-email: KrsMt <krsmt0113@gmail.com>
8
+ Maintainer-email: KrsMt <krsmt0113@gmail.com>
9
+ License-Expression: MIT
10
+ Project-URL: Homepage, https://github.com/KrsMt-0113/XMU-Rollcall-Bot
11
+ Project-URL: Repository, https://github.com/KrsMt-0113/XMU-Rollcall-Bot
12
+ Project-URL: Issues, https://github.com/KrsMt-0113/XMU-Rollcall-Bot/issues
13
+ Project-URL: Documentation, https://github.com/KrsMt-0113/XMU-Rollcall-Bot/blob/main/README.md
14
+ Keywords: xmu,xiamen-university,rollcall,tronclass,automation,cli
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Education
17
+ Classifier: Intended Audience :: End Users/Desktop
18
+ Classifier: Topic :: Education
19
+ Classifier: Topic :: Utilities
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.7
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Operating System :: OS Independent
28
+ Classifier: Environment :: Console
29
+ Requires-Python: >=3.7
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: requests
33
+ Requires-Dist: pycryptodome
34
+ Requires-Dist: xmulogin
35
+ Requires-Dist: click>=8.1.0
36
+ Requires-Dist: aiohttp>=3.9.0
37
+ Dynamic: author
38
+ Dynamic: home-page
39
+ Dynamic: license-file
40
+ Dynamic: requires-python
41
+
42
+ # XMU Rollcall CLI
43
+ 感谢所有为本项目提供反馈和建议的用户。
44
+
45
+ ## 致谢
46
+
47
+ KrsMt
48
+
49
+ ## 作者
50
+
51
+ 本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。
52
+
53
+ ## 许可证
54
+
55
+ 如果遇到问题,请在 [GitHub Issues](https://github.com/KrsMt-0113/XMU-Rollcall-Bot/issues) 提交反馈。
56
+
57
+ ## 问题反馈
58
+
59
+ - 本工具仅供学习交流使用
60
+ - 请遵守学校相关规定,合理使用本工具
61
+ - 请勿频繁重复运行,以免导致账号被暂时冻结
62
+
63
+ ## ⚠️ 注意事项
64
+
65
+ - aiohttp
66
+ - click
67
+ - xmulogin
68
+ - pycryptodome
69
+ - requests
70
+ - Python >= 3.7
71
+
72
+ ## 依赖项
73
+
74
+ 3. 使用手机 GPS 应用
75
+ 2. 使用 [百度地图坐标拾取器](https://api.map.baidu.com/lbsapi/getpoint/index.html)
76
+ 1. 使用 [高德地图坐标拾取器](https://lbs.amap.com/tools/picker)
77
+
78
+ 你可以通过以下方式获取位置坐标:
79
+
80
+ ## 获取位置坐标
81
+
82
+ ```
83
+ }
84
+ "longitude": "118.xxxx"
85
+ "latitude": "24.xxxx",
86
+ "password": "your_password",
87
+ "username": "your_username",
88
+ {
89
+ ```json
90
+
91
+ 你也可以手动编辑配置文件:
92
+
93
+ - Windows: `%USERPROFILE%\.xmu_rollcall\config.json`
94
+ - Linux/macOS: `~/.xmu_rollcall/config.json`
95
+ 配置文件会保存在以下位置:
96
+
97
+ ## 配置说明
98
+
99
+ ```
100
+ XMUrollcall-cli --help
101
+ ```bash
102
+
103
+ ### 3. 查看帮助
104
+
105
+ 程序将自动监控点名活动,发现后自动完成签到。
106
+
107
+ ```
108
+ XMUrollcall-cli start
109
+ ```bash
110
+
111
+ 配置完成后,启动监控程序:
112
+
113
+ ### 2. 开始监控
114
+
115
+ - 经度(longitude)
116
+ - 纬度(latitude)
117
+ - 统一身份认证密码
118
+ - 统一身份认证账号
119
+ 按照提示输入:
120
+
121
+ ```
122
+ XMUrollcall-cli config
123
+ ```bash
124
+
125
+ 首次使用需要配置你的账号、密码和位置信息:
126
+
127
+ ### 1. 配置账号信息
128
+
129
+ ## 使用方法
130
+
131
+ ```
132
+ pip install -e .
133
+ cd XMU-Rollcall-Bot/xmu-rollcall-cli
134
+ git clone https://github.com/KrsMt-0113/XMU-Rollcall-Bot.git
135
+ ```bash
136
+
137
+ ### 从源码安装
138
+
139
+ ```
140
+ pip install xmu-rollcall-cli
141
+ ```bash
142
+
143
+ ### 使用 pip 安装(推荐)
144
+
145
+ ## 安装
146
+
147
+ - 💻 简洁的命令行界面
148
+ - 📍 支持自定义地理位置
149
+ - 🔐 安全的本地配置存储
150
+ - 🚀 自动签到,无需人工干预
151
+ - ✨ 自动监控 Tronclass 点名活动
152
+
153
+ ## 功能特点
154
+
155
+ 厦门大学 Tronclass 自动点名签到命令行工具。
156
+
157
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
158
+ [![Python Version](https://img.shields.io/pypi/pyversions/xmu-rollcall-cli.svg)](https://pypi.org/project/xmu-rollcall-cli/)
159
+ [![PyPI version](https://badge.fury.io/py/xmu-rollcall-cli.svg)](https://badge.fury.io/py/xmu-rollcall-cli)
160
+
161
+
@@ -0,0 +1,120 @@
1
+ # XMU Rollcall CLI
2
+ 感谢所有为本项目提供反馈和建议的用户。
3
+
4
+ ## 致谢
5
+
6
+ KrsMt
7
+
8
+ ## 作者
9
+
10
+ 本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。
11
+
12
+ ## 许可证
13
+
14
+ 如果遇到问题,请在 [GitHub Issues](https://github.com/KrsMt-0113/XMU-Rollcall-Bot/issues) 提交反馈。
15
+
16
+ ## 问题反馈
17
+
18
+ - 本工具仅供学习交流使用
19
+ - 请遵守学校相关规定,合理使用本工具
20
+ - 请勿频繁重复运行,以免导致账号被暂时冻结
21
+
22
+ ## ⚠️ 注意事项
23
+
24
+ - aiohttp
25
+ - click
26
+ - xmulogin
27
+ - pycryptodome
28
+ - requests
29
+ - Python >= 3.7
30
+
31
+ ## 依赖项
32
+
33
+ 3. 使用手机 GPS 应用
34
+ 2. 使用 [百度地图坐标拾取器](https://api.map.baidu.com/lbsapi/getpoint/index.html)
35
+ 1. 使用 [高德地图坐标拾取器](https://lbs.amap.com/tools/picker)
36
+
37
+ 你可以通过以下方式获取位置坐标:
38
+
39
+ ## 获取位置坐标
40
+
41
+ ```
42
+ }
43
+ "longitude": "118.xxxx"
44
+ "latitude": "24.xxxx",
45
+ "password": "your_password",
46
+ "username": "your_username",
47
+ {
48
+ ```json
49
+
50
+ 你也可以手动编辑配置文件:
51
+
52
+ - Windows: `%USERPROFILE%\.xmu_rollcall\config.json`
53
+ - Linux/macOS: `~/.xmu_rollcall/config.json`
54
+ 配置文件会保存在以下位置:
55
+
56
+ ## 配置说明
57
+
58
+ ```
59
+ XMUrollcall-cli --help
60
+ ```bash
61
+
62
+ ### 3. 查看帮助
63
+
64
+ 程序将自动监控点名活动,发现后自动完成签到。
65
+
66
+ ```
67
+ XMUrollcall-cli start
68
+ ```bash
69
+
70
+ 配置完成后,启动监控程序:
71
+
72
+ ### 2. 开始监控
73
+
74
+ - 经度(longitude)
75
+ - 纬度(latitude)
76
+ - 统一身份认证密码
77
+ - 统一身份认证账号
78
+ 按照提示输入:
79
+
80
+ ```
81
+ XMUrollcall-cli config
82
+ ```bash
83
+
84
+ 首次使用需要配置你的账号、密码和位置信息:
85
+
86
+ ### 1. 配置账号信息
87
+
88
+ ## 使用方法
89
+
90
+ ```
91
+ pip install -e .
92
+ cd XMU-Rollcall-Bot/xmu-rollcall-cli
93
+ git clone https://github.com/KrsMt-0113/XMU-Rollcall-Bot.git
94
+ ```bash
95
+
96
+ ### 从源码安装
97
+
98
+ ```
99
+ pip install xmu-rollcall-cli
100
+ ```bash
101
+
102
+ ### 使用 pip 安装(推荐)
103
+
104
+ ## 安装
105
+
106
+ - 💻 简洁的命令行界面
107
+ - 📍 支持自定义地理位置
108
+ - 🔐 安全的本地配置存储
109
+ - 🚀 自动签到,无需人工干预
110
+ - ✨ 自动监控 Tronclass 点名活动
111
+
112
+ ## 功能特点
113
+
114
+ 厦门大学 Tronclass 自动点名签到命令行工具。
115
+
116
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
117
+ [![Python Version](https://img.shields.io/pypi/pyversions/xmu-rollcall-cli.svg)](https://pypi.org/project/xmu-rollcall-cli/)
118
+ [![PyPI version](https://badge.fury.io/py/xmu-rollcall-cli.svg)](https://badge.fury.io/py/xmu-rollcall-cli)
119
+
120
+
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xmu-rollcall-cli"
7
+ version = "3.1.0"
8
+ description = "XMU Rollcall Bot CLI - Automated rollcall monitoring and answering for Xiamen University Tronclass"
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = "MIT"
12
+ authors = [
13
+ {name = "KrsMt", email = "krsmt0113@gmail.com"}
14
+ ]
15
+ maintainers = [
16
+ {name = "KrsMt", email = "krsmt0113@gmail.com"}
17
+ ]
18
+ keywords = ["xmu", "xiamen-university", "rollcall", "tronclass", "automation", "cli"]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Intended Audience :: Education",
22
+ "Intended Audience :: End Users/Desktop",
23
+ "Topic :: Education",
24
+ "Topic :: Utilities",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.7",
27
+ "Programming Language :: Python :: 3.8",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Operating System :: OS Independent",
33
+ "Environment :: Console",
34
+ ]
35
+ dependencies = [
36
+ "requests",
37
+ "pycryptodome",
38
+ "xmulogin",
39
+ "click>=8.1.0",
40
+ "aiohttp>=3.9.0",
41
+ ]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/KrsMt-0113/XMU-Rollcall-Bot"
45
+ Repository = "https://github.com/KrsMt-0113/XMU-Rollcall-Bot"
46
+ Issues = "https://github.com/KrsMt-0113/XMU-Rollcall-Bot/issues"
47
+ Documentation = "https://github.com/KrsMt-0113/XMU-Rollcall-Bot/blob/main/README.md"
48
+
49
+ [project.scripts]
50
+ XMUrollcall-cli = "xmu_rollcall.cli:cli"
51
+
52
+ [tool.setuptools]
53
+ packages = ["xmu_rollcall"]
54
+
55
+ [tool.setuptools.package-data]
56
+ xmu_rollcall = ["py.typed"]
57
+
@@ -0,0 +1,6 @@
1
+ requests>=2.31.0
2
+ pycryptodome>=3.19.0
3
+ xmulogin>=1.0.0
4
+ click>=8.1.0
5
+ aiohttp>=3.9.0
6
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,68 @@
1
+ from setuptools import setup, find_packages
2
+ import pathlib
3
+
4
+ # Read the contents of README file
5
+ here = pathlib.Path(__file__).parent.resolve()
6
+ long_description = (here / "README.md").read_text(encoding="utf-8")
7
+
8
+ setup(
9
+ name="xmu-rollcall-cli",
10
+ version="3.1.0",
11
+ packages=find_packages(),
12
+ include_package_data=True,
13
+
14
+ # Metadata
15
+ author="KrsMt",
16
+ author_email="krsmt0113@gmail.com", # 建议填写真实邮箱
17
+ description="XMU Rollcall Bot CLI - Automated rollcall monitoring and answering for Xiamen University Tronclass",
18
+ long_description=long_description,
19
+ long_description_content_type="text/markdown",
20
+ url="https://github.com/KrsMt-0113/XMU-Rollcall-Bot",
21
+ project_urls={
22
+ "Bug Reports": "https://github.com/KrsMt-0113/XMU-Rollcall-Bot/issues",
23
+ "Source": "https://github.com/KrsMt-0113/XMU-Rollcall-Bot",
24
+ },
25
+
26
+ # Requirements
27
+ python_requires=">=3.7",
28
+ install_requires=[
29
+ "requests",
30
+ "pycryptodome",
31
+ "xmulogin",
32
+ "click>=8.1.0",
33
+ "aiohttp>=3.9.0",
34
+ ],
35
+
36
+ # Entry points
37
+ entry_points={
38
+ "console_scripts": [
39
+ "XMUrollcall-cli=xmu_rollcall.cli:cli",
40
+ ],
41
+ },
42
+
43
+ # Classifiers
44
+ classifiers=[
45
+ "Development Status :: 4 - Beta",
46
+ "Intended Audience :: Education",
47
+ "Intended Audience :: End Users/Desktop",
48
+ "Topic :: Education",
49
+ "Topic :: Utilities",
50
+ "License :: OSI Approved :: MIT License",
51
+ "Programming Language :: Python :: 3",
52
+ "Programming Language :: Python :: 3.7",
53
+ "Programming Language :: Python :: 3.8",
54
+ "Programming Language :: Python :: 3.9",
55
+ "Programming Language :: Python :: 3.10",
56
+ "Programming Language :: Python :: 3.11",
57
+ "Programming Language :: Python :: 3.12",
58
+ "Operating System :: OS Independent",
59
+ "Environment :: Console",
60
+ ],
61
+
62
+ # Keywords
63
+ keywords="xmu xiamen-university rollcall tronclass automation cli",
64
+
65
+ # License
66
+ license="MIT",
67
+ )
68
+
@@ -0,0 +1,4 @@
1
+ """XMU Rollcall CLI Package"""
2
+
3
+ __version__ = "3.1.0"
4
+
@@ -0,0 +1,114 @@
1
+ import click
2
+ import sys
3
+ from xmulogin import xmulogin
4
+ from .config import load_config, save_config, is_config_complete
5
+ from .monitor import start_monitor
6
+
7
+ # ANSI Color codes
8
+ class Colors:
9
+ HEADER = '\033[95m'
10
+ OKBLUE = '\033[94m'
11
+ OKCYAN = '\033[96m'
12
+ OKGREEN = '\033[92m'
13
+ WARNING = '\033[93m'
14
+ FAIL = '\033[91m'
15
+ ENDC = '\033[0m'
16
+ BOLD = '\033[1m'
17
+ GRAY = '\033[90m'
18
+
19
+ @click.group(invoke_without_command=True)
20
+ @click.pass_context
21
+ def cli(ctx):
22
+ """XMU Rollcall Bot CLI - Automated rollcall monitoring and answering"""
23
+ if ctx.invoked_subcommand is None:
24
+ click.echo(f"{Colors.OKCYAN}{Colors.BOLD}XMU Rollcall Bot CLI v3.1.0{Colors.ENDC}")
25
+ click.echo(f"\nUsage:")
26
+ click.echo(f" XMUrollcall-cli config Configure credentials and location")
27
+ click.echo(f" XMUrollcall-cli start Start monitoring rollcalls")
28
+ click.echo(f" XMUrollcall-cli --help Show this message")
29
+
30
+ @cli.command()
31
+ def config():
32
+ """配置账号密码和位置信息"""
33
+ click.echo(f"\n{Colors.BOLD}{Colors.OKCYAN}=== XMU Rollcall Configuration ==={Colors.ENDC}\n")
34
+
35
+ current_config = load_config()
36
+
37
+ # 显示当前配置
38
+ if any(current_config.values()):
39
+ click.echo(f"{Colors.GRAY}Current configuration:{Colors.ENDC}")
40
+ click.echo(f" Username: {current_config.get('username', '(not set)')}")
41
+ click.echo(f" Password: {'*' * len(current_config.get('password', '')) if current_config.get('password') else '(not set)'}")
42
+ click.echo(f" Latitude: {current_config.get('latitude', '(not set)')}")
43
+ click.echo(f" Longitude: {current_config.get('longitude', '(not set)')}")
44
+ click.echo()
45
+
46
+ # 输入新配置
47
+ username = click.prompt(f"{Colors.BOLD}Username{Colors.ENDC}",
48
+ default=current_config.get('username', ''),
49
+ show_default=True if current_config.get('username') else False)
50
+
51
+ password = click.prompt(f"{Colors.BOLD}Password{Colors.ENDC}",
52
+ hide_input=True,
53
+ default=current_config.get('password', ''),
54
+ show_default=False)
55
+
56
+ latitude = click.prompt(f"{Colors.BOLD}Latitude{Colors.ENDC}",
57
+ default=current_config.get('latitude', ''),
58
+ show_default=True if current_config.get('latitude') else False)
59
+
60
+ longitude = click.prompt(f"{Colors.BOLD}Longitude{Colors.ENDC}",
61
+ default=current_config.get('longitude', ''),
62
+ show_default=True if current_config.get('longitude') else False)
63
+
64
+ # 验证登录
65
+ click.echo(f"\n{Colors.OKCYAN}Validating credentials...{Colors.ENDC}")
66
+ try:
67
+ session = xmulogin(type=3, username=username, password=password)
68
+ if session:
69
+ click.echo(f"{Colors.OKGREEN}✓ Login successful!{Colors.ENDC}")
70
+
71
+ # 保存配置
72
+ new_config = {
73
+ "username": username,
74
+ "password": password,
75
+ "latitude": latitude,
76
+ "longitude": longitude
77
+ }
78
+ save_config(new_config)
79
+ click.echo(f"{Colors.OKGREEN}✓ Configuration saved successfully!{Colors.ENDC}\n")
80
+ click.echo(f"You can now run: {Colors.BOLD}XMUrollcall-cli start{Colors.ENDC}")
81
+ else:
82
+ click.echo(f"{Colors.FAIL}✗ Login failed. Please check your credentials.{Colors.ENDC}")
83
+ click.echo(f"{Colors.GRAY}Configuration not saved.{Colors.ENDC}")
84
+ sys.exit(1)
85
+ except Exception as e:
86
+ click.echo(f"{Colors.FAIL}✗ Error during login validation: {str(e)}{Colors.ENDC}")
87
+ click.echo(f"{Colors.GRAY}Configuration not saved.{Colors.ENDC}")
88
+ sys.exit(1)
89
+
90
+ @cli.command()
91
+ def start():
92
+ """启动签到监控"""
93
+ # 加载配置
94
+ config_data = load_config()
95
+
96
+ # 检查配置是否完整
97
+ if not is_config_complete(config_data):
98
+ click.echo(f"{Colors.FAIL}✗ Configuration incomplete!{Colors.ENDC}")
99
+ click.echo(f"Please run: {Colors.BOLD}XMUrollcall-cli config{Colors.ENDC}")
100
+ sys.exit(1)
101
+
102
+ # 启动监控
103
+ try:
104
+ start_monitor(config_data)
105
+ except KeyboardInterrupt:
106
+ click.echo(f"\n{Colors.WARNING}Shutting down...{Colors.ENDC}")
107
+ sys.exit(0)
108
+ except Exception as e:
109
+ click.echo(f"\n{Colors.FAIL}Error: {str(e)}{Colors.ENDC}")
110
+ sys.exit(1)
111
+
112
+ if __name__ == '__main__':
113
+ cli()
114
+
@@ -0,0 +1,45 @@
1
+ import os
2
+ import json
3
+ from pathlib import Path
4
+
5
+ CONFIG_DIR = Path.home() / ".xmu_rollcall"
6
+ CONFIG_FILE = CONFIG_DIR / "config.json"
7
+
8
+ DEFAULT_CONFIG = {
9
+ "username": "",
10
+ "password": "",
11
+ "latitude": "",
12
+ "longitude": ""
13
+ }
14
+
15
+ def ensure_config_dir():
16
+ """确保配置目录存在"""
17
+ CONFIG_DIR.mkdir(parents=True, exist_ok=True)
18
+
19
+ def load_config():
20
+ """加载配置文件"""
21
+ ensure_config_dir()
22
+ if CONFIG_FILE.exists():
23
+ try:
24
+ with open(CONFIG_FILE, "r", encoding="utf-8") as f:
25
+ return json.load(f)
26
+ except Exception:
27
+ return DEFAULT_CONFIG.copy()
28
+ return DEFAULT_CONFIG.copy()
29
+
30
+ def save_config(config):
31
+ """保存配置文件"""
32
+ ensure_config_dir()
33
+ with open(CONFIG_FILE, "w", encoding="utf-8") as f:
34
+ json.dump(config, f, indent=2, ensure_ascii=False)
35
+
36
+ def is_config_complete(config):
37
+ """检查配置是否完整"""
38
+ required_fields = ["username", "password", "latitude", "longitude"]
39
+ return all(config.get(field) for field in required_fields)
40
+
41
+ def get_cookies_path():
42
+ """获取cookies文件路径"""
43
+ ensure_config_dir()
44
+ return str(CONFIG_DIR / "cookies.json")
45
+