├── README.md
└── worker.js
/README.md:
--------------------------------------------------------------------------------
1 | # transcript-maker
2 | 部署在cf-worker的成绩单生成工具
3 |
--------------------------------------------------------------------------------
/worker.js:
--------------------------------------------------------------------------------
1 | addEventListener('fetch', event => {
2 | event.respondWith(handleRequest(event.request))
3 | });
4 |
5 | async function handleRequest(request) {
6 | const url = new URL(request.url);
7 |
8 | // Serve the editor HTML at the root path
9 | if (url.pathname === '/') {
10 | const editorHtml = "\n\n
\n \n \n \u6210\u7ee9\u5355\u7f16\u8f91\u5668\n \n\n\n \n
\n
\u6210\u7ee9\u5355\u7f16\u8f91\u5668
\n
\n
\n
\n
\n
\u6210\u7ee9\u5355\u5b9e\u65f6\u9884\u89c8
\n
\n
\u7f16\u8f91\u5de6\u4fa7\u8868\u5355\u5185\u5bb9\u540e\uff0c\u6b64\u5904\u5c06\u5b9e\u65f6\u663e\u793a\u9884\u89c8\u6548\u679c\u3002
\n
\n
\n
\n
\n\n \n\n\n\n"; // Python variable inserted here
11 | return new Response(editorHtml, {
12 | headers: { 'Content-Type': 'text/html;charset=UTF-8' },
13 | });
14 | }
15 |
16 | // Placeholder for other routes or API endpoints if needed in the future
17 | /*
18 | if (url.pathname === '/generate-image-server-side') {
19 | // ... logic to handle server-side image generation ...
20 | return new Response('Image generation endpoint (server-side - not implemented)', { headers: { 'Content-Type': 'text/plain' } });
21 | }
22 | */
23 |
24 | return new Response('Not found', { status: 404 });
25 | }
26 |
--------------------------------------------------------------------------------