0.0 前端优化,302标识短链添加/d前缀

This commit is contained in:
qaiu
2024-10-28 14:36:39 +08:00
parent 05039ece51
commit 155e88223c
11 changed files with 41 additions and 17 deletions

View File

@@ -189,6 +189,13 @@ bash service-install.sh
如果不想使用服务运行可以直接运行run.bat
> 注意: 如果jdk环境变量的java版本不是17请修改nfd-service-template.xml中的java命令的路径改为实际路径
## 相关配置说明
resources目录下包含服务端配置文件 配置文件自带说明,具体请查看配置文件内容,
app-dev.yml 可以配置解析服务相关信息, 包括端口,域名,缓存时长等
server-proxy.yml 可以配置代理服务运行的相关信息, 包括前端反向代理端口,路径等
## 0.1.9 开发计划
- 超星网盘解析 doing
- 带Referer头的js请求下载 doing

View File

@@ -132,8 +132,9 @@ public enum PanDomainTemplate {
"https://www.kugou.com/mixsong/{shareKey}.html",
MkgsTool.MkgTool.class),
// https://kuwo.cn/play_detail/395500809
// https://m.kuwo.cn/newh5app/play_detail/318448522
MKWS("酷我音乐分享*",
compile("https://kuwo\\.cn/play_detail/(?<KEY>.+)"),
compile("https://(m\\.)?kuwo\\.cn/(newh5app/)?play_detail/(?<KEY>.+)"),
"https://kuwo.cn/play_detail/{shareKey}",
MkwTool.class),
// https://music.migu.cn/v3/music/song/6326951FKBJ?channelId=001002H
@@ -148,7 +149,7 @@ public enum PanDomainTemplate {
// https://pan.huang1111.cn/s/xxx
// 通用域名([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}
CE("Cloudreve",
compile("https://([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\\.)+[a-zA-Z]{2,}(/s)?/(?<KEY>.+)"),
compile("http(s)?://([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\\.)+[a-zA-Z]{2,}(/s)?/(?<KEY>.+)"),
"https://{any}/s/{shareKey}",
CeTool.class),
// 可道云自定义域名解析

View File

@@ -138,7 +138,7 @@ public class ParserCreate {
public String genPathSuffix() {
String path;
if (panDomainTemplate == PanDomainTemplate.CE) {
if (panDomainTemplate.ordinal() >= PanDomainTemplate.CE.ordinal()) {
// 处理Cloudreve(ce)类: pan.huang1111.cn_s_wDz5TK _ -> /
path = this.shareLinkInfo.getType() + "/"
+ this.shareLinkInfo.getShareUrl()

View File

@@ -13,6 +13,7 @@ import java.util.regex.Pattern;
/**
* 酷我音乐分享
* <a href="https://kuwo.cn/play_detail/395500809">分享示例</a>
* <a href="https://m.kuwo.cn/newh5app/play_detail/318448522">分享示例</a>
*/
public class MkwTool extends PanBase {

View File

@@ -238,7 +238,7 @@ export default {
},
getInfo() {
// 初始化统计信息
axios.get('/n1/statisticsInfo').then(
axios.get('/v2/statisticsInfo').then(
response => {
if (response.data.success) {
this.node1Info = response.data.data

View File

@@ -15,12 +15,8 @@ module.exports = {
host: '127.0.0.1',
port: 6444,
proxy: {
'/api': {
'/': {
target: 'http://127.0.0.1:6400', // 请求本地
changeOrigin: true,
pathRewrite: {
'^/api': '/' //本身的接口地址没有 '/api' 这种通用前缀所以要rewrite如果本身有则去掉
},
ws: true
},
}

View File

@@ -0,0 +1,17 @@
package cn.qaiu.lz.web.controller;
import cn.qaiu.vx.core.annotaions.RouteHandler;
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.enums.RouteMethod;
import io.vertx.ext.web.RoutingContext;
import lombok.extern.slf4j.Slf4j;
@RouteHandler(value = "/d", order = 99)
@Slf4j
public class DownRedirect {
@RouteMapping(value = "/:type/:key", method = RouteMethod.GET)
public void parseKey(RoutingContext ctx, String type, String key) {
ctx.reroute("/" + type + "/" + key);
}
}

View File

@@ -68,12 +68,12 @@ public class ParserApi {
private static String getDownLink(ParserCreate create, boolean isJson) {
String linkPrefix = SharedDataUtil.getJsonConfig("server")
.getString("domainName");
String linkPrefix = SharedDataUtil.getJsonConfig("server").getString("domainName");
if (StringUtils.isBlank(linkPrefix)) {
linkPrefix = "http://127.0.0.1";
}
return linkPrefix + (isJson ? "/json/" : "/") + create.genPathSuffix();
// 下载短链前缀 /d
return linkPrefix + (isJson ? "/json/" : "/d/") + create.genPathSuffix();
}
}

View File

@@ -5,7 +5,7 @@ server:
# 使用数据库
enableDatabase: true
# 服务域名或者IP 生成二维码链接时需要
domainName: https://lz.qaiu.top
domainName: http://127.0.0.1:6401
# 反向代理服务器配置路径(不用加后缀)
proxyConf: server-proxy
@@ -40,11 +40,13 @@ dataSource:
username: root
password: '123456'
# 缓存配置
# 直链缓存相关配置
cache:
# 该配置未使用后续加入其他Cache实现时区分类型
type: h2db
# 默认时长: 单位分钟, 实际有效期分钟-1
# 默认时长: 单位分钟,大部分网盘未严格验证,建议不要太大
defaultDuration: 59
# 具体网盘的缓存配置如果不加配置则不缓存每次请求都会请求网盘API格式网盘标识: 时长
duration:
ce:
cow:

View File

@@ -11,7 +11,7 @@ GET http://127.0.0.1:6400/json/parser?url=https://wwsd.lanzoue.com/iLany1e9bbbi
GET http://127.0.0.1:6400/json/lz/i6SqHmp1yfc
### 蓝奏云https://acgtools.lanzoui.com/iUr7Qnu3sxc https://wwn.lanzouy.com/tp/ihLkw1gezutg https://wwn.lanzouy.com/ihLkw1gezutg
# @no-redirect
GET http://127.0.0.1:6400/lz/ihLkw1gezutg
GET http://127.0.0.1:6400/d/lz/ihLkw1gezutg
### 蓝奏云
# @no-redirect

View File

@@ -15,7 +15,7 @@ proxy:
# 1.origin代理地址端口后有目录(包括 / ),转发后地址:代理地址+访问URL目录部分去除location匹配目录
# 2.origin代理地址端口后无任何转发后地址代理地址+访问URL目录部
location:
- path: ~^/(json/|v2/|parser|ye/|lz/|cow/|ec/|fj/|fc/|le/|qq/|ws/|iz/|ce|mne|mqq|mkg/).*
- path: ~^/(json/|v2/|d/|parser|ye/|lz/|cow/|ec/|fj/|fc/|le/|qq/|ws/|iz/|ce/).*
origin: 127.0.0.1:6400
# json/parser -> xxx/parser