mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 10:16:26 +00:00
Merge commit '80a0c59f878d899fc21b72f08eb8afeb1970f9ba'
* commit '80a0c59f878d899fc21b72f08eb8afeb1970f9ba': make it as prerelease bump up version MarkdownのCodeblockの行間をひろげる 編集中キャンセルを押しても消える情報があれば警告をだす データ移転バグ修正 最初以降からはUpdaterがエラーをださない。 Stream EPIPEエラー解決、データはこれからJSON保存 notification デバッグ intercept entry point using ipc but not working in production bump up electron version 0.34 -> 0.35.1 MarkdownでEmojiが使える Markdown内のコードにSyntax highlightenをいれる Conflicts: main.js
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
var BrowserWindow = require('browser-window')
|
const electron = require('electron')
|
||||||
var path = require('path')
|
const BrowserWindow = electron.BrowserWindow
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
var finderWindow = new BrowserWindow({
|
var finderWindow = new BrowserWindow({
|
||||||
width: 640,
|
width: 640,
|
||||||
@@ -18,7 +19,7 @@ var finderWindow = new BrowserWindow({
|
|||||||
|
|
||||||
var url = path.resolve(__dirname, '../browser/finder/index.html')
|
var url = path.resolve(__dirname, '../browser/finder/index.html')
|
||||||
|
|
||||||
finderWindow.loadUrl('file://' + url)
|
finderWindow.loadURL('file://' + url)
|
||||||
|
|
||||||
finderWindow.on('blur', function () {
|
finderWindow.on('blur', function () {
|
||||||
finderWindow.hide()
|
finderWindow.hide()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var BrowserWindow = require('browser-window')
|
const electron = require('electron')
|
||||||
var path = require('path')
|
const BrowserWindow = electron.BrowserWindow
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
var mainWindow = new BrowserWindow({
|
var mainWindow = new BrowserWindow({
|
||||||
width: 1080,
|
width: 1080,
|
||||||
@@ -11,9 +12,9 @@ var mainWindow = new BrowserWindow({
|
|||||||
'standard-window': false
|
'standard-window': false
|
||||||
})
|
})
|
||||||
|
|
||||||
var url = path.resolve(__dirname, '../browser/main/index.html')
|
const url = path.resolve(__dirname, '../browser/main/index.html')
|
||||||
|
|
||||||
mainWindow.loadUrl('file://' + url)
|
mainWindow.loadURL('file://' + url)
|
||||||
|
|
||||||
mainWindow.setVisibleOnAllWorkspaces(true)
|
mainWindow.setVisibleOnAllWorkspaces(true)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
var BrowserWindow = require('browser-window')
|
const electron = require('electron')
|
||||||
|
const BrowserWindow = electron.BrowserWindow
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,8 @@ export function searchArticle (input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function refreshData () {
|
export function refreshData (data) {
|
||||||
console.log('refreshing data')
|
console.log('refreshing data')
|
||||||
let data = JSON.parse(localStorage.getItem('local'))
|
|
||||||
if (data == null) return null
|
|
||||||
|
|
||||||
let { folders, articles } = data
|
let { folders, articles } = data
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -31,3 +28,12 @@ export function refreshData () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
SELECT_ARTICLE,
|
||||||
|
SEARCH_ARTICLE,
|
||||||
|
REFRESH_DATA,
|
||||||
|
selectArticle,
|
||||||
|
searchArticle,
|
||||||
|
refreshData
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
||||||
<link rel="stylesheet" href="../../node_modules/devicon/devicon.min.css">
|
<link rel="stylesheet" href="../../node_modules/devicon/devicon.min.css">
|
||||||
|
<link rel="stylesheet" href="../../node_modules/highlight.js/styles/xcode.css">
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
<div id="content"></div>
|
<div id="content"></div>
|
||||||
<script src="../../submodules/ace/src-min/ace.js"></script>
|
<script src="../../submodules/ace/src-min/ace.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require('web-frame').setZoomLevelLimits(1, 1)
|
const electron = require('electron')
|
||||||
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
var scriptUrl = process.env.BOOST_ENV === 'development'
|
var scriptUrl = process.env.BOOST_ENV === 'development'
|
||||||
? 'http://localhost:8080/assets/finder.js'
|
? 'http://localhost:8080/assets/finder.js'
|
||||||
: '../../compiled/finder.js'
|
: '../../compiled/finder.js'
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import { createStore } from 'redux'
|
|||||||
import FinderInput from './FinderInput'
|
import FinderInput from './FinderInput'
|
||||||
import FinderList from './FinderList'
|
import FinderList from './FinderList'
|
||||||
import FinderDetail from './FinderDetail'
|
import FinderDetail from './FinderDetail'
|
||||||
import { selectArticle, searchArticle, refreshData } from './actions'
|
import actions, { selectArticle, searchArticle } from './actions'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import activityRecord from 'boost/activityRecord'
|
import dataStore from 'boost/dataStore'
|
||||||
|
|
||||||
|
const electron = require('electron')
|
||||||
|
const { remote, clipboard } = electron
|
||||||
|
|
||||||
import remote from 'remote'
|
|
||||||
var hideFinder = remote.getGlobal('hideFinder')
|
var hideFinder = remote.getGlobal('hideFinder')
|
||||||
import clipboard from 'clipboard'
|
|
||||||
|
|
||||||
function notify (...args) {
|
function notify (...args) {
|
||||||
return new window.Notification(...args)
|
return new window.Notification(...args)
|
||||||
@@ -62,7 +63,6 @@ class FinderMain extends React.Component {
|
|||||||
saveToClipboard () {
|
saveToClipboard () {
|
||||||
let { activeArticle } = this.props
|
let { activeArticle } = this.props
|
||||||
clipboard.writeText(activeArticle.content)
|
clipboard.writeText(activeArticle.content)
|
||||||
activityRecord.emit('FINDER_COPY')
|
|
||||||
|
|
||||||
notify('Saved to Clipboard!', {
|
notify('Saved to Clipboard!', {
|
||||||
body: 'Paste it wherever you want!'
|
body: 'Paste it wherever you want!'
|
||||||
@@ -212,13 +212,19 @@ function remap (state) {
|
|||||||
var Finder = connect(remap)(FinderMain)
|
var Finder = connect(remap)(FinderMain)
|
||||||
var store = createStore(reducer)
|
var store = createStore(reducer)
|
||||||
|
|
||||||
|
function refreshData () {
|
||||||
|
let data = dataStore.getData()
|
||||||
|
store.dispatch(actions.refreshData(data))
|
||||||
|
}
|
||||||
|
|
||||||
window.onfocus = e => {
|
window.onfocus = e => {
|
||||||
store.dispatch(refreshData())
|
refreshData()
|
||||||
activityRecord.emit('FINDER_OPEN')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render((
|
ReactDOM.render((
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<Finder/>
|
<Finder/>
|
||||||
</Provider>
|
</Provider>
|
||||||
), document.getElementById('content'))
|
), document.getElementById('content'), function () {
|
||||||
|
refreshData()
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { combineReducers } from 'redux'
|
import { combineReducers } from 'redux'
|
||||||
import { SELECT_ARTICLE, SEARCH_ARTICLE, REFRESH_DATA } from './actions'
|
import { SELECT_ARTICLE, SEARCH_ARTICLE, REFRESH_DATA } from './actions'
|
||||||
|
|
||||||
let data = JSON.parse(localStorage.getItem('local'))
|
let initialArticles = []
|
||||||
|
let initialFolders = []
|
||||||
let initialArticles = data != null ? data.articles : []
|
|
||||||
let initialFolders = data != null ? data.folders : []
|
|
||||||
let initialStatus = {
|
let initialStatus = {
|
||||||
articleKey: null,
|
articleKey: null,
|
||||||
search: ''
|
search: ''
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import ArticleTopBar from './HomePage/ArticleTopBar'
|
|||||||
import ArticleList from './HomePage/ArticleList'
|
import ArticleList from './HomePage/ArticleList'
|
||||||
import ArticleDetail from './HomePage/ArticleDetail'
|
import ArticleDetail from './HomePage/ArticleDetail'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import keygen from 'boost/keygen'
|
|
||||||
import { isModalOpen, closeModal } from 'boost/modal'
|
import { isModalOpen, closeModal } from 'boost/modal'
|
||||||
|
const electron = require('electron')
|
||||||
|
const BrowserWindow = electron.remote.BrowserWindow
|
||||||
|
|
||||||
const TEXT_FILTER = 'TEXT_FILTER'
|
const TEXT_FILTER = 'TEXT_FILTER'
|
||||||
const FOLDER_FILTER = 'FOLDER_FILTER'
|
const FOLDER_FILTER = 'FOLDER_FILTER'
|
||||||
@@ -31,7 +32,7 @@ class HomePage extends React.Component {
|
|||||||
if (process.env.BOOST_ENV === 'development' && e.keyCode === 73 && e.metaKey && e.altKey) {
|
if (process.env.BOOST_ENV === 'development' && e.keyCode === 73 && e.metaKey && e.altKey) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
require('remote').require('browser-window').getFocusedWindow().toggleDevTools()
|
BrowserWindow.getFocusedWindow().toggleDevTools()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
clearSearch,
|
clearSearch,
|
||||||
lockStatus,
|
lockStatus,
|
||||||
unlockStatus,
|
unlockStatus,
|
||||||
clearNewArticle,
|
|
||||||
updateArticle,
|
updateArticle,
|
||||||
destroyArticle,
|
destroyArticle,
|
||||||
NEW
|
NEW
|
||||||
@@ -248,9 +247,7 @@ export default class ArticleDetail extends React.Component {
|
|||||||
handleCancelButtonClick (e) {
|
handleCancelButtonClick (e) {
|
||||||
let { activeArticle, dispatch } = this.props
|
let { activeArticle, dispatch } = this.props
|
||||||
|
|
||||||
dispatch(unlockStatus())
|
|
||||||
if (activeArticle.status === NEW) {
|
if (activeArticle.status === NEW) {
|
||||||
dispatch(clearNewArticle())
|
|
||||||
dispatch(switchArticle(null))
|
dispatch(switchArticle(null))
|
||||||
}
|
}
|
||||||
dispatch(switchMode(IDLE_MODE))
|
dispatch(switchMode(IDLE_MODE))
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import Preferences from 'boost/components/modal/Preferences'
|
|||||||
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
|
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
|
||||||
import keygen from 'boost/keygen'
|
import keygen from 'boost/keygen'
|
||||||
|
|
||||||
import remote from 'remote'
|
const electron = require('electron')
|
||||||
|
const remote = electron.remote
|
||||||
let userName = remote.getGlobal('process').env.USER
|
let userName = remote.getGlobal('process').env.USER
|
||||||
|
|
||||||
const BRAND_COLOR = '#18AF90'
|
const BRAND_COLOR = '#18AF90'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import ipc from 'ipc'
|
const electron = require('electron')
|
||||||
|
const ipc = electron.ipcRenderer
|
||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
|
|
||||||
var ContactModal = require('boost/components/modal/ContactModal')
|
var ContactModal = require('boost/components/modal/ContactModal')
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
||||||
<link rel="stylesheet" href="../../node_modules/devicon/devicon.min.css">
|
<link rel="stylesheet" href="../../node_modules/devicon/devicon.min.css">
|
||||||
|
<link rel="stylesheet" href="../../node_modules/highlight.js/styles/xcode.css">
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -53,8 +54,9 @@
|
|||||||
|
|
||||||
<script src="../../submodules/ace/src-min/ace.js"></script>
|
<script src="../../submodules/ace/src-min/ace.js"></script>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
require('web-frame').setZoomLevelLimits(1, 1)
|
const electron = require('electron')
|
||||||
var version = require('remote').require('app').getVersion()
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
|
var version = electron.remote.app.getVersion()
|
||||||
document.title = 'Boost' + ((version == null || version.length === 0) ? ' DEV' : '')
|
document.title = 'Boost' + ((version == null || version.length === 0) ? ' DEV' : '')
|
||||||
var scriptUrl = process.env.BOOST_ENV === 'development'
|
var scriptUrl = process.env.BOOST_ENV === 'development'
|
||||||
? 'http://localhost:8080/assets/main.js'
|
? 'http://localhost:8080/assets/main.js'
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ require('../styles/main/index.styl')
|
|||||||
import { openModal } from 'boost/modal'
|
import { openModal } from 'boost/modal'
|
||||||
import Tutorial from 'boost/components/modal/Tutorial'
|
import Tutorial from 'boost/components/modal/Tutorial'
|
||||||
import activityRecord from 'boost/activityRecord'
|
import activityRecord from 'boost/activityRecord'
|
||||||
import ipc from 'ipc'
|
const electron = require('electron')
|
||||||
|
const ipc = electron.ipcRenderer
|
||||||
|
|
||||||
activityRecord.init()
|
activityRecord.init()
|
||||||
window.addEventListener('online', function () {
|
window.addEventListener('online', function () {
|
||||||
@@ -22,9 +23,9 @@ function notify (...args) {
|
|||||||
return new window.Notification(...args)
|
return new window.Notification(...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.on('notify', function (title, message) {
|
ipc.on('notify', function (e, payload) {
|
||||||
notify(title, {
|
notify(payload.title, {
|
||||||
body: message
|
body: payload.body
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ marked()
|
|||||||
display list-item
|
display list-item
|
||||||
line-height 1.8em
|
line-height 1.8em
|
||||||
code
|
code
|
||||||
font-family monospace
|
font-family Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace;
|
||||||
padding 2px 4px
|
padding 2px 4px
|
||||||
border solid 1px borderColor
|
border solid 1px borderColor
|
||||||
border-radius 4px
|
border-radius 4px
|
||||||
@@ -77,6 +77,7 @@ marked()
|
|||||||
overflow-x auto
|
overflow-x auto
|
||||||
margin 15px 0 25px
|
margin 15px 0 25px
|
||||||
background-color #F6F6F6
|
background-color #F6F6F6
|
||||||
|
line-height 1.35em
|
||||||
&>code
|
&>code
|
||||||
padding 0
|
padding 0
|
||||||
border none
|
border none
|
||||||
|
|||||||
72
finder.js
Executable file
72
finder.js
Executable file
@@ -0,0 +1,72 @@
|
|||||||
|
const electron = require('electron')
|
||||||
|
const app = electron.app
|
||||||
|
const Tray = electron.Tray
|
||||||
|
const Menu = electron.Menu
|
||||||
|
const MenuItem = electron.MenuItem
|
||||||
|
|
||||||
|
process.stdin.setEncoding('utf8')
|
||||||
|
|
||||||
|
console.log = function () {
|
||||||
|
process.stdout.write(JSON.stringify({
|
||||||
|
type: 'log',
|
||||||
|
data: JSON.stringify(Array.prototype.slice.call(arguments).join(' '))
|
||||||
|
}), 'utf-8')
|
||||||
|
}
|
||||||
|
|
||||||
|
function emit (type, data) {
|
||||||
|
process.stdout.write(JSON.stringify({
|
||||||
|
type: type,
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}), 'utf-8')
|
||||||
|
}
|
||||||
|
|
||||||
|
var finderWindow
|
||||||
|
app.on('ready', function () {
|
||||||
|
app.dock.hide()
|
||||||
|
var appIcon = new Tray(__dirname + '/resources/tray-icon.png')
|
||||||
|
appIcon.setToolTip('Boost')
|
||||||
|
|
||||||
|
finderWindow = require('./atom-lib/finder-window')
|
||||||
|
finderWindow.webContents.on('did-finish-load', function () {
|
||||||
|
var trayMenu = new Menu()
|
||||||
|
trayMenu.append(new MenuItem({
|
||||||
|
label: 'Open Main window',
|
||||||
|
click: function () {
|
||||||
|
emit('show-main-window')
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
trayMenu.append(new MenuItem({
|
||||||
|
label: 'Open Finder',
|
||||||
|
click: function () {
|
||||||
|
finderWindow.show()
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
trayMenu.append(new MenuItem({
|
||||||
|
label: 'Quit',
|
||||||
|
click: function () {
|
||||||
|
emit('quit-app')
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
appIcon.setContextMenu(trayMenu)
|
||||||
|
|
||||||
|
process.stdin.on('data', function (payload) {
|
||||||
|
try {
|
||||||
|
payload = JSON.parse(payload)
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Not parsable payload : ', payload)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('from main >> ', payload.type)
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'open-finder':
|
||||||
|
finderWindow.show()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
global.hideFinder = function () {
|
||||||
|
Menu.sendActionToFirstResponder('hide:')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
10
index.js
Normal file
10
index.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
function isFinderCalled () {
|
||||||
|
var argv = process.argv.slice(1)
|
||||||
|
return argv.some(arg => arg.match(/--finder/))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinderCalled()) {
|
||||||
|
require('./finder.js')
|
||||||
|
} else {
|
||||||
|
require('./main.js')
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
import shell from 'shell'
|
const electron = require('electron')
|
||||||
|
const shell = electron.shell
|
||||||
|
|
||||||
export default class ExternalLink extends React.Component {
|
export default class ExternalLink extends React.Component {
|
||||||
handleClick (e) {
|
handleClick (e) {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import shell from 'shell'
|
|
||||||
var React = require('react')
|
var React = require('react')
|
||||||
var { PropTypes } = React
|
var { PropTypes } = React
|
||||||
import markdown from 'boost/markdown'
|
import markdown from 'boost/markdown'
|
||||||
var ReactDOM = require('react-dom')
|
var ReactDOM = require('react-dom')
|
||||||
|
|
||||||
|
const electron = require('electron')
|
||||||
|
const shell = electron.shell
|
||||||
|
|
||||||
function handleAnchorClick (e) {
|
function handleAnchorClick (e) {
|
||||||
shell.openExternal(e.target.href)
|
shell.openExternal(e.target.href)
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import linkState from 'boost/linkState'
|
import linkState from 'boost/linkState'
|
||||||
import remote from 'remote'
|
|
||||||
import ipc from 'ipc'
|
const electron = require('electron')
|
||||||
|
const ipc = electron.ipcRenderer
|
||||||
|
const remote = electron.remote
|
||||||
|
|
||||||
export default class AppSettingTab extends React.Component {
|
export default class AppSettingTab extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
@@ -47,7 +49,9 @@ export default class AppSettingTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleKeyDown (e) {
|
handleKeyDown (e) {
|
||||||
this.submitHotKey()
|
if (e.keyCode === 13) {
|
||||||
|
this.submitHotKey()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|||||||
@@ -83,158 +83,6 @@ class Preferences extends React.Component {
|
|||||||
return (<AppSettingTab/>)
|
return (<AppSettingTab/>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleProfileSaveButtonClick (e) {
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// profileState.userInfo.alert = {
|
|
||||||
// type: 'info',
|
|
||||||
// message: 'Sending...'
|
|
||||||
// }
|
|
||||||
// this.setState({profile: profileState}, () => {
|
|
||||||
// let input = {
|
|
||||||
// profileName: profileState.userInfo.profileName,
|
|
||||||
// email: profileState.userInfo.email
|
|
||||||
// }
|
|
||||||
// api.updateUserInfo(input)
|
|
||||||
// .then(res => {
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// profileState.userInfo.alert = {
|
|
||||||
// type: 'success',
|
|
||||||
// message: 'Successfully done!'
|
|
||||||
// }
|
|
||||||
// this.setState({profile: profileState})
|
|
||||||
// })
|
|
||||||
// .catch(err => {
|
|
||||||
// var message
|
|
||||||
// if (err.status != null) {
|
|
||||||
// message = err.response.body.message
|
|
||||||
// } else if (err.code === 'ECONNREFUSED') {
|
|
||||||
// message = 'Can\'t connect to API server.'
|
|
||||||
// } else throw err
|
|
||||||
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// profileState.userInfo.alert = {
|
|
||||||
// type: 'error',
|
|
||||||
// message: message
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.setState({profile: profileState})
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// handlePasswordSaveButton (e) {
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
|
|
||||||
// if (profileState.password.newPassword !== profileState.password.confirmation) {
|
|
||||||
// profileState.password.alert = {
|
|
||||||
// type: 'error',
|
|
||||||
// message: 'Confirmation doesn\'t match'
|
|
||||||
// }
|
|
||||||
// this.setState({profile: profileState})
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// profileState.password.alert = {
|
|
||||||
// type: 'info',
|
|
||||||
// message: 'Sending...'
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.setState({profile: profileState}, () => {
|
|
||||||
// let input = {
|
|
||||||
// password: profileState.password.currentPassword,
|
|
||||||
// newPassword: profileState.password.newPassword
|
|
||||||
// }
|
|
||||||
// api.updatePassword(input)
|
|
||||||
// .then(res => {
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// profileState.password.alert = {
|
|
||||||
// type: 'success',
|
|
||||||
// message: 'Successfully done!'
|
|
||||||
// }
|
|
||||||
// profileState.password.currentPassword = ''
|
|
||||||
// profileState.password.newPassword = ''
|
|
||||||
// profileState.password.confirmation = ''
|
|
||||||
|
|
||||||
// this.setState({profile: profileState})
|
|
||||||
// })
|
|
||||||
// .catch(err => {
|
|
||||||
// var message
|
|
||||||
// if (err.status != null) {
|
|
||||||
// message = err.response.body.message
|
|
||||||
// } else if (err.code === 'ECONNREFUSED') {
|
|
||||||
// message = 'Can\'t connect to API server.'
|
|
||||||
// } else throw err
|
|
||||||
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// profileState.password.alert = {
|
|
||||||
// type: 'error',
|
|
||||||
// message: message
|
|
||||||
// }
|
|
||||||
// profileState.password.currentPassword = ''
|
|
||||||
// profileState.password.newPassword = ''
|
|
||||||
// profileState.password.confirmation = ''
|
|
||||||
|
|
||||||
// this.setState({profile: profileState}, () => {
|
|
||||||
// if (this.refs.currentPassword != null) findDOMNode(this.refs.currentPassword).focus()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// renderProfile () {
|
|
||||||
// let profileState = this.state.profile
|
|
||||||
// return (
|
|
||||||
// <div className='content profile'>
|
|
||||||
// <div className='section userSection'>
|
|
||||||
// <div className='sectionTitle'>User Info</div>
|
|
||||||
// <div className='sectionInput'>
|
|
||||||
// <label>Profile Name</label>
|
|
||||||
// <input valueLink={this.linkState('profile.userInfo.profileName')} type='text'/>
|
|
||||||
// </div>
|
|
||||||
// <div className='sectionInput'>
|
|
||||||
// <label>E-mail</label>
|
|
||||||
// <input valueLink={this.linkState('profile.userInfo.email')} type='text'/>
|
|
||||||
// </div>
|
|
||||||
// <div className='sectionConfirm'>
|
|
||||||
// <button onClick={e => this.handleProfileSaveButtonClick(e)}>Save</button>
|
|
||||||
|
|
||||||
// {this.state.profile.userInfo.alert != null
|
|
||||||
// ? (
|
|
||||||
// <div className={'alert ' + profileState.userInfo.alert.type}>{profileState.userInfo.alert.message}</div>
|
|
||||||
// )
|
|
||||||
// : null}
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className='section passwordSection'>
|
|
||||||
// <div className='sectionTitle'>Password</div>
|
|
||||||
// <div className='sectionInput'>
|
|
||||||
// <label>Current Password</label>
|
|
||||||
// <input ref='currentPassword' valueLink={this.linkState('profile.password.currentPassword')} type='password' placeholder='Current Password'/>
|
|
||||||
// </div>
|
|
||||||
// <div className='sectionInput'>
|
|
||||||
// <label>New Password</label>
|
|
||||||
// <input valueLink={this.linkState('profile.password.newPassword')} type='password' placeholder='New Password'/>
|
|
||||||
// </div>
|
|
||||||
// <div className='sectionInput'>
|
|
||||||
// <label>Confirmation</label>
|
|
||||||
// <input valueLink={this.linkState('profile.password.confirmation')} type='password' placeholder='Confirmation'/>
|
|
||||||
// </div>
|
|
||||||
// <div className='sectionConfirm'>
|
|
||||||
// <button onClick={e => this.handlePasswordSaveButton(e)}>Save</button>
|
|
||||||
|
|
||||||
// {profileState.password.alert != null
|
|
||||||
// ? (
|
|
||||||
// <div className={'alert ' + profileState.password.alert.type}>{profileState.password.alert.message}</div>
|
|
||||||
// )
|
|
||||||
// : null}
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences.propTypes = {
|
Preferences.propTypes = {
|
||||||
|
|||||||
@@ -1,11 +1,27 @@
|
|||||||
import keygen from 'boost/keygen'
|
import keygen from 'boost/keygen'
|
||||||
|
const electron = require('electron')
|
||||||
|
const remote = electron.remote
|
||||||
|
const jetpack = require('fs-jetpack')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
let defaultContent = 'Boost is a brand new note App for programmers.\n\n> 下に日本語版があります。\n\n# \u25CEfeature\n\nBoost has some preponderant functions for efficient engineer\'s task.See some part of it.\n\n1. classify information by\u300CFolders\u300D\n2. deal with great variety of syntax\n3. Finder function\n\n\uFF0A\u3000\uFF0A\u3000\uFF0A\u3000\uFF0A\n\n# 1. classify information by \u300CFolders\u300D- access the information you needed easily.\n\n\u300CFolders\u300D which on the left side bar. Press plus button now. flexible way of classification.\n- Create Folder every language or flamework\n- Make Folder for your own casual memos\n\n# 2. Deal with a great variety of syntax \u2013 instead of your brain\nSave handy all information related with programming\n- Use markdown and gather api specification\n- Well using module and snippet\n\nSave them on Boost, you don\'t need to rewrite or re-search same code again.\n\n# 3. Load Finder function \u2013 now you don\'t need to spell command by hand typing.\n\n**Shift +ctrl+tab** press buttons at same time.\nThen, the window will show up for search Boost contents that instant.\n\nUsing cursor key to chose, press enter, cmd+v to paste and\u2026 please check it out by your own eye.\n\n- Such command spl or linux which programmers often use but troublesome to hand type\n\n- (Phrases commonly used for e-mail or customer support)\n\nWe support preponderant efficiency\n\n\uFF0A\u3000\uFF0A\u3000\uFF0A\u3000\uFF0A\n\n## \u25CEfor more information\nFrequently updated with this blog ( http:\/\/blog-jp.b00st.io )\n\nHave wonderful programmer life!\n\n## Hack your memory**\n\n\n\n# 日本語版\n\n**Boost**は全く新しいエンジニアライクのノートアプリです。\n\n# ◎特徴\nBoostはエンジニアの仕事を圧倒的に効率化するいくつかの機能を備えています。\nその一部をご紹介します。\n1. Folderで情報を分類\n2. 豊富なsyantaxに対応\n3. Finder機能\n\n\n* * * *\n\n# 1. Folderで情報を分類、欲しい情報にすぐアクセス。\n左側のバーに存在する「Folders」。\n今すぐプラスボタンを押しましょう。\n分類の仕方も自由自在です。\n- 言語やフレームワークごとにFolderを作成\n- 自分用のカジュアルなメモをまとめる場としてFolderを作成\n\n\n# 2. 豊富なsyntaxに対応、自分の脳の代わりに。\nプログラミングに関する情報を全て、手軽に保存しましょう。\n- mdで、apiの仕様をまとめる\n- よく使うモジュールやスニペット\n\nBoostに保存しておくことで、何度も同じコードを書いたり調べたりする必要がなくなります。\n\n# 3. Finder機能を搭載、もうコマンドを手打ちする必要はありません。\n**「shift+ctrl+tab」** を同時に押してみてください。\nここでは、一瞬でBoostの中身を検索するウィンドウを表示させることができます。\n\n矢印キーで選択、Enterを押し、cmd+vでペーストすると…続きはご自身の目でお確かめください。\n- sqlやlinux等の、よく使うが手打ちが面倒なコマンド\n- (メールやカスタマーサポート等でよく使うフレーズ)\n\n私たちは、圧倒的な効率性を支援します。\n\* * * *\n\n\n## ◎詳しくは\nこちらのブログ( http://blog-jp.b00st.io )にて随時更新しています。\n\nそれでは素晴らしいエンジニアライフを!\n\n## Hack your memory**'
|
let defaultContent = 'Boost is a brand new note App for programmers.\n\n> 下に日本語版があります。\n\n# \u25CEfeature\n\nBoost has some preponderant functions for efficient engineer\'s task.See some part of it.\n\n1. classify information by\u300CFolders\u300D\n2. deal with great variety of syntax\n3. Finder function\n\n\uFF0A\u3000\uFF0A\u3000\uFF0A\u3000\uFF0A\n\n# 1. classify information by \u300CFolders\u300D- access the information you needed easily.\n\n\u300CFolders\u300D which on the left side bar. Press plus button now. flexible way of classification.\n- Create Folder every language or flamework\n- Make Folder for your own casual memos\n\n# 2. Deal with a great variety of syntax \u2013 instead of your brain\nSave handy all information related with programming\n- Use markdown and gather api specification\n- Well using module and snippet\n\nSave them on Boost, you don\'t need to rewrite or re-search same code again.\n\n# 3. Load Finder function \u2013 now you don\'t need to spell command by hand typing.\n\n**Shift +ctrl+tab** press buttons at same time.\nThen, the window will show up for search Boost contents that instant.\n\nUsing cursor key to chose, press enter, cmd+v to paste and\u2026 please check it out by your own eye.\n\n- Such command spl or linux which programmers often use but troublesome to hand type\n\n- (Phrases commonly used for e-mail or customer support)\n\nWe support preponderant efficiency\n\n\uFF0A\u3000\uFF0A\u3000\uFF0A\u3000\uFF0A\n\n## \u25CEfor more information\nFrequently updated with this blog ( http:\/\/blog-jp.b00st.io )\n\nHave wonderful programmer life!\n\n## Hack your memory**\n\n\n\n# 日本語版\n\n**Boost**は全く新しいエンジニアライクのノートアプリです。\n\n# ◎特徴\nBoostはエンジニアの仕事を圧倒的に効率化するいくつかの機能を備えています。\nその一部をご紹介します。\n1. Folderで情報を分類\n2. 豊富なsyantaxに対応\n3. Finder機能\n\n\n* * * *\n\n# 1. Folderで情報を分類、欲しい情報にすぐアクセス。\n左側のバーに存在する「Folders」。\n今すぐプラスボタンを押しましょう。\n分類の仕方も自由自在です。\n- 言語やフレームワークごとにFolderを作成\n- 自分用のカジュアルなメモをまとめる場としてFolderを作成\n\n\n# 2. 豊富なsyntaxに対応、自分の脳の代わりに。\nプログラミングに関する情報を全て、手軽に保存しましょう。\n- mdで、apiの仕様をまとめる\n- よく使うモジュールやスニペット\n\nBoostに保存しておくことで、何度も同じコードを書いたり調べたりする必要がなくなります。\n\n# 3. Finder機能を搭載、もうコマンドを手打ちする必要はありません。\n**「shift+ctrl+tab」** を同時に押してみてください。\nここでは、一瞬でBoostの中身を検索するウィンドウを表示させることができます。\n\n矢印キーで選択、Enterを押し、cmd+vでペーストすると…続きはご自身の目でお確かめください。\n- sqlやlinux等の、よく使うが手打ちが面倒なコマンド\n- (メールやカスタマーサポート等でよく使うフレーズ)\n\n私たちは、圧倒的な効率性を支援します。\n\* * * *\n\n\n## ◎詳しくは\nこちらのブログ( http://blog-jp.b00st.io )にて随時更新しています。\n\nそれでは素晴らしいエンジニアライフを!\n\n## Hack your memory**'
|
||||||
|
|
||||||
|
function getLocalPath () {
|
||||||
|
return path.join(remote.app.getPath('userData'), 'local.json')
|
||||||
|
}
|
||||||
|
|
||||||
export function init () {
|
export function init () {
|
||||||
console.log('initialize data store')
|
console.log('initialize data store')
|
||||||
let data = JSON.parse(localStorage.getItem('local'))
|
let data = jetpack.read(getLocalPath(), 'json')
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
if (localStorage.getItem('local') != null) {
|
||||||
|
data = JSON.parse(localStorage.getItem('local'))
|
||||||
|
jetpack.write(getLocalPath(), data)
|
||||||
|
localStorage.removeItem('local')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let defaultFolder = {
|
let defaultFolder = {
|
||||||
name: 'default',
|
name: 'default',
|
||||||
key: keygen()
|
key: keygen()
|
||||||
@@ -24,37 +40,35 @@ export function init () {
|
|||||||
folders: [defaultFolder],
|
folders: [defaultFolder],
|
||||||
version: '0.4'
|
version: '0.4'
|
||||||
}
|
}
|
||||||
localStorage.setItem('local', JSON.stringify(data))
|
jetpack.write(getLocalPath(), data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getKey (teamId) {
|
export function getData () {
|
||||||
return teamId == null
|
return jetpack.read(getLocalPath(), 'json')
|
||||||
? 'local'
|
|
||||||
: `team-${teamId}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getData (teamId) {
|
export function setArticles (articles) {
|
||||||
let key = getKey(teamId)
|
let data = getData()
|
||||||
return JSON.parse(localStorage.getItem(key))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setArticles (teamId, articles) {
|
|
||||||
let key = getKey(teamId)
|
|
||||||
let data = JSON.parse(localStorage.getItem(key))
|
|
||||||
data.articles = articles
|
data.articles = articles
|
||||||
localStorage.setItem(key, JSON.stringify(data))
|
jetpack.write(getLocalPath(), data)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setFolders (teamId, folders) {
|
export function setFolders (folders) {
|
||||||
let key = getKey(teamId)
|
let data = getData()
|
||||||
let data = JSON.parse(localStorage.getItem(key))
|
|
||||||
data.folders = folders
|
data.folders = folders
|
||||||
localStorage.setItem(key, JSON.stringify(data))
|
jetpack.write(getLocalPath(), data)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isFinderCalled () {
|
||||||
|
var argv = process.argv.slice(1)
|
||||||
|
return argv.some(arg => arg.match(/--finder/))
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (function () {
|
export default (function () {
|
||||||
init()
|
if (!isFinderCalled()) {
|
||||||
|
init()
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
init,
|
init,
|
||||||
getData,
|
getData,
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
import markdownit from 'markdown-it'
|
import markdownit from 'markdown-it'
|
||||||
|
import hljs from 'highlight.js'
|
||||||
|
import emoji from 'markdown-it-emoji'
|
||||||
|
|
||||||
var md = markdownit({
|
var md = markdownit({
|
||||||
typographer: true,
|
typographer: true,
|
||||||
linkify: true
|
linkify: true,
|
||||||
|
highlight: function (str, lang) {
|
||||||
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
|
try {
|
||||||
|
return hljs.highlight(lang, str).value;
|
||||||
|
} catch (__) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return hljs.highlightAuto(str).value;
|
||||||
|
} catch (__) {}
|
||||||
|
|
||||||
|
return ''; // use external default escaping
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
md.use(emoji)
|
||||||
|
|
||||||
export default function markdown (content) {
|
export default function markdown (content) {
|
||||||
if (content == null) content = ''
|
if (content == null) content = ''
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
var shell = require('shell')
|
const electron = require('electron')
|
||||||
|
const shell = electron.shell
|
||||||
|
|
||||||
export default function (e) {
|
export default function (e) {
|
||||||
shell.openExternal(e.currentTarget.href)
|
shell.openExternal(e.currentTarget.href)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ function folders (state = initialFolders, action) {
|
|||||||
if (conflictFolder != null) throw new Error(`${newFolder.name} already exists!`)
|
if (conflictFolder != null) throw new Error(`${newFolder.name} already exists!`)
|
||||||
state.push(newFolder)
|
state.push(newFolder)
|
||||||
|
|
||||||
dataStore.setFolders(null, state)
|
dataStore.setFolders(state)
|
||||||
activityRecord.emit('FOLDER_CREATE')
|
activityRecord.emit('FOLDER_CREATE')
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ function folders (state = initialFolders, action) {
|
|||||||
updatedAt: new Date()
|
updatedAt: new Date()
|
||||||
})
|
})
|
||||||
|
|
||||||
dataStore.setFolders(null, state)
|
dataStore.setFolders(state)
|
||||||
activityRecord.emit('FOLDER_UPDATE')
|
activityRecord.emit('FOLDER_UPDATE')
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ function folders (state = initialFolders, action) {
|
|||||||
if (targetIndex >= 0) {
|
if (targetIndex >= 0) {
|
||||||
state.splice(targetIndex, 1)
|
state.splice(targetIndex, 1)
|
||||||
}
|
}
|
||||||
dataStore.setFolders(null, state)
|
dataStore.setFolders(state)
|
||||||
activityRecord.emit('FOLDER_DESTROY')
|
activityRecord.emit('FOLDER_DESTROY')
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ function articles (state = initialArticles, action) {
|
|||||||
if (targetIndex < 0) state.unshift(article)
|
if (targetIndex < 0) state.unshift(article)
|
||||||
else state.splice(targetIndex, 1, article)
|
else state.splice(targetIndex, 1, article)
|
||||||
|
|
||||||
if (article.status !== 'NEW') dataStore.setArticles(null, state)
|
if (article.status !== 'NEW') dataStore.setArticles(state)
|
||||||
else isCreatingNew = true
|
else isCreatingNew = true
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ function articles (state = initialArticles, action) {
|
|||||||
let targetIndex = _.findIndex(state, _article => articleKey === _article.key)
|
let targetIndex = _.findIndex(state, _article => articleKey === _article.key)
|
||||||
if (targetIndex >= 0) state.splice(targetIndex, 1)
|
if (targetIndex >= 0) state.splice(targetIndex, 1)
|
||||||
|
|
||||||
dataStore.setArticles(null, state)
|
dataStore.setArticles(state)
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
case FOLDER_DESTROY:
|
case FOLDER_DESTROY:
|
||||||
@@ -187,7 +187,7 @@ function articles (state = initialArticles, action) {
|
|||||||
|
|
||||||
state = state.filter(article => article.FolderKey !== folderKey)
|
state = state.filter(article => article.FolderKey !== folderKey)
|
||||||
|
|
||||||
dataStore.setArticles(null, state)
|
dataStore.setArticles(state)
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
145
main.js
145
main.js
@@ -1,43 +1,50 @@
|
|||||||
var app = require('app')
|
const electron = require('electron')
|
||||||
var Menu = require('menu')
|
const app = electron.app
|
||||||
var MenuItem = require('menu-item')
|
const Menu = electron.Menu
|
||||||
var Tray = require('tray')
|
const ipc = electron.ipcMain
|
||||||
var ipc = require('ipc')
|
const globalShortcut = electron.globalShortcut
|
||||||
var jetpack = require('fs-jetpack')
|
const autoUpdater = electron.autoUpdater
|
||||||
|
const jetpack = require('fs-jetpack')
|
||||||
require('crash-reporter').start()
|
const path = require('path')
|
||||||
|
const ChildProcess = require('child_process')
|
||||||
|
electron.crashReporter.start()
|
||||||
|
|
||||||
var mainWindow = null
|
var mainWindow = null
|
||||||
var appIcon = null
|
var finderProcess
|
||||||
var menu = null
|
|
||||||
var finderWindow = null
|
|
||||||
|
|
||||||
var update = null
|
var update = null
|
||||||
|
|
||||||
// app.on('window-all-closed', function () {
|
// app.on('window-all-closed', function () {
|
||||||
// if (process.platform !== 'darwin') app.quit()
|
// if (process.platform !== 'darwin') app.quit()
|
||||||
// })
|
// })
|
||||||
|
|
||||||
var autoUpdater = require('auto-updater')
|
|
||||||
|
|
||||||
var appQuit = false
|
var appQuit = false
|
||||||
|
|
||||||
var version = app.getVersion()
|
var version = app.getVersion()
|
||||||
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
|
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
|
||||||
var versionNotified = false
|
var versionNotified = false
|
||||||
|
|
||||||
|
function notify (title, body) {
|
||||||
|
if (mainWindow != null) {
|
||||||
|
mainWindow.webContents.send('notify', {
|
||||||
|
title: title,
|
||||||
|
body: body
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
autoUpdater
|
autoUpdater
|
||||||
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
|
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
|
||||||
update = quitAndUpdate
|
update = quitAndUpdate
|
||||||
|
|
||||||
if (mainWindow != null) {
|
if (mainWindow != null) {
|
||||||
mainWindow.webContents.send('notify', 'Ready to Update! ' + releaseName, 'Click update button on Main window.')
|
notify('Ready to Update! ' + releaseName, 'Click update button on Main window.')
|
||||||
mainWindow.webContents.send('update-available', 'Update available!')
|
mainWindow.webContents.send('update-available', 'Update available!')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('error', function (err, message) {
|
.on('error', function (err, message) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
if (mainWindow != null && !versionNotified) {
|
if (!versionNotified) {
|
||||||
mainWindow.webContents.send('notify', 'Updater error!', message)
|
notify('Updater error!', message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// .on('checking-for-update', function () {
|
// .on('checking-for-update', function () {
|
||||||
@@ -45,27 +52,27 @@ autoUpdater
|
|||||||
// console.log('checking...')
|
// console.log('checking...')
|
||||||
// })
|
// })
|
||||||
.on('update-available', function () {
|
.on('update-available', function () {
|
||||||
if (mainWindow != null) {
|
notify('Update is available!', 'Download started.. wait for the update ready.')
|
||||||
mainWindow.webContents.send('notify', 'Update is available!', 'Download started.. wait for the update ready.')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on('update-not-available', function () {
|
.on('update-not-available', function () {
|
||||||
if (mainWindow != null && !versionNotified) {
|
if (mainWindow != null && !versionNotified) {
|
||||||
versionNotified = true
|
versionNotified = true
|
||||||
mainWindow.webContents.send('notify', 'Latest Build!! ' + versionText, 'Hope you to enjoy our app :D')
|
notify('Latest Build!! ' + versionText, 'Hope you to enjoy our app :D')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('ready', function () {
|
app.on('ready', function () {
|
||||||
app.on('before-quit', function () {
|
app.on('before-quit', function () {
|
||||||
|
if (finderProcess) finderProcess.kill()
|
||||||
appQuit = true
|
appQuit = true
|
||||||
})
|
})
|
||||||
console.log('Version ' + version)
|
console.log('Version ' + version)
|
||||||
autoUpdater.setFeedUrl('http://orbital.b00st.io/rokt33r/boost-app/latest?version=' + version)
|
autoUpdater.setFeedUrl('http://orbital.b00st.io/rokt33r/boost-app/latest?version=' + version)
|
||||||
autoUpdater.checkForUpdates()
|
autoUpdater.checkForUpdates()
|
||||||
|
|
||||||
// menu start
|
|
||||||
var template = require('./atom-lib/menu-template')
|
var template = require('./atom-lib/menu-template')
|
||||||
|
var menu = Menu.buildFromTemplate(template)
|
||||||
|
Menu.setApplicationMenu(menu)
|
||||||
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
if (update == null) autoUpdater.checkForUpdates()
|
if (update == null) autoUpdater.checkForUpdates()
|
||||||
@@ -82,28 +89,6 @@ app.on('ready', function () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
menu = Menu.buildFromTemplate(template)
|
|
||||||
|
|
||||||
Menu.setApplicationMenu(menu)
|
|
||||||
// menu end
|
|
||||||
appIcon = new Tray(__dirname + '/resources/tray-icon.png')
|
|
||||||
appIcon.setToolTip('Boost')
|
|
||||||
|
|
||||||
var trayMenu = new Menu()
|
|
||||||
trayMenu.append(new MenuItem({
|
|
||||||
label: 'Open main window',
|
|
||||||
click: function () {
|
|
||||||
if (mainWindow != null) mainWindow.show()
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
trayMenu.append(new MenuItem({
|
|
||||||
label: 'Quit',
|
|
||||||
click: function () {
|
|
||||||
app.quit()
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
appIcon.setContextMenu(trayMenu)
|
|
||||||
|
|
||||||
mainWindow = require('./atom-lib/main-window')
|
mainWindow = require('./atom-lib/main-window')
|
||||||
mainWindow.on('close', function (e) {
|
mainWindow.on('close', function (e) {
|
||||||
if (appQuit) return true
|
if (appQuit) return true
|
||||||
@@ -111,6 +96,15 @@ app.on('ready', function () {
|
|||||||
mainWindow.hide()
|
mainWindow.hide()
|
||||||
})
|
})
|
||||||
mainWindow.webContents.on('did-finish-load', function () {
|
mainWindow.webContents.on('did-finish-load', function () {
|
||||||
|
if (finderProcess == null) {
|
||||||
|
finderProcess = ChildProcess
|
||||||
|
.execFile(process.execPath, [path.resolve(__dirname, 'finder.js'), '--finder'])
|
||||||
|
finderProcess.stdout.setEncoding('utf8')
|
||||||
|
finderProcess.stderr.setEncoding('utf8')
|
||||||
|
finderProcess.stdout.on('data', format)
|
||||||
|
finderProcess.stderr.on('data', errorFormat)
|
||||||
|
}
|
||||||
|
|
||||||
if (update != null) {
|
if (update != null) {
|
||||||
mainWindow.webContents.send('update-available', 'whoooooooh!')
|
mainWindow.webContents.send('update-available', 'whoooooooh!')
|
||||||
} else {
|
} else {
|
||||||
@@ -118,14 +112,53 @@ app.on('ready', function () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('activate-with-no-open-windows', function () {
|
app.on('activate', function () {
|
||||||
if (mainWindow == null) return null
|
if (mainWindow == null) return null
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
finderWindow = require('./atom-lib/finder-window')
|
function format (payload) {
|
||||||
|
// console.log('from finder >> ', payload)
|
||||||
|
try {
|
||||||
|
payload = JSON.parse(payload)
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Not parsable payload : ', payload)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'log':
|
||||||
|
console.log('FINDER(stdout): ' + payload.data)
|
||||||
|
break
|
||||||
|
case 'show-main-window':
|
||||||
|
if (mainWindow != null) {
|
||||||
|
mainWindow.show()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'request-data':
|
||||||
|
mainWindow.webContents.send('request-data')
|
||||||
|
break
|
||||||
|
case 'quit-app':
|
||||||
|
appQuit = true
|
||||||
|
app.quit()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function errorFormat (output) {
|
||||||
|
console.error('FINDER(stderr):' + output)
|
||||||
|
}
|
||||||
|
|
||||||
|
function emitToFinder (type, data) {
|
||||||
|
if (!finderProcess) {
|
||||||
|
console.log('finder process is not ready')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var payload = {
|
||||||
|
type: type,
|
||||||
|
data: data
|
||||||
|
}
|
||||||
|
finderProcess.stdin.write(JSON.stringify(payload), 'utf-8')
|
||||||
|
}
|
||||||
|
|
||||||
var globalShortcut = require('global-shortcut')
|
|
||||||
var userDataPath = app.getPath('userData')
|
var userDataPath = app.getPath('userData')
|
||||||
if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
|
if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
|
||||||
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
|
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
|
||||||
@@ -141,10 +174,7 @@ app.on('ready', function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
globalShortcut.register(toggleFinderKey, function () {
|
globalShortcut.register(toggleFinderKey, function () {
|
||||||
if (mainWindow != null && !mainWindow.isFocused()) {
|
emitToFinder('open-finder')
|
||||||
mainWindow.hide()
|
|
||||||
}
|
|
||||||
finderWindow.show()
|
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err.name)
|
console.log(err.name)
|
||||||
@@ -160,10 +190,7 @@ app.on('ready', function () {
|
|||||||
var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
|
var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
|
||||||
try {
|
try {
|
||||||
globalShortcut.register(toggleFinderKey, function () {
|
globalShortcut.register(toggleFinderKey, function () {
|
||||||
if (mainWindow != null && !mainWindow.isFocused()) {
|
emitToFinder('open-finder')
|
||||||
mainWindow.hide()
|
|
||||||
}
|
|
||||||
finderWindow.show()
|
|
||||||
})
|
})
|
||||||
mainWindow.webContents.send('APP_SETTING_DONE', {})
|
mainWindow.webContents.send('APP_SETTING_DONE', {})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -173,12 +200,4 @@ app.on('ready', function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
global.hideFinder = function () {
|
|
||||||
if (!mainWindow.isVisible()) {
|
|
||||||
Menu.sendActionToFirstResponder('hide:')
|
|
||||||
} else {
|
|
||||||
mainWindow.focus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "boost",
|
"name": "boost",
|
||||||
"version": "0.4.1-beta.3",
|
"version": "0.4.2-rc.0",
|
||||||
"description": "Boost App",
|
"description": "Boost App",
|
||||||
"main": "main.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "BOOST_ENV=development electron ./main.js",
|
"start": "BOOST_ENV=development electron ./main.js",
|
||||||
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
|
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"codesign": "codesign --verbose --deep --force --sign \"MAISIN solutions Inc.\" Boost-darwin-x64/Boost.app"
|
"codesign": "codesign --verbose --deep --force --sign \"MAISIN solutions Inc.\" Boost-darwin-x64/Boost.app"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"version": "--version=0.34.0 --app-bundle-id=com.maisin.boost",
|
"version": "--version=0.35.1 --app-bundle-id=com.maisin.boost",
|
||||||
"platform": "--platform=darwin --arch=x64 --prune --icon=resources/app.icns",
|
"platform": "--platform=darwin --arch=x64 --prune --icon=resources/app.icns",
|
||||||
"ignore": "--ignore=Boost-darwin-x64 --ignore=node_modules/devicon/icons --ignore=submodules/ace/(?!src-min)|submodules/ace/(?=src-min-noconflict)"
|
"ignore": "--ignore=Boost-darwin-x64 --ignore=node_modules/devicon/icons --ignore=submodules/ace/(?!src-min)|submodules/ace/(?=src-min-noconflict)"
|
||||||
},
|
},
|
||||||
@@ -40,8 +40,10 @@
|
|||||||
"devicon": "^2.0.0",
|
"devicon": "^2.0.0",
|
||||||
"font-awesome": "^4.3.0",
|
"font-awesome": "^4.3.0",
|
||||||
"fs-jetpack": "^0.7.0",
|
"fs-jetpack": "^0.7.0",
|
||||||
|
"highlight.js": "^8.9.1",
|
||||||
"lodash": "^3.10.1",
|
"lodash": "^3.10.1",
|
||||||
"markdown-it": "^4.3.1",
|
"markdown-it": "^4.3.1",
|
||||||
|
"markdown-it-emoji": "^1.1.0",
|
||||||
"md5": "^2.0.0",
|
"md5": "^2.0.0",
|
||||||
"moment": "^2.10.3",
|
"moment": "^2.10.3",
|
||||||
"socket.io-client": "^1.3.6",
|
"socket.io-client": "^1.3.6",
|
||||||
@@ -53,16 +55,15 @@
|
|||||||
"babel-plugin-react-transform": "^1.1.1",
|
"babel-plugin-react-transform": "^1.1.1",
|
||||||
"css-loader": "^0.19.0",
|
"css-loader": "^0.19.0",
|
||||||
"electron-packager": "^5.1.0",
|
"electron-packager": "^5.1.0",
|
||||||
"electron-prebuilt": "^0.33.6",
|
"electron-prebuilt": "^0.35.1",
|
||||||
"nib": "^1.1.0",
|
"nib": "^1.1.0",
|
||||||
"react": "^0.14.0",
|
"react": "^0.14.0",
|
||||||
"react-dom": "^0.14.0",
|
"react-dom": "^0.14.0",
|
||||||
"react-redux": "^4.0.0",
|
"react-redux": "^4.0.0",
|
||||||
"react-router": "^1.0.0-rc1",
|
"react-router": "^1.0.0-rc1",
|
||||||
"react-select": "^0.8.1",
|
|
||||||
"react-transform-catch-errors": "^1.0.0",
|
"react-transform-catch-errors": "^1.0.0",
|
||||||
"react-transform-hmr": "^1.0.1",
|
"react-transform-hmr": "^1.0.1",
|
||||||
"redbox-react": "^1.1.1",
|
"redbox-react": "^1.2.0",
|
||||||
"redux": "^3.0.2",
|
"redux": "^3.0.2",
|
||||||
"standard": "^5.3.1",
|
"standard": "^5.3.1",
|
||||||
"style-loader": "^0.12.4",
|
"style-loader": "^0.12.4",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ var path = require('path')
|
|||||||
var JsonpTemplatePlugin = webpack.JsonpTemplatePlugin
|
var JsonpTemplatePlugin = webpack.JsonpTemplatePlugin
|
||||||
var FunctionModulePlugin = require('webpack/lib/FunctionModulePlugin')
|
var FunctionModulePlugin = require('webpack/lib/FunctionModulePlugin')
|
||||||
var NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin')
|
var NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin')
|
||||||
var ExternalsPlugin = webpack.ExternalsPlugin
|
|
||||||
var opt = {
|
var opt = {
|
||||||
path: path.join(__dirname, 'compiled'),
|
path: path.join(__dirname, 'compiled'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
@@ -39,29 +38,10 @@ var config = {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.NoErrorsPlugin(),
|
new webpack.NoErrorsPlugin(),
|
||||||
new ExternalsPlugin('commonjs', [
|
|
||||||
'app',
|
|
||||||
'auto-updater',
|
|
||||||
'browser-window',
|
|
||||||
'content-tracing',
|
|
||||||
'dialog',
|
|
||||||
'global-shortcut',
|
|
||||||
'ipc',
|
|
||||||
'menu',
|
|
||||||
'menu-item',
|
|
||||||
'power-monitor',
|
|
||||||
'protocol',
|
|
||||||
'tray',
|
|
||||||
'remote',
|
|
||||||
'web-frame',
|
|
||||||
'clipboard',
|
|
||||||
'crash-reporter',
|
|
||||||
'screen',
|
|
||||||
'shell'
|
|
||||||
]),
|
|
||||||
new NodeTargetPlugin()
|
new NodeTargetPlugin()
|
||||||
],
|
],
|
||||||
externals: [
|
externals: [
|
||||||
|
'electron',
|
||||||
'socket.io-client',
|
'socket.io-client',
|
||||||
'md5',
|
'md5',
|
||||||
'superagent',
|
'superagent',
|
||||||
@@ -69,7 +49,9 @@ var config = {
|
|||||||
'lodash',
|
'lodash',
|
||||||
'markdown-it',
|
'markdown-it',
|
||||||
'moment',
|
'moment',
|
||||||
'node-notifier'
|
'highlight.js',
|
||||||
|
'markdown-it-emoji',
|
||||||
|
'fs-jetpack'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
externals: [
|
externals: [
|
||||||
|
'electron',
|
||||||
'socket.io-client',
|
'socket.io-client',
|
||||||
'md5',
|
'md5',
|
||||||
'superagent',
|
'superagent',
|
||||||
@@ -45,10 +46,11 @@ module.exports = {
|
|||||||
'lodash',
|
'lodash',
|
||||||
'markdown-it',
|
'markdown-it',
|
||||||
'moment',
|
'moment',
|
||||||
'node-notifier'
|
'highlight.js',
|
||||||
|
'markdown-it-emoji',
|
||||||
|
'fs-jetpack'
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['', '.js', '.jsx', 'styl']
|
extensions: ['', '.js', '.jsx', 'styl']
|
||||||
},
|
}
|
||||||
target: 'atom'
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user