ALLOW_FILES flag

This commit is contained in:
Tamás Kádár
2024-03-15 14:14:17 +00:00
parent 7213e6c690
commit 2653a4bccf
5 changed files with 16 additions and 7 deletions

View File

@@ -34,6 +34,10 @@ lazy_static! {
.unwrap_or("32".to_string())
.parse()
.unwrap();
pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES")
.unwrap_or("true".to_string())
.parse()
.unwrap();
}
// THEME

View File

@@ -9,6 +9,7 @@ pub struct Status {
pub max_views: u32,
pub max_expiration: u32,
pub allow_advanced: bool,
pub allow_files: bool,
// Theme
pub theme_image: String,
pub theme_text: String,

View File

@@ -11,10 +11,11 @@ async fn get_status() -> impl Responder {
max_views: *config::MAX_VIEWS,
max_expiration: *config::MAX_EXPIRATION,
allow_advanced: *config::ALLOW_ADVANCED,
allow_files: *config::ALLOW_FILES,
theme_image: config::THEME_IMAGE.to_string(),
theme_text: config::THEME_TEXT.to_string(),
theme_page_title: config::THEME_PAGE_TITLE.to_string(),
theme_favicon: config::THEME_FAVICON.to_string()
theme_favicon: config::THEME_FAVICON.to_string(),
});
}

View File

@@ -118,12 +118,14 @@
{/if}
<div class="bottom">
<Switch
data-testid="switch-file"
class="file"
label={$t('common.file')}
bind:value={isFile}
/>
{#if $status?.allow_files}
<Switch
data-testid="switch-file"
class="file"
label={$t('common.file')}
bind:value={isFile}
/>
{/if}
{#if $status?.allow_advanced}
<Switch
data-testid="switch-advanced"