Add manifest link

pull/7/head
Toni Melisma 3 years ago
parent b4f28b4f81
commit 34ef2555c0
No known key found for this signature in database
GPG Key ID: FFF9A7EDDEA34756

@ -5,6 +5,9 @@
<title>{{ .Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
{{if .ManifestFile }}
<link href="{{ . }}" rel="manifest">
{{ end }}
{{ range .CSS }}
<link href="{{ . }}" rel="stylesheet">
{{ end }}

@ -142,6 +142,7 @@ type htmlData struct {
JS []string
FolderIcon string
BackIcon string
ManifestFile string
}
// transformationJob struct is used to communicate needed image/video transformations to
@ -664,8 +665,6 @@ func getIconType(iconPath string) (filetype string, err error) {
// createPWAManifest creates a customized manifest.json for a PWA if PWA url is supplied in args
func createPWAManifest(gallery directory, source directory, dryRun bool, config configuration) {
// TODO Fill in data structure, load template and execute it
// TODO Iterate over icons, grab size from filename
// TODO Add manifest link to HTMLs
// TODO Add apple-touch-icon to HTML
// TODO register service worker in HTML, add manifest and apple-touch-icon links to head
@ -848,9 +847,15 @@ func createHTML(depth int, source directory, galleryDirectory string, dryRun boo
if depth > 0 {
thisHTML.BackIcon = filepath.Join(rootEscape, config.assets.backIcon)
}
// Generic folder icon to be used for each subfolder
thisHTML.FolderIcon = filepath.Join(rootEscape, config.assets.folderIcon)
// If we're in the root directory, add manifest link
if depth == 0 {
thisHTML.ManifestFile = config.assets.manifestFile
}
// thisHTML struct has been filled in successfully, parse the HTML template,
// fill in the data and write it to the correct file
htmlFilePath := filepath.Join(galleryDirectory, config.assets.htmlFile)

Loading…
Cancel
Save