From 3b7975a364a2c2d2131cf7d08ce356482b241a48 Mon Sep 17 00:00:00 2001 From: Simon Tucker Date: Sat, 13 May 2017 17:52:13 -0400 Subject: [PATCH] basic electron setup --- .gitignore | 4 ++-- client/components/download-button.component.js | 5 ++--- client/components/home.component.js | 4 ++-- lib/config.js | 10 ++++++++++ package.json | 2 +- private/electron/main.js | 9 +++++++-- private/electron/package.json | 2 +- todo.md | 4 ++-- 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index f9386d1..1f86064 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ settings.json node_modules config.push.json -public/downloads/darwin-x64/* -public/downloads/win32-ia32/* +public/downloads/mac/* +public/downloads/windows/* diff --git a/client/components/download-button.component.js b/client/components/download-button.component.js index 8312ada..2f79e41 100644 --- a/client/components/download-button.component.js +++ b/client/components/download-button.component.js @@ -52,12 +52,10 @@ const DownloadButtonComponent = (props) => { const platforms = { mac: { icon: '/images/apple.svg', - // link: `/downloads/darwin-x64/${APP_NAME}.zip`, title: 'Mac OS X', }, win: { icon: '/images/windows.svg', - // link: `/downloads/win-x64/${APP_NAME}.zip`, title: 'Windows', }, }; @@ -65,7 +63,7 @@ const DownloadButtonComponent = (props) => { const platform = platforms[props.platform]; return ( - + { }; DownloadButtonComponent.propTypes = { + link: PropTypes.string, platform: PropTypes.string.isRequired, }; diff --git a/client/components/home.component.js b/client/components/home.component.js index 82a6214..f2fd7c4 100644 --- a/client/components/home.component.js +++ b/client/components/home.component.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import Radium from 'radium'; import RaisedButton from 'material-ui/RaisedButton'; import React from 'react'; -import { APP_NAME, COMPANY, GITHUB_URL } from '../../lib/config'; +import { APP_NAME, COMPANY, GITHUB_URL, DOWNLOAD_URLS } from '../../lib/config'; import * as Actions from '../actions/actions'; import DownloadButtonComponent from './download-button.component'; import FooterComponent from './footer.component'; @@ -74,7 +74,7 @@ export class HomeComponent extends React.Component { />
{(Browser.mac && !Browser.electron) ? - : ''} + : ''} diff --git a/lib/config.js b/lib/config.js index 4d66736..eebff56 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,5 +1,10 @@ import { Meteor } from 'meteor/meteor'; +if (Meteor.isServer) { + const pjson = require('../package.json'); + Meteor.settings.public.version = pjson.version; +} + export const ICE_CONFIG = { iceServers: [{ url: 'stun:stun.l.google.com:19302' }] }; // consistent constraints for getUserMedia @@ -18,9 +23,14 @@ export const GUM_CONSTRAINTS = { }, }; +export const VERSION = Meteor.settings.public.version; export const APP_NAME = Meteor.settings.public.name; export const APP_EMAIL = 'support@glipchat.herokuapp.com'; export const APP_ICON = '/android-icon-192x192.png'; +export const DOWNLOAD_URLS = { + mac: `/downloads/mac/${APP_NAME}-${VERSION}-mac.zip`, + windows: `/downloads/mac/${APP_NAME}-${VERSION}-windows.zip`, +}; export const COMPANY = { name: 'Glipcode', diff --git a/package.json b/package.json index 616c5d2..4e7998a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "glipchat", - "version": "0.0.1", + "version": "1.0.0", "private": true, "scripts": { "start": "meteor --settings settings.json", diff --git a/private/electron/main.js b/private/electron/main.js index 07e5cf7..64d3d2f 100644 --- a/private/electron/main.js +++ b/private/electron/main.js @@ -3,6 +3,12 @@ const path = require('path'); const proxyWindowEvents = require('./proxy-window-events'); const updater = require('electron-simple-updater'); +let settings = {}; + +if (process.env.NODE_ENV !== 'development') { + settings = require('./settings.json'); +} + updater.init({ checkUpdateOnStart: false, autoDownload: false, @@ -12,8 +18,7 @@ updater.init({ // be closed automatically when the JavaScript object is garbage collected. let mainWindow; -const settings = process.env.SETTINGS || {}; -const rootUrl = settings.url || 'http://localhost:3000'; +const rootUrl = settings.rootUrl || 'http://localhost:3000'; // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here. diff --git a/private/electron/package.json b/private/electron/package.json index e2cb8df..6fe2b2b 100644 --- a/private/electron/package.json +++ b/private/electron/package.json @@ -19,7 +19,7 @@ "url": "https://raw.githubusercontent.com/srtucker22/glipchat/master/private/electron/updates.json" }, "scripts": { - "start": "electron .", + "start": "NODE_ENV='development' electron .", "pack": "build --dir", "dist": "build", "publish": "publish", diff --git a/todo.md b/todo.md index 958507e..88d4c6a 100644 --- a/todo.md +++ b/todo.md @@ -4,9 +4,8 @@ - BUG: rtc.actions.js:306 DOMException: Failed to set remote answer sdp: Called in wrong state: STATE_INPROGRESS - BUG: sometimes first notification isn't received, probably due to new subscriptionid - missing a notification leads to being 1 behind in the chain -- ENHANCEMENT: electron settings for file locations +- ENHANCEMENT: Streamline build/publish process for Electron - FEATURE: electron download buttons -- TEST: electron auto-updater/builder test - ENHANCEMENT: clear non-active rooms with chron job - ENHANCEMENT: clicking notification with open window should redirect without reloading page - ENHANCEMENT: handle all error messages @@ -17,6 +16,7 @@ - FEATURE: firefox notifications - FEATURE: mobile calling overlay - FEATURE: UI for mobile notifications +- TEST: electron auto-updater test **med** - ENHANCEMENT: Add TURN server support to make it more useful for real-world deployment