This commit is contained in:
Timothy Jaeryang Baek
2026-01-01 14:10:11 +04:00
parent 89565c58c6
commit d3ee3fd23e
4 changed files with 28 additions and 20 deletions
+1 -1
View File
@@ -1546,7 +1546,7 @@ ENABLE_FOLDERS = PersistentConfig(
FOLDER_MAX_FILE_COUNT = PersistentConfig( FOLDER_MAX_FILE_COUNT = PersistentConfig(
"FOLDER_MAX_FILE_COUNT", "FOLDER_MAX_FILE_COUNT",
"folders.max_file_count", "folders.max_file_count",
int(os.environ.get("FOLDER_MAX_FILE_COUNT", "100")), os.environ.get("FOLDER_MAX_FILE_COUNT", ""),
) )
ENABLE_CHANNELS = PersistentConfig( ENABLE_CHANNELS = PersistentConfig(
+6 -2
View File
@@ -1013,7 +1013,7 @@ class AdminConfig(BaseModel):
ENABLE_COMMUNITY_SHARING: bool ENABLE_COMMUNITY_SHARING: bool
ENABLE_MESSAGE_RATING: bool ENABLE_MESSAGE_RATING: bool
ENABLE_FOLDERS: bool ENABLE_FOLDERS: bool
FOLDER_MAX_FILE_COUNT: int FOLDER_MAX_FILE_COUNT: Optional[int | str] = None
ENABLE_CHANNELS: bool ENABLE_CHANNELS: bool
ENABLE_NOTES: bool ENABLE_NOTES: bool
ENABLE_USER_WEBHOOKS: bool ENABLE_USER_WEBHOOKS: bool
@@ -1040,7 +1040,11 @@ async def update_admin_config(
) )
request.app.state.config.ENABLE_FOLDERS = form_data.ENABLE_FOLDERS request.app.state.config.ENABLE_FOLDERS = form_data.ENABLE_FOLDERS
request.app.state.config.FOLDER_MAX_FILE_COUNT = form_data.FOLDER_MAX_FILE_COUNT request.app.state.config.FOLDER_MAX_FILE_COUNT = (
int(form_data.FOLDER_MAX_FILE_COUNT)
if form_data.FOLDER_MAX_FILE_COUNT
else None
)
request.app.state.config.ENABLE_CHANNELS = form_data.ENABLE_CHANNELS request.app.state.config.ENABLE_CHANNELS = form_data.ENABLE_CHANNELS
request.app.state.config.ENABLE_NOTES = form_data.ENABLE_NOTES request.app.state.config.ENABLE_NOTES = form_data.ENABLE_NOTES
@@ -334,22 +334,22 @@
<Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} /> <Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} />
</div> </div>
{#if adminConfig.SHOW_ADMIN_DETAILS} {#if adminConfig.SHOW_ADMIN_DETAILS}
<div class="mb-2.5 w-full justify-between"> <div class="mb-2.5 w-full justify-between">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Admin Contact Email')}</div> <div class=" self-center text-xs font-medium">{$i18n.t('Admin Contact Email')}</div>
</div> </div>
<div class="flex mt-2 space-x-2"> <div class="flex mt-2 space-x-2">
<input <input
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden" class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
type="email" type="email"
placeholder={$i18n.t('Leave empty to use first admin user')} placeholder={$i18n.t('Leave empty to use first admin user')}
bind:value={adminConfig.ADMIN_EMAIL} bind:value={adminConfig.ADMIN_EMAIL}
/> />
</div>
</div> </div>
</div> {/if}
{/if}
<div class="mb-2.5"> <div class="mb-2.5">
<div class=" self-center text-xs font-medium mb-2"> <div class=" self-center text-xs font-medium mb-2">
@@ -704,14 +704,16 @@
{#if adminConfig.ENABLE_FOLDERS} {#if adminConfig.ENABLE_FOLDERS}
<div class="mb-2.5 w-full justify-between"> <div class="mb-2.5 w-full justify-between">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Folder Max File Count')}</div> <div class=" self-center text-xs font-medium">
{$i18n.t('Folder Max File Count')}
</div>
</div> </div>
<div class="flex mt-2 space-x-2"> <div class="flex mt-2 space-x-2">
<input <input
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden" class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
type="number" type="number"
min="1" min="0"
placeholder={$i18n.t('Enter max file count per folder')} placeholder={$i18n.t('Enter max file count per folder')}
bind:value={adminConfig.FOLDER_MAX_FILE_COUNT} bind:value={adminConfig.FOLDER_MAX_FILE_COUNT}
/> />
@@ -45,7 +45,9 @@
// Check folder max file count limit // Check folder max file count limit
const maxFileCount = $config?.features?.folder_max_file_count ?? null; const maxFileCount = $config?.features?.folder_max_file_count ?? null;
if (maxFileCount !== null && (data?.files ?? []).length > maxFileCount) { if (maxFileCount !== null && (data?.files ?? []).length > maxFileCount) {
toast.error($i18n.t('Maximum number of files per folder is {{max}}.', { max: maxFileCount })); toast.error(
$i18n.t('Maximum number of files per folder is {{max}}.', { max: maxFileCount ?? 0 })
);
loading = false; loading = false;
return; return;
} }