// Github @BlueSkyXN // Code https://gist.github.com/BlueSkyXN/0be89e736cd2fe0418f77c034538c502 // 仅供学习CloudFlare Worker开发使用,违规使用后果自负 // License @GPLv3 // 记得修改98行左右的域名/URL为你的Worker的API节点,注意58图床会删图,只能临时、短期学习使用 addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) }) async function handleRequest(request) { if (request.method === 'POST') { try { const requestBody = await request.json(); const base64Data = requestBody.base64Data; const targetURL = "https://upload.58cdn.com.cn/json"; const payload = { "Pic-Size": "0*0", "Pic-Encoding": "base64", "Pic-Path": "/nowater/webim/big/", "Pic-Data": base64Data }; const targetResponse = await fetch(targetURL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const result = await targetResponse.text(); return new Response('https://pic1.58cdn.com.cn/nowater/webim/big/' + result, { headers: { 'content-type': 'text/plain' }, }); } catch (error) { return new Response('Error processing request: ' + error.message, { status: 500 }); } } else if (request.method === 'GET') { return new Response(htmlContent, { headers: { 'content-type': 'text/html' }, }); } } const htmlContent = `