Goodbye Unirun - Campus Running Assistant Web Versionšāāļø
School List |
---|
Chengdu University of Information Technology |
Chengdu University of Traditional Chinese Medicine |
Nanchong Health School of Sichuan Province |
... |
Deployment Platform | Byerun | Unirun |
---|---|---|
Cloudflare | Byerun | Unirun |
Vercel | Byerun | Unirun |
Install dependencies:
npm install-all
Run for development:
npm run dev
Build for production:
npm run build
export default {
async fetch(request, env) {
if (request.method === 'OPTIONS') {
return new Response(null, {
status: 200,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': '*'
}
});
} else {
return handleRequest(request, env);
}
}
};
async function handleRequest(request, env) {
const url = new URL(request.url);
const backendUrl = 'https://run-lb.tanmasports.com/v1' + url.pathname + url.search;
const newHeaders = new Headers(request.headers);
newHeaders.delete('Host');
const init = {
method: request.method,
headers: newHeaders,
body: request.method === 'GET' ? null : await request.clone().text()
};
const response = await fetch(backendUrl, init);
const responseHeaders = new Headers(response.headers);
responseHeaders.set('Access-Control-Allow-Origin', '*');
responseHeaders.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
responseHeaders.set('Access-Control-Allow-Headers', '*');
const body = await response.text();
return new Response(body, {
status: response.status,
headers: responseHeaders
});
}
This project is for learning and research purposes only and shall not be used for any commercial or illegal purposes. If you need to experience the full functionality, please use the official App.
Any direct or indirect risk damage of any nature caused by the use of this project shall be borne by the user, and the developer shall not bear any responsibility for the user's illegal behavior.
If the official believes that this project is inappropriate, please contact us through Issues and we will modify or remove it.
Byerun is released under the CC BY-NC License, Version 4.0.