Commit 7b81271b authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: hide signup when ENABLE_SIGNUP false

parent 83107c8e
...@@ -357,12 +357,13 @@ async def get_app_config(): ...@@ -357,12 +357,13 @@ async def get_app_config():
"name": WEBUI_NAME, "name": WEBUI_NAME,
"version": VERSION, "version": VERSION,
"auth": WEBUI_AUTH, "auth": WEBUI_AUTH,
"auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
"enable_signup": webui_app.state.config.ENABLE_SIGNUP,
"enable_image_generation": images_app.state.config.ENABLED,
"enable_admin_export": ENABLE_ADMIN_EXPORT,
"default_locale": default_locale, "default_locale": default_locale,
"images": images_app.state.config.ENABLED,
"default_models": webui_app.state.config.DEFAULT_MODELS, "default_models": webui_app.state.config.DEFAULT_MODELS,
"default_prompt_suggestions": webui_app.state.config.DEFAULT_PROMPT_SUGGESTIONS, "default_prompt_suggestions": webui_app.state.config.DEFAULT_PROMPT_SUGGESTIONS,
"trusted_header_auth": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
"admin_export_enabled": ENABLE_ADMIN_EXPORT,
} }
...@@ -386,12 +387,6 @@ async def update_model_filter_config( ...@@ -386,12 +387,6 @@ async def update_model_filter_config(
app.state.config.ENABLE_MODEL_FILTER = form_data.enabled app.state.config.ENABLE_MODEL_FILTER = form_data.enabled
app.state.config.MODEL_FILTER_LIST = form_data.models app.state.config.MODEL_FILTER_LIST = form_data.models
ollama_app.state.config.ENABLE_MODEL_FILTER = app.state.config.ENABLE_MODEL_FILTER
ollama_app.state.config.MODEL_FILTER_LIST = app.state.config.MODEL_FILTER_LIST
openai_app.state.config.ENABLE_MODEL_FILTER = app.state.config.ENABLE_MODEL_FILTER
openai_app.state.config.MODEL_FILTER_LIST = app.state.config.MODEL_FILTER_LIST
return { return {
"enabled": app.state.config.ENABLE_MODEL_FILTER, "enabled": app.state.config.ENABLE_MODEL_FILTER,
"models": app.state.config.MODEL_FILTER_LIST, "models": app.state.config.MODEL_FILTER_LIST,
...@@ -412,7 +407,6 @@ class UrlForm(BaseModel): ...@@ -412,7 +407,6 @@ class UrlForm(BaseModel):
@app.post("/api/webhook") @app.post("/api/webhook")
async def update_webhook_url(form_data: UrlForm, user=Depends(get_admin_user)): async def update_webhook_url(form_data: UrlForm, user=Depends(get_admin_user)):
app.state.config.WEBHOOK_URL = form_data.url app.state.config.WEBHOOK_URL = form_data.url
webui_app.state.WEBHOOK_URL = app.state.config.WEBHOOK_URL webui_app.state.WEBHOOK_URL = app.state.config.WEBHOOK_URL
return { return {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div> <div>
<div class=" mb-2 text-sm font-medium">{$i18n.t('Database')}</div> <div class=" mb-2 text-sm font-medium">{$i18n.t('Database')}</div>
{#if $config?.admin_export_enabled ?? true} {#if $config?.enable_admin_export ?? true}
<div class=" flex w-full justify-between"> <div class=" flex w-full justify-between">
<!-- <div class=" self-center text-xs font-medium">{$i18n.t('Allow Chat Deletion')}</div> --> <!-- <div class=" self-center text-xs font-medium">{$i18n.t('Allow Chat Deletion')}</div> -->
......
...@@ -693,7 +693,7 @@ ...@@ -693,7 +693,7 @@
</button> </button>
</Tooltip> </Tooltip>
{#if $config.images && !readOnly} {#if $config.enable_image_generation && !readOnly}
<Tooltip content="Generate Image" placement="bottom"> <Tooltip content="Generate Image" placement="bottom">
<button <button
class="{isLastMessage class="{isLastMessage
......
...@@ -133,7 +133,7 @@ type Config = { ...@@ -133,7 +133,7 @@ type Config = {
images?: boolean; images?: boolean;
default_models?: string[]; default_models?: string[];
default_prompt_suggestions?: PromptSuggestion[]; default_prompt_suggestions?: PromptSuggestion[];
trusted_header_auth?: boolean; auth_trusted_header?: boolean;
model_config?: GlobalModelConfig; model_config?: GlobalModelConfig;
}; };
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
await goto('/'); await goto('/');
} }
loaded = true; loaded = true;
if (($config?.trusted_header_auth ?? false) || $config?.auth === false) { if (($config?.auth_trusted_header ?? false) || $config?.auth === false) {
await signInHandler(); await signInHandler();
} }
}); });
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
</div> --> </div> -->
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center"> <div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
{#if ($config?.trusted_header_auth ?? false) || $config?.auth === false} {#if ($config?.auth_trusted_header ?? false) || $config?.auth === false}
<div class=" my-auto pb-10 w-full"> <div class=" my-auto pb-10 w-full">
<div <div
class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200" class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200"
...@@ -194,25 +194,27 @@ ...@@ -194,25 +194,27 @@
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')} {mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button> </button>
<div class=" mt-4 text-sm text-center"> {#if $config.enable_signup}
{mode === 'signin' <div class=" mt-4 text-sm text-center">
? $i18n.t("Don't have an account?") {mode === 'signin'
: $i18n.t('Already have an account?')} ? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button
class=" font-medium underline" <button
type="button" class=" font-medium underline"
on:click={() => { type="button"
if (mode === 'signin') { on:click={() => {
mode = 'signup'; if (mode === 'signin') {
} else { mode = 'signup';
mode = 'signin'; } else {
} mode = 'signin';
}} }
> }}
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')} >
</button> {mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
</div> </button>
</div>
{/if}
</div> </div>
</form> </form>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment