PWA: Add alternative prism app icon
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 139 KiB |
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
assets/static/img/icons/logo-114.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/static/img/icons/logo-128.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/static/img/icons/logo-144.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/static/img/icons/logo-152.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
assets/static/img/icons/logo-16.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/static/img/icons/logo-160.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
assets/static/img/icons/logo-167.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
assets/static/img/icons/logo-180.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
assets/static/img/icons/logo-192.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
assets/static/img/icons/logo-196.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/static/img/icons/logo-256.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
assets/static/img/icons/logo-32.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
assets/static/img/icons/logo-400.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
assets/static/img/icons/logo-512.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
assets/static/img/icons/logo-64.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/static/img/icons/logo-72.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/static/img/icons/prism-114.png
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/static/img/icons/prism-128.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/static/img/icons/prism-144.png
Executable file
After Width: | Height: | Size: 3.4 KiB |
BIN
assets/static/img/icons/prism-152.png
Executable file
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/static/img/icons/prism-16.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
assets/static/img/icons/prism-160.png
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
assets/static/img/icons/prism-167.png
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
assets/static/img/icons/prism-180.png
Executable file
After Width: | Height: | Size: 3.8 KiB |
BIN
assets/static/img/icons/prism-192.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/static/img/icons/prism-196.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/static/img/icons/prism-256.png
Executable file
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/static/img/icons/prism-32.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/static/img/icons/prism-400.png
Executable file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/static/img/icons/prism-512.png
Executable file
After Width: | Height: | Size: 8.1 KiB |
BIN
assets/static/img/icons/prism-72.png
Executable file
After Width: | Height: | Size: 2.7 KiB |
|
@ -4,77 +4,77 @@
|
|||
"description": "{{ .config.SiteDescription }}",
|
||||
"icons": [
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-16.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-16.png",
|
||||
"sizes": "16x16",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-32.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-32.png",
|
||||
"sizes": "32x32",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-72.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-114.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-114.png",
|
||||
"sizes": "114x114",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-128.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-144.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-152.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-160.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-160.png",
|
||||
"sizes": "160x160",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-167.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-167.png",
|
||||
"sizes": "167x167",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-180.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-180.png",
|
||||
"sizes": "180x180",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-192.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-196.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-196.png",
|
||||
"sizes": "196x196",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-256.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-256.png",
|
||||
"sizes": "256x256",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-400.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-400.png",
|
||||
"sizes": "400x400",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ .config.StaticUri }}/img/{{ .config.AppIcon }}-512.png",
|
||||
"src": "{{ .config.StaticUri }}/img/icons/{{ .config.AppIcon }}-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
|
@ -82,8 +82,8 @@
|
|||
"scope": "{{ .config.BaseUri }}/",
|
||||
"start_url": "{{ .config.BaseUri }}/",
|
||||
"display": "{{ .config.AppMode }}",
|
||||
"theme_color": "#0d0d0d",
|
||||
"background_color": "#0d0d0d",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#000000",
|
||||
"permissions": [
|
||||
"geolocation",
|
||||
"downloads",
|
||||
|
|
53
internal/config/app.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
"github.com/photoprism/photoprism/pkg/txt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// AppName returns the app name when installed on a device.
|
||||
func (c *Config) AppName() string {
|
||||
name := strings.TrimSpace(c.options.AppName)
|
||||
|
||||
if name == "" {
|
||||
name = c.SiteTitle()
|
||||
}
|
||||
|
||||
clean := func(r rune) rune {
|
||||
switch r {
|
||||
case '\'', '"':
|
||||
return -1
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
name = strings.Map(clean, name)
|
||||
|
||||
return txt.Clip(name, 32)
|
||||
}
|
||||
|
||||
// AppMode returns the app mode when installed on a device.
|
||||
func (c *Config) AppMode() string {
|
||||
switch c.options.AppMode {
|
||||
case "fullscreen", "standalone", "minimal-ui", "browser":
|
||||
return c.options.AppMode
|
||||
default:
|
||||
return "standalone"
|
||||
}
|
||||
}
|
||||
|
||||
// AppIcon returns the app icon when installed on a device.
|
||||
func (c *Config) AppIcon() string {
|
||||
defaultIcon := "logo"
|
||||
|
||||
if c.options.AppIcon == "" || c.options.AppIcon == defaultIcon {
|
||||
// Default.
|
||||
} else if fs.FileExists(filepath.Join(c.ImgPath(), "icons", c.options.AppIcon+"-192.png")) {
|
||||
return c.options.AppIcon
|
||||
}
|
||||
|
||||
return defaultIcon
|
||||
}
|
|
@ -42,7 +42,7 @@ var TotalMem uint64
|
|||
const MsgFreeBeer = "Help us make a difference and become a sponsor today!"
|
||||
const MsgFundingInfo = "Visit https://docs.photoprism.org/funding/ to learn more."
|
||||
const MsgSponsorCommand = "Since running this command puts additional load on our infrastructure," +
|
||||
" we unfortunately can't offer it for free."
|
||||
" we unfortunately can only offer it to sponsors."
|
||||
|
||||
const ApiUri = "/api/v1" // REST API
|
||||
const StaticUri = "/static" // Static Content
|
||||
|
@ -350,10 +350,6 @@ func (c *Config) SiteCaption() string {
|
|||
|
||||
// SiteDescription returns a long site description.
|
||||
func (c *Config) SiteDescription() string {
|
||||
if !c.Sponsor() {
|
||||
return MsgFreeBeer
|
||||
}
|
||||
|
||||
return c.options.SiteDescription
|
||||
}
|
||||
|
||||
|
@ -370,49 +366,6 @@ func (c *Config) SitePreview() string {
|
|||
return c.options.SitePreview
|
||||
}
|
||||
|
||||
// AppName returns the app name when installed on a device.
|
||||
func (c *Config) AppName() string {
|
||||
name := strings.TrimSpace(c.options.AppName)
|
||||
|
||||
if name == "" {
|
||||
name = c.SiteTitle()
|
||||
}
|
||||
|
||||
clean := func(r rune) rune {
|
||||
switch r {
|
||||
case '\'', '"':
|
||||
return -1
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
name = strings.Map(clean, name)
|
||||
|
||||
return txt.Clip(name, 32)
|
||||
}
|
||||
|
||||
// AppMode returns the app mode when installed on a device.
|
||||
func (c *Config) AppMode() string {
|
||||
switch c.options.AppMode {
|
||||
case "fullscreen", "standalone", "minimal-ui", "browser":
|
||||
return c.options.AppMode
|
||||
default:
|
||||
return "standalone"
|
||||
}
|
||||
}
|
||||
|
||||
// AppIcon returns the app icon when installed on a device.
|
||||
func (c *Config) AppIcon() string {
|
||||
if c.options.AppIcon == "" || c.options.AppIcon == "favicon" {
|
||||
// Default.
|
||||
} else if fs.FileExists(filepath.Join(c.ImgPath(), c.options.AppIcon+"-192.png")) {
|
||||
return c.options.AppIcon
|
||||
}
|
||||
|
||||
return "favicon"
|
||||
}
|
||||
|
||||
// Debug tests if debug mode is enabled.
|
||||
func (c *Config) Debug() bool {
|
||||
return c.options.Debug
|
||||
|
|
|
@ -281,8 +281,8 @@ var GlobalFlags = []cli.Flag{
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "app-icon",
|
||||
Usage: "application `ICON` (favicon, lens)",
|
||||
Value: "favicon",
|
||||
Usage: "application `ICON` (logo, prism, lens)",
|
||||
Value: "logo",
|
||||
EnvVar: "PHOTOPRISM_APP_ICON",
|
||||
},
|
||||
cli.IntFlag{
|
||||
|
|