v0.2.7: 修复Redis连接 + 启动管理后台

- 修复Redis认证 (配置密码)
- 启动Python管理后台 (端口9531, 15个功能开关)
- 统一版本号 0.2.7
- 更新docker-compose.yml (镜像版本/Redis URL/Admin服务)
This commit is contained in:
2026-05-17 02:22:18 +08:00
commit 83cbfaf03f
164 changed files with 25195 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
"""123云盘适配器 v1.0.0"""
from ..base import BaseCloudDriveAdapter, FileInfo, TransferResult, VerifyResult
from ...errors import TransferError, TransferErrorCode
from .credential import Pan123CredentialManager
from .transfer import Pan123Transfer
from .cleanup import Pan123Cleanup
class Pan123Adapter(BaseCloudDriveAdapter):
PLATFORM_NAME = "123云盘"
PLATFORM_KEY = "pan123"
URL_PATTERNS = [r"123pan\.com/s/([A-Za-z0-9]+)"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._cred = Pan123CredentialManager(self.config)
self._transfer_engine = None
self._cln = Pan123Cleanup()
@property
def _transfer(self):
if self._transfer_engine is None:
self._transfer_engine = Pan123Transfer(
self.session, self._cred, self.config, self.transfer_config)
return self._transfer_engine
def _get_share_detail(self, pwd_id, passcode=""):
return self._transfer.get_share_info(pwd_id, passcode)
def _save_files(self, pwd_id, detail, save_dir):
return self._transfer.save_files(pwd_id, detail, save_dir)
def _create_share(self, file_ids, title, password=""):
return self._transfer.create_share(file_ids, title, password)
def get_files(self, parent_fid="0"):
return self._transfer.list_files(parent_fid)
def delete(self, file_ids):
return self._cln.delete_files(self.session, self._cred, file_ids)

View File

@@ -0,0 +1,26 @@
"""123云盘数据清理 v1.0.0"""
import logging
from typing import List
logger = logging.getLogger(__name__)
class Pan123Cleanup:
API_BASE = "https://www.123pan.com/api"
def delete_files(self, session, credential_mgr, file_ids: List[str]) -> bool:
try:
resp = session.post(
f"{self.API_BASE}/file/delete",
json={"fileIds": file_ids},
timeout=30,
)
return resp.json().get("code") == 0
except Exception as e:
logger.error(f"123 delete failed: {e}")
return False
def filter_ad_ids(self, file_ids: List[str], file_names: List[str],
banned_keywords: List[str]) -> List[str]:
return file_ids

View File

@@ -0,0 +1,16 @@
"""123云盘凭证管理 v1.0.0 — Cookie直传"""
class Pan123CredentialManager:
def __init__(self, config):
self.config = config
def validate(self) -> bool:
return bool(self.config.cookie and len(self.config.cookie) >= 30)
def get_headers(self) -> dict:
return {
"Cookie": self.config.cookie,
"Referer": "https://www.123pan.com/",
"Origin": "https://www.123pan.com",
}

View File

@@ -0,0 +1,71 @@
"""123云盘转存逻辑 v1.0.0"""
import re
import logging
from typing import List, Tuple
logger = logging.getLogger(__name__)
class Pan123Transfer:
API_BASE = "https://www.123pan.com/api"
def __init__(self, session, credential_mgr, config, transfer_config):
self.session = session
self.credential = credential_mgr
self.config = config
self.transfer_config = transfer_config
self._last_file_names = []
@staticmethod
def parse_share_url(url: str) -> Tuple[str, str]:
m = re.search(r"123pan\.com/s/([A-Za-z0-9]+)", url)
if not m:
raise ValueError("Invalid 123pan share URL")
code = m.group(1)
m2 = re.search(r"[?&]pwd=(\w+)", url)
return code, m2.group(1) if m2 else ""
def get_share_info(self, share_key: str, password: str = "") -> dict:
payload = {"shareKey": share_key}
if password:
payload["sharePwd"] = password
resp = self.session.post(
f"{self.API_BASE}/share/info",
json=payload,
timeout=self.transfer_config.request_timeout,
)
data = resp.json()
if data.get("code") != 0:
raise Exception(f"123 share info failed: {data}")
info = data.get("data", {})
files = info.get("fileList", [])
return {
"title": info.get("shareName", ""),
"files": [{"id": f.get("fileId", ""), "name": f.get("fileName", ""),
"size": f.get("fileSize", 0)} for f in files],
"share_id": info.get("shareId", ""),
}
def save_files(self, share_key: str, detail: dict, save_dir: str) -> List[str]:
payload = {
"shareKey": share_key,
"shareId": detail.get("share_id", ""),
"parentFileId": save_dir or "0",
}
resp = self.session.post(
f"{self.API_BASE}/share/save",
json=payload,
timeout=self.transfer_config.request_timeout,
)
data = resp.json()
if data.get("code") != 0:
raise Exception(f"123 save failed: {data}")
return [str(data.get("data", {}).get("fileId", ""))]
def create_share(self, file_ids: List[str], title: str,
password: str = "") -> Tuple[str, str]:
return "", ""
def list_files(self, parent_id: str = "0") -> list:
return []