mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-15 20:03:02 +00:00
musetransfer api test
This commit is contained in:
@@ -21,6 +21,7 @@ import io.vertx.ext.web.Router;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import io.vertx.ext.web.handler.BodyHandler;
|
||||
import io.vertx.ext.web.handler.CorsHandler;
|
||||
import io.vertx.ext.web.handler.StaticHandler;
|
||||
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
|
||||
import io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions;
|
||||
import javassist.CtClass;
|
||||
@@ -73,6 +74,19 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
*/
|
||||
public Router createRouter() {
|
||||
Router router = Router.router(VertxHolder.getVertxInstance());
|
||||
|
||||
// 静态资源
|
||||
String path = SharedDataUtil.getJsonConfig("server")
|
||||
.getString("staticResourcePath");
|
||||
if (!StringUtils.isEmpty(path)) {
|
||||
// 静态资源
|
||||
router.route("/*").handler(StaticHandler
|
||||
.create(path)
|
||||
.setCachingEnabled(true)
|
||||
.setDefaultContentEncoding("UTF-8"));
|
||||
}
|
||||
|
||||
|
||||
router.route().handler(ctx -> {
|
||||
LOGGER.debug("The HTTP service request address information ===>path:{}, uri:{}, method:{}",
|
||||
ctx.request().path(), ctx.request().absoluteURI(), ctx.request().method());
|
||||
@@ -116,6 +130,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
.error("Method Not Allowed", 405)));
|
||||
router.errorHandler(404, ctx -> ctx.response().setStatusCode(404).setChunked(true)
|
||||
.end("Internal server error: 404 not found"));
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.security.Key;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
import java.util.HexFormat;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* AES加解密工具类
|
||||
@@ -236,4 +237,25 @@ public class AESUtils {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ========================== musetransfer加密相关 ===========================
|
||||
|
||||
//length用户要求产生字符串的长度
|
||||
public static String getRandomString(int length){
|
||||
String str="abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
Random random=new Random();
|
||||
StringBuilder sb=new StringBuilder();
|
||||
for(int i=0;i<length;i++){
|
||||
int number=random.nextInt(36);
|
||||
sb.append(str.charAt(number));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getRandomString(){
|
||||
return getRandomString(10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
###
|
||||
POST https://service.tezign.com/transfer/share/download
|
||||
Content-Type: application/json;charset=UTF-8
|
||||
X-Transfer-Device:e2cc524f8cb
|
||||
X-Transfer-Sign:af6185237445665d8f84764791c376ed
|
||||
X-Transfer-Device:a14a17ccc07
|
||||
X-Transfer-Sign:bea1e0bece50692b5d062d6d809cdb75
|
||||
|
||||
{"code":"a85hmqm1g"}
|
||||
|
||||
###
|
||||
POST https://service.tezign.com/transfer/share/download
|
||||
Content-Type: application/json;charset=UTF-8
|
||||
X-Transfer-Device:xz9ynai8bi
|
||||
X-Transfer-Sign:923690974149080012f9eba9ddc0cd82
|
||||
|
||||
{"code":"81nq4gm8j", "pwd":"3184"}
|
||||
|
||||
|
||||
###
|
||||
https://musetransfer.com/s/a85hmqm1g
|
||||
@@ -16,8 +24,8 @@ https://musetransfer.com/s/a85hmqm1g
|
||||
|
||||
|
||||
|
||||
https://musetransfer.com/s/81nq4gm8j | 密码:3184请点击链接获取《无主题 - sdgsEasyManual.doc》, 有效期至2024年6月13日
|
||||
https://musetransfer.com/s/a85hmqm1g 请点击链接获取《111》, 有效期至2024年6月13日
|
||||
#https://musetransfer.com/s/81nq4gm8j | 密码:3184请点击链接获取《无主题 - sdgsEasyManual.doc》, 有效期至2024年6月13日
|
||||
#https://musetransfer.com/s/a85hmqm1g 请点击链接获取《111》, 有效期至2024年6月13日
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +35,7 @@ https://musetransfer.com/s/a85hmqm1g 请点击链接获取《111》, 有效期
|
||||
#
|
||||
# MD5(L3RyYW5zZmVyL3NoYXJlL2Rvd25sb2Fk|eyJjb2RlIjoiYTg1aG1xbTFnIn0=|a14a17cc207|)=fc29338ac476fb1bee7d2eb12bb30bca
|
||||
#
|
||||
# L3RyYW5zZmVyL3NoYXJlL2Rvd25sb2Fk|eyJjb2RlIjoiYTg1aG1xbTFnIn0=|a14a17cc207|
|
||||
# L3RyYW5zZmVyL3NoYXJlL2Rvd25sb2Fk|eyJjb2RlIjoiODFucTRnbThqIn0=|8g54fpq1we|
|
||||
#
|
||||
# L3RyYW5zZmVyL3NoYXJlL2Rvd25sb2Fk /transfer/share/download
|
||||
# eyJjb2RlIjoiYTg1aG1xbTFnIn0= {"code":"a85hmqm1g"}
|
||||
@@ -35,3 +43,14 @@ https://musetransfer.com/s/a85hmqm1g 请点击链接获取《111》, 有效期
|
||||
# a14a17cc207 随机数
|
||||
#
|
||||
# ƒ u(t){var e="",n=t||11,u=(1+n)/2|0;(!o||i+u>c)&&(o=r(c),i=0);while(u--)e+=a[o[i++]];return e.substring(0,n)}
|
||||
# 'L3RyYW5zZmVyL3NoYXJlL2Rvd25sb2Fk|eyJjb2RlIjoiODFucTRnbThqIiwgICJwd2QiOiIzMTg0In0=|xz9ynai8bi|'
|
||||
|
||||
###
|
||||
https://transfer.musecdn1.com/a85hmqm1g/d43a1b3baf646501368a7cc2a087ae8e.zip?auth_key=1686790800-YTg1aG1xbTFnOjE1OTU1NA-0-19b281e3e5fefedac6c57272deb6e747&response-content-type=application/octet-stream&response-content-disposition=attachment%3B%20filename%3D%22netdisk-fast-download-0.1.5-bin.zip%22%3B%20filename%2A%3DUTF-8%27%27netdisk-fast-download-0.1.5-bin.zip
|
||||
Referer:https://musetransfer.com/
|
||||
|
||||
###
|
||||
# @no-cookie-jar
|
||||
# @no-redirect
|
||||
https://transfer.musecdn1.com/81nq4gm8j/2333dd8e48fbf52f787d633d506c2d8d.doc?auth_key=1686798000-ODFucTRnbThqOjE1OTU1NA-0-7f9f1174bf1cc9925ed5ad497c6344b8&response-content-type=application/octet-stream&response-content-disposition=attachment%3B%20filename%3D%22sdgsEasyManual.doc%22%3B%20filename%2A%3DUTF-8%27%27sdgsEasyManual.doc
|
||||
Referer:https://musetransfer.com/
|
||||
|
||||
@@ -28,3 +28,14 @@ server-name: Vert.x-proxy-server(v4.1.2)
|
||||
# sock:
|
||||
# - path: /real/
|
||||
# origin: 127.0.0.1:8088
|
||||
|
||||
|
||||
#proxy:
|
||||
# - listen: 8085
|
||||
# static:
|
||||
# path: /mu-down
|
||||
# # add-headers:
|
||||
# # x-token: ABC
|
||||
# root: webroot/mu-down/
|
||||
# index: index.html
|
||||
|
||||
|
||||
@@ -54,4 +54,12 @@ public class TestAESUtil {
|
||||
public void testTs() {
|
||||
System.out.println(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRandom() {
|
||||
System.out.println(AESUtils.getRandomString());
|
||||
System.out.println(AESUtils.getRandomString());
|
||||
System.out.println(AESUtils.getRandomString());
|
||||
System.out.println(AESUtils.getRandomString());
|
||||
}
|
||||
}
|
||||
|
||||
7
webroot/mu-down/a.html
Normal file
7
webroot/mu-down/a.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<html lang="en">
|
||||
<body>
|
||||
<iframe
|
||||
src="data:text/html;base64,PGZvcm0gbWV0aG9kPXBvc3QgYWN0aW9uPWh0dHA6Ly9hLmIuY29tL2Q+PGlucHV0IHR5cGU9dGV4dCBuYW1lPSdpZCcgdmFsdWU9JzEyMycvPjwvZm9ybT48c2NyaXB0PmRvY3VtZW50LmZvcm1zWzBdLnN1Ym1pdCgpOzwvc2NyaXB0Pg==">
|
||||
</iframe>
|
||||
</body>
|
||||
</html>
|
||||
74
webroot/mu-down/index.html
Normal file
74
webroot/mu-down/index.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>musetransfer文件下载中间页面</title></head>
|
||||
<body>
|
||||
<script src="jquery.min.js"></script>
|
||||
|
||||
<h1 id="msg"></h1>
|
||||
<script>
|
||||
const data = location.search.substring(1);
|
||||
const url = window.atob(data);
|
||||
console.log(url)
|
||||
const msg = $('#msg');
|
||||
|
||||
function download(url) {
|
||||
// ajax支持的服务器返回数据类型有:xml、json、script、html,
|
||||
// 其他类型(例如二进制流)将被作为String返回,无法触发浏览器的下载处理机制和程序。
|
||||
// 从Response Headers中获取fileName
|
||||
let fileName = /filename="(.*)"/g.exec(decodeURIComponent(url))[1]
|
||||
if (!fileName) {
|
||||
msg.text('解析文件名异常')
|
||||
return
|
||||
}
|
||||
msg.text('解析成功, Ajax下载完成后会自动保存, 如果文件较大可能需要一定时间请耐心等待')
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: "get",
|
||||
xhrFields: {responseType: "blob"},
|
||||
beforeSend: function (request) {
|
||||
// request.setRequestHeader("token", sessionStorage.getItem('token'));
|
||||
request.setRequestHeader("token", sessionStorage.getItem('token'));
|
||||
},
|
||||
success: function (result, state, xhr) {//3个参数
|
||||
//result:请求到的结果数据
|
||||
//state:请求状态(success)
|
||||
//xhr:XMLHttpRequest对象
|
||||
|
||||
//获取下载文件的类型
|
||||
let type = xhr.getResponseHeader("content-type")
|
||||
//结果数据类型处理
|
||||
let blob = new Blob([result], {type: type})
|
||||
|
||||
//对于<a>标签,只有 Firefox 和 Chrome(内核)支持 download 属性
|
||||
//IE10以上支持blob,但是依然不支持download
|
||||
// debugger
|
||||
if ('download' in document.createElement('a')) {//支持a标签download的浏览器
|
||||
//通过创建a标签实现
|
||||
let link = document.createElement("a");
|
||||
//文件名
|
||||
link.download = fileName;
|
||||
link.style.display = "none"
|
||||
link.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(link);
|
||||
link.click();//执行下载
|
||||
URL.revokeObjectURL(link.href);//释放url
|
||||
document.body.removeChild(link);//释放标签
|
||||
} else {//不支持
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
window.navigator.msSaveOrOpenBlob(blob, fileName)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (url.length > 16) {
|
||||
download(url)
|
||||
} else {
|
||||
msg.text('解析URL异常')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
2
webroot/mu-down/jquery.min.js
vendored
Normal file
2
webroot/mu-down/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user