Respect CONFIG_ENABLED_APPS in .env
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Handlers, PageProps } from 'fresh/server.ts';
|
||||
|
||||
import { FreshContextState, NewsFeedArticle } from '/lib/types.ts';
|
||||
import { isAppEnabled } from '/lib/config.ts';
|
||||
import { getNewsArticles } from '/lib/data/news.ts';
|
||||
import Articles from '/islands/news/Articles.tsx';
|
||||
|
||||
@@ -14,6 +15,10 @@ export const handler: Handlers<Data, FreshContextState> = {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/login` } });
|
||||
}
|
||||
|
||||
if (!isAppEnabled('news')) {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/dashboard` } });
|
||||
}
|
||||
|
||||
const userArticles = await getNewsArticles(context.state.user.id);
|
||||
|
||||
return await context.render({ userArticles });
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Handlers, PageProps } from 'fresh/server.ts';
|
||||
|
||||
import { Directory, DirectoryFile, FreshContextState } from '/lib/types.ts';
|
||||
import { isAppEnabled } from '/lib/config.ts';
|
||||
import { getDirectories, getFiles } from '/lib/data/files.ts';
|
||||
import NotesWrapper from '/islands/notes/NotesWrapper.tsx';
|
||||
|
||||
@@ -16,6 +17,10 @@ export const handler: Handlers<Data, FreshContextState> = {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/login` } });
|
||||
}
|
||||
|
||||
if (!isAppEnabled('notes')) {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/files` } });
|
||||
}
|
||||
|
||||
const searchParams = new URL(request.url).searchParams;
|
||||
|
||||
let currentPath = searchParams.get('path') || '/Notes/';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Handlers, PageProps } from 'fresh/server.ts';
|
||||
|
||||
import { Directory, DirectoryFile, FreshContextState } from '/lib/types.ts';
|
||||
import { isAppEnabled } from '/lib/config.ts';
|
||||
import { getDirectories, getFiles } from '/lib/data/files.ts';
|
||||
import { PHOTO_EXTENSIONS } from '/lib/utils/photos.ts';
|
||||
import PhotosWrapper from '/islands/photos/PhotosWrapper.tsx';
|
||||
@@ -17,6 +18,10 @@ export const handler: Handlers<Data, FreshContextState> = {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/login` } });
|
||||
}
|
||||
|
||||
if (!isAppEnabled('photos')) {
|
||||
return new Response('Redirect', { status: 303, headers: { 'Location': `/files` } });
|
||||
}
|
||||
|
||||
const searchParams = new URL(request.url).searchParams;
|
||||
|
||||
let currentPath = searchParams.get('path') || '/Photos/';
|
||||
|
||||
Reference in New Issue
Block a user