mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
* chore: restructure project into yarn workspaces, remove next * fix tests, remove webapp from terraform * remove more ui deployment bits * remove pages, fix FUNDING.yml * remove isomorphism * remove next providers * fix linting issues * feat: start basis of new web ui system on CRA * chore: move types to @roleypoly/types package * chore: move src/common/utils to @roleypoly/misc-utils * chore: remove roleypoly/ path remappers * chore: renmove vercel config * chore: re-add worker-types to api package * chore: fix type linting scope for api * fix(web): craco should include all of packages dir * fix(ci): change api webpack path for wrangler * chore: remove GAR actions from CI * chore: update codeql job * chore: test better github dar matcher in lint-staged
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import { BotJoin } from './handlers/bot-join';
|
|
import { CreateRoleypolyData } from './handlers/create-roleypoly-data';
|
|
import { GetPickerData } from './handlers/get-picker-data';
|
|
import { GetSession } from './handlers/get-session';
|
|
import { GetSlug } from './handlers/get-slug';
|
|
import { LoginBounce } from './handlers/login-bounce';
|
|
import { LoginCallback } from './handlers/login-callback';
|
|
import { RevokeSession } from './handlers/revoke-session';
|
|
import { UpdateRoles } from './handlers/update-roles';
|
|
import { Router } from './router';
|
|
import { respond } from './utils/api-tools';
|
|
import { uiPublicURI } from './utils/config';
|
|
|
|
const router = new Router();
|
|
|
|
// OAuth
|
|
router.add('GET', 'bot-join', BotJoin);
|
|
router.add('GET', 'login-bounce', LoginBounce);
|
|
router.add('GET', 'login-callback', LoginCallback);
|
|
|
|
// Session
|
|
router.add('GET', 'get-session', GetSession);
|
|
router.add('POST', 'revoke-session', RevokeSession);
|
|
|
|
// Main biz logic
|
|
router.add('GET', 'get-slug', GetSlug);
|
|
router.add('GET', 'get-picker-data', GetPickerData);
|
|
router.add('PATCH', 'update-roles', UpdateRoles);
|
|
|
|
// Root users only
|
|
router.add('GET', 'x-create-roleypoly-data', CreateRoleypolyData);
|
|
|
|
// Tester Routes
|
|
router.add('GET', 'x-headers', (request) => {
|
|
const headers: { [x: string]: string } = {};
|
|
|
|
for (let [key, value] of request.headers.entries()) {
|
|
headers[key] = value;
|
|
}
|
|
|
|
return new Response(JSON.stringify(headers));
|
|
});
|
|
|
|
// Root Zen <3
|
|
router.addFallback('root', () => {
|
|
return respond({
|
|
__warning: '🦊',
|
|
this: 'is',
|
|
a: 'fox-based',
|
|
web: 'application',
|
|
please: 'be',
|
|
mindful: 'of',
|
|
your: 'surroundings',
|
|
warning__: '🦊',
|
|
meta: uiPublicURI,
|
|
});
|
|
});
|
|
|
|
addEventListener('fetch', (event: FetchEvent) => {
|
|
event.respondWith(router.handle(event.request));
|
|
});
|