diff --git a/src/app.ts b/src/app.ts index aa88024..d6f42d6 100644 --- a/src/app.ts +++ b/src/app.ts @@ -22,6 +22,7 @@ app.use( ...helmet.contentSecurityPolicy.getDefaultDirectives(), 'default-src': ["'self'", 'plausible.jaw.dev'], 'script-src': ["'self'", "'unsafe-inline'", 'plausible.jaw.dev'], + 'script-src-attr': ["'unsafe-inline'"], }, }), ); diff --git a/src/handler.ts b/src/handler.ts index 2f3c9e1..2bde83e 100644 --- a/src/handler.ts +++ b/src/handler.ts @@ -87,6 +87,19 @@ export async function getAppChannelsPageHandler(req: Request, res: Response) { }); } +// GET /apps/:id/channels/create +export async function getNewAppChannelPageHandler(req: Request, res: Response) { + const [app] = await db + .select('*') + .from('apps') + .where({ id: parseInt(req.params.id!) }); + return res.render('apps-id-channels-create.html', { + app, + layout: '../layouts/app.html', + path: `/apps/${app.id}/channels/create`, + }); +} + // GET /apps/:id/notifications export async function getAppNotificationsPageHandler(req: Request, res: Response) { const [app] = await db diff --git a/src/router.ts b/src/router.ts index d9cf3da..ff6f286 100644 --- a/src/router.ts +++ b/src/router.ts @@ -4,6 +4,7 @@ import { getHomePageHandler, getAppsPageHandler, postCreateAppHandler, + getNewAppChannelPageHandler, getAppPageHandler, getTermsOfServicePageHandler, getSettingsPageHandler, @@ -38,6 +39,8 @@ router.get('/apps/:id', catchAsyncErrorMiddleware(getAppPageHandler)); router.get('/apps/:id/channels', catchAsyncErrorMiddleware(getAppChannelsPageHandler)); +router.get('/apps/:id/channels/create', catchAsyncErrorMiddleware(getNewAppChannelPageHandler)); + router.get('/apps/:id/notifications', catchAsyncErrorMiddleware(getAppNotificationsPageHandler)); router.get('/settings', catchAsyncErrorMiddleware(getSettingsPageHandler)); diff --git a/src/views/pages/apps-id-channels-create.html b/src/views/pages/apps-id-channels-create.html new file mode 100644 index 0000000..86967f0 --- /dev/null +++ b/src/views/pages/apps-id-channels-create.html @@ -0,0 +1,80 @@ + + + +
+
+

Channels / New

+

Create a new channel

+
+ +
+ +
+ + +
+ + + + + + + + +
+
diff --git a/src/views/pages/apps-id-channels.html b/src/views/pages/apps-id-channels.html index 5d94f4d..3587eb9 100644 --- a/src/views/pages/apps-id-channels.html +++ b/src/views/pages/apps-id-channels.html @@ -1,4 +1,10 @@ -
-

Channels

-
<%= JSON.stringify(app, null, 2) %>
+
+
+

Channels

+ Create a new channel +
+ +
+
<%= JSON.stringify(app, null, 2) %>
+