Config: Add "imprint" option to display legal info in the footer #1990

This commit is contained in:
Michael Mayer 2022-02-08 14:41:03 +01:00
parent 4c1d68eb85
commit 7c4241fbea
10 changed files with 73 additions and 21 deletions

View file

@ -18,7 +18,10 @@
<svg width="264" height="264" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="a" x1="45.04" y1="231.72" x2="231.72" y2="45.04" gradientUnits="userSpaceOnUse" gradientTransform="translate(-6.38 -6.38)"><stop offset="0" stop-color="#fff"/><stop offset="0" stop-color="#b8edff"/><stop offset="1" stop-color="#d4b8ff"/></linearGradient></defs><circle cx="132" cy="132" r="132" style="fill:url(#a)"/><path data-name="Logo Pfad" d="m223.19 175.51-4 24.19M40.91 176.5l14.81 14m95.76-137.65L55.62 190.31a.09.09 0 0 0 .07.15l163.41 9.37a.09.09 0 0 0 .09-.13L151.62 52.87a.1.1 0 0 0-.14-.02zm-19.74-13.29L40.8 176.31a.13.13 0 0 0 .11.19l182.18-.8a.12.12 0 0 0 .1-.19L131.95 39.56a.12.12 0 0 0-.21 0zm.11-.16 19.77 13.32" style="fill:none;stroke:#1d1d1b;stroke-miterlimit:10;stroke-width:6px;shape-rendering:geometricPrecision"/></svg>
{{end}}
</div>
{{if not .config.Sponsor}}<div id="loading-info"><a href="{{ .signUp.url }}" target="_blank">{{ .signUp.message }}</a></div>{{end}}
{{if .config.Imprint}}<div id="loading-info">
{{if .config.ImprintUrl}}<a href="{{ .config.ImprintUrl }}" target="_blank">{{ .config.Imprint }}</a>{{else}}
<span>{{ .config.Imprint }}</span>{{end}}
</div>{{end}}
</div>
<div id="busy-overlay"></div>

View file

@ -500,7 +500,10 @@
</v-navigation-drawer>
<div v-if="isTest" id="photoprism-info"><a href="https://photoprism.app/" target="_blank">Browse Your Life in Pictures</a></div>
<div v-if="config.imprint" id="imprint">
<a v-if="config.imprintUrl" :href="config.imprintUrl" target="_blank">{{ config.imprint }}</a>
<span v-else>{{ config.imprint }}</span>
</div>
<p-reload-dialog :show="reload.dialog" @close="reload.dialog = false"></p-reload-dialog>
<p-upload-dialog :show="upload.dialog" @cancel="upload.dialog = false"
@confirm="upload.dialog = false"></p-upload-dialog>
@ -557,7 +560,7 @@ export default {
accountInfo() {
const user = this.$session.getUser();
return user.PrimaryEmail ? user.PrimaryEmail : this.$gettext("Account");
}
},
},
created() {
this.reload.subscription = Event.subscribe("dialog.reload", () => this.reload.dialog = true);

View file

@ -53,7 +53,7 @@
color: white;
}
#photoprism-info {
#imprint {
position: fixed;
bottom: 0;
left: 50%;
@ -64,7 +64,8 @@
border-radius: 5px 5px 0 0;
}
#photoprism-info a {
#imprint a,
#imprint span {
text-decoration: none;
font-size: 12px;
color: #000;

View file

@ -148,7 +148,8 @@
text-align: center;
}
#loading-info a {
#loading-info a,
#loading-info span {
text-align: center;
text-decoration: none;
font-size: 13px;

View file

@ -18,7 +18,7 @@
</v-toolbar>
<v-toolbar dark flat :dense="$vuetify.breakpoint.smAndDown" color="#fafafa">
</v-toolbar>
<div id="photoprism-info"><a href="https://photoprism.app/" target="_blank">Shared with PhotoPrism</a></div>
<div id="imprint"><a href="https://photoprism.app/" target="_blank">Shared with PhotoPrism</a></div>
</div>
</template>

View file

@ -100,6 +100,10 @@ func configAction(ctx *cli.Context) error {
fmt.Printf("%-25s %s\n", "site-description", conf.SiteDescription())
fmt.Printf("%-25s %s\n", "site-preview", conf.SitePreview())
// Legal info.
fmt.Printf("%-25s %s\n", "imprint", conf.Imprint())
fmt.Printf("%-25s %s\n", "imprint-url", conf.ImprintUrl())
// URIs.
fmt.Printf("%-25s %s\n", "content-uri", conf.ContentUri())
fmt.Printf("%-25s %s\n", "static-uri", conf.StaticUri())

View file

@ -31,6 +31,8 @@ type ClientConfig struct {
SiteCaption string `json:"siteCaption"`
SiteDescription string `json:"siteDescription"`
SitePreview string `json:"sitePreview"`
Imprint string `json:"imprint"`
ImprintUrl string `json:"imprintUrl"`
AppName string `json:"appName"`
AppMode string `json:"appMode"`
AppIcon string `json:"appIcon"`
@ -206,6 +208,8 @@ func (c *Config) PublicConfig() ClientConfig {
SiteCaption: c.SiteCaption(),
SiteDescription: c.SiteDescription(),
SitePreview: c.SitePreview(),
Imprint: c.Imprint(),
ImprintUrl: c.ImprintUrl(),
AppName: c.AppName(),
AppMode: c.AppMode(),
AppIcon: c.AppIcon(),
@ -274,6 +278,8 @@ func (c *Config) GuestConfig() ClientConfig {
SiteCaption: c.SiteCaption(),
SiteDescription: c.SiteDescription(),
SitePreview: c.SitePreview(),
Imprint: c.Imprint(),
ImprintUrl: c.ImprintUrl(),
AppName: c.AppName(),
AppMode: c.AppMode(),
AppIcon: c.AppIcon(),
@ -337,6 +343,8 @@ func (c *Config) UserConfig() ClientConfig {
SiteCaption: c.SiteCaption(),
SiteDescription: c.SiteDescription(),
SitePreview: c.SitePreview(),
Imprint: c.Imprint(),
ImprintUrl: c.ImprintUrl(),
AppName: c.AppName(),
AppMode: c.AppMode(),
AppIcon: c.AppIcon(),

View file

@ -384,6 +384,24 @@ func (c *Config) SitePreview() string {
return c.options.SitePreview
}
// Imprint returns the legal info text for the page footer.
func (c *Config) Imprint() string {
if !c.Sponsor() || c.Test() {
return MsgSponsor
}
return c.options.Imprint
}
// ImprintUrl returns the legal info url.
func (c *Config) ImprintUrl() string {
if !c.Sponsor() || c.Test() {
return SignUpURL
}
return c.options.ImprintUrl
}
// Debug tests if debug mode is enabled.
func (c *Config) Debug() bool {
return c.options.Debug

View file

@ -98,27 +98,27 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "import-path",
Usage: "optional base `PATH` from which files can be imported to originals",
Usage: "base `PATH` from which files can be imported to originals (optional)",
EnvVar: "PHOTOPRISM_IMPORT_PATH",
},
cli.StringFlag{
Name: "cache-path",
Usage: "optional custom cache `PATH` for sessions and thumbnail files",
Usage: "custom cache `PATH` for sessions and thumbnail files (optional)",
EnvVar: "PHOTOPRISM_CACHE_PATH",
},
cli.StringFlag{
Name: "sidecar-path",
Usage: "optional custom relative or absolute sidecar `PATH`",
Usage: "custom relative or absolute sidecar `PATH` (optional)",
EnvVar: "PHOTOPRISM_SIDECAR_PATH",
},
cli.StringFlag{
Name: "temp-path",
Usage: "optional custom temporary file `PATH`",
Usage: "custom temporary file `PATH` (optional)",
EnvVar: "PHOTOPRISM_TEMP_PATH",
},
cli.StringFlag{
Name: "backup-path",
Usage: "optional custom backup `PATH` for index backup files",
Usage: "custom backup `PATH` for index backup files (optional)",
EnvVar: "PHOTOPRISM_BACKUP_PATH",
},
cli.StringFlag{
@ -239,24 +239,24 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "app-icon",
Usage: "application `ICON` (logo, app, crisp, mint, bold)",
Usage: "web app `ICON` (logo, app, crisp, mint, bold)",
EnvVar: "PHOTOPRISM_APP_ICON",
},
cli.StringFlag{
Name: "app-name",
Usage: "application `NAME` when installed on a device",
Usage: "web app `NAME` when installed on a device",
Value: "PhotoPrism",
EnvVar: "PHOTOPRISM_APP_NAME",
},
cli.StringFlag{
Name: "app-mode",
Usage: "application `MODE` (fullscreen, standalone, minimal-ui, browser)",
Usage: "web app `MODE` (fullscreen, standalone, minimal-ui, browser)",
Value: "standalone",
EnvVar: "PHOTOPRISM_APP_MODE",
},
cli.StringFlag{
Name: "cdn-url",
Usage: "optional content delivery network `URL`",
Usage: "content delivery network `URL` (optional)",
EnvVar: "PHOTOPRISM_CDN_URL",
},
cli.StringFlag{
@ -267,7 +267,7 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "site-author",
Usage: "`COPYRIGHT`, artist, or owner name",
Usage: "site `OWNER`, copyright, or artist",
EnvVar: "PHOTOPRISM_SITE_AUTHOR",
},
cli.StringFlag{
@ -284,14 +284,26 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "site-description",
Usage: "optional site `DESCRIPTION`",
Usage: "site `DESCRIPTION` (optional)",
EnvVar: "PHOTOPRISM_SITE_DESCRIPTION",
},
cli.StringFlag{
Name: "site-preview",
Usage: "optional preview image `URL`",
Usage: "site preview image `URL` (optional)",
EnvVar: "PHOTOPRISM_SITE_PREVIEW",
},
cli.StringFlag{
Name: "imprint",
Usage: "legal `INFO`, displayed in the page footer",
Value: "",
EnvVar: "PHOTOPRISM_IMPRINT",
},
cli.StringFlag{
Name: "imprint-url",
Usage: "legal info `URL` (optional)",
Value: "",
EnvVar: "PHOTOPRISM_IMPRINT_URL",
},
cli.IntFlag{
Name: "http-port",
Value: 2342,
@ -429,12 +441,12 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "download-token",
Usage: "custom download URL `TOKEN` (default: random)",
Usage: "`SECRET` download URL token for originals (default: random)",
EnvVar: "PHOTOPRISM_DOWNLOAD_TOKEN",
},
cli.StringFlag{
Name: "preview-token",
Usage: "custom thumbnail and streaming URL `TOKEN` (default: random)",
Usage: "`SECRET` thumbnail and video streaming URL token (default: random)",
EnvVar: "PHOTOPRISM_PREVIEW_TOKEN",
},
cli.StringFlag{

View file

@ -88,6 +88,8 @@ type Options struct {
SiteCaption string `yaml:"SiteCaption" json:"SiteCaption" flag:"site-caption"`
SiteDescription string `yaml:"SiteDescription" json:"SiteDescription" flag:"site-description"`
SitePreview string `yaml:"SitePreview" json:"SitePreview" flag:"site-preview"`
Imprint string `yaml:"Imprint" json:"Imprint" flag:"imprint"`
ImprintUrl string `yaml:"ImprintUrl" json:"ImprintUrl" flag:"imprint-url"`
DatabaseDriver string `yaml:"DatabaseDriver" json:"-" flag:"database-driver"`
DatabaseDsn string `yaml:"DatabaseDsn" json:"-" flag:"database-dsn"`
DatabaseServer string `yaml:"DatabaseServer" json:"-" flag:"database-server"`