Personal Telegram developer console for GitHub

fix: keep public status endpoint minimal

davoodmehraban89 committed Oct 4, 2026 at 14:15 UTC 76454240403b5a25cc18c31691ed908aa3111bc4
1 file changed +10 -13
src/index.js
+10 -13
@@ -9,6 +9,13 @@ const jsonResponse = (payload, status = 200) => new Response(JSON.stringify(payl
9 headers: { 'Content-Type': 'application/json; charset=utf-8' }
10 });
11
12 +const publicHealthPayload = () => ({
13 + status: 'online',
14 + bot: 'Nexa Dev Bot',
15 + version: '1.1.1',
16 + mode: 'Cloudflare Worker Webhook'
17 +});
18 +
19 function senderIdFromUpdate(update) {
20 return update?.message?.from?.id ?? update?.callback_query?.from?.id ?? null;
21 }
@@ -36,6 +43,7 @@ function safeErrorMessage(error, env = {}) {
43 /**
44 * Cloudflare Worker entrypoint.
45 * Security invariants:
46 + * - Public health endpoints expose only minimal non-sensitive service identity.
47 * - Telegram webhook requests must carry the configured secret header.
48 * - Telegram updates are owner-only and unauthorized senders are ignored silently.
49 * - Workspace Mini App API validates Telegram initData, freshness and owner identity.
@@ -60,19 +68,8 @@ export default {
68 }
69
70 if (request.method === 'GET') {
63 - if (url.pathname === '/health' || url.pathname === '/') {
64 - return jsonResponse({
65 - status: 'online',
66 - bot: 'Nexa Dev Bot',
67 - version: '1.1.1',
68 - mode: 'Cloudflare Worker Webhook'
69 - });
70 - }
71 -
72 - if (url.pathname === '/status') {
73 - const bot = new GuidedNexaDevBot(env);
74 - const statusView = await bot.menu.getServiceStatusView();
75 - return jsonResponse(statusView);
71 + if (url.pathname === '/health' || url.pathname === '/' || url.pathname === '/status') {
72 + return jsonResponse(publicHealthPayload());
73 }
74
75 return new Response('Not Found', { status: 404 });