luci-app-flowoffload:fix denpention && luci-app-unblockmusic: add more function

This commit is contained in:
CN_SZTL 2019-07-14 04:28:27 +08:00
parent a51719961e
commit 694fdcfbd7
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
14 changed files with 63 additions and 359 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Flow Offload
LUCI_DEPENDS:=+kmod-ipt-offload +pdnsd-alt +kmod-tcp-bbr @!LINUX_3_18 @!LINUX_4_9
LUCI_DEPENDS:=+kmod-ipt-offload +pdnsd-alt +kmod-tcp-bbr +coreutils-nohup @!LINUX_3_18 @!LINUX_4_9
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=38

View File

@ -10,7 +10,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Unblock NeteaseCloudMusic
LUCI_DEPENDS:=+node
LUCI_DEPENDS:=+node +bash
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-unblockmusic
PKG_VERSION:=1

View File

@ -1,6 +1,6 @@
mp = Map("unblockmusic", translate("解锁网易云灰色歌曲"))
mp.description = translate("原理:采用 [网易云旧链/QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源 替换网易云变灰歌曲链接<br />具体使用方法可查看github<br />https://github.com/maxlicheng/luci-app-unblockmusic")
mp.description = translate("原理:采用 [网易云旧链/QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源,替换网易云变灰歌曲链接<br/>具体使用方法可查看GitHubhttps://github.com/maxlicheng/luci-app-unblockmusic")
mp:section(SimpleSection).template = "unblockmusic/unblockmusic_status"
@ -12,18 +12,43 @@ enabled = s:option(Flag, "enabled", translate("启用解锁"))
enabled.default = 0
enabled.rmempty = false
enabled = s:option(Flag, "strict_mode", translate("启用严格模式"))
enabled.default = 0
enabled.rmempty = false
speedtype = s:option(ListValue, "musicapptype", translate("音源选择"))
speedtype:value("default", translate("默认"))
speedtype:value("NeteaseCloud", translate("网易云音乐"))
speedtype:value("QQ", translate("QQ音乐"))
speedtype:value("netease", translate("网易云音乐"))
speedtype:value("qq", translate("QQ音乐"))
speedtype:value("xiami", translate("虾米音乐"))
speedtype:value("baidu", translate("百度音乐"))
speedtype:value("kugou", translate("酷狗音乐"))
speedtype:value("koowo", translate("酷我音乐"))
speedtype:value("kuwo", translate("酷我音乐"))
speedtype:value("migu", translate("咕咪音乐"))
speedtype:value("joox", translate("JOOX音乐"))
speedtype:value("all", translate("所有平台"))
account = s:option(Value, "port", translate("端口号"))
account.datatype = "string"
enabled = s:option(Flag, "set_netease_server_ip", translate("自定义网易云服务器IP"))
enabled.description = translate("自定义网易云服务器IP地址如使用Hosts方式则必选")
enabled.default = 0
enabled.rmempty = false
account = s:option(Value, "netease_server_ip", translate("网易云服务器IP"))
account.description = translate("通过 ping music.163.com 即可获得,仅限填写一个")
account.default = "59.111.181.38"
account.datatype = "string"
account:depends("set_netease_server_ip", 1)
enabled = s:option(Flag, "enable_proxy", translate("使用代理服务器"))
enabled.description = translate("具体格式请参考https://github.com/nondanee/UnblockNeteaseMusic")
enabled.default = 0
enabled.rmempty = false
account = s:option(Value, "proxy_server_ip", translate("代理服务器IP"))
account.datatype = "string"
account:depends("enable_proxy", 1)
return mp

View File

@ -3,22 +3,34 @@
START=99
STOP=10
TYPE=$(uci get unblockmusic.@unblockmusic[0].musicapptype)
PORT=$(uci get unblockmusic.@unblockmusic[0].port)
enable="$(uci get unblockmusic.@unblockmusic[0].enabled)"
[ "$(uci get unblockmusic.@unblockmusic[0].strict_mode)" -ne "0" ] && strict_mode="-s"
[ "$(uci get unblockmusic.@unblockmusic[0].set_netease_server_ip)" -ne "0" ] && netease_server_ip="-f $(uci get unblockmusic.@unblockmusic[0].netease_server_ip)"
[ "$(uci get unblockmusic.@unblockmusic[0].enable_proxy)" -ne "0" ] && proxy_server_ip="-u $(uci get unblockmusic.@unblockmusic[0].proxy_server_ip)"
type="$(uci get unblockmusic.@unblockmusic[0].musicapptype)"
port="$(uci get unblockmusic.@unblockmusic[0].port)"
start()
{
stop
enable=$(uci get unblockmusic.@unblockmusic[0].enabled)
[ $enable -eq 0 ] && exit 0
node /usr/share/unblockmusic/app.js -p $PORT &
[ "${enable}" -eq "0" ] && exit 0
if [ "${type}" = "default" ]; then
node /usr/share/unblockmusic/app.js -p ${port} ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >/tmp/unblockmusic.log 2>&1 &
elif [ "${type}" = "all" ]; then
node /usr/share/unblockmusic/app.js -p ${port} -o kuwo migu xiami kugou qq joox netease ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >/tmp/unblockmusic.log 2>&1 &
else
node /usr/share/unblockmusic/app.js -p ${port} -o ${type} ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >/tmp/unblockmusic.log 2>&1 &
fi
/usr/share/unblockmusic/logcheck.sh >/dev/null 2>&1 &
}
stop()
{
kill -9 $(ps | grep app.js | grep -v grep | awk '{print $1}') >/dev/null 2>&1
kill -9 "$(ps | grep app.js | grep -v grep | awk '{print $1}')" >/dev/null 2>&1
kill -9 "$(ps | grep logcheck.sh | grep -v grep | awk '{print $1}')" >/dev/null 2>&1
}

View File

@ -1,15 +0,0 @@
.git
.vscode
.npmignore
.gitignore
.dockerignore
LICENSE
Procfile
README.md
node_modules
npm-debug.log
Dockerfile*
docker-compose*

View File

@ -1,72 +0,0 @@
# IDE
.vscode
.idea
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
# pkg dist directory
dist/
# es6 transformation
browser/provider
browser/cache.js

View File

@ -1,12 +0,0 @@
FROM node:lts-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --production
COPY . .
EXPOSE 8080
ENTRYPOINT ["node", "app.js"]

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2018 Nzix
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,190 +0,0 @@
<img src="https://user-images.githubusercontent.com/26399680/47980314-0e3f1700-e102-11e8-8857-e3436ecc8beb.png" alt="logo" width="140" height="140" align="right">
# UnblockNeteaseMusic
解锁网易云音乐客户端变灰歌曲
## 特性
- 使用网易云旧链 / QQ / 虾米 / 百度 / 酷狗 / 酷我 / 咕咪 / JOOX 音源替换变灰歌曲链接 (默认仅启用前四)
- 为请求增加 `X-Real-IP` 参数解锁海外限制,支持指定网易云服务器 IP支持设置上游 HTTP / HTTPS 代理
- 完整的流量代理功能 (HTTP / HTTPS),可直接作为系统代理 (同时支持 PAC)
## 运行
从源码运行
```
$ node app.js
```
或使用 Docker
```
$ docker run nondanee/unblockneteasemusic
```
```
$ docker-compose up
```
### 配置参数
```
$ node app.js -h
usage: unblockneteasemusic [-v] [-p port] [-u url] [-f host]
[-o source [source ...]] [-t token] [-e url] [-s]
[-h]
optional arguments:
-v, --version output the version number
-p port, --port port specify server port
-u url, --proxy-url url request through upstream proxy
-f host, --force-host host force the netease server ip
-o source [source ...], --match-order source [source ...]
set priority of sources
-t token, --token token set up http basic authentication
-e url, --endpoint url replace virtual endpoint with public host
-s, --strict enable proxy limitation
-h, --help output usage information
```
## 使用
**警告:本项目不提供线上 demo请不要轻易信任使用他人提供的公开代理服务以免发生安全问题**
**若将服务部署到公网,强烈建议使用严格模式 (此模式下仅放行网易云音乐所属域名的请求) `-s` 限制代理范围 (需使用 PAC 或 hosts)~~或启用 Proxy Authentication `-t <name>:<password>` 设置代理用户名密码~~ (目前密码认证在 Windows 客户端设置和 macOS 系统设置都无法生效,请不要使用),以防代理被他人滥用**
支持 Windows 客户端UWP 客户端Linux 客户端 (1.2 版本以上需要自签证书 MITM启动客户端需要增加 `--ignore-certificate-errors` 参数)macOS 客户端 (726 版本以上需要自签证书)iOS 客户端 (配置 https endpoint 或使用自签证书)Android 客户端和网页版 (需要自签证书,需要脚本配合)
目前除 UWP 外其它客户端均优先请求 HTTPS 接口,默认配置下本代理对网易云所有 HTTPS API 连接返回空数据,促使客户端降级使用 HTTP 接口 (新版 Linux 客户端和 macOS 客户端已无法降级)
因 UWP 应用存在网络隔离,限制流量发送到本机,若使用的代理在 localhost或修改的 hosts 指向 localhost需为 "网易云音乐 UWP" 手动开启 loopback 才能使用,请以**管理员身份**执行命令
```powershell
checknetisolation loopbackexempt -a -n="1F8B0F94.122165AE053F_j2p0p5q0044a6"
```
### 方法 1. 修改 hosts
向 hosts 文件添加两条规则
```
<Server IP> music.163.com
<Server IP> interface.music.163.com
```
> 使用此方法必须监听 80 端口 `-p 80`
>
> **若在本机运行程序**,请指定网易云服务器 IP `-f xxx.xxx.xxx.xxx` (可在修改 hosts 前通过 `ping music.163.com` 获得) **或** 使用代理 `-u http(s)://xxx.xxx.xxx.xxx:xxx`,以防请求死循环
>
> **Android 客户端下修改 hosts 无法直接使用**,原因和解决方法详见[云音乐安卓又搞事啦](https://jixun.moe/post/netease-android-hosts-bypass/)[安卓免 root 绕过网易云音乐 IP 限制](https://jixun.moe/post/android-block-netease-without-root/)
### 方法 2. 设置代理
PAC 自动代理脚本地址 `http://<Server Name:PORT>/proxy.pac`
全局代理地址填写服务器地址和端口号即可
| 平台 | 基础设置 |
| :------ | :------------------------------- |
| Windows | 设置 > 工具 > 自定义代理 (客户端内) |
| UWP | Windows 设置 > 网络和 Internet > 代理 |
| Linux | 系统设置 > 网络 > 网络代理 |
| macOS | 系统偏好设置 > 网络 > 高级 > 代理 |
| Android | WLAN > 修改网络 > 高级选项 > 代理 |
| iOS | 无线局域网 > HTTP 代理 > 配置代理 |
> 代理工具和方法有很多请自行探索,欢迎在 issues 讨论
### ✳方法 3. 调用接口
作为依赖库使用
```
$ npm install nondanee/UnblockNeteaseMusic
```
```javascript
const match = require('unblockneteasemusic')
/**
* Set proxy or hosts if needed
*/
global.proxy = require('url').parse('http://127.0.0.1:1080')
global.hosts = {'i.y.qq.com': '59.37.96.220'}
/**
* Find matching song from other platforms
* @param {Number} id netease song id
* @param {Array<String>||undefined} source support netease, qq, xiami, baidu, kugou, kuwo, migu, joox
* @return {Promise<Object>}
*/
match(418602084, ['netease', 'qq', 'xiami', 'baidu']).then(song => console.log(song))
```
## 效果
#### Windows 客户端
<img src="https://user-images.githubusercontent.com/26399680/57972590-425b9480-79cf-11e9-9761-b46a12d36249.png" width="100%">
#### UWP 客户端
<img src="https://user-images.githubusercontent.com/26399680/52215123-5a028780-28ce-11e9-8491-08c4c5dac3b4.png" width="100%">
#### Linux 客户端
<img src="https://user-images.githubusercontent.com/26399680/52214856-a7cac000-28cd-11e9-92dd-0c41dc619481.png" width="100%">
#### macOS 客户端
<img src="https://user-images.githubusercontent.com/26399680/52196035-51418f80-2895-11e9-8f33-78a631cdf151.png" width="100%">
#### Android 客户端
<img src="https://user-images.githubusercontent.com/26399680/57972549-eabd2900-79ce-11e9-8fef-95cb60906298.png" width="50%">
#### iOS 客户端
<img src="https://user-images.githubusercontent.com/26399680/57972440-f90a4580-79cc-11e9-8dbf-6150ee299b9c.jpg" width="50%">
## 致谢
感谢大佬们为逆向 eapi 所做的努力
使用的其它平台音源 API 出自
[trazyn/ieaseMusic](https://github.com/trazyn/ieaseMusic)
[listen1/listen1_chrome_extension](https://github.com/listen1/listen1_chrome_extension)
向所有同类项目致敬
[EraserKing/CloudMusicGear](https://github.com/EraserKing/CloudMusicGear)
[EraserKing/Unblock163MusicClient](https://github.com/EraserKing/Unblock163MusicClient)
[ITJesse/UnblockNeteaseMusic](https://github.com/ITJesse/UnblockNeteaseMusic/)
[bin456789/Unblock163MusicClient-Xposed](https://github.com/bin456789/Unblock163MusicClient-Xposed)
[YiuChoi/Unlock163Music](https://github.com/YiuChoi/Unlock163Music)
[yi-ji/NeteaseMusicAbroad](https://github.com/yi-ji/NeteaseMusicAbroad)
[stomakun/NeteaseReverseLadder](https://github.com/stomakun/NeteaseReverseLadder/)
[fengjueming/unblock-NetEaseMusic](https://github.com/fengjueming/unblock-NetEaseMusic)
[acgotaku/NetEaseMusicWorld](https://github.com/acgotaku/NetEaseMusicWorld)
[mengskysama/163-Cloud-Music-Unlock](https://github.com/mengskysama/163-Cloud-Music-Unlock)
[azureplus/163-music-unlock](https://github.com/azureplus/163-music-unlock)
[typcn/163music-mac-client-unlock](https://github.com/typcn/163music-mac-client-unlock)
## 许可
The MIT License

View File

@ -1,25 +0,0 @@
# Web Extension Port
For test
## Implementation
- Convert node module to ES6 module which can be directly executed in Chrome 61+ without Babel
- Rewrite crypto module (using CryptoJS) and request (using XMLHttpRequest) module for browser environment
- Do matching in background and transfer result with chrome runtime communication
- Inject content script for hijacking Netease Music Web Ajax response
## Build
```
$ node convert.js
```
## Install
Load unpacked extension in Developer mode
## Reference
- [brix/crypto-js](https://github.com/brix/crypto-js)
- [JixunMoe/cuwcl4c](https://github.com/JixunMoe/cuwcl4c)

View File

@ -1,9 +0,0 @@
version: '3'
services:
unblockneteasemusic:
image: nondanee/unblockneteasemusic
environment:
NODE_ENV: production
ports:
- 8080:8080

View File

@ -0,0 +1,11 @@
#!/bin/bash
log_max_size="4" #使用KB计算
log_file="/tmp/unblockmusic.log"
while true
do
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
(( "${log_size}" >= "${log_max_size}" )) && echo "" > /tmp/unblockmusic.log
sleep 5m
done

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB