// Check for old directory and get old users info
oldDirInfo := getOldDirectoryInfo()
+ // Get App Settings (Env-vars)
+ appSettings := utils.GetAppSettings()
+
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]any{
- "users": adminUsers,
- "free_space": freeSpace,
- "old_data": oldDirInfo,
+ "users": adminUsers,
+ "free_space": freeSpace,
+ "old_data": oldDirInfo,
+ "app_settings": appSettings,
})
}
// Register handles user registration
// The API endpoint
func RegisterHandler(w http.ResponseWriter, r *http.Request) {
+ if !utils.Settings.AllowRegistration {
+ http.Error(w, "Registration is not allowed", http.StatusForbidden)
+ return
+ }
+
// Parse the request body
var req RegisterRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
return nil
}
+func GetAppSettings() AppSettings {
+ // dont't show secret - remove it!
+ var tempSettings AppSettings
+
+ data, _ := json.Marshal(Settings)
+ json.Unmarshal(data, &tempSettings)
+
+ tempSettings.SecretToken = ""
+ return tempSettings
+}
+
func GetUserIDByUsername(username string) (int, error) {
// Get users
users, err := GetUsers()
let freeSpace = $state(0);
let oldData = $state({});
let users = $state([]);
+ let appSettings = $state({});
let isLoadingUsers = $state(false);
let deleteUserId = $state(null);
let isDeletingUser = $state(false);
users = response.data.users || [];
freeSpace = response.data.free_space;
oldData = response.data.old_data;
+ appSettings = response.data.app_settings || {};
} catch (error) {
console.error('Error loading users:', error);
if (error.response?.status === 401) {
adminPassword = '';
adminAuthError = '';
users = [];
+ appSettings = {};
deleteUserId = null;
}
</div>
{/if}
+ <!-- App Settings Card / Environment Variables -->
+ <div class="card mt-4">
+ <div class="card-header">
+ <h4 class="card-title mb-0">⚙️ {$t('settings.admin.environment_variables')}</h4>
+ </div>
+ <div class="card-body">
+ <p class="text-muted mb-3">
+ {$t('settings.admin.environment_variables_description')}
+ </p>
+
+ {#if Object.keys(appSettings).length > 0}
+ <div class="list-group list-group-flush">
+ {#each Object.entries(appSettings) as [key, value]}
+ <div class="list-group-item px-0 py-2">
+ <div class="row">
+ <div class="col-4">
+ <span class="fw-bold text-muted">{key}:</span>
+ </div>
+ <div class="col-8">
+ <span class="font-monospace">
+ {#if Array.isArray(value)}
+ {JSON.stringify(value)}
+ {:else if typeof value === 'boolean'}
+ <span class="badge {value ? 'bg-success' : 'bg-danger'}">
+ {value ? 'true' : 'false'}
+ </span>
+ {:else if key === 'secret_token' && value === ''}
+ <span class="text-muted fst-italic"
+ >{$t('settings.admin.hidden_for_security')}</span
+ >
+ {:else}
+ {value}
+ {/if}
+ </span>
+ </div>
+ </div>
+ </div>
+ {/each}
+ </div>
+ {:else}
+ <p class="text-muted">{$t('settings.admin.no_environment_variables')}</p>
+ {/if}
+ </div>
+ </div>
+
<!-- Reload Button moved to bottom -->
<div class="mt-4 d-flex justify-content-center">
<button class="btn btn-outline-primary" onclick={loadUsers} disabled={isLoadingUsers}>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#loginAccordion">
<div class="accordion-body">
+ <div class="alert alert-info">{$t('login.create_account_info')}</div>
+ {#if !registration_allowed}
+ <div class="alert alert-danger" role="alert">
+ {$t('login.alert.registration_not_allowed')}
+ </div>
+ {/if}
<form onsubmit={handleRegister}>
<div class="form-floating mb-3">
<input
/>
<label for="registerPassword2">{$t('login.confirm_password')}</label>
</div>
- {#if !registration_allowed}
- <div class="alert alert-danger" role="alert">
- {$t('login.alert.registration_not_allowed')}
- </div>
- {/if}
+
{#if show_registration_failed_with_message}
<div class="alert alert-danger" role="alert">
{@html $t('login.alert.registration_failed_with_message', {