Update index.js
Browse files
index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import https from 'https'
|
| 2 |
import crc32 from './crc32.js'
|
| 3 |
import http from 'axios'
|
| 4 |
import express from 'express'
|
|
@@ -12,9 +11,9 @@ app.use(express.urlencoded({ extended: true }))
|
|
| 12 |
// 带取消令牌的请求函数
|
| 13 |
const createRequestWithCancel = (cancelToken) => {
|
| 14 |
return {
|
| 15 |
-
get: (url, config = {}) => http.get(url, { ...config, cancelToken
|
| 16 |
-
post: (url, data, config = {}) => http.post(url, data, { ...config, cancelToken
|
| 17 |
-
head: (url, config = {}) => http.head(url, { ...config, cancelToken
|
| 18 |
}
|
| 19 |
}
|
| 20 |
|
|
@@ -209,7 +208,7 @@ app.get('*', async (req, res) => {
|
|
| 209 |
const request = createRequestWithCancel(cancelTokenSource.token)
|
| 210 |
|
| 211 |
// 获取上传信息
|
| 212 |
-
const upload_info = await request.get('
|
| 213 |
console.log(upload_info.data)
|
| 214 |
const upload_part_info = await request.post(`${upload_info.data.url}?uploadmode=part&phase=init`, null, {
|
| 215 |
headers: {
|
|
|
|
|
|
|
| 1 |
import crc32 from './crc32.js'
|
| 2 |
import http from 'axios'
|
| 3 |
import express from 'express'
|
|
|
|
| 11 |
// 带取消令牌的请求函数
|
| 12 |
const createRequestWithCancel = (cancelToken) => {
|
| 13 |
return {
|
| 14 |
+
get: (url, config = {}) => http.get(url, { ...config, cancelToken }),
|
| 15 |
+
post: (url, data, config = {}) => http.post(url, data, { ...config, cancelToken }),
|
| 16 |
+
head: (url, config = {}) => http.head(url, { ...config, cancelToken })
|
| 17 |
}
|
| 18 |
}
|
| 19 |
|
|
|
|
| 208 |
const request = createRequestWithCancel(cancelTokenSource.token)
|
| 209 |
|
| 210 |
// 获取上传信息
|
| 211 |
+
const upload_info = await request.get('http://api.emmmm.eu.org.cdn.cloudflare.net/upload/sg')
|
| 212 |
console.log(upload_info.data)
|
| 213 |
const upload_part_info = await request.post(`${upload_info.data.url}?uploadmode=part&phase=init`, null, {
|
| 214 |
headers: {
|