feat: add a new setting that disables the display of the disk usage (#2136)
parent
60d1e2d291
commit
428c1c606d
|
@ -45,6 +45,7 @@ func addConfigFlags(flags *pflag.FlagSet) {
|
|||
flags.String("branding.color", "", "set the theme color")
|
||||
flags.String("branding.files", "", "path to directory with images and custom styles")
|
||||
flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links")
|
||||
flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph")
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
|
@ -147,6 +148,7 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut
|
|||
fmt.Fprintf(w, "\tName:\t%s\n", set.Branding.Name)
|
||||
fmt.Fprintf(w, "\tFiles override:\t%s\n", set.Branding.Files)
|
||||
fmt.Fprintf(w, "\tDisable external links:\t%t\n", set.Branding.DisableExternal)
|
||||
fmt.Fprintf(w, "\tDisable used disk percentage graph:\t%t\n", set.Branding.DisableUsedPercentage)
|
||||
fmt.Fprintf(w, "\tColor:\t%s\n", set.Branding.Color)
|
||||
fmt.Fprintln(w, "\nServer:")
|
||||
fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log)
|
||||
|
|
|
@ -37,6 +37,7 @@ override the options.`,
|
|||
Branding: settings.Branding{
|
||||
Name: mustGetString(flags, "branding.name"),
|
||||
DisableExternal: mustGetBool(flags, "branding.disableExternal"),
|
||||
DisableUsedPercentage: mustGetBool(flags, "branding.DisableUsedPercentage"),
|
||||
Files: mustGetString(flags, "branding.files"),
|
||||
},
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ you want to change. Other options will remain unchanged.`,
|
|||
set.Branding.Color = mustGetString(flags, flag.Name)
|
||||
case "branding.disableExternal":
|
||||
set.Branding.DisableExternal = mustGetBool(flags, flag.Name)
|
||||
case "branding.disableUsedPercentage":
|
||||
set.Branding.DisableUsedPercentage = mustGetBool(flags, flag.Name)
|
||||
case "branding.files":
|
||||
set.Branding.Files = mustGetString(flags, flag.Name)
|
||||
}
|
||||
|
|
|
@ -82,7 +82,9 @@
|
|||
|
||||
<div
|
||||
class="credits"
|
||||
v-if="$router.currentRoute.path.includes('/files/')"
|
||||
v-if="
|
||||
$router.currentRoute.path.includes('/files/') && !disableUsedPercentage
|
||||
"
|
||||
style="width: 90%; margin: 2em 2.5em 3em 2.5em"
|
||||
>
|
||||
<progress-bar :val="usage.usedPercentage" size="small"></progress-bar>
|
||||
|
@ -116,6 +118,7 @@ import {
|
|||
version,
|
||||
signup,
|
||||
disableExternal,
|
||||
disableUsedPercentage,
|
||||
noAuth,
|
||||
loginPage,
|
||||
} from "@/utils/constants";
|
||||
|
@ -137,6 +140,7 @@ export default {
|
|||
signup: () => signup,
|
||||
version: () => version,
|
||||
disableExternal: () => disableExternal,
|
||||
disableUsedPercentage: () => disableUsedPercentage,
|
||||
canLogout: () => !noAuth && loginPage,
|
||||
},
|
||||
asyncComputed: {
|
||||
|
@ -146,6 +150,9 @@ export default {
|
|||
? this.$route.path
|
||||
: this.$route.path + "/";
|
||||
let usageStats = { used: 0, total: 0, usedPercentage: 0 };
|
||||
if (this.disableUsedPercentage) {
|
||||
return usageStats;
|
||||
}
|
||||
try {
|
||||
let usage = await api.usage(path);
|
||||
usageStats = {
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "ستايل مخصص",
|
||||
"defaultUserDescription": "This are the default settings for new users.",
|
||||
"disableExternalLinks": "Disable external links (except documentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentation",
|
||||
"examples": "أمثلة",
|
||||
"executeOnShell": "Execute on shell",
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
"customStylesheet": "Individuelles Stylesheet",
|
||||
"defaultUserDescription": "Das sind die Standardeinstellung für Benutzer",
|
||||
"disableExternalLinks": "Externe Links deaktivieren (außer Dokumentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "Dokumentation",
|
||||
"examples": "Beispiele",
|
||||
"executeOnShell": "In Shell ausführen",
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
"customStylesheet": "Custom Stylesheet",
|
||||
"defaultUserDescription": "This are the default settings for new users.",
|
||||
"disableExternalLinks": "Disable external links (except documentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentation",
|
||||
"examples": "Examples",
|
||||
"executeOnShell": "Execute on shell",
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
"customStylesheet": "Modificar hoja de estilos",
|
||||
"defaultUserDescription": "Estas son las configuraciones por defecto para nuevos usuarios.",
|
||||
"disableExternalLinks": "Deshabilitar enlaces externos (excepto documentación)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentación",
|
||||
"examples": "Ejemplos",
|
||||
"executeOnShell": "Ejecutar en la shell",
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
"customStylesheet": "Feuille de style personnalisée",
|
||||
"defaultUserDescription": "Paramètres par défaut pour les nouveaux utilisateurs.",
|
||||
"disableExternalLinks": "Désactiver les liens externes (sauf la documentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentation",
|
||||
"examples": "Exemples",
|
||||
"executeOnShell": "Exécuter dans le shell",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "Custom Stylesheet",
|
||||
"defaultUserDescription": "Þetta eru sjálfgefnar stillingar fyrir nýja notendur.",
|
||||
"disableExternalLinks": "Sýna ytri-hlekki (fyrir utan leiðbeiningar)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "leiðbeiningar",
|
||||
"examples": "Dæmi",
|
||||
"executeOnShell": "Keyra í skel",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "Foglio di stile personalizzato",
|
||||
"defaultUserDescription": "Queste sono le impostazioni predefinite per i nuovi utenti.",
|
||||
"disableExternalLinks": "Disabilita link esterni (tranne per la documentazione)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentazione",
|
||||
"examples": "Esempi",
|
||||
"executeOnShell": "Esegui nella shell",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "カスタムスタイルシ ート",
|
||||
"defaultUserDescription": "This are the default settings for new users.",
|
||||
"disableExternalLinks": "Disable external links (except documentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentation",
|
||||
"examples": "例",
|
||||
"executeOnShell": "Execute on shell",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "커스텀 스타일시트",
|
||||
"defaultUserDescription": "아래 사항은 신규 사용자들에 대한 기본 설정입니다.",
|
||||
"disableExternalLinks": "외부 링크 감추기",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "문서",
|
||||
"examples": "예",
|
||||
"executeOnShell": "쉘에서 실행",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "Aangepast Stylesheet",
|
||||
"defaultUserDescription": "Dit zijn de standaardinstellingen voor nieuwe gebruikers.",
|
||||
"disableExternalLinks": "Schakel externe links uit (behalve documentatie)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "Documentatie",
|
||||
"examples": "Voorbeelden",
|
||||
"executeOnShell": "Uitvoeren in de shell",
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
"customStylesheet": "Własny arkusz stylów",
|
||||
"defaultUserDescription": "Oto domyślne ustawienia dla nowych użytkowników.",
|
||||
"disableExternalLinks": "Wyłącz linki zewnętrzne (z wyjątkiem dokumentacji)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "dokumentacja",
|
||||
"examples": "Przykłady",
|
||||
"executeOnShell": "Wykonaj w powłoce",
|
||||
|
@ -258,4 +259,3 @@
|
|||
"unit": "Jednostka czasu"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
"customStylesheet": "Estilos personalizados",
|
||||
"defaultUserDescription": "Estas são as configurações padrão para novos usuários.",
|
||||
"disableExternalLinks": "Desabilitar links externos (exceto documentação)",
|
||||
"disableUsedDiskPercentage": "Desabilitar gráfico de porcentagem de disco usado",
|
||||
"documentation": "documentação",
|
||||
"examples": "Exemplos",
|
||||
"executeOnShell": "Executar no console",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "Folha de estilos personalizada",
|
||||
"defaultUserDescription": "Estas são as configurações padrão para novos utilizadores.",
|
||||
"disableExternalLinks": "Desativar links externos (exceto documentação)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentação",
|
||||
"examples": "Exemplos",
|
||||
"executeOnShell": "Executar na shell",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "CSS personalizat",
|
||||
"defaultUserDescription": "Acestea sunt setările implicite pentru noii utilizatori.",
|
||||
"disableExternalLinks": "Dezactivează linkurile externe (exceptând documentația)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "documentație",
|
||||
"examples": "Exemple",
|
||||
"executeOnShell": "Execută in linia de comandă",
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
"customStylesheet": "Свой стиль",
|
||||
"defaultUserDescription": "Это настройки по умолчанию для новых пользователей.",
|
||||
"disableExternalLinks": "Отключить внешние ссылки (кроме документации)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "документация",
|
||||
"examples": "Примеры",
|
||||
"executeOnShell": "Выполнить в командной строке",
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
"customStylesheet": "Vlastný Stylesheet",
|
||||
"defaultUserDescription": "Toto sú predvolané nastavenia nového používateľa.",
|
||||
"disableExternalLinks": "Vypnúť externé odkazy (okrem dokumentácie)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "dokumentácia",
|
||||
"examples": "Príklady",
|
||||
"executeOnShell": "Vykonať cez shell",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "Anpassad formatmall",
|
||||
"defaultUserDescription": "Detta är standard inställningar för användare.",
|
||||
"disableExternalLinks": "Inaktivera externa länkar (förutom dokumentation)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "dokumentation",
|
||||
"examples": "Exempel",
|
||||
"executeOnShell": "Exekvera på skal",
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
"customStylesheet": "Özel CSS",
|
||||
"defaultUserDescription": "Bu, yeni kullanıcılar için varsayılan ayarlardır.",
|
||||
"disableExternalLinks": "Harici bağlantıları devre dışı bırakın (dökümantasyon hariç)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "dökümantasyon",
|
||||
"examples": "Örnekler",
|
||||
"executeOnShell": "Komut satırında çalıştır",
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
"customStylesheet": "Свій стиль",
|
||||
"defaultUserDescription": "Це налаштування за замовчуванням для нових користувачів.",
|
||||
"disableExternalLinks": "Вимкнути зовнішні посилання (крім документації)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "документація",
|
||||
"examples": "Приклади",
|
||||
"executeOnShell": "Виконати в командному рядку",
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
"customStylesheet": "自定义样式表(CSS)",
|
||||
"defaultUserDescription": "这些是新用户的默认设置。",
|
||||
"disableExternalLinks": "禁止外部链接(帮助文档除外)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "帮助文档",
|
||||
"examples": "例子",
|
||||
"executeOnShell": "在 Shell 中执行",
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
"customStylesheet": "自定義樣式表",
|
||||
"defaultUserDescription": "這些是新使用者的預設設定。",
|
||||
"disableExternalLinks": "禁止外部連結(幫助文件除外)",
|
||||
"disableUsedDiskPercentage": "Disable used disk percentage graph",
|
||||
"documentation": "幫助文件",
|
||||
"examples": "範例",
|
||||
"executeOnShell": "在Shell中執行",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const name = window.FileBrowser.Name || "File Browser";
|
||||
const disableExternal = window.FileBrowser.DisableExternal;
|
||||
const disableUsedPercentage = window.FileBrowser.DisableUsedPercentage;
|
||||
const baseURL = window.FileBrowser.BaseURL;
|
||||
const staticURL = window.FileBrowser.StaticURL;
|
||||
const recaptcha = window.FileBrowser.ReCaptcha;
|
||||
|
@ -19,6 +20,7 @@ const origin = window.location.origin;
|
|||
export {
|
||||
name,
|
||||
disableExternal,
|
||||
disableUsedPercentage,
|
||||
baseURL,
|
||||
logoURL,
|
||||
recaptcha,
|
||||
|
|
|
@ -62,6 +62,15 @@
|
|||
{{ $t("settings.disableExternalLinks") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="settings.branding.disableUsedPercentage"
|
||||
id="branding-links"
|
||||
/>
|
||||
{{ $t("settings.disableUsedDiskPercentage") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="theme">{{ $t("settings.themes.title") }}</label>
|
||||
<themes
|
||||
|
|
|
@ -29,6 +29,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, fSys
|
|||
data := map[string]interface{}{
|
||||
"Name": d.settings.Branding.Name,
|
||||
"DisableExternal": d.settings.Branding.DisableExternal,
|
||||
"DisableUsedPercentage": d.settings.Branding.DisableUsedPercentage,
|
||||
"Color": d.settings.Branding.Color,
|
||||
"BaseURL": d.server.BaseURL,
|
||||
"Version": version.Version,
|
||||
|
|
|
@ -4,6 +4,7 @@ package settings
|
|||
type Branding struct {
|
||||
Name string `json:"name"`
|
||||
DisableExternal bool `json:"disableExternal"`
|
||||
DisableUsedPercentage bool `json:"disableUsedPercentage"`
|
||||
Files string `json:"files"`
|
||||
Theme string `json:"theme"`
|
||||
Color string `json:"color"`
|
||||
|
|
Loading…
Reference in New Issue