Add home url option to branding settings
parent
3d6c5152fe
commit
1b94dc7ac8
|
@ -48,6 +48,7 @@ func addConfigFlags(flags *pflag.FlagSet) {
|
||||||
flags.String("branding.files", "", "path to directory with images and custom styles")
|
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.disableExternal", false, "disable external links such as GitHub links")
|
||||||
flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph")
|
flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph")
|
||||||
|
flags.String("branding.homeURL", "", "URL to the home website (use in case you have filebrowser embedded in another system)")
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gocyclo
|
//nolint:gocyclo
|
||||||
|
@ -153,6 +154,7 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut
|
||||||
fmt.Fprintf(w, "\tDisable used disk percentage graph:\t%t\n", set.Branding.DisableUsedPercentage)
|
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.Fprintf(w, "\tColor:\t%s\n", set.Branding.Color)
|
||||||
fmt.Fprintf(w, "\tTheme:\t%s\n", set.Branding.Theme)
|
fmt.Fprintf(w, "\tTheme:\t%s\n", set.Branding.Theme)
|
||||||
|
fmt.Fprintf(w, "\tHome URL:\t%s\n", set.Branding.HomeURL)
|
||||||
fmt.Fprintln(w, "\nServer:")
|
fmt.Fprintln(w, "\nServer:")
|
||||||
fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log)
|
fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log)
|
||||||
fmt.Fprintf(w, "\tPort:\t%s\n", ser.Port)
|
fmt.Fprintf(w, "\tPort:\t%s\n", ser.Port)
|
||||||
|
|
|
@ -41,6 +41,7 @@ override the options.`,
|
||||||
DisableUsedPercentage: mustGetBool(flags, "branding.disableUsedPercentage"),
|
DisableUsedPercentage: mustGetBool(flags, "branding.disableUsedPercentage"),
|
||||||
Theme: mustGetString(flags, "branding.theme"),
|
Theme: mustGetString(flags, "branding.theme"),
|
||||||
Files: mustGetString(flags, "branding.files"),
|
Files: mustGetString(flags, "branding.files"),
|
||||||
|
HomeURL: mustGetString(flags, "branding.homeURL"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ you want to change. Other options will remain unchanged.`,
|
||||||
set.Branding.DisableUsedPercentage = mustGetBool(flags, flag.Name)
|
set.Branding.DisableUsedPercentage = mustGetBool(flags, flag.Name)
|
||||||
case "branding.files":
|
case "branding.files":
|
||||||
set.Branding.Files = mustGetString(flags, flag.Name)
|
set.Branding.Files = mustGetString(flags, flag.Name)
|
||||||
|
case "branding.homeURL":
|
||||||
|
set.Branding.HomeURL = mustGetString(flags, flag.Name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
Signup: false,
|
Signup: false,
|
||||||
StaticURL: "",
|
StaticURL: "",
|
||||||
Theme: "",
|
Theme: "",
|
||||||
|
HomeURL: "",
|
||||||
TusSettings: { chunkSize: 10485760, retryCount: 5 },
|
TusSettings: { chunkSize: 10485760, retryCount: 5 },
|
||||||
Version: "(untracked)",
|
Version: "(untracked)",
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<header>
|
<header>
|
||||||
<img v-if="showLogo" :src="logoURL" />
|
<a :href="homeURL"> <img v-if="showLogo" :src="logoURL" /> </a>
|
||||||
<Action
|
<Action
|
||||||
v-if="showMenu"
|
v-if="showMenu"
|
||||||
class="menu-button"
|
class="menu-button"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useLayoutStore } from "@/stores/layout";
|
import { useLayoutStore } from "@/stores/layout";
|
||||||
|
|
||||||
import { logoURL } from "@/utils/constants";
|
import { logoURL, homeURL } from "@/utils/constants";
|
||||||
|
|
||||||
import Action from "@/components/header/Action.vue";
|
import Action from "@/components/header/Action.vue";
|
||||||
import { computed, useSlots } from "vue";
|
import { computed, useSlots } from "vue";
|
||||||
|
|
|
@ -29,6 +29,7 @@ interface SettingsBranding {
|
||||||
files: string;
|
files: string;
|
||||||
theme: UserTheme;
|
theme: UserTheme;
|
||||||
color: string;
|
color: string;
|
||||||
|
homeURL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SettingsTus {
|
interface SettingsTus {
|
||||||
|
|
|
@ -2,6 +2,7 @@ const name: string = window.FileBrowser.Name || "File Browser";
|
||||||
const disableExternal: boolean = window.FileBrowser.DisableExternal;
|
const disableExternal: boolean = window.FileBrowser.DisableExternal;
|
||||||
const disableUsedPercentage: boolean = window.FileBrowser.DisableUsedPercentage;
|
const disableUsedPercentage: boolean = window.FileBrowser.DisableUsedPercentage;
|
||||||
const baseURL: string = window.FileBrowser.BaseURL;
|
const baseURL: string = window.FileBrowser.BaseURL;
|
||||||
|
const homeURL: string = window.FileBrowser.HomeURL || baseURL;
|
||||||
const staticURL: string = window.FileBrowser.StaticURL;
|
const staticURL: string = window.FileBrowser.StaticURL;
|
||||||
const recaptcha: string = window.FileBrowser.ReCaptcha;
|
const recaptcha: string = window.FileBrowser.ReCaptcha;
|
||||||
const recaptchaKey: string = window.FileBrowser.ReCaptchaKey;
|
const recaptchaKey: string = window.FileBrowser.ReCaptchaKey;
|
||||||
|
@ -24,6 +25,7 @@ export {
|
||||||
disableExternal,
|
disableExternal,
|
||||||
disableUsedPercentage,
|
disableUsedPercentage,
|
||||||
baseURL,
|
baseURL,
|
||||||
|
homeURL,
|
||||||
logoURL,
|
logoURL,
|
||||||
recaptcha,
|
recaptcha,
|
||||||
recaptchaKey,
|
recaptchaKey,
|
||||||
|
|
|
@ -95,6 +95,16 @@
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="branding-name">{{ t("settings.homeURL") }}</label>
|
||||||
|
<input
|
||||||
|
class="input input--block"
|
||||||
|
type="text"
|
||||||
|
v-model="settings.branding.homeURL"
|
||||||
|
id="branding-home-url"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="branding-files">{{
|
<label for="branding-files">{{
|
||||||
t("settings.brandingDirectoryPath")
|
t("settings.brandingDirectoryPath")
|
||||||
|
|
|
@ -32,6 +32,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, fSys
|
||||||
"DisableExternal": d.settings.Branding.DisableExternal,
|
"DisableExternal": d.settings.Branding.DisableExternal,
|
||||||
"DisableUsedPercentage": d.settings.Branding.DisableUsedPercentage,
|
"DisableUsedPercentage": d.settings.Branding.DisableUsedPercentage,
|
||||||
"Color": d.settings.Branding.Color,
|
"Color": d.settings.Branding.Color,
|
||||||
|
"HomeURL": d.settings.Branding.HomeURL,
|
||||||
"BaseURL": d.server.BaseURL,
|
"BaseURL": d.server.BaseURL,
|
||||||
"Version": version.Version,
|
"Version": version.Version,
|
||||||
"StaticURL": path.Join(d.server.BaseURL, "/static"),
|
"StaticURL": path.Join(d.server.BaseURL, "/static"),
|
||||||
|
|
|
@ -8,4 +8,5 @@ type Branding struct {
|
||||||
Files string `json:"files"`
|
Files string `json:"files"`
|
||||||
Theme string `json:"theme"`
|
Theme string `json:"theme"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
|
HomeURL string `json:"homeURL"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue