Disable system settings for demo mode (#78)

Co-authored-by: Wayne <5291640+ringoinca@users.noreply.github.com>
This commit is contained in:
Wei S.
2025-09-01 13:29:45 +03:00
committed by GitHub
parent 94021eab69
commit 85607d2ab3
2 changed files with 9 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import type { Request, Response } from 'express';
import { SettingsService } from '../../services/SettingsService';
import { config } from '../../config';
const settingsService = new SettingsService();
@@ -16,6 +17,9 @@ export const getSettings = async (req: Request, res: Response) => {
export const updateSettings = async (req: Request, res: Response) => {
try {
// Basic validation can be performed here if necessary
if (config.app.isDemo) {
return res.status(403).json({ message: req.t('errors.demoMode') });
}
const updatedSettings = await settingsService.updateSettings(req.body);
res.status(200).json(updatedSettings);
} catch (error) {

View File

@@ -157,7 +157,11 @@ export class ImapConnector implements IEmailConnector {
// filter out trash and all mail emails
if (mailbox.specialUse) {
const specialUse = mailbox.specialUse.toLowerCase();
if (specialUse === '\\junk' || specialUse === '\\trash' || specialUse === '\\all') {
if (
specialUse === '\\junk' ||
specialUse === '\\trash' ||
specialUse === '\\all'
) {
return false;
}
}