移除了几个不支持的,新增了一个图片Test页面
This commit is contained in:
BlueSkyXN 2024-10-29 10:53:15 +08:00
parent 0f1a71baa1
commit 64f9071fd4
7 changed files with 248 additions and 144 deletions

View File

@ -0,0 +1,23 @@
const fs = require('fs');
const path = require('path');
// 设置源文件和目标文件的路径
const srcDir = path.join(__dirname, '..', '..', 'cloudflare-page'); // cloudflare-page 目录的路径
const srcFilePath = path.join(srcDir, 'Tools-IMGTest.html'); // 源文件路径
const destDir = path.join(__dirname, '..', '..', 'dist'); // 目标 dist 目录的路径
const destToolsDir = path.join(destDir, 'tools'); // 目标 tools 目录的路径
const destFilePath = path.join(destToolsDir, 'test.html'); // 目标文件路径
// 确保目标目录存在
if (!fs.existsSync(destToolsDir)) {
fs.mkdirSync(destToolsDir, { recursive: true });
}
// 检查源文件是否存在
if (fs.existsSync(srcFilePath)) {
// 复制并重命名文件
fs.copyFileSync(srcFilePath, destFilePath);
console.log(`文件 ${srcFilePath} 已成功复制并重命名到 ${destFilePath}`);
} else {
console.log(`源文件 ${srcFilePath} 不存在。`);
}

View File

@ -72,14 +72,11 @@
<select class="form-control" id="apiSelect">
<option value="ipfs">IPFS-去中心化多网关兼容</option>
<option value="58img">58img-定期删图</option>
<option value="aliex">AliEx-国内CDN国外Akamai-不提供账号请自行部署后端</option>
<option value="jdkf">JDKF-国内BGP</option>
<option value="tgphimg">TGPH-Debug通道</option>
<option value="qst8">qst8-国内CDN</option>
<option value="vviptuangou">vviptuangou-国内CDN</option>
<option value="da8m">da8m-国内CDN</option>
<option value="10086">10086-CFIP被BAN</option>
<option value="tencent">TX-接口挂了</option>
<option value="aliex">AliEx-国内CDN国外Akamai-不提供账号请自行部署后端</option>
</select>
</div>
<div class="form-check mb-2">

View File

@ -0,0 +1,219 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>多接口图床可用性检测</title>
<!-- 字体和基本样式 -->
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
background-color: #f6f9fc;
margin: 0;
padding: 0;
}
.container {
max-width: 900px;
margin: 40px auto;
padding: 0 20px;
}
h1 {
color: #32325d;
text-align: center;
}
.upload-time {
text-align: center;
color: #525f7f;
margin-bottom: 40px;
}
.image-card {
background-color: #ffffff;
border: 1px solid #e6ebf1;
border-radius: 6px;
padding: 20px;
margin-bottom: 20px;
transition: box-shadow 0.2s ease;
}
.image-card:hover {
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11),
0 1px 3px rgba(0, 0, 0, 0.08);
}
.image-card h2 {
font-size: 20px;
color: #32325d;
margin-bottom: 10px;
}
.image-card p {
color: #525f7f;
line-height: 1.6;
word-break: break-all;
}
.image-card a {
color: #6772e5;
text-decoration: none;
}
.image-card a:hover {
text-decoration: underline;
}
.image-preview {
text-align: center;
margin-top: 20px;
}
.image-preview img {
max-width: 100%;
max-height: 300px; /* 限制图片最大高度 */
width: auto;
height: auto;
border-radius: 4px;
border: 1px solid #e6ebf1;
}
.status {
margin-top: 10px;
font-weight: bold;
text-align: center;
}
.status.ok {
color: #28a745;
}
.status.error {
color: #dc3545;
}
</style>
</head>
<body>
<div class="container">
<h1>多接口图床可用性检测</h1>
<p class="upload-time">上传时间2024年10月29日</p>
<!-- IPFS -->
<div class="image-card" data-url="https://eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" data-interface="IPFS">
<h2>IPFS</h2>
<p>图片URL<a href="https://eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" target="_blank">https://eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz</a></p>
<div class="image-preview">
<img src="https://eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- IPFS-WP -->
<div class="image-card" data-url="https://i0.wp.com/eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" data-interface="IPFS-WP">
<h2>IPFS-WP</h2>
<p>图片URL<a href="https://i0.wp.com/eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" target="_blank">https://i0.wp.com/eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz</a></p>
<div class="image-preview">
<img src="https://i0.wp.com/eth.sucks/ipfs/QmUFcsbncWVhja1xGGeHSxEk1MpGDhtSAaWhP8418vS7hz" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- 58IMG -->
<div class="image-card" data-url="https://pic4.58cdn.com.cn/nowater/webim/big/n_v293b87fefeee74021b514151580fe429a.jpg" data-interface="58IMG">
<h2>58IMG</h2>
<p>图片URL<a href="https://pic4.58cdn.com.cn/nowater/webim/big/n_v293b87fefeee74021b514151580fe429a.jpg" target="_blank">https://pic4.58cdn.com.cn/nowater/webim/big/n_v293b87fefeee74021b514151580fe429a.jpg</a></p>
<div class="image-preview">
<img src="https://pic4.58cdn.com.cn/nowater/webim/big/n_v293b87fefeee74021b514151580fe429a.jpg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- AliEx -->
<div class="image-card" data-url="https://ae01.alicdn.com/kf/A632c7925ee60472e9059db35e0c6dc50p.jpg" data-interface="AliEx">
<h2>AliEx</h2>
<p>图片URL<a href="https://ae01.alicdn.com/kf/A632c7925ee60472e9059db35e0c6dc50p.jpg" target="_blank">https://ae01.alicdn.com/kf/A632c7925ee60472e9059db35e0c6dc50p.jpg</a></p>
<div class="image-preview">
<img src="https://ae01.alicdn.com/kf/A632c7925ee60472e9059db35e0c6dc50p.jpg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- JDKF -->
<div class="image-card" data-url="https://kefu-jtalk.jd.com/upload/202410/1029104105998-20241029104106000.jpeg" data-interface="JDKF">
<h2>JDKF</h2>
<p>图片URL<a href="https://kefu-jtalk.jd.com/upload/202410/1029104105998-20241029104106000.jpeg" target="_blank">https://kefu-jtalk.jd.com/upload/202410/1029104105998-20241029104106000.jpeg</a></p>
<div class="image-preview">
<img src="https://kefu-jtalk.jd.com/upload/202410/1029104105998-20241029104106000.jpeg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- TGPH -->
<div class="image-card" data-url="https://telegra.ph/file/cba86a5f06c24dac99ecc-54641be50efaccd63d.jpg" data-interface="TGPH">
<h2>TGPH</h2>
<p>图片URL<a href="https://telegra.ph/file/cba86a5f06c24dac99ecc-54641be50efaccd63d.jpg" target="_blank">https://telegra.ph/file/cba86a5f06c24dac99ecc-54641be50efaccd63d.jpg</a></p>
<div class="image-preview">
<img src="https://telegra.ph/file/cba86a5f06c24dac99ecc-54641be50efaccd63d.jpg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- vviptuangou -->
<div class="image-card" data-url="https://assets.vviptuangou.com/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" data-interface="vviptuangou">
<h2>vviptuangou</h2>
<p>图片URL<a href="https://assets.vviptuangou.com/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" target="_blank">https://assets.vviptuangou.com/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg</a></p>
<div class="image-preview">
<img src="https://assets.vviptuangou.com/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
<!-- da8m -->
<div class="image-card" data-url="https://assets.da8m.cn/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" data-interface="da8m">
<h2>da8m</h2>
<p>图片URL<a href="https://assets.da8m.cn/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" target="_blank">https://assets.da8m.cn/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg</a></p>
<div class="image-preview">
<img src="https://assets.da8m.cn/c2ab03e2d62c6fddb35494935a6d9ae6eb0813e1.jpg" alt="图片预览">
</div>
<p class="status">检测中...</p>
</div>
</div>
<!-- JavaScript部分 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
const imageCards = document.querySelectorAll('.image-card');
imageCards.forEach(card => {
const img = card.querySelector('img');
const statusElem = card.querySelector('.status');
const imageUrl = img.src;
// 创建一个新的Image对象用于检测图片加载
const testImg = new Image();
testImg.onload = function() {
statusElem.textContent = '图片加载成功';
statusElem.classList.remove('error');
statusElem.classList.add('ok');
};
testImg.onerror = function() {
// 尝试获取HTTP状态码
fetch(imageUrl, { method: 'HEAD' })
.then(response => {
if (response.ok) {
// 如果HEAD请求成功但图片加载失败可能是CORS或其他问题
statusElem.textContent = '图片加载失败但HEAD请求成功';
} else {
statusElem.textContent = '图片加载失败,状态码:' + response.status;
}
statusElem.classList.remove('ok');
statusElem.classList.add('error');
})
.catch(error => {
statusElem.textContent = '图片加载失败,无法获取状态码';
statusElem.classList.remove('ok');
statusElem.classList.add('error');
});
};
// 设置图片源,开始加载
testImg.src = imageUrl;
// 为预览图片设置最大宽度和高度(冗余,但确保)
img.style.maxWidth = '100%';
img.style.maxHeight = '300px';
});
});
</script>
</body>
</html>

View File

@ -213,78 +213,6 @@ async function handleRequest(request) {
}
}
async function handleQst8Request(request) {
console.log('Request received:', request.url);
if (request.method !== 'POST') {
return new Response('Method not allowed', { status: 405 });
}
try {
const formData = await request.formData();
const file = formData.get('image'); // 使用 'image' 字段名
if (!file) {
return new Response('No file uploaded', { status: 400 });
}
const newFormData = new FormData();
newFormData.append('file', file, file.name); // 上传到目标服务器时使用 'file'
const targetUrl = 'https://api.qst8.cn/api/front/upload/img';
const response = await fetch(targetUrl, {
method: 'POST',
body: newFormData,
headers: {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7',
'Branchid': '1002',
'Cache-Control': 'no-cache',
'DNT': '1',
'Origin': 'https://mlw10086.serv00.net',
'Pragma': 'no-cache',
'Priority': 'u=1, i',
'Referer': 'https://mlw10086.serv00.net/',
'Sec-Ch-Ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'Sign': 'e346dedcb06bace9cd7ccc6688dd7ca1', // 替换为动态生成的sign值
'Source': 'h5',
'Tenantid': '3',
'Timestamp': '1725792862411', // 替换为动态生成的timestamp值
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
}
});
console.log('Response status:', response.status);
const responseText = await response.text();
console.log('Response body:', responseText);
try {
const jsonResponse = JSON.parse(responseText);
if (jsonResponse.code === 200 && jsonResponse.data) {
// 返回 data 字段中的 URL
return new Response(jsonResponse.data, {
status: 200,
headers: { 'Content-Type': 'text/plain' }
});
}
} catch (e) {
console.error('Failed to parse JSON:', e);
}
return new Response(responseText, {
status: response.status,
headers: response.headers
});
} catch (error) {
console.error('Error:', error);
return new Response('Internal Server Error', { status: 500 });
}
}
async function handleVviptuangouRequest(request) {
console.log('Request received:', request.url);
@ -543,71 +471,6 @@ async function handleRequest(request) {
}
}
async function handle10086Request(request) {
console.log('Request received:', request.url);
if (request.method !== 'POST') {
return new Response('Method not allowed', { status: 405 });
}
try {
const formData = await request.formData();
const file = formData.get('image'); // 使用 'image' 字段名
if (!file) {
return new Response('No file uploaded', { status: 400 });
}
const newFormData = new FormData();
newFormData.append('file', file, file.name); // 上传到目标服务器时使用 'file'
const targetUrl = 'https://mlw10086.serv00.net/upload.php';
const response = await fetch(targetUrl, {
method: 'POST',
body: newFormData,
headers: {
'Accept': '*/*',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7',
'Cache-Control': 'no-cache',
'DNT': '1',
'Origin': 'https://mlw10086.serv00.net',
'Pragma': 'no-cache',
'Referer': 'https://mlw10086.serv00.net/',
'Sec-Ch-Ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
}
});
console.log('Response status:', response.status);
const responseText = await response.text();
console.log('Response body:', responseText);
try {
const jsonResponse = JSON.parse(responseText);
if (jsonResponse.code === 200 && jsonResponse.url) {
return new Response(jsonResponse.url, {
status: 200,
headers: { 'Content-Type': 'text/plain' }
});
}
} catch (e) {
console.error('Failed to parse JSON:', e);
}
return new Response(responseText, {
status: response.status,
headers: response.headers
});
} catch (error) {
console.error('Error:', error);
return new Response('Internal Server Error', { status: 500 });
}
}
async function handleAliExpressRequest(request) {
try {

View File

@ -16,3 +16,4 @@
- 20240908 新增 da8m,qts8,vviptuangou三个均来自之前的10086今天发现他改版了
- 20240912 新增 ipfs-img对接来自 https://www.nodeseek.com/post-158028-1 TGPH临时修复方案来自 https://www.nodeseek.com/post-159355-1
- 20241014 新增 AliEx对接来自 https://jike.info/topic/36748/ ; 另外发现10086图床对CF IP进行了封禁 error "您的IP已被封禁,请联系管理员" 新增JDKF对接来自即刻图床插件
- 20241029 移除了几个不支持的新增了一个图片Test页面 https://imgup.pages.dev/test

View File

@ -8,7 +8,8 @@
"build2": "node cloudflare-page-build/scripts/Build_Tools-TGPH.js",
"build3": "node cloudflare-page-build/scripts/Build_Tools-IMGProxy.js",
"build4": "node cloudflare-page-build/scripts/Build_Tools-GoogleCache.js",
"build": "npm run build1 && npm run build2 && npm run build3 && npm run build4"
"build5": "node cloudflare-page-build/scripts/Build_Tools-IMGTest.js",
"build": "npm run build1 && npm run build2 && npm run build3 && npm run build4 && npm run build5"
},
"author": "BlueSkyXN",
"license": "GPLv3",

View File

@ -3,7 +3,7 @@ import os
import random
# 上传图片的本地路径
image_path = r"F:\Download\20241011-111233.jpg"
image_path = r"C:\Users\SKY\Pictures\20240125-144244.jpg"
# AliExpress 上传接口的 URL
upload_url = "https://filebroker.aliexpress.com/x/upload?jiketuchuang=1"