mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-18 13:23:02 +00:00
奶牛快传支持下载zip目录分享#11, core框架优化
This commit is contained in:
@@ -23,6 +23,7 @@ import io.vertx.ext.web.RoutingContext;
|
|||||||
import io.vertx.ext.web.handler.BodyHandler;
|
import io.vertx.ext.web.handler.BodyHandler;
|
||||||
import io.vertx.ext.web.handler.CorsHandler;
|
import io.vertx.ext.web.handler.CorsHandler;
|
||||||
import io.vertx.ext.web.handler.StaticHandler;
|
import io.vertx.ext.web.handler.StaticHandler;
|
||||||
|
import io.vertx.ext.web.handler.TimeoutHandler;
|
||||||
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
|
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
|
||||||
import io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions;
|
import io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
@@ -39,6 +40,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static cn.qaiu.vx.core.util.ConfigConstant.ROUTE_TIME_OUT;
|
||||||
import static io.vertx.core.http.HttpHeaders.*;
|
import static io.vertx.core.http.HttpHeaders.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,6 +175,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
|||||||
route.consumes(mineType);
|
route.consumes(mineType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置默认超时
|
||||||
|
route.handler(TimeoutHandler.create(SharedDataUtil.getCustomConfig().getInteger(ROUTE_TIME_OUT)));
|
||||||
// 先执行拦截方法, 再进入业务请求
|
// 先执行拦截方法, 再进入业务请求
|
||||||
route.handler(interceptor);
|
route.handler(interceptor);
|
||||||
route.handler(ctx -> handlerMethod(instance, method, ctx)).failureHandler(ctx -> {
|
route.handler(ctx -> handlerMethod(instance, method, ctx)).failureHandler(ctx -> {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public interface ConfigConstant {
|
|||||||
String CUSTOM_CONFIG = "customConfig";
|
String CUSTOM_CONFIG = "customConfig";
|
||||||
String ASYNC_SERVICE_INSTANCES = "asyncServiceInstances";
|
String ASYNC_SERVICE_INSTANCES = "asyncServiceInstances";
|
||||||
String IGNORES_REG="ignoresReg";
|
String IGNORES_REG="ignoresReg";
|
||||||
|
|
||||||
String BASE_LOCATIONS="baseLocations";
|
String BASE_LOCATIONS="baseLocations";
|
||||||
|
|
||||||
|
String ROUTE_TIME_OUT="routeTimeOut";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class SharedDataUtil {
|
|||||||
return (JsonObject) localMap.get(key);
|
return (JsonObject) localMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JsonObject getJsonObjectForCustomConfig(String key) {
|
public static JsonObject getCustomConfig() {
|
||||||
return getJsonConfig("customConfig").getJsonObject(key);
|
return getJsonConfig("customConfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getStringForCustomConfig(String key) {
|
public static String getStringForCustomConfig(String key) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface IPanTool {
|
|||||||
|
|
||||||
static IPanTool shareURLPrefixMatching(String url, String pwd) {
|
static IPanTool shareURLPrefixMatching(String url, String pwd) {
|
||||||
|
|
||||||
if (url.startsWith(CowTool.SHARE_URL_PREFIX)) {
|
if (url.contains(CowTool.LINK_KEY)) {
|
||||||
return new CowTool(url, pwd);
|
return new CowTool(url, pwd);
|
||||||
} else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) {
|
} else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) {
|
||||||
return new EcTool(url, pwd);
|
return new EcTool(url, pwd);
|
||||||
@@ -35,7 +35,7 @@ public interface IPanTool {
|
|||||||
return new YeTool(url, pwd);
|
return new YeTool(url, pwd);
|
||||||
} else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) {
|
} else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) {
|
||||||
return new FjTool(url, pwd);
|
return new FjTool(url, pwd);
|
||||||
} else if (url.contains("lanzou")) {
|
} else if (url.contains(LzTool.LINK_KEY)) {
|
||||||
return new LzTool(url, pwd);
|
return new LzTool(url, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public class CowTool extends PanBase implements IPanTool {
|
|||||||
private static final String API_REQUEST_URL = "https://cowtransfer.com/core/api/transfer/share";
|
private static final String API_REQUEST_URL = "https://cowtransfer.com/core/api/transfer/share";
|
||||||
public static final String SHARE_URL_PREFIX = "https://cowtransfer.com/s/";
|
public static final String SHARE_URL_PREFIX = "https://cowtransfer.com/s/";
|
||||||
|
|
||||||
|
public static final String LINK_KEY = "cowtransfer.com/s/";
|
||||||
|
|
||||||
public CowTool(String key, String pwd) {
|
public CowTool(String key, String pwd) {
|
||||||
super(key, pwd);
|
super(key, pwd);
|
||||||
}
|
}
|
||||||
@@ -30,8 +32,16 @@ public class CowTool extends PanBase implements IPanTool {
|
|||||||
if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) {
|
if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) {
|
||||||
JsonObject dataJson = resJson.getJsonObject("data");
|
JsonObject dataJson = resJson.getJsonObject("data");
|
||||||
String guid = dataJson.getString("guid");
|
String guid = dataJson.getString("guid");
|
||||||
String fileId = dataJson.getJsonObject("firstFile").getString("id");
|
StringBuilder url2Build = new StringBuilder(API_REQUEST_URL + "/download?transferGuid=" + guid);
|
||||||
String url2 = API_REQUEST_URL + "/download?transferGuid=" + guid + "&fileId=" + fileId;
|
if (dataJson.getBoolean("zipDownload")) {
|
||||||
|
// &title=xxx
|
||||||
|
JsonObject firstFolder = dataJson.getJsonObject("firstFolder");
|
||||||
|
url2Build.append("&title=").append(firstFolder.getString("title"));
|
||||||
|
} else {
|
||||||
|
String fileId = dataJson.getJsonObject("firstFile").getString("id");
|
||||||
|
url2Build.append("&fileId=").append(fileId);
|
||||||
|
}
|
||||||
|
String url2 = url2Build.toString();
|
||||||
client.getAbs(url2).send().onSuccess(res2 -> {
|
client.getAbs(url2).send().onSuccess(res2 -> {
|
||||||
JsonObject res2Json = res2.bodyAsJsonObject();
|
JsonObject res2Json = res2.bodyAsJsonObject();
|
||||||
if ("success".equals(res2Json.getString("message")) && res2Json.containsKey("data")) {
|
if ("success".equals(res2Json.getString("message")) && res2Json.containsKey("data")) {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class LzTool extends PanBase implements IPanTool {
|
|||||||
|
|
||||||
public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com";
|
public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com";
|
||||||
|
|
||||||
|
public static final String LINK_KEY = "lanzou";
|
||||||
|
|
||||||
public LzTool(String key, String pwd) {
|
public LzTool(String key, String pwd) {
|
||||||
super(key, pwd);
|
super(key, pwd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ import java.util.Map;
|
|||||||
public class CommonUtils {
|
public class CommonUtils {
|
||||||
|
|
||||||
public static String adaptShortPaths(String urlPrefix, String url) {
|
public static String adaptShortPaths(String urlPrefix, String url) {
|
||||||
if (!url.startsWith(urlPrefix)) {
|
|
||||||
url = urlPrefix + url;
|
|
||||||
}
|
|
||||||
if (url.endsWith(".html")) {
|
if (url.endsWith(".html")) {
|
||||||
url = url.substring(0, url.length() - 5);
|
url = url.substring(0, url.length() - 5);
|
||||||
}
|
}
|
||||||
|
String prefix = "https://";
|
||||||
|
if (!url.startsWith(urlPrefix) && url.startsWith(prefix)) {
|
||||||
|
urlPrefix = urlPrefix.substring(prefix.length());
|
||||||
|
return url.substring(url.indexOf(urlPrefix) + urlPrefix.length());
|
||||||
|
} else if (!url.startsWith(urlPrefix)) {
|
||||||
|
url = urlPrefix + url;
|
||||||
|
}
|
||||||
return url.substring(urlPrefix.length());
|
return url.substring(urlPrefix.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cn.qaiu.lz.web.http;
|
package cn.qaiu.lz.web.http;
|
||||||
|
|
||||||
import cn.qaiu.lz.common.parser.IPanTool;
|
import cn.qaiu.lz.common.parser.IPanTool;
|
||||||
import cn.qaiu.lz.common.parser.impl.*;
|
import cn.qaiu.lz.common.parser.impl.EcTool;
|
||||||
import cn.qaiu.lz.web.model.SysUser;
|
import cn.qaiu.lz.web.model.SysUser;
|
||||||
import cn.qaiu.lz.web.service.UserService;
|
import cn.qaiu.lz.web.service.UserService;
|
||||||
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import cn.qaiu.lz.web.service.UserService;
|
|||||||
import cn.qaiu.vx.core.annotaions.Service;
|
import cn.qaiu.vx.core.annotaions.Service;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lz-web
|
* lz-web
|
||||||
* <br>Create date 2021/8/27 14:09
|
* <br>Create date 2021/8/27 14:09
|
||||||
@@ -17,6 +19,11 @@ public class UserServiceImpl implements UserService {
|
|||||||
@Override
|
@Override
|
||||||
public Future<String> login(SysUser user) {
|
public Future<String> login(SysUser user) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(6);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
return Future.succeededFuture("111");
|
return Future.succeededFuture("111");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ custom:
|
|||||||
asyncServiceInstances: 4
|
asyncServiceInstances: 4
|
||||||
# server路由(controller层)所在包路径
|
# server路由(controller层)所在包路径
|
||||||
baseLocations: cn.qaiu.lz
|
baseLocations: cn.qaiu.lz
|
||||||
|
# 路由处理默认超时时间(毫秒)
|
||||||
|
routeTimeOut: 15000
|
||||||
# 拦截器包路径
|
# 拦截器包路径
|
||||||
interceptorClassPath: cn.qaiu.lz.common.interceptorImpl.DefaultInterceptor
|
interceptorClassPath: cn.qaiu.lz.common.interceptorImpl.DefaultInterceptor
|
||||||
# 拦截器匹配规则
|
# 拦截器匹配规则
|
||||||
|
|||||||
@@ -46,15 +46,14 @@ Content-Disposition: form-data; name="email"
|
|||||||
--WebAppBoundary
|
--WebAppBoundary
|
||||||
Content-Disposition: form-data; name="joinProToken"
|
Content-Disposition: form-data; name="joinProToken"
|
||||||
|
|
||||||
|
|
||||||
--WebAppBoundary--
|
--WebAppBoundary--
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=eb9df924-7b29-496b-8147-96762fc81d28&title=spring-play
|
||||||
|
|
||||||
###
|
###
|
||||||
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch web-service/src/main/resources/http-tools/test.http' --prune-empty --tag-name-filter cat -- --all
|
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=
|
||||||
git push origin master --force
|
|
||||||
rmdir .git/refs/original/
|
###
|
||||||
git reflog expire --expire=now --all
|
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=eb9df924-7b29-496b-8147-96762fc81d28
|
||||||
git gc --prune=now
|
|
||||||
git gc --aggressive --prune=now
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ GET http://127.0.0.1:6400/cow/e4f41b51b5da4f
|
|||||||
# @no-redirect
|
# @no-redirect
|
||||||
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
|
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
|
||||||
|
|
||||||
|
### 奶牛
|
||||||
|
# @no-redirect
|
||||||
|
GET http://127.0.0.1:6400/parser?url=https://goldrepo.cowtransfer.com/s/026a638795634b
|
||||||
|
|
||||||
### 移动云空间 https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
### 移动云空间 https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
||||||
# @no-redirect
|
# @no-redirect
|
||||||
GET http://127.0.0.1:6400/parser?url=https://www.ecpan.cn/web//yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
GET http://127.0.0.1:6400/parser?url=https://www.ecpan.cn/web//yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
||||||
@@ -94,6 +98,6 @@ GET http://127.0.0.1:6400/ye/iaKtVv-qOECd
|
|||||||
GET http://127.0.0.1:6400/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
|
GET http://127.0.0.1:6400/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
|
||||||
|
|
||||||
###
|
###
|
||||||
POST http://127.0.0.1:6400/login1
|
POST http://127.0.0.1:6400/login
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user