mirror of
https://github.com/hyb-oyqq/FRAISEMOE-Addons-Installer-NEXT.git
synced 2026-01-01 19:50:50 +00:00
feat(core): 更新配置管理和文件忽略规则
- 修改.gitignore文件,添加对Python缓存文件、虚拟环境和系统文件的忽略规则,提升项目整洁性。 - 更新主窗口和相关模块的导入路径,确保从新的配置模块中正确导入配置项,增强代码结构的清晰度。 - 删除不再使用的图片和模块,优化项目资源,减少冗余文件,提升维护效率。
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
import os
|
||||
import base64
|
||||
import datetime
|
||||
|
||||
# 配置信息
|
||||
app_data = {
|
||||
"APP_VERSION": "1.3.2",
|
||||
"APP_NAME": "FRAISEMOE Addons Installer NEXT",
|
||||
"TEMP": "TEMP",
|
||||
"CACHE": "FRAISEMOE",
|
||||
"PLUGIN": "PLUGIN",
|
||||
"CONFIG_URL": "aHR0cHM6Ly9hcGkuMncyLnRvcC9hcGkvb3V5YW5ncWlxaS9uZWtvcGFyYS9kb3dubG9hZF91cmwuanNvbg==",
|
||||
"UA_TEMPLATE": "Mozilla/5.0 (Linux debian12 FraiseMoe2-Accept-Next) Gecko/20100101 Firefox/114.0 FraiseMoe2/{}",
|
||||
"game_info": {
|
||||
"NEKOPARA Vol.1": {
|
||||
"exe": "nekopara_vol1.exe",
|
||||
"hash": "04b48b231a7f34431431e5027fcc7b27affaa951b8169c541709156acf754f3e",
|
||||
"install_path": "NEKOPARA Vol. 1/adultsonly.xp3",
|
||||
"plugin_path": "vol.1/adultsonly.xp3",
|
||||
},
|
||||
"NEKOPARA Vol.2": {
|
||||
"exe": "nekopara_vol2.exe",
|
||||
"hash": "b9c00a2b113a1e768bf78400e4f9075ceb7b35349cdeca09be62eb014f0d4b42",
|
||||
"install_path": "NEKOPARA Vol. 2/adultsonly.xp3",
|
||||
"plugin_path": "vol.2/adultsonly.xp3",
|
||||
},
|
||||
"NEKOPARA Vol.3": {
|
||||
"exe": "NEKOPARAvol3.exe",
|
||||
"hash": "2ce7b223c84592e1ebc3b72079dee1e5e8d064ade15723328a64dee58833b9d5",
|
||||
"install_path": "NEKOPARA Vol. 3/update00.int",
|
||||
"plugin_path": "vol.3/update00.int",
|
||||
},
|
||||
"NEKOPARA Vol.4": {
|
||||
"exe": "nekopara_vol4.exe",
|
||||
"hash": "4a4a9ae5a75a18aacbe3ab0774d7f93f99c046afe3a777ee0363e8932b90f36a",
|
||||
"install_path": "NEKOPARA Vol. 4/vol4adult.xp3",
|
||||
"plugin_path": "vol.4/vol4adult.xp3",
|
||||
},
|
||||
"NEKOPARA After": {
|
||||
"exe": "nekopara_after.exe",
|
||||
"hash": "eb26ff6850096a240af8340ba21c5c3232e90f29fb8191e24b6ce701acae0aa9",
|
||||
"install_path": "NEKOPARA After/afteradult.xp3",
|
||||
"plugin_path": "after/afteradult.xp3",
|
||||
"sig_path": "after/afteradult.xp3.sig"
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# Base64解码
|
||||
def decode_base64(encoded_str):
|
||||
return base64.b64decode(encoded_str).decode("utf-8")
|
||||
|
||||
# 全局变量
|
||||
APP_VERSION = app_data["APP_VERSION"]
|
||||
APP_NAME = app_data["APP_NAME"]
|
||||
TEMP = os.getenv(app_data["TEMP"]) or app_data["TEMP"]
|
||||
CACHE = os.path.join(TEMP, app_data["CACHE"])
|
||||
CONFIG_FILE = os.path.join(CACHE, "config.json")
|
||||
|
||||
# 将log文件放在程序根目录下的log文件夹中,使用日期+时间戳格式命名
|
||||
root_dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
log_dir = os.path.join(root_dir, "log")
|
||||
current_datetime = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
LOG_FILE = os.path.join(log_dir, f"log-{current_datetime}.txt")
|
||||
|
||||
PLUGIN = os.path.join(CACHE, app_data["PLUGIN"])
|
||||
CONFIG_URL = decode_base64(app_data["CONFIG_URL"])
|
||||
UA = app_data["UA_TEMPLATE"].format(APP_VERSION)
|
||||
GAME_INFO = app_data["game_info"]
|
||||
BLOCK_SIZE = 67108864
|
||||
HASH_SIZE = 134217728
|
||||
PLUGIN_HASH = {
|
||||
"NEKOPARA Vol.1": GAME_INFO["NEKOPARA Vol.1"]["hash"],
|
||||
"NEKOPARA Vol.2": GAME_INFO["NEKOPARA Vol.2"]["hash"],
|
||||
"NEKOPARA Vol.3": GAME_INFO["NEKOPARA Vol.3"]["hash"],
|
||||
"NEKOPARA Vol.4": GAME_INFO["NEKOPARA Vol.4"]["hash"],
|
||||
"NEKOPARA After": GAME_INFO["NEKOPARA After"]["hash"]
|
||||
}
|
||||
PROCESS_INFO = {info["exe"]: game for game, info in GAME_INFO.items()}
|
||||
|
||||
# 下载线程档位设置
|
||||
DOWNLOAD_THREADS = {
|
||||
"low": 1, # 低速
|
||||
"medium": 8, # 中速(默认)
|
||||
"high": 16, # 高速
|
||||
"extreme": 32, # 极速
|
||||
"insane": 64 # 狂暴
|
||||
}
|
||||
|
||||
# 默认下载线程档位
|
||||
DEFAULT_DOWNLOAD_THREAD_LEVEL = "high"
|
||||
@@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from utils.logger import setup_logger
|
||||
|
||||
# 初始化logger
|
||||
logger = setup_logger("privacy_policy")
|
||||
|
||||
# 隐私协议的缩略版内容
|
||||
PRIVACY_POLICY_BRIEF = """
|
||||
# FRAISEMOE Addons Installer NEXT 隐私政策摘要
|
||||
|
||||
本应用在运行过程中会收集和处理以下信息:
|
||||
|
||||
## 收集的信息
|
||||
- **系统信息**:程序版本号。
|
||||
- **网络信息**:IP 地址、ISP、地理位置(用于使用统计)、下载统计、IPv6 连接测试(通过访问 testipv6.cn)、IPv6 地址获取(通过 ipw.cn)。
|
||||
- **文件信息**:游戏安装路径、文件哈希值。
|
||||
|
||||
## 系统修改
|
||||
- 使用 Cloudflare 加速时会临时修改系统 hosts 文件。
|
||||
- 修改前会自动备份,程序退出时自动恢复。
|
||||
|
||||
## 第三方服务
|
||||
- **Cloudflare 服务**:通过开源项目 CloudflareSpeedTest (CFST) 提供,用于优化下载速度。此过程会将您的 IP 提交至 Cloudflare 节点。
|
||||
- **云端配置服务**:获取配置信息。服务器会记录您的 IP、ISP 及地理位置用于统计。
|
||||
- **IPv6 测试服务**:应用使用 testipv6.cn 和 ipw.cn 测试和获取 IPv6 连接信息。
|
||||
|
||||
完整的隐私政策可在本程序的 GitHub 仓库中查看。
|
||||
"""
|
||||
|
||||
# 隐私协议的英文版缩略版内容
|
||||
PRIVACY_POLICY_BRIEF_EN = """
|
||||
# FRAISEMOE Addons Installer NEXT Privacy Policy Summary
|
||||
|
||||
This application collects and processes the following information:
|
||||
|
||||
## Information Collected
|
||||
- **System info**: Application version.
|
||||
- **Network info**: IP address, ISP, geographic location (for usage statistics), download statistics, IPv6 connectivity test (via testipv6.cn), IPv6 address acquisition (via ipw.cn).
|
||||
- **File info**: Game installation paths, file hash values.
|
||||
|
||||
## System Modifications
|
||||
- Temporarily modifies system hosts file when using Cloudflare acceleration.
|
||||
- Automatically backs up before modification and restores upon exit.
|
||||
|
||||
## Third-party Services
|
||||
- **Cloudflare services**: Provided via the open-source project CloudflareSpeedTest (CFST) to optimize download speeds. This process submits your IP to Cloudflare nodes.
|
||||
- **Cloud configuration services**: For obtaining configuration information. The server logs your IP, ISP, and location for statistical purposes.
|
||||
- **IPv6 testing services**: The application uses testipv6.cn and ipw.cn to test and retrieve IPv6 connection information.
|
||||
|
||||
The complete privacy policy can be found in the program's GitHub repository.
|
||||
"""
|
||||
|
||||
# 默认隐私协议版本 - 本地版本的日期
|
||||
PRIVACY_POLICY_VERSION = "2025.08.04"
|
||||
|
||||
def get_local_privacy_policy():
|
||||
"""获取本地打包的隐私协议文件
|
||||
|
||||
Returns:
|
||||
tuple: (隐私协议内容, 版本号, 错误信息)
|
||||
"""
|
||||
# 尝试不同的可能路径
|
||||
possible_paths = [
|
||||
"PRIVACY.md", # 相对于可执行文件
|
||||
os.path.join(os.path.dirname(sys.executable), "PRIVACY.md"), # 可执行文件目录
|
||||
os.path.join(os.path.dirname(__file__), "PRIVACY.md"), # 当前模块目录
|
||||
]
|
||||
|
||||
for path in possible_paths:
|
||||
try:
|
||||
if os.path.exists(path):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# 提取更新日期
|
||||
date_pattern = r'最后更新日期:(\d{4}年\d{1,2}月\d{1,2}日)'
|
||||
match = re.search(date_pattern, content)
|
||||
|
||||
if match:
|
||||
date_str = match.group(1)
|
||||
try:
|
||||
date_obj = datetime.strptime(date_str, '%Y年%m月%d日')
|
||||
date_version = date_obj.strftime('%Y.%m.%d')
|
||||
logger.info(f"成功读取本地隐私协议文件: {path}, 版本: {date_version}")
|
||||
return content, date_version, ""
|
||||
except ValueError:
|
||||
logger.error(f"本地隐私协议日期格式解析错误: {path}")
|
||||
else:
|
||||
logger.warning(f"本地隐私协议未找到更新日期: {path}")
|
||||
except Exception as e:
|
||||
logger.error(f"读取本地隐私协议失败 {path}: {str(e)}")
|
||||
|
||||
# 所有路径都尝试失败,使用默认版本
|
||||
return PRIVACY_POLICY_BRIEF, PRIVACY_POLICY_VERSION, "无法读取本地隐私协议文件"
|
||||
Reference in New Issue
Block a user