From 2cce8ded844edbf91d24c992cc9467ddd2a7b134 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 9 Nov 2018 19:25:58 +0100 Subject: [PATCH] Moved all server assets to subdirectory #55 --- .dockerignore | 2 +- Makefile | 6 ++---- assets/{ => server}/favicons/favicon.ico | Bin assets/{ => server}/favicons/favicon.png | Bin assets/{ => server}/public/build/.gitignore | 0 assets/{ => server}/public/img/logo.png | Bin assets/{ => server}/templates/index.tmpl | 0 frontend/webpack.config.js | 2 +- internal/photoprism/config.go | 22 ++++++++++++++------ 9 files changed, 20 insertions(+), 12 deletions(-) rename assets/{ => server}/favicons/favicon.ico (100%) rename assets/{ => server}/favicons/favicon.png (100%) rename assets/{ => server}/public/build/.gitignore (100%) rename assets/{ => server}/public/img/logo.png (100%) rename assets/{ => server}/templates/index.tmpl (100%) diff --git a/.dockerignore b/.dockerignore index f18bf81b1..a3ae28c3d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,7 @@ assets/photos/* assets/thumbnails/* internal/photoprism/testdata/* frontend/node_modules/* -assets/public/build/* +assets/server/public/build/* Dockerfile /docker /photoprism diff --git a/Makefile b/Makefile index c2ce2dbbd..17e01efd6 100644 --- a/Makefile +++ b/Makefile @@ -18,12 +18,10 @@ install: install-bin install-assets install-config install-bin: scripts/build.sh install /usr/local/bin/$(BINARY_NAME) install-assets: - mkdir -p /srv/photoprism mkdir -p /srv/photoprism/photos mkdir -p /srv/photoprism/thumbnails - cp -r assets/favicons /srv/photoprism - cp -r assets/public /srv/photoprism - cp -r assets/templates /srv/photoprism + mkdir -p /srv/photoprism/database + cp -r assets/server /srv/photoprism cp -r assets/tensorflow /srv/photoprism find /srv/photoprism -name '.*' -type f -delete install-config: diff --git a/assets/favicons/favicon.ico b/assets/server/favicons/favicon.ico similarity index 100% rename from assets/favicons/favicon.ico rename to assets/server/favicons/favicon.ico diff --git a/assets/favicons/favicon.png b/assets/server/favicons/favicon.png similarity index 100% rename from assets/favicons/favicon.png rename to assets/server/favicons/favicon.png diff --git a/assets/public/build/.gitignore b/assets/server/public/build/.gitignore similarity index 100% rename from assets/public/build/.gitignore rename to assets/server/public/build/.gitignore diff --git a/assets/public/img/logo.png b/assets/server/public/img/logo.png similarity index 100% rename from assets/public/img/logo.png rename to assets/server/public/img/logo.png diff --git a/assets/templates/index.tmpl b/assets/server/templates/index.tmpl similarity index 100% rename from assets/templates/index.tmpl rename to assets/server/templates/index.tmpl diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 1dacc8c46..b33756a3b 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -7,7 +7,7 @@ const webpack = require('webpack'); const PATHS = { app: path.join(__dirname, 'src/app.js'), css: path.join(__dirname, 'css'), - build: path.join(__dirname, '../assets/public/build'), + build: path.join(__dirname, '../assets/server/public/build'), }; const cssPlugin = new ExtractTextPlugin({ diff --git a/internal/photoprism/config.go b/internal/photoprism/config.go index 63ddbdd62..a45215d36 100644 --- a/internal/photoprism/config.go +++ b/internal/photoprism/config.go @@ -217,22 +217,32 @@ func (c *Config) GetTensorFlowModelPath() string { return c.GetAssetsPath() + "/tensorflow" } -// GetTemplatesPath returns the templates path. +// GetDatabasePath returns the database storage path (e.g. for SQLite or Bleve). +func (c *Config) GetDatabasePath() string { + return c.GetAssetsPath() + "/database" +} + +// GetServerAssetsPath returns the server assets path (public files, favicons, templates,...). +func (c *Config) GetServerAssetsPath() string { + return c.GetAssetsPath() + "/server" +} + +// GetTemplatesPath returns the server templates path. func (c *Config) GetTemplatesPath() string { - return c.GetAssetsPath() + "/templates" + return c.GetServerAssetsPath() + "/templates" } // GetFaviconsPath returns the favicons path. func (c *Config) GetFaviconsPath() string { - return c.GetAssetsPath() + "/favicons" + return c.GetServerAssetsPath() + "/favicons" } -// GetPublicPath returns the public path. +// GetPublicPath returns the public server path (//server/assets/*). func (c *Config) GetPublicPath() string { - return c.GetAssetsPath() + "/public" + return c.GetServerAssetsPath() + "/public" } -// GetPublicBuildPath returns the public build path. +// GetPublicBuildPath returns the public build path (//server/assets/build/*). func (c *Config) GetPublicBuildPath() string { return c.GetPublicPath() + "/build" }