From aaa7b20360ff6e79c8789ea16ad321e32e5daf03 Mon Sep 17 00:00:00 2001 From: Nicolas Schmitt Date: Tue, 23 Aug 2016 16:19:11 +0200 Subject: [PATCH] fix for remote pages --- .gitignore | 1 + app/assets/css/app.css | 3 +++ app/assets/css/app.scss | 5 +++++ app/main.js | 7 ++++++- app/scripts/config.js | 9 ++++++++- gulpfile.js | 12 +++++++----- package.json | 4 +++- 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1b1a45a..3d2883e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .env .npm +.publish node_modules bower_components certs diff --git a/app/assets/css/app.css b/app/assets/css/app.css index 594c881..551741e 100644 --- a/app/assets/css/app.css +++ b/app/assets/css/app.css @@ -94,6 +94,7 @@ body, html, .content { right: 0; } .message { + box-sizing: content-box; background-color: rgba(255, 255, 255, 0.9); color: #436a6b; max-width: 350px; @@ -111,6 +112,8 @@ body, html, .content { z-index: 2000; } .message .data { line-height: 100%; } + .message .close { + top: 10px; } .inventory { box-sizing: content-box; diff --git a/app/assets/css/app.scss b/app/assets/css/app.scss index 8a50b9e..c5eb104 100644 --- a/app/assets/css/app.scss +++ b/app/assets/css/app.scss @@ -84,6 +84,7 @@ body, html, .content { } .message { + box-sizing: content-box; background-color: rgba(255,255,255,0.9); color: #436a6b; max-width: 350px; @@ -103,6 +104,10 @@ body, html, .content { .data { line-height: 100%; } + + .close { + top: 10px; + } } .inventory { diff --git a/app/main.js b/app/main.js index 562ca9d..312df99 100644 --- a/app/main.js +++ b/app/main.js @@ -16,7 +16,12 @@ let mainWindow function createWindow () { mainWindow = new BrowserWindow({width: 1200, height: 900}) - mainWindow.loadURL(`file://${__dirname}/index.html`); + if (process.argv.indexOf("--local") >= 0) { + console.log("Using local version."); + mainWindow.loadURL(`file://${__dirname}/index.html`); + } else { + mainWindow.loadURL(`http://necrovisualizer.nicontoso.eu`); + } mainWindow.on('closed', function () { mainWindow = null diff --git a/app/scripts/config.js b/app/scripts/config.js index 5da4a10..e53f647 100644 --- a/app/scripts/config.js +++ b/app/scripts/config.js @@ -39,7 +39,14 @@ var configfile = path.join(remote.app.getPath("userData"), "settings.json"); - const { version } = require("./package.json"); + $.ajax({ + url: `package.json`, + async: false, + success: (result) => { + result = (typeof result == "string" ? JSON.parse(result) : result); + version = "v" + result.version; + } + }); service.save = function(config) { fs.writeFileSync(configfile, JSON.stringify(config)); diff --git a/gulpfile.js b/gulpfile.js index 16366cd..06592fa 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,11 +5,13 @@ var rename = require("gulp-rename"); var concat = require("gulp-concat"); var cssnano = require("gulp-cssnano"); var sass = require('gulp-sass'); +var file = require('gulp-file'); +var ghPages = require('gulp-gh-pages'); // Watch gulp.task('dev-styles', function() { - return gulp.src('src/assets/css/*.scss') + return gulp.src('app/assets/css/*.scss') .pipe(sass.sync().on('error', sass.logError)) .pipe(gulp.dest(function(f) { return f.base; @@ -17,20 +19,20 @@ gulp.task('dev-styles', function() { }); gulp.task('watch-styles', function() { - return gulp.watch('src/assets/css/*.scss', ['dev-styles']); + return gulp.watch('app/assets/css/*.scss', ['dev-styles']); }); gulp.task('watch', [ 'dev-styles', 'watch-styles' ]); // Deploy -gulp.task('deploy', ['build'], function() { +gulp.task('deploy', ['dev-styles'], function() { return gulp.src([ './app/**/*', - '!./app/node_modules' + '!./app/node_modules/**/*' ]) .pipe(file('CNAME', "necrovisualizer.nicontoso.eu")) - .pipe(ghPages({remoteUrl: "https://github.com/nicoschmitt/necrovisualizer"})); + .pipe(ghPages({remoteUrl: "https://github.com/nicoschmitt/necrobotvisualizer"})); }); // Main tasks diff --git a/package.json b/package.json index ca07e2f..5e90c40 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,12 @@ "del": "^2.2.2", "dotenv": "^2.0.0", "electron-builder": "^5.30.0", - "electron-prebuilt": "^1.3.3", + "electron-prebuilt": "^1.3.4", "gulp": "^3.9.1", "gulp-concat": "^2.6.0", "gulp-cssnano": "^2.1.2", + "gulp-file": "^0.3.0", + "gulp-gh-pages": "^0.5.4", "gulp-rename": "^1.2.2", "gulp-sass": "^2.3.2", "gulp-uglify": "^2.0.0"