- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from jason5ng32/dev
Improvements
Showing
54 changed files
with
419 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ dist-ssr | |
.vscode/extensions.json | ||
|
||
package-lock.json | ||
res | ||
localtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 从 Cloudflare 中国获取 IP 地址 | ||
const getIPFromCloudflare_CN = async () => { | ||
try { | ||
const response = await fetch("https://cf-ns.com/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "CF-CN"; | ||
return { ip: ip, source: source }; | ||
} catch (error) { | ||
console.error("Error fetching IP from Cloudflare:", error); | ||
return { | ||
ip: null, | ||
source: "CF-CN" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromCloudflare_CN }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 从 Cloudflare 获取 IPv4 地址 | ||
const getIPFromCloudflare_V4 = async () => { | ||
try { | ||
const response = await fetch("https://1.0.0.1/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "Cloudflare IPv4"; | ||
return { ip: ip, source: source }; | ||
} catch (error) { | ||
console.error("Error fetching IP from Cloudflare:", error); | ||
return { | ||
ip: null, | ||
source: "Cloudflare IPv4" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromCloudflare_V4 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 从 Cloudflare 获取 IPv6 地址 | ||
const getIPFromCloudflare_V6 = async () => { | ||
try { | ||
const response = await fetch("https://[2606:4700:4700::1111]/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "Cloudflare IPv6"; | ||
return { ip: ip, source: source }; | ||
} catch (error) { | ||
return { | ||
ip: null, | ||
source: "Cloudflare IPv6" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromCloudflare_V6 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getIPFromIPIP } from "./ipipnet"; | ||
import { getIPFromQQ } from "./qqvideo"; | ||
import { getIPFromUpai } from "./upai"; | ||
import { getIPFromCloudflare_CN } from "./cloudflare-cn"; | ||
import { getIPFromCloudflare_V4 } from "./cloudflare-v4"; | ||
import { getIPFromCloudflare_V6 } from "./cloudflare-v6"; | ||
import { getIPFromGCR } from "./ipchecking"; | ||
import { getIPFromIpify_V4 } from "./ipify-v4"; | ||
import { getIPFromIpify_V6 } from "./ipify-v6"; | ||
|
||
export { getIPFromIPIP, getIPFromQQ, getIPFromUpai, getIPFromCloudflare_CN, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromGCR, getIPFromIpify_V4, getIPFromIpify_V6}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { getIPFromCloudflare_CN } from "./cloudflare-cn"; | ||
|
||
// 从 GCR 获取 IP 地址 | ||
const getIPFromGCR = async () => { | ||
try { | ||
const url = `https://getipfromgoogle.ipcheck.ing/`; | ||
const response = await fetch(url); | ||
if (!response.ok) { | ||
throw new Error("Network response was not ok"); | ||
} | ||
|
||
const data = await response.json(); | ||
const fullIp = data.ip; | ||
const ip = fullIp.includes(',') ? fullIp.split(',')[0] : fullIp; | ||
const source = "IPCheck.ing"; | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} catch (error) { | ||
console.error("Error fetching IP from IPCheck.ing:", error); | ||
let { ip , source } = await getIPFromCloudflare_CN(); | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromGCR }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 从 IPify 获取 IPv4 地址 | ||
const getIPFromIpify_V4 = async () => { | ||
try { | ||
const response = await fetch("https://api4.ipify.org?format=json"); | ||
if (!response.ok) { | ||
throw new Error("Network response was not ok"); | ||
} | ||
|
||
const data = await response.json(); | ||
const ip = data.ip; | ||
const source = "IPify IPv4"; | ||
return { ip: ip, source: source }; | ||
} catch (error) { | ||
console.error("Error fetching IPv4 address from ipify:", error); | ||
return { | ||
ip: null, | ||
source: "IPify IPv4" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromIpify_V4 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 从 IPify 获取 IPv6 地址 | ||
const getIPFromIpify_V6 = async () => { | ||
try { | ||
const response = await fetch("https://api6.ipify.org?format=json"); | ||
if (!response.ok) { | ||
throw new Error("Network response was not ok"); | ||
} | ||
|
||
const data = await response.json(); | ||
const ip = data.ip; | ||
const source = "IPify IPv6"; | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} catch (error) { | ||
console.error("Error fetching IPv6 address from ipify:", error); | ||
return { | ||
ip: null, | ||
source: "IPify IPv6" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromIpify_V6 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { getIPFromQQ } from "./qqvideo"; | ||
|
||
// 从 IPIP.net 获取 IP 地址 | ||
const getIPFromIPIP = async () => { | ||
let ip = ""; | ||
let source = ""; | ||
try { | ||
const response = await fetch("https://myip.ipip.net/json"); | ||
const data = await response.json(); | ||
ip = data.data.ip; | ||
source = "IPIP.net"; | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} catch (error) { | ||
console.error("Error fetching IP from IPIP.net:", error); | ||
// 故障时尝试从 QQ Video 获取 IP 地址 | ||
let { ip , source } = await getIPFromQQ(); | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} | ||
}; | ||
|
||
|
||
export { getIPFromIPIP }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 从 QQ Video 获取 IP 地址 | ||
const getIPFromQQ = () => { | ||
return new Promise((resolve, reject) => { | ||
// 动态创建 script 标签发起 JSONP 请求 | ||
let script = document.createElement("script"); | ||
script.src = "https://vv.video.qq.com/checktime?otype=json&callback=ipCallback"; | ||
document.head.appendChild(script); | ||
|
||
// 设置超时拒绝 Promise,以防万一请求挂起 | ||
const timeoutId = setTimeout(() => { | ||
console.error("Request to QQ timed out"); | ||
document.head.removeChild(script); | ||
delete window.ipCallback; | ||
reject(new Error("Request to QQ timed out")); | ||
}, 2000); | ||
|
||
// 设置成功获取数据的回调 | ||
window.ipCallback = (data) => { | ||
clearTimeout(timeoutId); // 取消超时定时器 | ||
try { | ||
let ip = data.ip; | ||
let source = "QQ.com"; | ||
document.head.removeChild(script); | ||
delete window.ipCallback; | ||
resolve({ ip, source }); | ||
} catch (error) { | ||
console.error("Error processing IP data from QQ:", error); | ||
document.head.removeChild(script); | ||
delete window.ipCallback; | ||
resolve({ ip: null, source: "QQ.com"}); | ||
} | ||
}; | ||
|
||
// 设置加载错误处理 | ||
script.onerror = () => { | ||
clearTimeout(timeoutId); // 取消超时定时器 | ||
console.error("Error loading script for IP data from QQ"); | ||
document.head.removeChild(script); | ||
delete window.ipCallback; | ||
resolve({ ip: null, source: "QQ.com"}); | ||
}; | ||
}); | ||
}; | ||
|
||
export { getIPFromQQ }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getIPFromCloudflare_CN } from "./cloudflare-cn"; | ||
|
||
// 从 Upai 获取 IP 地址 | ||
const getIPFromUpai = async () => { | ||
try { | ||
const unixTime = Date.now(); | ||
const url = `https://pubstatic.b0.upaiyun.com/?_upnode&t=${unixTime}`; | ||
const response = await fetch(url); | ||
if (!response.ok) { | ||
throw new Error("Network response was not ok"); | ||
} | ||
|
||
const data = await response.json(); | ||
const ip = data.remote_addr; | ||
const source = "Upai"; | ||
return { ip: ip, source: source }; | ||
} catch (error) { | ||
console.error("Error fetching IP from Upai:", error); | ||
let { ip , source } = await getIPFromCloudflare_CN(); | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromUpai }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters