Fix enable/disable edit mode (#1333)

This commit is contained in:
WillyJL
2023-09-03 17:54:12 +02:00
committed by GitHub
parent fc9d6f796e
commit d5c90a742b
11 changed files with 21 additions and 16 deletions

View File

@@ -68,6 +68,12 @@ export const configRouter = createTRPCRouter({
})
)
.mutation(async ({ input }) => {
if (process.env.DISABLE_EDIT_MODE?.toLowerCase() === 'true') {
throw new TRPCError({
code: 'METHOD_NOT_SUPPORTED',
message: 'Edit is not allowed, because edit mode is disabled'
});
}
Consola.info(`Saving updated configuration of '${input.name}' config.`);
const previousConfig = getConfig(input.name);

View File

@@ -13,7 +13,7 @@ export const notebookRouter = createTRPCRouter({
.input(z.object({ widgetId: z.string(), content: z.string(), configName: z.string() }))
.mutation(async ({ input }) => {
//TODO: #1305 Remove use of DISABLE_EDIT_MODE for auth update
if (!process.env.DISABLE_EDIT_MODE) {
if (process.env.DISABLE_EDIT_MODE?.toLowerCase() === 'true') {
throw new TRPCError({
code: 'METHOD_NOT_SUPPORTED',
message: 'Edit is not allowed, because edit mode is disabled'