This commit is contained in:
2026-02-25 07:27:30 +00:00
parent acd7713c86
commit cf121e2fee
11 changed files with 413 additions and 21 deletions
+33
View File
@@ -0,0 +1,33 @@
import { join } from 'node:path';
import { existsSync, readFileSync, appendFileSync, mkdirSync } from 'node:fs';
import { createRouter } from '../../create-router';
import { DATA_PATH } from '../../data-path';
export const waitlistRouter = createRouter();
const WAITLIST_FILE = join(DATA_PATH, 'waitlist.txt');
waitlistRouter.post('/', async (ctx) => {
const body = await ctx.req.json<{ email?: string }>();
const email = body.email?.trim().toLowerCase();
if (!email || !email.includes('@')) {
return ctx.json({ error: 'Invalid email' }, 400);
}
const dir = DATA_PATH;
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
if (existsSync(WAITLIST_FILE)) {
const existing = readFileSync(WAITLIST_FILE, 'utf-8');
const emails = existing.split('\n').map((l) => l.trim().toLowerCase());
if (emails.includes(email)) {
return ctx.json({ ok: true });
}
}
appendFileSync(WAITLIST_FILE, email + '\n', 'utf-8');
return ctx.json({ ok: true });
});
+2
View File
@@ -5,6 +5,7 @@ import type { HonoVariables } from './create-router';
import { authRouter } from './api/auth';
import { serverSettingsRouter } from './api/server-settings/server-settings';
import { landingPageDataRouter } from './api/landing-page-data/landing-page-data';
import { waitlistRouter } from './api/waitlist/waitlist';
import { usersRouter } from './api/users/users-router';
import { plansRouter } from './api/plans/plans';
import { skillsRouter } from './api/skills/skills';
@@ -44,6 +45,7 @@ honoServer.get('/api', (ctx) => ctx.json({ officerAPI: 'ok' }));
honoServer.route('/api/auth', authRouter);
honoServer.route('/api/server-settings', serverSettingsRouter);
honoServer.route('/api/landing-page-data', landingPageDataRouter);
honoServer.route('/api/waitlist', waitlistRouter);
honoServer.route('/api/dev-server-proxy', devServerProxyRouter);
honoServer.get('/api/integrations/google/callback', googleCallbackHandler);