diff --git a/client/Dockerfile b/client/Dockerfile
index a3d0ffcb..94ab8001 100644
--- a/client/Dockerfile
+++ b/client/Dockerfile
@@ -17,9 +17,8 @@ WORKDIR /var/www
RUN \
# Create init file
echo "#!/bin/sh" >> /init && \
- echo 'sed -i "s|__BACKEND__|${BACKEND_HOST}|" /etc/nginx/nginx.conf' \
- >> /init && \
- echo 'sed -i "s|__BASEURL__|${BASE_URL:-/}|" /var/www/index.htm' >> /init && \
+ echo 'sed -i "s|__BACKEND__|${BACKEND_HOST}|" /etc/nginx/nginx.conf' >> /init && \
+ echo 'sed -i "s|__BASEURL__|${BASE_URL:-/}|g" /var/www/index.htm /var/www/manifest.json' >> /init && \
echo 'exec nginx' >> /init && \
chmod a+x /init
diff --git a/client/app/manifest.json b/client/app/manifest.json
deleted file mode 100644
index 067677ab..00000000
--- a/client/app/manifest.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "szurubooru",
- "icons": [
- {
- "src": "/img/android-chrome-192x192.png",
- "type": "image/png",
- "sizes": "192x192"
- },
- {
- "src": "/img/android-chrome-512x512.png",
- "type": "image/png",
- "sizes": "512x512"
- }
- ],
- "start_url": "/",
- "theme_color": "#24aadd",
- "background_color": "#ffffff",
- "display": "standalone"
-}
diff --git a/client/build.js b/client/build.js
index ce91b8df..44d8c010 100755
--- a/client/build.js
+++ b/client/build.js
@@ -28,6 +28,26 @@ const external_js = [
'nprogress',
];
+const app_manifest = {
+ name: 'szurubooru',
+ icons: [
+ {
+ src: baseUrl() + 'img/android-chrome-192x192.png',
+ type: 'image/png',
+ sizes: '192x192'
+ },
+ {
+ src: baseUrl() + 'img/android-chrome-512x512.png',
+ type: 'image/png',
+ sizes: '512x512'
+ }
+ ],
+ start_url: baseUrl(),
+ theme_color: '#24aadd',
+ background_color: '#ffffff',
+ display: 'standalone'
+}
+
// -------------------------------------------------
const fs = require('fs');
@@ -45,14 +65,16 @@ function gzipFile(file) {
execSync('gzip -6 -k ' + file);
}
+function baseUrl() {
+ return process.env.BASE_URL ? process.env.BASE_URL : '/';
+}
+
// -------------------------------------------------
function bundleHtml() {
const underscore = require('underscore');
const babelify = require('babelify');
- const baseUrl = process.env.BASE_URL ? process.env.BASE_URL : '/';
-
function minifyHtml(html) {
return require('html-minifier').minify(html, {
removeComments: true,
@@ -62,7 +84,7 @@ function bundleHtml() {
}
const baseHtml = readTextFile('./html/index.htm')
- .replace('', ``);
+ .replace('', ``);
fs.writeFileSync('./public/index.htm', minifyHtml(baseHtml));
let compiledTemplateJs = [
@@ -198,12 +220,13 @@ function bundleConfig() {
};
fs.writeFileSync('./js/.config.autogen.json', JSON.stringify(config));
+ console.info('Generated config file');
}
function bundleBinaryAssets() {
fs.copyFileSync('./img/favicon.png', './public/img/favicon.png');
fs.copyFileSync('./img/transparency_grid.png', './public/img/transparency_grid.png');
- console.info('Copied Images');
+ console.info('Copied images');
fs.copyFileSync('./fonts/open_sans.woff2', './public/fonts/open_sans.woff2')
for (let file of glob.sync('./node_modules/font-awesome/fonts/*.*')) {
@@ -220,13 +243,14 @@ function bundleBinaryAssets() {
gzipFile(file);
}
}
- console.info('Copied Fonts')
+ console.info('Copied fonts')
}
function bundleWebAppFiles() {
const Jimp = require('jimp');
- fs.copyFileSync('./app/manifest.json', './public/manifest.json');
+ fs.writeFileSync('./public/manifest.json', JSON.stringify(app_manifest));
+ console.info('Generated app manifest');
Promise.all(webapp_icons.map(icon => {
return Jimp.read('./img/app.png')
@@ -268,6 +292,7 @@ function makeOutputDirs() {
for (let dir of dirs) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, 0o755);
+ console.info('Created directory: ' + dir);
}
}
}