From dcb3b7119f704baf2e27e422dc6f714be3ace515 Mon Sep 17 00:00:00 2001 From: schwarzlichtbezirk Date: Thu, 3 Nov 2022 23:53:27 +0300 Subject: [PATCH] fix to caches. --- caches.go | 37 +++++++++++++++------------- frontend/assets/material-icons.woff | 0 frontend/assets/material-icons.woff2 | 0 frontend/build/main.html | 8 +++--- frontend/build/stat.html | 6 ++--- frontend/devmode/devmode.js | 2 +- frontend/devmode/main.html | 10 ++++---- frontend/devmode/relmode.js | 4 +-- frontend/devmode/stat.html | 6 ++--- go.mod | 2 +- go.sum | 4 +-- task/deploy-plugins.cmd | 34 ++++++++++++------------- task/deploy-plugins.sh | 34 ++++++++++++------------- 13 files changed, 75 insertions(+), 72 deletions(-) create mode 100644 frontend/assets/material-icons.woff create mode 100644 frontend/assets/material-icons.woff2 diff --git a/caches.go b/caches.go index 228aeb45..8b637acb 100644 --- a/caches.go +++ b/caches.go @@ -3,6 +3,7 @@ package hms import ( "bytes" "errors" + "fmt" "image" "io" "io/fs" @@ -405,8 +406,8 @@ func initcaches() { // cached images data file. type CachePackage struct { wpk.Package - WPT wpk.WriteSeekCloser // package tags part - WPF wpk.WriteSeekCloser // package files part + wpt wpk.WriteSeekCloser // package tags part + wpf wpk.WriteSeekCloser // package files part } // InitCacheWriter opens existing cache with given file name placed in @@ -422,22 +423,22 @@ func InitCacheWriter(fname string) (cw *CachePackage, err error) { } defer func() { if err != nil { - if cw.WPT != nil { - cw.WPT.Close() - cw.WPT = nil + if cw.wpt != nil { + cw.wpt.Close() + cw.wpt = nil } - if cw.WPF != nil { - cw.WPF.Close() - cw.WPF = nil + if cw.wpf != nil { + cw.wpf.Close() + cw.wpf = nil } } }() var ok, _ = PathExists(pkgpath) - if cw.WPT, err = os.OpenFile(pkgpath, os.O_WRONLY|os.O_CREATE, 0755); err != nil { + if cw.wpt, err = os.OpenFile(pkgpath, os.O_WRONLY|os.O_CREATE, 0755); err != nil { return } - if cw.WPF, err = os.OpenFile(datpath, os.O_WRONLY|os.O_CREATE, 0755); err != nil { + if cw.wpf, err = os.OpenFile(datpath, os.O_WRONLY|os.O_CREATE, 0755); err != nil { return } if ok { @@ -451,7 +452,7 @@ func InitCacheWriter(fname string) (cw *CachePackage, err error) { return } - if err = cw.Append(cw.WPT, cw.WPF); err != nil { + if err = cw.Append(cw.wpt, cw.wpf); err != nil { return } } else { @@ -459,7 +460,7 @@ func InitCacheWriter(fname string) (cw *CachePackage, err error) { tidsz, tagsz, tssize, }) - if err = cw.Begin(cw.WPT); err != nil { + if err = cw.Begin(cw.wpt, cw.wpf); err != nil { return } cw.Package.SetInfo(). @@ -473,16 +474,16 @@ func InitCacheWriter(fname string) (cw *CachePackage, err error) { // Close saves actual tags table and closes opened cache. func (cw *CachePackage) Close() (err error) { - if et := cw.Sync(cw.WPT, cw.WPF); et != nil && err == nil { + if et := cw.Sync(cw.wpt, cw.wpf); et != nil && err == nil { err = et } - if et := cw.WPT.Close(); et != nil && err == nil { + if et := cw.wpt.Close(); et != nil && err == nil { err = et } - if et := cw.WPF.Close(); et != nil && err == nil { + if et := cw.wpf.Close(); et != nil && err == nil { err = et } - cw.WPT, cw.WPF = nil, nil + cw.wpt, cw.wpf = nil, nil return } @@ -520,7 +521,7 @@ func (cw *CachePackage) GetImage(fpath string) (md *MediaData, err error) { // PutImage puts thumbnail to package. func (cw *CachePackage) PutImage(fpath string, md *MediaData) (err error) { var ts *wpk.TagsetRaw - if ts, err = cw.PackData(cw.WPF, bytes.NewReader(md.Data), fpath); err != nil { + if ts, err = cw.PackData(cw.wpf, bytes.NewReader(md.Data), fpath); err != nil { return } var now = time.Now() @@ -545,11 +546,13 @@ func PackInfo(fname string, pkg *wpk.Package) { func initpackages() (err error) { if thumbpkg, err = InitCacheWriter(tmbfile); err != nil { + err = fmt.Errorf("inits thumbnails database: %w", err) return } PackInfo(tmbfile, &thumbpkg.Package) if tilespkg, err = InitCacheWriter(tilfile); err != nil { + err = fmt.Errorf("inits tiles database: %w", err) return } PackInfo(tilfile, &tilespkg.Package) diff --git a/frontend/assets/material-icons.woff b/frontend/assets/material-icons.woff new file mode 100644 index 00000000..e69de29b diff --git a/frontend/assets/material-icons.woff2 b/frontend/assets/material-icons.woff2 new file mode 100644 index 00000000..e69de29b diff --git a/frontend/build/main.html b/frontend/build/main.html index ae5e0e2e..eae1c56f 100644 --- a/frontend/build/main.html +++ b/frontend/build/main.html @@ -79,11 +79,11 @@ - + - + @@ -94,9 +94,9 @@ - + - + diff --git a/frontend/build/stat.html b/frontend/build/stat.html index a544f814..f5ea5813 100644 --- a/frontend/build/stat.html +++ b/frontend/build/stat.html @@ -38,7 +38,7 @@ - + @@ -49,9 +49,9 @@ - + - + diff --git a/frontend/devmode/devmode.js b/frontend/devmode/devmode.js index 76da397a..4e5aeb95 100644 --- a/frontend/devmode/devmode.js +++ b/frontend/devmode/devmode.js @@ -3,7 +3,7 @@ // This file is included only for developer mode linkage const buildvers = "0.8.3"; -const builddate = "2022.10.31"; +const builddate = "2022.11.03"; console.info("version: %s, builton: %s", buildvers, builddate); console.info("starts in developer mode"); diff --git a/frontend/devmode/main.html b/frontend/devmode/main.html index e7af1176..5a30384c 100644 --- a/frontend/devmode/main.html +++ b/frontend/devmode/main.html @@ -79,11 +79,11 @@ - + - + @@ -94,11 +94,11 @@ - + - + - + diff --git a/frontend/devmode/relmode.js b/frontend/devmode/relmode.js index c33633d7..efd5de64 100644 --- a/frontend/devmode/relmode.js +++ b/frontend/devmode/relmode.js @@ -2,8 +2,8 @@ // This file is included for release mode linkage -const buildvers = "0.8.2"; -const builddate = "2022.10.24"; +const buildvers = "0.8.3"; +const builddate = "2022.11.03"; const devmode = false; const traceajax = () => undefined; diff --git a/frontend/devmode/stat.html b/frontend/devmode/stat.html index 1ea404c2..4448e94e 100644 --- a/frontend/devmode/stat.html +++ b/frontend/devmode/stat.html @@ -38,7 +38,7 @@ - + @@ -49,9 +49,9 @@ - + - + diff --git a/go.mod b/go.mod index be78a1ec..07a46a57 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/jessevdk/go-flags v1.5.0 github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd - github.com/schwarzlichtbezirk/wpk v1.4.0 + github.com/schwarzlichtbezirk/wpk v1.4.1 github.com/spate/glimage v0.0.0-20200505055513-fbdcc60a65e5 golang.org/x/crypto v0.1.0 golang.org/x/image v0.1.0 diff --git a/go.sum b/go.sum index 8c8cb11d..3ed1587a 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBO github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd h1:CmH9+J6ZSsIjUK3dcGsnCnO41eRBOnY12zwkn5qVwgc= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= -github.com/schwarzlichtbezirk/wpk v1.4.0 h1:lpU5Qx7oPLV0Rb9wnkLtaNH15ygKeu9vNggkwe1Jj+s= -github.com/schwarzlichtbezirk/wpk v1.4.0/go.mod h1:/4C38mew4XlS1OSlcymd6C/JgsBDZ1IINc4j8oH0fRY= +github.com/schwarzlichtbezirk/wpk v1.4.1 h1:Tfjc21LDDi08pl4ONKf9aY+0+rDTIW5bN7OPXNOhBs4= +github.com/schwarzlichtbezirk/wpk v1.4.1/go.mod h1:DYvZev70aBqDJTdLs8RVwZP5lWVmkLCM/We0oSTxy/M= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= diff --git a/task/deploy-plugins.cmd b/task/deploy-plugins.cmd index ef030680..0cc9548b 100644 --- a/task/deploy-plugins.cmd +++ b/task/deploy-plugins.cmd @@ -8,34 +8,34 @@ rem https://github.com/marella/material-icons curl https://github.com/marella/material-icons/raw/main/iconfont/material-icons.woff2 --output %asstdir%/material-icons.woff2 curl https://github.com/marella/material-icons/raw/main/iconfont/material-icons.woff --output %asstdir%/material-icons.woff -rem bootstrap 5.2.0 +rem bootstrap 5.2.2 rem https://cdnjs.com/libraries/bootstrap -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.min.js --output %plugdir%/bootstrap.min.js -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.min.js.map --output %plugdir%/bootstrap.min.js.map -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css --output %plugdir%/bootstrap.min.css -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css.map --output %plugdir%/bootstrap.min.css.map +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/js/bootstrap.min.js --output %plugdir%/bootstrap.min.js +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/js/bootstrap.min.js.map --output %plugdir%/bootstrap.min.js.map +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/css/bootstrap.min.css --output %plugdir%/bootstrap.min.css +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/css/bootstrap.min.css.map --output %plugdir%/bootstrap.min.css.map rem popper 2.11.6 rem https://cdnjs.com/libraries/popper.js curl https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js --output %plugdir%/popper.min.js curl https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js.map --output %plugdir%/popper.min.js.map -rem Vue 3.2.40 +rem Vue 3.2.41 rem https://cdnjs.com/libraries/vue rem https://unpkg.com/vue@next -curl https://unpkg.com/vue@3.2.40/dist/vue.global.js --output %plugdir%/vue.global.js -curl https://unpkg.com/vue@3.2.40/dist/vue.global.prod.js --output %plugdir%/vue.global.prod.js +curl https://unpkg.com/vue@3.2.41/dist/vue.global.js --output %plugdir%/vue.global.js +curl https://unpkg.com/vue@3.2.41/dist/vue.global.prod.js --output %plugdir%/vue.global.prod.js -rem leaflet 1.9.1 +rem leaflet 1.9.2 rem https://cdnjs.com/libraries/leaflet -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.js --output %plugdir%/leaflet.js -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.js.map --output %plugdir%/leaflet.js.map -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.min.css --output %plugdir%/leaflet.min.css -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/layers.png --output %plugdir%/images/layers.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/layers-2x.png --output %plugdir%/images/layers-2x.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-icon.png --output %plugdir%/images/marker-icon.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-icon-2x.png --output %plugdir%/images/marker-icon-2x.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-shadow.png --output %plugdir%/images/marker-shadow.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.js --output %plugdir%/leaflet.js +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.js.map --output %plugdir%/leaflet.js.map +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.min.css --output %plugdir%/leaflet.min.css +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/layers.png --output %plugdir%/images/layers.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/layers-2x.png --output %plugdir%/images/layers-2x.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-icon.png --output %plugdir%/images/marker-icon.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-icon-2x.png --output %plugdir%/images/marker-icon-2x.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-shadow.png --output %plugdir%/images/marker-shadow.png rem MarkerCluster 1.5.3 rem https://cdnjs.com/libraries/leaflet.markercluster diff --git a/task/deploy-plugins.sh b/task/deploy-plugins.sh index 4d1a8e22..517e33a1 100644 --- a/task/deploy-plugins.sh +++ b/task/deploy-plugins.sh @@ -8,34 +8,34 @@ mkdir -pv $plugdir/images curl https://github.com/marella/material-icons/raw/main/iconfont/material-icons.woff2 --output $asstdir/material-icons.woff2 curl https://github.com/marella/material-icons/raw/main/iconfont/material-icons.woff --output $asstdir/material-icons.woff -# bootstrap 5.2.0 +# bootstrap 5.2.2 # https://cdnjs.com/libraries/bootstrap -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.min.js --output $plugdir/bootstrap.min.js -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.min.js.map --output $plugdir/bootstrap.min.js.map -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css --output $plugdir/bootstrap.min.css -curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css.map --output $plugdir/bootstrap.min.css.map +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/js/bootstrap.min.js --output $plugdir/bootstrap.min.js +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/js/bootstrap.min.js.map --output $plugdir/bootstrap.min.js.map +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/css/bootstrap.min.css --output $plugdir/bootstrap.min.css +curl https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/css/bootstrap.min.css.map --output $plugdir/bootstrap.min.css.map # popper 2.11.6 # https://cdnjs.com/libraries/popper.js curl https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js --output $plugdir/popper.min.js curl https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js.map --output $plugdir/popper.min.js.map -# Vue 3.2.40 +# Vue 3.2.41 # https://cdnjs.com/libraries/vue # https://unpkg.com/vue@next -curl https://unpkg.com/vue@3.2.40/dist/vue.global.js --output $plugdir/vue.global.js -curl https://unpkg.com/vue@3.2.40/dist/vue.global.prod.js --output $plugdir/vue.global.prod.js +curl https://unpkg.com/vue@3.2.41/dist/vue.global.js --output $plugdir/vue.global.js +curl https://unpkg.com/vue@3.2.41/dist/vue.global.prod.js --output $plugdir/vue.global.prod.js -# leaflet 1.9.1 +# leaflet 1.9.2 # https://cdnjs.com/libraries/leaflet -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.js --output $plugdir/leaflet.js -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.js.map --output $plugdir/leaflet.js.map -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/leaflet.min.css --output $plugdir/leaflet.min.css -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/layers.png --output $plugdir/images/layers.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/layers-2x.png --output $plugdir/images/layers-2x.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-icon.png --output $plugdir/images/marker-icon.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-icon-2x.png --output $plugdir/images/marker-icon-2x.png -curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.1/images/marker-shadow.png --output $plugdir/images/marker-shadow.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.js --output $plugdir/leaflet.js +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.js.map --output $plugdir/leaflet.js.map +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/leaflet.min.css --output $plugdir/leaflet.min.css +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/layers.png --output $plugdir/images/layers.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/layers-2x.png --output $plugdir/images/layers-2x.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-icon.png --output $plugdir/images/marker-icon.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-icon-2x.png --output $plugdir/images/marker-icon-2x.png +curl https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.2/images/marker-shadow.png --output $plugdir/images/marker-shadow.png # MarkerCluster 1.5.3 # https://cdnjs.com/libraries/leaflet.markercluster