一个基于 UptimeRobot API 的在线状态面板
An uptime status dashboard based on UptimeRobot API
Build an UptimeRobot API proxy based on Cloudflare Workers to solve the cross-domain issue of official API
const handleRequest = async ({ request }) => {
let url = new URL(request.url);
let response = await fetch('https://api.uptimerobot.com' + url.pathname, request);
response = new Response(response.body, response);
response.headers.set('Access-Control-Allow-Origin', '*');
response.headers.set('Access-Control-Allow-Methods', '*');
response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Headers', 'Content-Type,Access-Token');
response.headers.set('Access-Control-Expose-Headers', '*');
return response;
}
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event));
});
修改 config.js
中的 ApiDomian
为你的域名;
Modify ApiDomian
in config.js
to your domain;