新增群晖Download Station下载脚本

This commit is contained in:
blackmatrix7 2021-09-27 16:31:18 +08:00
parent f727bdeb75
commit ac1263fe09
8 changed files with 413 additions and 0 deletions

View File

@ -222,5 +222,60 @@
}
]
}
{
"id": "blackmatrix7.synology",
"name": "Synology",
"keys": ["syno_https_url", "syno_account", "syno_passwd", "syno_sid"],
"settings": [
{
"id": "syno_https_url",
"name": "群晖地址",
"val": "",
"type": "input",
"placeholder": "http://192.168.1.100:5000",
"autoGrow": true,
"desc": "目前暂不支持https请使用http"
},
{
"id": "syno_account",
"name": "群晖账户",
"val": "",
"type": "input",
"placeholder": "admin",
"autoGrow": true,
"desc": "可访问DownloadStation的账号记得设置默认下载路径"
},
{
"id": "syno_passwd",
"name": "群晖密码",
"val": "",
"type": "input",
"placeholder": "",
"autoGrow": true,
"desc": "建议单独建立一个账户保证安全"
},
{
"id": "syno_sid",
"name": "群晖Sid",
"val": "",
"type": "input",
"placeholder": "",
"autoGrow": true,
"desc": "除非无法正常获取Sid否则保持现在的值不要修改"
}
],
"author": "@blackmatrix7",
"repo": "https://github.com/blackmatrix7/ios_rule_script/tree/master/script/synology",
"icons": [
"https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/icon/synology_dark.jpg",
"https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/icon/synology.jpg"
],
"scripts": [
{
"name": "登录Synology",
"script": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/downloadstation.js"
}
]
}
]
}

80
script/synology/README.md Normal file
View File

@ -0,0 +1,80 @@
# Download Station
利用Synology的Download Station下载互联网资源。
## 说明
一个小玩具实现将互联网某些资源添加到群晖的Download Stations下载目前暂时支持推特第三方客户端的图片视频下载。
这其实是个架子提供一种思路通过脚本获取资源后添加到群晖的Download Station欢迎有兴趣的大佬一起完善添加其他功能。~~计划添加自动下载京东电子发票,看什么时候有时间再实现。~~
在使用脚本前,需要有一些前提条件:
1. 一台群晖安装Download Station
2. 会使用BoxJs
3. 保证能在各种情况下访问群晖
4. 一点点动手和排查问题的能力
## 基础配置
### 新建群晖账户
访问你的群晖新增User账户**一定要新建账户**。为了数据安全强烈建议不要给予管理员权限。仅需要DSM、~~File Station实际上不需要看着给~~、Download Station三个权限。
**目录权限方面,仅需要下载目录的读写权限,其他目录的权限不需要给**,如果你一定要给我也不拦着。
### 登录账户
登录新建的账户打开Download Station首次使用会提示选择下载目录设置好下载目录后完成配置。
### 配置BoxJS
在BoxJS里填入群晖的http地址不建议使用https可能因为证书问题会导致访问失败账户密码根据最近的设置输入sid不需要填会自动获取。
目前仅在DSM6.2上验证DSM7上没有测试是否正常如果群晖的DSM7接口没有变化应该是可以的。
## 存在的问题
群晖的sid一段时间后会失效观察了3个多月sid有效期大概1个月不到具体的时间没有统计。sid失效后需要进入boxjs手动将sid删除让脚本重新获取。~~自动更新sid可以实现不过比较懒看看什么时候手动操作烦了再考虑加这个功能。~~
可能会导致用于下载的群晖账户出现异常表现为sid无论如何重新获取都无法正常添加下载任务。这个时候需要删除这个用于下载的账户再根据上述的步骤重新添加账户。目前仅偶尔出现可能是sid失效后多过重试导致。
**所以新建一个专用的账户给脚本使用就非常重要了。**
## Twitter资源下载
### Twitter第三方客户端
因为Twitter官方的客户端带SSL Pinning没办法使用此脚本所以必须使用第三方客户端。并且**开启此脚本的复写后会导致Twitter官方客户端无法正常使用。**
### 操作方式
在Twitter第三方客户端中看到喜欢的推文点击Like会自动将推文内的图片和视频下载到群晖中。当然还要保证群晖能访问推特否则下载资源就无从谈起了……
### 配置说明
#### Surge
使用模块
```ini
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/twitter.sgmodule
```
#### Loon
使用插件
```ini
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/twitter.lnplugin
```
#### Quantumult X
配置文件
```ini
[rewrite_remote]
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/twitter.qxrewrite, tag=Twitter_离线下载收藏内容, enabled=true
```

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,8 @@
# Twitter离线下载收藏内容
[Script]
http-response ^https?:\/\/api\.twitter\.com\/[0-9.]*\/favorites\/create.json requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/downloadstation.js,tag=Twitter_离线下载收藏内容
[MITM]
hostname = api.twitter.com

View File

@ -0,0 +1,4 @@
# Twitter_离线下载收藏内容
^https?:\/\/api\.twitter\.com\/[0-9.]*\/favorites\/create.json url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/downloadstation.js
hostname = api.twitter.com

View File

@ -0,0 +1,8 @@
#!name=Twitter
#!desc=Twitter离线下载收藏内容
[Script]
Twitter_收藏离线下载 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.twitter\.com\/[0-9.]*\/favorites\/create.json,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/synology/downloadstation.js
[MITM]
hostname = %APPEND% api.twitter.com