diff --git a/forge.config.js b/forge.config.js index 7358592..9aac052 100644 --- a/forge.config.js +++ b/forge.config.js @@ -1,3 +1,5 @@ +const packageJson = require('./package'); + const ignoreList = [ /^\/\.idea($|\/)/, /^\/\.vscode($|\/)/, @@ -32,10 +34,13 @@ const ignoreList = [ /^\/src\/.*tslint\.json/, ]; +const name = packageJson.productName; + module.exports = { packagerConfig: { icon: 'resources/icon', ignore: ignoreList, + name: name, }, electronRebuildConfig: { force: true, @@ -43,6 +48,9 @@ module.exports = { makers: [ { name: '@electron-forge/maker-squirrel', + config: { + name: name, + }, }, ], }; diff --git a/package.json b/package.json index 350f103..55f2ae9 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "renai", + "productName": "Renai", "version": "1.0.0", "description": "Hentai Library Thingy", "private": true, diff --git a/templates/data.json b/templates/data.json index d85708e..a305a23 100644 --- a/templates/data.json +++ b/templates/data.json @@ -3,15 +3,13 @@ "csp": { "default-src": ["self"], "style-src": ["unsafe-inline"] - }, - "appBundle": "./bundle.js" + } }, "dev": { "csp": { "default-src": ["self"], "style-src": ["unsafe-inline"], "script-src": ["self", "unsafe-eval"] - }, - "appBundle": "./bundle.js" + } } } diff --git a/templates/index.html.handlebars b/templates/index.html.handlebars index cccdb04..82afe46 100644 --- a/templates/index.html.handlebars +++ b/templates/index.html.handlebars @@ -8,7 +8,7 @@ content="{{#each csp}}{{@key}}{{#each this}} '{{this}}'{{/each}};{{/each}}" /> {{/if}} - Renai + {{appTitle}} diff --git a/templates/index.js b/templates/index.js index 877aa45..93b7f89 100644 --- a/templates/index.js +++ b/templates/index.js @@ -2,19 +2,22 @@ const handlebars = require('handlebars'); const path = require('path'); const fs = require('fs'); const data = require('./data'); +const packageJson = require('../package'); function compile(isDevMode = false) { const templatePath = path.resolve(__dirname, 'index.html.handlebars'); const template = fs.readFileSync(templatePath).toString(); - const compiled = handlebars.compile(template); - let result; + const delegate = handlebars.compile(template); + let extendedData; if (isDevMode) { - result = compiled(data.dev); + extendedData = data.dev; } else { - result = compiled(data.prod); + extendedData = data.prod; } + extendedData.appBundle = './bundle.js'; + extendedData.appTitle = packageJson.productName; - return result; + return delegate(extendedData); } exports.compile = compile;