Skip to content

Commit 69af851

Browse files
author
Taois
committed
feat: 发布新版本
1 parent 8d5dc5b commit 69af851

File tree

20 files changed

+581
-21
lines changed

20 files changed

+581
-21
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# drpyS(drpy-node)
22

33
nodejs作为服务端的drpy实现。全面升级异步写法
4-
~~积极开发中,每日一更~~,当前进度 `83%`
4+
~~积极开发中,每日一更~~,当前进度 `85%`
55
~~找工作中,随缘更新~~
66
上班当牛马,下班要带娃,阶段性佛系趁娃睡觉熬夜更新
77

@@ -25,6 +25,10 @@ nodejs作为服务端的drpy实现。全面升级异步写法
2525

2626
## 更新记录
2727

28+
### 20250824
29+
30+
更新至V1.2.19
31+
2832
### 20250823
2933

3034
更新至V1.2.18

autorun.ps1

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
#Requires -RunAsAdministrator
2+
param(
3+
[switch]$UseProxy,
4+
[string]$ProxyHost = "127.0.0.1:7890",
5+
[switch]$SkipConfirm
6+
)
7+
$ErrorActionPreference = "Stop"
8+
9+
# ---------- 代理开关 ----------
10+
function Use-ProxyIfNeeded {
11+
param([scriptblock]$Script)
12+
if ($UseProxy) {
13+
$oldHttp = [Environment]::GetEnvironmentVariable("HTTP_PROXY")
14+
$oldHttps = [Environment]::GetEnvironmentVariable("HTTPS_PROXY")
15+
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://$ProxyHost", "Process")
16+
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", "http://$ProxyHost", "Process")
17+
try { & $Script }
18+
finally {
19+
[Environment]::SetEnvironmentVariable("HTTP_PROXY", $oldHttp, "Process")
20+
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", $oldHttps, "Process")
21+
}
22+
} else { & $Script }
23+
}
24+
25+
# ---------- 工具检测 ----------
26+
function Test-Cmd { param($cmd); $null -ne (Get-Command $cmd -ErrorAction SilentlyContinue) }
27+
28+
# ---------- 用户确认 ----------
29+
if (-not $SkipConfirm) {
30+
Write-Host "警告:此脚本仅适用于 Windows 10/11 64 位"
31+
Write-Host "建议使用Windows Terminal终端"
32+
Write-Host "默认执行命令.\drpys.ps1"
33+
Write-Host "下载失败可以指定旁路由代理执行命令.\drpys.ps1 -UseProxy -ProxyHost "旁路由/clash:7890""
34+
Write-Host "警告:此脚本仅适用于 Windows 10/11 64 位"
35+
$confirm = Read-Host "您是否理解并同意继续?(y/n) 默认(y)"
36+
if ($confirm -eq "n") { exit 1 }
37+
}
38+
39+
# ---------- 安装 Node ----------
40+
Use-ProxyIfNeeded -Script {
41+
if (Test-Cmd "node") {
42+
$nodeVer = (node -v) -replace '^v','' -split '\.' | ForEach-Object { [int]$_ }
43+
if ($nodeVer[0] -ge 20) {
44+
Write-Host "已检测到 Node v$($nodeVer -join '.') ≥20,跳过安装"
45+
} else {
46+
if (-not (Test-Cmd "nvm")) {
47+
Write-Host "正在安装 nvm-windows..."
48+
$nvmSetup = "$env:TEMP\nvm-setup.exe"
49+
Invoke-WebRequest "https://download.fastgit.org/coreybutler/nvm-windows/releases/latest/download/nvm-setup.exe" -OutFile $nvmSetup
50+
Start-Process -Wait -FilePath $nvmSetup -ArgumentList "/silent"
51+
Remove-Item $nvmSetup
52+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
53+
}
54+
nvm install 20
55+
nvm use 20
56+
}
57+
} else {
58+
if (-not (Test-Cmd "nvm")) {
59+
Write-Host "正在安装 nvm-windows..."
60+
$nvmSetup = "$env:TEMP\nvm-setup.exe"
61+
Invoke-WebRequest "https://download.fastgit.org/coreybutler/nvm-windows/releases/latest/download/nvm-setup.exe" -OutFile $nvmSetup
62+
Start-Process -Wait -FilePath $nvmSetup -ArgumentList "/silent"
63+
Remove-Item $nvmSetup
64+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
65+
}
66+
nvm install 20
67+
nvm use 20
68+
}
69+
70+
foreach ($tool in @("yarn","pm2","git","python")) {
71+
if (-not (Test-Cmd $tool)) {
72+
switch ($tool) {
73+
"yarn" { npm install -g yarn }
74+
"pm2" { npm install -g pm2 }
75+
"git" { winget install --id Git.Git -e --source winget }
76+
"python" { winget install --id Python.Python.3 -e --source winget }
77+
}
78+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
79+
}
80+
}
81+
}
82+
83+
# ---------- 工作目录 ----------
84+
$repoDir = Read-Host "请输入项目存放目录(留空则使用当前目录)"
85+
if ([string]::IsNullOrWhiteSpace($repoDir)) { $repoDir = (Get-Location).Path }
86+
$projectPath = Join-Path $repoDir "drpy-node"
87+
$remoteRepo = "https://github.com/hjdhnx/drpy-node.git"
88+
89+
# ---------- 首次克隆 / 配置 ----------
90+
Use-ProxyIfNeeded -Script {
91+
if (-not (Test-Path $projectPath)) {
92+
Write-Host "正在克隆仓库..."
93+
git clone $remoteRepo $projectPath
94+
}
95+
Set-Location $projectPath
96+
97+
# 初始化配置
98+
$configJson = "config\env.json"
99+
if (-not (Test-Path $configJson)) {
100+
@{
101+
ali_token = ""; ali_refresh_token = ""; quark_cookie = "";
102+
uc_cookie = ""; bili_cookie = ""; thread = "10";
103+
enable_dr2 = "1"; enable_py = "2"
104+
} | ConvertTo-Json | Set-Content $configJson -Encoding UTF8
105+
}
106+
107+
$envFile = ".env"
108+
if (-not (Test-Path $envFile)) {
109+
Copy-Item ".env.development" $envFile
110+
$cookieAuth = Read-Host "网盘入库密码(默认 drpys)"
111+
$apiUser = Read-Host "登录用户名(默认 admin)"
112+
$apiPass = Read-Host "登录密码(默认 drpys)"
113+
$apiPwd = Read-Host "订阅PWD值(默认 dzyyds)"
114+
(Get-Content $envFile) `
115+
-replace 'COOKIE_AUTH_CODE = .*', "COOKIE_AUTH_CODE = $(if([string]::IsNullOrWhiteSpace($cookieAuth)){'drpys'}else{$cookieAuth})" `
116+
-replace 'API_AUTH_NAME = .*', "API_AUTH_NAME = $(if([string]::IsNullOrWhiteSpace($apiUser)){'admin'}else{$apiUser})" `
117+
-replace 'API_AUTH_CODE = .*', "API_AUTH_CODE = $(if([string]::IsNullOrWhiteSpace($apiPass)){'drpys'}else{$apiPass})" `
118+
-replace 'API_PWD = .*', "API_PWD = $(if([string]::IsNullOrWhiteSpace($apiPwd)){'dzyyds'}else{$apiPwd})" |
119+
Set-Content $envFile -Encoding UTF8
120+
}
121+
122+
# 首次安装依赖
123+
if (-not (Test-Path "node_modules")) {
124+
Write-Host "首次安装 Node 依赖..."
125+
yarn config set registry https://registry.npmmirror.com/
126+
yarn
127+
}
128+
if (-not (Test-Path ".venv\pyvenv.cfg")) {
129+
Write-Host "首次创建 Python 虚拟环境..."
130+
python -m venv .venv
131+
}
132+
& .\.venv\Scripts\Activate.ps1
133+
if ((git diff HEAD^ HEAD --name-only 2>$null) -match "requirements.txt") {
134+
Write-Host "检测到 requirements.txt 变动,更新 Python 依赖..."
135+
pip install -r spider\py\base\requirements.txt -i https://mirrors.cloud.tencent.com/pypi/simple
136+
}
137+
138+
# 首次或 PM2 未启动时启动
139+
if (-not (pm2 list | Select-String "drpyS.*online")) {
140+
Write-Host "首次启动 PM2 进程..."
141+
pm2 start index.js --name drpyS --update-env
142+
pm2 save
143+
} else {
144+
Write-Host "PM2 进程 drpyS 已在运行,跳过启动"
145+
}
146+
}
147+
148+
# ---------- 任务计划 ----------
149+
$taskStartup = "drpyS_PM2_Startup"
150+
$taskUpdate = "drpyS_Update"
151+
152+
if (-not (Get-ScheduledTask -TaskName $taskStartup -ErrorAction SilentlyContinue)) {
153+
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
154+
-Argument "-NoProfile -WindowStyle Hidden -Command pm2 resurrect"
155+
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -Seconds 30)
156+
$setting = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
157+
Register-ScheduledTask -TaskName $taskStartup -Action $action -Trigger $trigger `
158+
-Settings $setting -User "SYSTEM" -RunLevel Highest -Force | Out-Null
159+
Write-Host "已创建开机自启任务:$taskStartup"
160+
}
161+
162+
if (-not (Get-ScheduledTask -TaskName $taskUpdate -ErrorAction SilentlyContinue)) {
163+
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
164+
-Argument "-NoProfile -WindowStyle Hidden -Command `"& { cd '$projectPath'; git fetch origin; if (git status -uno | Select-String 'Your branch is behind') { git reset --hard origin/main; yarn --prod --silent; if (git diff HEAD^ HEAD --name-only | Select-String 'spider/py/base/requirements.txt') { python -m venv .venv; & .\.venv\Scripts\Activate.ps1; pip install -r spider\py\base\requirements.txt -q } pm2 restart drpyS } }`""
165+
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Hours 24)
166+
$setting = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
167+
Register-ScheduledTask -TaskName $taskUpdate -Action $action -Trigger $trigger `
168+
-Settings $setting -User "SYSTEM" -RunLevel Highest -Force | Out-Null
169+
Write-Host "已创建每 24 小时更新任务:$taskUpdate"
170+
}
171+
172+
# ---------- 完成 ----------
173+
$ip = (ipconfig | Select-String "IPv4 地址" | Select-Object -First 1).ToString().Split(":")[-1].Trim()
174+
$public = (Invoke-RestMethod "https://ipinfo.io/ip")
175+
Write-Host "内网地址:http://${ip}:5757"
176+
Write-Host "公网地址:http://${public}:5757"
177+
Write-Host "脚本执行完成!重启后 drpyS 自动启动并每 24 小时检查更新。"
178+
Write-Host "脚本只需要执行一次不需要重复执行。"
179+
Write-Host "如果弹出空白窗口可以直接关闭不影响使用。"

docs/sub.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [远程订阅接口-绿色](/config/1?sub=green&pwd=$pwd)
66
* [电视订阅接口-仅多媒体源](/config/1?sub=tv&pwd=$pwd)
77
* [电视订阅接口-仅网盘](/config/1?sub=pan&pwd=$pwd)
8+
* [仅HIPY源](/config/1?sub=hipy&pwd=$pwd)
89

910
# 其他工具链接
1011

docs/updateRecord.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# drpyS更新记录
22

3+
### 20250824
4+
5+
更新至V1.2.19
6+
7+
1. 给hipy源写了一个测试示例,详见文件: `spider/py/base_test.py`,方便py写源时候本地调试
8+
2. 修改了 `spider/py/base/requirements.txt` 添加必要的注释
9+
3. 增强了脚本 `spider/py/core/kill_t4_daemon.sh` 的杀进程能力
10+
4. 修复 `荐片`
11+
5. 增加脚本 `autorun.ps1` `uninstall.sh`,方便ds运维
12+
6. 设计了新的js版守护进程桥接程序 `spider/py/core/bridge.js`,同时让守护进程输入数据支持json协议,也许会大幅度提升hipy性能
13+
7. 修改局域网地址获取逻辑,避免获取到vmware的虚拟网段
14+
15+
注意:本次更新新增了一个nodejs依赖 `pickleparser`,需要执行一次`yarn`命令
16+
317
### 20250823
418

519
更新至V1.2.18

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ const start = async () => {
171171
const localAddress = `http://localhost:${PORT}`;
172172
const interfaces = os.networkInterfaces();
173173
let lanAddress = 'Not available';
174-
for (const iface of Object.values(interfaces)) {
175-
if (!iface) continue;
174+
// console.log('interfaces:', interfaces);
175+
for (const [key, iface] of Object.entries(interfaces)) {
176+
if (key.startsWith('VMware Network Adapter VMnet') || !iface) continue;
176177
for (const config of iface) {
177178
if (config.family === 'IPv4' && !config.internal) {
178179
lanAddress = `http://${config.address}:${PORT}`;

libs/hipy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {md5} from "../libs_drpy/crypto-util.js";
77
import {PythonShell, PythonShellError} from 'python-shell';
88
import {fastify} from "../controllers/fastlogger.js";
99
import {daemon} from "../utils/daemonManager.js";
10+
import {netCallPythonMethod} from '../spider/py/core/bridge.js';
1011

1112
// 缓存已初始化的模块和文件 hash 值
1213
const moduleCache = new Map();
@@ -175,7 +176,8 @@ const loadEsmWithHash = async function (filePath, fileHash, env) {
175176
// 为代理对象添加方法
176177
spiderMethods.forEach(method => {
177178
spiderProxy[method] = async (...args) => {
178-
return callPythonMethod(method, env, ...args);
179+
// return callPythonMethod(method, env, ...args);
180+
return netCallPythonMethod(filePath, method, env, ...args);
179181
};
180182
});
181183

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "drpy-node",
3-
"version": "1.2.18",
3+
"version": "1.2.19",
44
"main": "index.js",
55
"type": "module",
66
"scripts": {
@@ -51,6 +51,7 @@
5151
"node-sqlite3-wasm": "^0.8.35",
5252
"nodemailer": "^7.0.5",
5353
"p-queue": "^8.0.1",
54+
"pickleparser": "^0.2.1",
5455
"pino": "^9.7.0",
5556
"pinyin": "^4.0.0",
5657
"python-shell": "^5.0.0",

public/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</head>
99
<body>
1010
<h1 id="drpysdrpy-node">drpyS(drpy-node)</h1>
11-
<p>nodejs作为服务端的drpy实现。全面升级异步写法<br><del>积极开发中,每日一更</del>,当前进度 <code>83%</code><br><del>找工作中,随缘更新</del><br>上班当牛马,下班要带娃,阶段性佛系趁娃睡觉熬夜更新</p>
11+
<p>nodejs作为服务端的drpy实现。全面升级异步写法<br><del>积极开发中,每日一更</del>,当前进度 <code>85%</code><br><del>找工作中,随缘更新</del><br>上班当牛马,下班要带娃,阶段性佛系趁娃睡觉熬夜更新</p>
1212
<ul>
1313
<li><a href="docs/apidoc.md">接口文档</a> | <a href="docs/apiList.md">接口列表如定时任务</a> | <a href="https://github.com/waifu-project/movie/pull/135">小猫影视-待对接T4</a></li>
1414
<li><a href="/config?pwd=dzyyds">本地配置接口-动态本地</a></li>
@@ -29,6 +29,8 @@ <h1 id="drpysdrpy-node">drpyS(drpy-node)</h1>
2929
<li><a href="/cat/index.html">在线猫ds源主页</a></li>
3030
</ul>
3131
<h2 id="更新记录">更新记录</h2>
32+
<h3 id="20250824">20250824</h3>
33+
<p>更新至V1.2.19</p>
3234
<h3 id="20250823">20250823</h3>
3335
<p>更新至V1.2.18</p>
3436
<h3 id="20250822">20250822</h3>

public/sub/sub.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,12 @@
3535
"reg": "\\[[盘]\\]|push_agent|推送",
3636
"mode": 0,
3737
"status": 1
38+
},
39+
{
40+
"name": "仅HIPY",
41+
"code": "hipy",
42+
"reg": "hipy",
43+
"mode": 0,
44+
"status": 1
3845
}
3946
]

spider/catvod/荐片.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ async function init(cfg) {
1414
cfg.stype = '3';
1515
}
1616

17-
let host = 'https://api.ubj83.com';
17+
// let host = 'https://api.ubj83.com';
18+
//let host = 'https://xqmbwc.zxbwv.com';
19+
//let host = 'https://zlokzk.deweit.com';
20+
//let host = 'https://ofxbny.qyjzlh.com';
21+
//let host = 'https://ts5hto.qyjzlh.com';
22+
let host = 'https://ij1men.slsw6.com';
23+
1824
let UA = 'Mozilla/5.0 (Linux; Android 9; V2196A Build/PQ3A.190705.08211809; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;webank/h5face;webank/1.0;netType:NETWORK_WIFI;appVersion:416;packageName:com.jp3.xg3';
1925
let imghost = `https://${JSON.parse((await req(`${host}/api/appAuthConfig`)).content).data.imgDomain}`;
2026

0 commit comments

Comments
 (0)