1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 10:16:26 +00:00

Compare commits

..

30 Commits

Author SHA1 Message Date
Rokt33r
ee91daad7e Merge branch 'dev'
* dev:
  hotfix: Edited alertが変な時に出る
2015-11-18 18:51:39 +09:00
Dick Choi
09482ebcf3 fix wrong dependency 2015-11-17 05:36:08 +09:00
Rokt33r
67424f2d3a Merge branch 'dev'
* dev:
  bump up version 0.4.1
  記事が編集された状態で他の記事を見ようとすると警告をだす
  updateが準備できたら、再起動されるまで改めてUpdateの確認をしない
  Tag suggest
  EnterでSubmitができる - Hotkey, folder edit, folder create(preference/create new folder modal両方)
  Folderの位置を変えることができる
  Preferenceからもフォルダーの色の選択ができる。
  // filterを使うと確実にFolder名が一致するもののみを表示する
  fix style
  new folder modalにcolor select追加
  auto update確認
  FinderからCopyした時、通知を出す
  FinderにCopy to clipboard button追加
  Folder リストに articleの数をだす
  フォルダーで検索するときに in:じゃなくて /にする +バグ修正
  IntroのFinder説明変更
2015-11-16 07:03:46 +09:00
Rokt33r
61cc44cc83 Merge branch 'dev'
* dev:
  0.4.0-beta.2
  tutorial 追加
  ModeSelect
  行動データ, contact form, default articleに英語文追加, Intro fix
  Hotkey settingの時Alertで結果を出す Folder nameが長すぎ雨時のlayout崩れ解決 ArticleNavigatorの余計なスペースをなくす Default articleの誤字直し
  Cmd+Sで保存 debug craetedAt
  fix Title overflow behaviour
  0.4.0-beta.1

Conflicts:
	package.json
2015-11-11 03:09:28 +09:00
Rokt33r
59d3c6c94f 0.4.0-beta.1 2015-11-05 10:33:14 +09:00
Rokt33r
388027b731 Merge branch 'dev'
* dev:
  beta - add error alert(folder editing) - debug clear button of search input
2015-11-05 09:50:39 +09:00
Rokt33r
9758f5baa8 release version 0.4.0-alpha.7 2015-11-02 16:13:31 +09:00
Rokt33r
248262a597 Merge branch 'dev'
* dev: (43 commits)
  webpack bugfix, tooltip modified, preview button string changed(toggle Preview -> Preview / Edit)
  tooltip, tutorial追加
  ArticleListに自動scroll機能追加
  Tooltip追加、キー反応改善、Pinch2Zoom使用禁止、Webpack config debug
  編集状態でのMarkdown preview追加
  Key入力の動き改善 - Searchに内容がある時にEscを押すと内容をSearchの内容を削除する - Cmd + Fを押すとSearch inputがfocusされる
  Key入力追加
  prepare alpha.5 (remain work: MD preview, keybind)
  Going LIte
  add Team destroy
  add text:ellipsis to some labels & add member deletion confirm
  bump alpha.3
  add folder create
  add Member setting, Team setting, FolderSetting(80%) bump react-select
  bumpup alpha.2
  addTag search
  add Invalid token handler
  bumpup react (0.13.3->0.14.0), reacthmr work perfectly
  fix updater bug
  Folder indexing
  ...
2015-11-02 16:12:08 +09:00
Rokt33r
3f54eb52b2 Merge branch 'dev'
* dev:
  リアルタイム(SocketIO)実装 / Markdown style改善

Conflicts:
	package.json
2015-09-08 15:30:02 +09:00
Rokt33r
1e7415b692 fix version 0.2.11 2015-09-06 19:48:44 +09:00
Rokt33r
ff950ef28a Merge branch 'dev'
* dev:
  improve markdown style
2015-09-06 12:19:20 +09:00
Rokt33r
5fa37dbffb Merge branch 'dev'
* dev:
  version 0.2.10 - Hotkeyの設定機能 - Stylus refactor
2015-09-02 01:02:32 +09:00
Rokt33r
06a54d451c Merge branch 'dev'
* dev:
  0.2.9 API server changed, bump electron version 0.31.0
2015-08-31 01:34:15 +09:00
Rokt33r
45541a255b Merge branch 'dev'
* dev:
  - StylusでコンパイルされたCSSをCachingする(ロディングが短くなる) - Planet name changeのときにエラーハンドリング追加 + Bug fix - TeamのMemberを編集する場合、自分を編集することはできない - FinderにMarkdownのリンクがちゃんと外部に飛ぶように - Tray iconがちゃんと表示 - ArticleDetailのCodeアイコンがちゃんと表示されない
2015-08-30 05:31:13 +09:00
Rokt33r
345d7b427a Merge branch 'dev'
* dev:
  Loading font 微調整
2015-08-26 18:27:42 +09:00
Rokt33r
b2845e2284 Merge branch 'dev'
* dev:
  version 0.2.7  - Planet, Team作成の時Error message表示  - MarkdownのCode blockの背景を薄い灰色にする  - 権限なしのPlanetには  - SignUpに規約/Privacyの外部リンク追加  - Loading画面追加  - Font 添付(Lato regular)  - UserContainerでのTeam Label変更
2015-08-26 18:23:04 +09:00
Rokt33r
4bda84d69c cleanup old files 2015-08-24 17:42:43 +09:00
Rokt33r
b510aa11f5 Merge branch 'dev'
* dev:
  fix bugs - ArticleList text overflow behaviour in Finder, PlanetContainer - No DevTools
2015-08-24 17:42:00 +09:00
Rokt33r
85f833c865 Merge branch 'dev'
* dev:
  v0.2.5 - bugfix - Alert message added(Private planet/Team member)

Conflicts:
	package.json
2015-08-24 13:46:32 +09:00
Rokt33r
b93990d10b bump version 2015-08-24 06:23:41 +09:00
Rokt33r
a0bcb8edbe Merge branch 'dev'
* dev:
  実装 - MemberがOwnerではないときにTeam設定ボターンを全部隠す
  v0.2.4 - Minor fix
  fix minor bug
2015-08-24 06:22:32 +09:00
Rokt33r
19930a2472 fix minor bug 2015-08-23 03:49:19 +09:00
Rokt33r
e75d95b1fc Merge branch 'dev'
* dev:
  実装 - PlanetArticleListへのAuto scroll追加
  実装 - tooltip (Refresh, Planet setting, Planet refresh, Edit article, Delete article, Contact)
  #14 改善適用 - アプリが立ち上がったら最初はmy planetが表示されるようにしたい - Noteがスクロールできない - Note行間がなくて読みづらい
  実装 - Hotkey
2015-08-23 03:42:40 +09:00
Rokt33r
3b7215b36a Merge branch 'dev'
* dev:
  改善 - Finder descriptionのTextoverflow対策, 最初起動の時のFinderの異常振る舞い
2015-08-22 03:46:51 +09:00
Rokt33r
8ab96cf2fb fix version 2015-08-22 03:36:04 +09:00
Rokt33r
63af2fd8b1 fix submodule setting 2015-08-22 03:33:32 +09:00
Rokt33r
fcf26f7844 Merge branch 'dev'
* dev:
  改善 - PlanetArticleList, PlanetArticleDetail
  #14 改善点4つ適用  - Team member 管理画面でのスペルミス  - Member profile imageを丸にする  - Profile popup 改善  - 文字サイズ大きく(UserContainerのみ)
2015-08-22 03:28:56 +09:00
Rokt33r
a05bba15e7 Merge branch 'dev'
* dev: (79 commits)
  version 0.2.1
  修正 - Member list, Team listのデザイン修正
  実装 - Team pageとPlanet pageにMember List表示
  実装 - PlanetHeaderにPrivate鍵表示
  Noteから外部Linkを開くときにBrowserを使う
  LogoutModal実装
  Contact Modal追加
  on Refactor... #4
  on Refactor... #3
  on Refactor... #2
  on Refactoring...
  test 0.2.0
  Fix: Personal Settingボターンを右にする。写真からまっすぐProfile pageに入れるようにする
  Add: Refresh button
  Fix: Design changed
  Fix: Disable pinch to zoom
  Fix: Preview button修正
  Fix: PlanetNavigatorのHome削除 & SnippetsとBlueprintsはToggleができるように
  Fix: minor features 設定ボタンアイコンの変更 削除Modalでcmd+enterの使用 検索バーデザイン
  Add: Log in / Sign upの時にエラーが出たらAlertを表示する Debug: Tray Icon, PopUpWindow, Menuがいつの間にか消える
  ...

Conflicts:
	src/browser/main/controllers/AppController.js
	src/browser/main/controllers/directives/SideNavController.js
	src/browser/main/controllers/states/AuthRegisterController.js
	src/browser/main/index.html
	src/browser/main/services/Modal.js
	src/browser/main/styles/app.css
	src/browser/main/styles/app.styl
	src/browser/main/styles/directives/side-nav.styl
	src/browser/main/tpls/directives/side-nav.tpl.html
	src/browser/main/tpls/states/home.tpl.html
2015-08-21 04:58:01 +09:00
Rokt33r
3b907627f7 fix links 2015-07-03 18:35:10 +09:00
Rokt33r
2284fd41b9 add agreement 2015-07-03 16:41:42 +09:00
33 changed files with 450 additions and 452 deletions

View File

@@ -1,6 +1,5 @@
const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const path = require('path')
var BrowserWindow = require('browser-window')
var path = require('path')
var finderWindow = new BrowserWindow({
width: 640,
@@ -19,7 +18,7 @@ var finderWindow = new BrowserWindow({
var url = path.resolve(__dirname, '../browser/finder/index.html')
finderWindow.loadURL('file://' + url)
finderWindow.loadUrl('file://' + url)
finderWindow.on('blur', function () {
finderWindow.hide()

View File

@@ -1,6 +1,5 @@
const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const path = require('path')
var BrowserWindow = require('browser-window')
var path = require('path')
var mainWindow = new BrowserWindow({
width: 1080,
@@ -12,9 +11,9 @@ var mainWindow = new BrowserWindow({
'standard-window': false
})
const url = path.resolve(__dirname, '../browser/main/index.html')
var url = path.resolve(__dirname, '../browser/main/index.html')
mainWindow.loadURL('file://' + url)
mainWindow.loadUrl('file://' + url)
mainWindow.setVisibleOnAllWorkspaces(true)

View File

@@ -1,5 +1,4 @@
const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
var BrowserWindow = require('browser-window')
module.exports = [
{
@@ -90,6 +89,13 @@ module.exports = [
click: function () {
BrowserWindow.getFocusedWindow().reload()
}
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
click: function () {
BrowserWindow.getFocusedWindow().toggleDevTools()
}
}
]
},

42
atom-lib/updater.js Normal file
View File

@@ -0,0 +1,42 @@
var autoUpdater = require('auto-updater')
var nn = require('node-notifier')
var app = require('app')
var path = require('path')
var version = app.getVersion()
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
var versionNotified = false
autoUpdater
.on('error', function (err, message) {
console.error(err)
console.error(message)
console.log(path.resolve(__dirname, '../resources/favicon-230x230.png'))
nn.notify({
title: 'Error! ' + versionText,
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: message
})
})
// .on('checking-for-update', function () {
// // Connecting
// console.log('checking...')
// })
.on('update-available', function () {
nn.notify({
title: 'Update is available!! ' + versionText,
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: 'Download started.. wait for the update ready.'
})
})
.on('update-not-available', function () {
if (!versionNotified) {
nn.notify({
title: 'Latest Build!! ' + versionText,
icon: path.resolve(__dirname, '../resources/favicon-230x230.png'),
message: 'Hope you to enjoy our app :D'
})
versionNotified = true
}
})
module.exports = autoUpdater

View File

@@ -16,8 +16,11 @@ export function searchArticle (input) {
}
}
export function refreshData (data) {
export function refreshData () {
console.log('refreshing data')
let data = JSON.parse(localStorage.getItem('local'))
if (data == null) return null
let { folders, articles } = data
return {
@@ -28,12 +31,3 @@ export function refreshData (data) {
}
}
}
export default {
SELECT_ARTICLE,
SEARCH_ARTICLE,
REFRESH_DATA,
selectArticle,
searchArticle,
refreshData
}

View File

@@ -9,7 +9,6 @@
<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/highlight.js/styles/xcode.css">
<link rel="shortcut icon" href="favicon.ico">
<style>
@@ -28,8 +27,7 @@
<div id="content"></div>
<script src="../../submodules/ace/src-min/ace.js"></script>
<script>
const electron = require('electron')
electron.webFrame.setZoomLevelLimits(1, 1)
require('web-frame').setZoomLevelLimits(1, 1)
var scriptUrl = process.env.BOOST_ENV === 'development'
? 'http://localhost:8080/assets/finder.js'
: '../../compiled/finder.js'

View File

@@ -6,17 +6,18 @@ import { createStore } from 'redux'
import FinderInput from './FinderInput'
import FinderList from './FinderList'
import FinderDetail from './FinderDetail'
import actions, { selectArticle, searchArticle } from './actions'
import { selectArticle, searchArticle, refreshData } from './actions'
import _ from 'lodash'
import dataStore from 'boost/dataStore'
const electron = require('electron')
const { remote, clipboard } = electron
import activityRecord from 'boost/activityRecord'
import remote from 'remote'
var hideFinder = remote.getGlobal('hideFinder')
import clipboard from 'clipboard'
function notify (...args) {
return new window.Notification(...args)
var notifier = require('node-notifier')
var path = require('path')
function getIconPath () {
return path.resolve(global.__dirname, '../../resources/favicon-230x230.png')
}
require('../styles/finder/index.styl')
@@ -63,9 +64,12 @@ class FinderMain extends React.Component {
saveToClipboard () {
let { activeArticle } = this.props
clipboard.writeText(activeArticle.content)
activityRecord.emit('FINDER_COPY')
notify('Saved to Clipboard!', {
body: 'Paste it wherever you want!'
notifier.notify({
icon: getIconPath(),
'title': 'Saved to Clipboard!',
'message': 'Paste it wherever you want!'
})
hideFinder()
}
@@ -212,19 +216,13 @@ function remap (state) {
var Finder = connect(remap)(FinderMain)
var store = createStore(reducer)
function refreshData () {
let data = dataStore.getData()
store.dispatch(actions.refreshData(data))
}
window.onfocus = e => {
refreshData()
store.dispatch(refreshData())
activityRecord.emit('FINDER_OPEN')
}
ReactDOM.render((
<Provider store={store}>
<Finder/>
</Provider>
), document.getElementById('content'), function () {
refreshData()
})
), document.getElementById('content'))

View File

@@ -1,8 +1,10 @@
import { combineReducers } from 'redux'
import { SELECT_ARTICLE, SEARCH_ARTICLE, REFRESH_DATA } from './actions'
let initialArticles = []
let initialFolders = []
let data = JSON.parse(localStorage.getItem('local'))
let initialArticles = data != null ? data.articles : []
let initialFolders = data != null ? data.folders : []
let initialStatus = {
articleKey: null,
search: ''

View File

@@ -7,9 +7,8 @@ import ArticleTopBar from './HomePage/ArticleTopBar'
import ArticleList from './HomePage/ArticleList'
import ArticleDetail from './HomePage/ArticleDetail'
import _ from 'lodash'
import keygen from 'boost/keygen'
import { isModalOpen, closeModal } from 'boost/modal'
const electron = require('electron')
const BrowserWindow = electron.remote.BrowserWindow
const TEXT_FILTER = 'TEXT_FILTER'
const FOLDER_FILTER = 'FOLDER_FILTER'
@@ -29,13 +28,6 @@ class HomePage extends React.Component {
}
handleKeyDown (e) {
if (process.env.BOOST_ENV === 'development' && e.keyCode === 73 && e.metaKey && e.altKey) {
e.preventDefault()
e.stopPropagation()
BrowserWindow.getFocusedWindow().toggleDevTools()
return
}
if (isModalOpen()) {
if (e.keyCode === 27) closeModal()
return
@@ -226,6 +218,42 @@ function remap (state) {
let activeArticle = _.findWhere(articles, {key: status.articleKey})
if (activeArticle == null) activeArticle = articles[0]
// remove Unsaved new article if user is not CREATE_MODE
if (status.mode !== CREATE_MODE) {
let targetIndex = _.findIndex(articles, article => article.status === NEW)
if (targetIndex >= 0) articles.splice(targetIndex, 1)
}
// switching CREATE_MODE
// restrict
// 1. team have one folder at least
// or Change IDLE MODE
if (status.mode === CREATE_MODE) {
let newArticle = _.findWhere(articles, {status: 'NEW'})
console.log('targetFolders')
let FolderKey = targetFolders.length > 0
? targetFolders[0].key
: folders[0].key
if (newArticle == null) {
newArticle = {
id: null,
key: keygen(),
title: '',
content: '',
mode: 'markdown',
tags: [],
FolderKey: FolderKey,
status: NEW
}
articles.unshift(newArticle)
}
activeArticle = newArticle
} else if (status.mode === CREATE_MODE) {
status.mode = IDLE_MODE
}
return {
folders,
status,

View File

@@ -7,6 +7,7 @@ import MarkdownPreview from 'boost/components/MarkdownPreview'
import CodeEditor from 'boost/components/CodeEditor'
import {
IDLE_MODE,
CREATE_MODE,
EDIT_MODE,
switchMode,
switchArticle,
@@ -113,7 +114,7 @@ export default class ArticleDetail extends React.Component {
componentDidUpdate (prevProps) {
let isModeChanged = prevProps.status.mode !== this.props.status.mode
if (isModeChanged && this.props.status.mode === EDIT_MODE) {
if (isModeChanged && this.props.status.mode !== IDLE_MODE) {
ReactDOM.findDOMNode(this.refs.title).focus()
}
}
@@ -123,7 +124,6 @@ export default class ArticleDetail extends React.Component {
let isArticleChanged = nextProps.activeArticle != null && (nextProps.activeArticle.key !== this.state.article.key)
let isModeChanged = nextProps.status.mode !== this.props.status.mode
// Reset article input
if (isArticleChanged || (isModeChanged && nextProps.status.mode !== IDLE_MODE)) {
Object.assign(nextState, {
@@ -247,14 +247,13 @@ export default class ArticleDetail extends React.Component {
handleCancelButtonClick (e) {
let { activeArticle, dispatch } = this.props
if (activeArticle.status === NEW) {
dispatch(switchArticle(null))
}
dispatch(unlockStatus())
if (activeArticle.status === NEW) dispatch(switchArticle(null))
dispatch(switchMode(IDLE_MODE))
}
handleSaveButtonClick (e) {
let { dispatch, folders, status } = this.props
let { dispatch, folders, filters } = this.props
let article = this.state.article
let newArticle = Object.assign({}, article)
@@ -278,7 +277,7 @@ export default class ArticleDetail extends React.Component {
// Searchを初期化し、更新先のFolder filterをかける
// かかれていない時に
// Searchを初期化する
if (status.targetFolders.length > 0) dispatch(switchFolder(folder.name))
if (filters.folder.length !== 0) dispatch(switchFolder(folder.name))
else dispatch(clearSearch())
dispatch(switchArticle(newArticle.key))
}
@@ -320,6 +319,8 @@ export default class ArticleDetail extends React.Component {
let article = this.state.article
article.tags = tags
this.setState({article: article})
let _isTagChanged = _.difference(article.tags, this.props.activeArticle.tags).length > 0 || _.difference(this.props.activeArticle.tags, article.tags).length > 0
let { isTitleChanged, isContentChanged, isArticleEdited, isModeChanged } = this.state
@@ -499,6 +500,7 @@ export default class ArticleDetail extends React.Component {
if (activeArticle == null) return this.renderEmpty()
switch (status.mode) {
case CREATE_MODE:
case EDIT_MODE:
return this.renderEdit()
case IDLE_MODE:

View File

@@ -1,14 +1,12 @@
import React, { PropTypes } from 'react'
import { findWhere } from 'lodash'
import { setSearchFilter, switchFolder, switchMode, switchArticle, updateArticle, EDIT_MODE } from 'boost/actions'
import { setSearchFilter, switchFolder, switchMode, CREATE_MODE } from 'boost/actions'
import { openModal } from 'boost/modal'
import FolderMark from 'boost/components/FolderMark'
import Preferences from 'boost/components/modal/Preferences'
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
import keygen from 'boost/keygen'
const electron = require('electron')
const remote = electron.remote
import remote from 'remote'
let userName = remote.getGlobal('process').env.USER
const BRAND_COLOR = '#18AF90'
@@ -67,27 +65,9 @@ export default class ArticleNavigator extends React.Component {
}
handleNewPostButtonClick (e) {
let { dispatch, folders, status } = this.props
let { targetFolders } = status
let { dispatch } = this.props
let FolderKey = targetFolders.length > 0
? targetFolders[0].key
: folders[0].key
let newArticle = {
id: null,
key: keygen(),
title: '',
content: '',
mode: 'markdown',
tags: [],
FolderKey: FolderKey,
status: 'NEW'
}
dispatch(updateArticle(newArticle))
dispatch(switchArticle(newArticle.key, true))
dispatch(switchMode(EDIT_MODE))
dispatch(switchMode(CREATE_MODE))
}
handleNewFolderButton (e) {
@@ -114,7 +94,7 @@ export default class ArticleNavigator extends React.Component {
let folderElememts = folders.map((folder, index) => {
let isActive = findWhere(targetFolders, {key: folder.key})
let articleCount = allArticles.filter(article => article.FolderKey === folder.key && article.status !== 'NEW').length
let articleCount = allArticles.filter(article => article.FolderKey === folder.key).length
return (
<button onClick={e => this.handleFolderButtonClick(folder.name)(e)} key={'folder-' + folder.key} className={isActive ? 'active' : ''}>

View File

View File

@@ -1,5 +1,4 @@
const electron = require('electron')
const ipc = electron.ipcRenderer
import ipc from 'ipc'
import React, { PropTypes } from 'react'
var ContactModal = require('boost/components/modal/ContactModal')

View File

@@ -6,7 +6,6 @@
<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/highlight.js/styles/xcode.css">
<link rel="shortcut icon" href="favicon.ico">
<style>
@@ -54,9 +53,8 @@
<script src="../../submodules/ace/src-min/ace.js"></script>
<script type='text/javascript'>
const electron = require('electron')
electron.webFrame.setZoomLevelLimits(1, 1)
var version = electron.remote.app.getVersion()
require('web-frame').setZoomLevelLimits(1, 1)
var version = require('remote').require('app').getVersion()
document.title = 'Boost' + ((version == null || version.length === 0) ? ' DEV' : '')
var scriptUrl = process.env.BOOST_ENV === 'development'
? 'http://localhost:8080/assets/main.js'

View File

@@ -11,24 +11,13 @@ require('../styles/main/index.styl')
import { openModal } from 'boost/modal'
import Tutorial from 'boost/components/modal/Tutorial'
import activityRecord from 'boost/activityRecord'
const electron = require('electron')
const ipc = electron.ipcRenderer
import ipc from 'ipc'
activityRecord.init()
window.addEventListener('online', function () {
ipc.send('check-update', 'check-update')
})
function notify (...args) {
return new window.Notification(...args)
}
ipc.on('notify', function (e, payload) {
notify(payload.title, {
body: payload.body
})
})
let routes = (
<Route path='/' component={MainPage}>
<IndexRoute name='home' component={HomePage}/>

View File

@@ -62,7 +62,7 @@ marked()
display list-item
line-height 1.8em
code
font-family Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace;
font-family monospace
padding 2px 4px
border solid 1px borderColor
border-radius 4px
@@ -77,7 +77,6 @@ marked()
overflow-x auto
margin 15px 0 25px
background-color #F6F6F6
line-height 1.35em
&>code
padding 0
border none

View File

@@ -1,72 +0,0 @@
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:')
}
})

View File

@@ -1,10 +0,0 @@
function isFinderCalled () {
var argv = process.argv.slice(1)
return argv.some(arg => arg.match(/--finder/))
}
if (isFinderCalled()) {
require('./finder.js')
} else {
require('./main.js')
}

View File

@@ -1,5 +1,4 @@
// Action types
export const CLEAR_NEW_ARTICLE = 'CLEAR_NEW_ARTICLE'
export const ARTICLE_UPDATE = 'ARTICLE_UPDATE'
export const ARTICLE_DESTROY = 'ARTICLE_DESTROY'
export const FOLDER_CREATE = 'FOLDER_CREATE'
@@ -19,18 +18,13 @@ export const TOGGLE_TUTORIAL = 'TOGGLE_TUTORIAL'
// Status - mode
export const IDLE_MODE = 'IDLE_MODE'
export const CREATE_MODE = 'CREATE_MODE'
export const EDIT_MODE = 'EDIT_MODE'
// Article status
export const NEW = 'NEW'
// DB
export function clearNewArticle () {
return {
type: CLEAR_NEW_ARTICLE
}
}
export function updateArticle (article) {
return {
type: ARTICLE_UPDATE,
@@ -90,13 +84,10 @@ export function switchMode (mode) {
}
}
export function switchArticle (articleKey, isNew) {
export function switchArticle (articleKey) {
return {
type: SWITCH_ARTICLE,
data: {
key: articleKey,
isNew: isNew
}
data: articleKey
}
}

View File

@@ -47,10 +47,6 @@ Post all records(except today)
and remove all posted records
*/
export function postRecords (data) {
if (process.env.BOOST_ENV === 'development') {
console.log('post failed - on development')
return
}
let records = getAllRecords()
records = records.filter(record => {
return !isSameDate(new Date(), record.date)

View File

@@ -1,6 +1,5 @@
import React, { PropTypes } from 'react'
const electron = require('electron')
const shell = electron.shell
import shell from 'shell'
export default class ExternalLink extends React.Component {
handleClick (e) {

View File

@@ -1,11 +1,9 @@
import shell from 'shell'
var React = require('react')
var { PropTypes } = React
import markdown from 'boost/markdown'
var ReactDOM = require('react-dom')
const electron = require('electron')
const shell = electron.shell
function handleAnchorClick (e) {
shell.openExternal(e.target.href)
e.preventDefault()

View File

@@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'
import store from 'boost/store'
import { unlockStatus, clearNewArticle } from 'boost/actions'
import { unlockStatus } from 'boost/actions'
export default class EditedAlert extends React.Component {
handleNoButtonClick (e) {
@@ -10,7 +10,6 @@ export default class EditedAlert extends React.Component {
handleYesButtonClick (e) {
store.dispatch(unlockStatus())
store.dispatch(this.props.action)
store.dispatch(clearNewArticle())
this.props.close()
}

View File

@@ -1,9 +1,7 @@
import React from 'react'
import linkState from 'boost/linkState'
const electron = require('electron')
const ipc = electron.ipcRenderer
const remote = electron.remote
import remote from 'remote'
import ipc from 'ipc'
export default class AppSettingTab extends React.Component {
constructor (props) {
@@ -49,9 +47,7 @@ export default class AppSettingTab extends React.Component {
}
handleKeyDown (e) {
if (e.keyCode === 13) {
this.submitHotKey()
}
this.submitHotKey()
}
render () {

View File

@@ -83,6 +83,158 @@ class Preferences extends React.Component {
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 = {

View File

@@ -1,27 +1,11 @@
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'
function getLocalPath () {
return path.join(remote.app.getPath('userData'), 'local.json')
}
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 +cmd+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機能\n4. チーム機能(リアルタイム搭載)\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+cmd+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'
export function init () {
console.log('initialize data store')
let data = jetpack.read(getLocalPath(), 'json')
let data = JSON.parse(localStorage.getItem('local'))
if (data == null) {
if (localStorage.getItem('local') != null) {
data = JSON.parse(localStorage.getItem('local'))
jetpack.write(getLocalPath(), data)
localStorage.removeItem('local')
return
}
let defaultFolder = {
name: 'default',
key: keygen()
@@ -40,35 +24,37 @@ export function init () {
folders: [defaultFolder],
version: '0.4'
}
jetpack.write(getLocalPath(), data)
localStorage.setItem('local', JSON.stringify(data))
}
}
export function getData () {
return jetpack.read(getLocalPath(), 'json')
function getKey (teamId) {
return teamId == null
? 'local'
: `team-${teamId}`
}
export function setArticles (articles) {
let data = getData()
export function getData (teamId) {
let key = getKey(teamId)
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
jetpack.write(getLocalPath(), data)
localStorage.setItem(key, JSON.stringify(data))
}
export function setFolders (folders) {
let data = getData()
export function setFolders (teamId, folders) {
let key = getKey(teamId)
let data = JSON.parse(localStorage.getItem(key))
data.folders = folders
jetpack.write(getLocalPath(), data)
}
function isFinderCalled () {
var argv = process.argv.slice(1)
return argv.some(arg => arg.match(/--finder/))
localStorage.setItem(key, JSON.stringify(data))
}
export default (function () {
if (!isFinderCalled()) {
init()
}
init()
return {
init,
getData,

View File

@@ -1,25 +1,9 @@
import markdownit from 'markdown-it'
import hljs from 'highlight.js'
import emoji from 'markdown-it-emoji'
var md = markdownit({
typographer: 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
}
linkify: true
})
md.use(emoji)
export default function markdown (content) {
if (content == null) content = ''

View File

@@ -1,5 +1,4 @@
const electron = require('electron')
const shell = electron.shell
var shell = require('shell')
export default function (e) {
shell.openExternal(e.currentTarget.href)

View File

@@ -15,7 +15,6 @@ import {
// Article action type
ARTICLE_UPDATE,
ARTICLE_DESTROY,
CLEAR_NEW_ARTICLE,
// Folder action type
FOLDER_CREATE,
@@ -24,7 +23,8 @@ import {
FOLDER_REPLACE,
// view mode
IDLE_MODE
IDLE_MODE,
CREATE_MODE
} from './actions'
import dataStore from 'boost/dataStore'
import keygen from 'boost/keygen'
@@ -43,9 +43,6 @@ let data = dataStore.getData()
let initialArticles = data.articles
let initialFolders = data.folders
let isStatusLocked = false
let isCreatingNew = false
function folders (state = initialFolders, action) {
state = state.slice()
switch (action.type) {
@@ -67,7 +64,7 @@ function folders (state = initialFolders, action) {
if (conflictFolder != null) throw new Error(`${newFolder.name} already exists!`)
state.push(newFolder)
dataStore.setFolders(state)
dataStore.setFolders(null, state)
activityRecord.emit('FOLDER_CREATE')
return state
}
@@ -94,7 +91,7 @@ function folders (state = initialFolders, action) {
updatedAt: new Date()
})
dataStore.setFolders(state)
dataStore.setFolders(null, state)
activityRecord.emit('FOLDER_UPDATE')
return state
}
@@ -107,7 +104,7 @@ function folders (state = initialFolders, action) {
if (targetIndex >= 0) {
state.splice(targetIndex, 1)
}
dataStore.setFolders(state)
dataStore.setFolders(null, state)
activityRecord.emit('FOLDER_DESTROY')
return state
}
@@ -124,41 +121,10 @@ function folders (state = initialFolders, action) {
return state
}
}
let isCleaned = true
function articles (state = initialArticles, action) {
state = state.slice()
if (!isCreatingNew && !isCleaned) {
state = state.filter(article => article.status !== 'NEW')
isCleaned = true
}
switch (action.type) {
case SWITCH_ARTICLE:
if (action.data.isNew) {
isCleaned = false
}
if (!isStatusLocked && !action.data.isNew) {
isCreatingNew = false
if (!isCleaned) {
state = state.filter(article => article.status !== 'NEW')
isCleaned = true
}
}
return state
case SWITCH_FOLDER:
case SET_SEARCH_FILTER:
case SET_TAG_FILTER:
case CLEAR_SEARCH:
if (!isStatusLocked) {
isCreatingNew = false
if (!isCleaned) {
state = state.filter(article => article.status !== 'NEW')
isCleaned = true
}
}
return state
case CLEAR_NEW_ARTICLE:
return state.filter(article => article.status !== 'NEW')
case ARTICLE_UPDATE:
{
let article = action.data.article
@@ -167,8 +133,7 @@ function articles (state = initialArticles, action) {
if (targetIndex < 0) state.unshift(article)
else state.splice(targetIndex, 1, article)
if (article.status !== 'NEW') dataStore.setArticles(state)
else isCreatingNew = true
dataStore.setArticles(null, state)
return state
}
case ARTICLE_DESTROY:
@@ -178,7 +143,7 @@ function articles (state = initialArticles, action) {
let targetIndex = _.findIndex(state, _article => articleKey === _article.key)
if (targetIndex >= 0) state.splice(targetIndex, 1)
dataStore.setArticles(state)
dataStore.setArticles(null, state)
return state
}
case FOLDER_DESTROY:
@@ -187,7 +152,7 @@ function articles (state = initialArticles, action) {
state = state.filter(article => article.FolderKey !== folderKey)
dataStore.setArticles(state)
dataStore.setArticles(null, state)
return state
}
default:
@@ -197,15 +162,16 @@ function articles (state = initialArticles, action) {
function status (state = initialStatus, action) {
state = Object.assign({}, state)
switch (action.type) {
case TOGGLE_TUTORIAL:
state.isTutorialOpen = !state.isTutorialOpen
return state
case LOCK_STATUS:
isStatusLocked = state.isStatusLocked = true
state.isStatusLocked = true
return state
case UNLOCK_STATUS:
isStatusLocked = state.isStatusLocked = false
state.isStatusLocked = false
return state
}
@@ -222,10 +188,11 @@ function status (state = initialStatus, action) {
return state
case SWITCH_MODE:
state.mode = action.data
if (state.mode === CREATE_MODE) state.articleKey = null
return state
case SWITCH_ARTICLE:
state.articleKey = action.data.key
state.articleKey = action.data
state.mode = IDLE_MODE
return state

185
main.js
View File

@@ -1,84 +1,61 @@
const electron = require('electron')
const app = electron.app
const Menu = electron.Menu
const ipc = electron.ipcMain
const globalShortcut = electron.globalShortcut
const autoUpdater = electron.autoUpdater
const jetpack = require('fs-jetpack')
const path = require('path')
const ChildProcess = require('child_process')
electron.crashReporter.start()
var app = require('app')
var Menu = require('menu')
var MenuItem = require('menu-item')
var Tray = require('tray')
var ipc = require('ipc')
var jetpack = require('fs-jetpack')
require('crash-reporter').start()
var mainWindow = null
var finderProcess
var appIcon = null
var menu = null
var finderWindow = null
var update = null
// app.on('window-all-closed', function () {
// if (process.platform !== 'darwin') app.quit()
// })
var appQuit = false
var version = app.getVersion()
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
var versionNotified = false
var nn = require('node-notifier')
var updater = require('./atom-lib/updater')
var path = require('path')
function notify (title, body) {
if (mainWindow != null) {
mainWindow.webContents.send('notify', {
title: title,
body: body
})
}
}
var appQuit = false
autoUpdater
updater
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
nn.notify({
title: 'Ready to Update!! ' + versionText,
icon: path.join(__dirname, '/resources/favicon-230x230.png'),
message: 'Click update button on Main window: ' + releaseName
})
update = quitAndUpdate
if (mainWindow != null) {
notify('Ready to Update! ' + releaseName, 'Click update button on Main window.')
if (mainWindow != null && !mainWindow.webContents.isLoading()) {
mainWindow.webContents.send('update-available', 'Update available!')
}
})
.on('error', function (err, message) {
console.error(err)
if (!versionNotified) {
notify('Updater error!', message)
}
})
// .on('checking-for-update', function () {
// // Connecting
// console.log('checking...')
// })
.on('update-available', function () {
notify('Update is available!', 'Download started.. wait for the update ready.')
})
.on('update-not-available', function () {
if (mainWindow != null && !versionNotified) {
versionNotified = true
notify('Latest Build!! ' + versionText, 'Hope you to enjoy our app :D')
}
})
app.on('ready', function () {
app.on('before-quit', function () {
if (finderProcess) finderProcess.kill()
appQuit = true
})
autoUpdater.setFeedURL('https://orbital.b00st.io/rokt33r/boost-dev/latest?version=' + version)
console.log('Version ' + version)
updater.setFeedUrl('http://orbital.b00st.io/rokt33r/boost-app/latest?version=' + version)
updater.checkForUpdates()
// menu start
var template = require('./atom-lib/menu-template')
var menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
setInterval(function () {
if (update == null) autoUpdater.checkForUpdates()
if (update == null) updater.checkForUpdates()
}, 1000 * 60 * 60 * 24)
ipc.on('check-update', function (event, msg) {
if (update == null) autoUpdater.checkForUpdates()
if (update == null) updater.checkForUpdates()
})
ipc.on('update-app', function (event, msg) {
@@ -88,76 +65,48 @@ 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.on('close', function (e) {
if (appQuit) return true
e.preventDefault()
mainWindow.hide()
})
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.on('did-finish-load', function () {
mainWindow.webContents.send('update-available', 'whoooooooh!')
} else {
autoUpdater.checkForUpdates()
}
})
})
}
app.on('activate', function () {
app.on('activate-with-no-open-windows', function () {
if (mainWindow == null) return null
mainWindow.show()
})
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')
}
finderWindow = require('./atom-lib/finder-window')
var globalShortcut = require('global-shortcut')
var userDataPath = app.getPath('userData')
if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
@@ -173,7 +122,10 @@ app.on('ready', function () {
try {
globalShortcut.register(toggleFinderKey, function () {
emitToFinder('open-finder')
if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide()
}
finderWindow.show()
})
} catch (err) {
console.log(err.name)
@@ -189,7 +141,10 @@ app.on('ready', function () {
var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
try {
globalShortcut.register(toggleFinderKey, function () {
emitToFinder('open-finder')
if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide()
}
finderWindow.show()
})
mainWindow.webContents.send('APP_SETTING_DONE', {})
} catch (err) {
@@ -199,4 +154,12 @@ app.on('ready', function () {
})
}
})
global.hideFinder = function () {
if (!mainWindow.isVisible()) {
Menu.sendActionToFirstResponder('hide:')
} else {
mainWindow.focus()
}
}
})

View File

@@ -1,17 +1,17 @@
{
"name": "boost",
"version": "0.4.2-rc.0",
"version": "0.4.1-beta.1",
"description": "Boost App",
"main": "index.js",
"main": "main.js",
"scripts": {
"start": "BOOST_ENV=development electron ./main.js",
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
"compile": "NODE_ENV=production webpack --config webpack.config.production.js",
"build": "electron-packager ./ Boost --app-version=$npm_package_version $npm_package_config_platform $npm_package_config_version $npm_package_config_ignore --overwrite --asar",
"build": "electron-packager ./ Boost --app-version=$npm_package_version $npm_package_config_platform $npm_package_config_version $npm_package_config_ignore --overwrite",
"codesign": "codesign --verbose --deep --force --sign \"MAISIN solutions Inc.\" Boost-darwin-x64/Boost.app"
},
"config": {
"version": "--version=0.35.1 --app-bundle-id=com.maisin.boost",
"version": "--version=0.34.0 --app-bundle-id=com.maisin.boost",
"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)"
},
@@ -40,12 +40,11 @@
"devicon": "^2.0.0",
"font-awesome": "^4.3.0",
"fs-jetpack": "^0.7.0",
"highlight.js": "^8.9.1",
"lodash": "^3.10.1",
"markdown-it": "^4.3.1",
"markdown-it-emoji": "^1.1.0",
"md5": "^2.0.0",
"moment": "^2.10.3",
"node-notifier": "^4.2.3",
"socket.io-client": "^1.3.6",
"superagent": "^1.2.0",
"superagent-promise": "^1.0.3"
@@ -55,15 +54,16 @@
"babel-plugin-react-transform": "^1.1.1",
"css-loader": "^0.19.0",
"electron-packager": "^5.1.0",
"electron-prebuilt": "^0.35.1",
"electron-prebuilt": "^0.33.6",
"nib": "^1.1.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react-redux": "^4.0.0",
"react-router": "^1.0.0-rc1",
"react-select": "^0.8.1",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.2.0",
"redbox-react": "^1.1.1",
"redux": "^3.0.2",
"standard": "^5.3.1",
"style-loader": "^0.12.4",

View File

@@ -3,6 +3,7 @@ var path = require('path')
var JsonpTemplatePlugin = webpack.JsonpTemplatePlugin
var FunctionModulePlugin = require('webpack/lib/FunctionModulePlugin')
var NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin')
var ExternalsPlugin = webpack.ExternalsPlugin
var opt = {
path: path.join(__dirname, 'compiled'),
filename: '[name].js',
@@ -38,10 +39,29 @@ var config = {
},
plugins: [
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()
],
externals: [
'electron',
'socket.io-client',
'md5',
'superagent',
@@ -49,9 +69,7 @@ var config = {
'lodash',
'markdown-it',
'moment',
'highlight.js',
'markdown-it-emoji',
'fs-jetpack'
'node-notifier'
]
}

View File

@@ -1,5 +1,6 @@
var webpack = require('webpack')
module.exports = {
devtool: 'source-map',
entry: {
main: './browser/main/index.js',
finder: './browser/finder/index.js'
@@ -7,7 +8,7 @@ module.exports = {
output: {
path: 'compiled',
filename: '[name].js',
// sourceMapFilename: '[name].map',
sourceMapFilename: '[name].map',
libraryTarget: 'commonjs2'
},
module: {
@@ -30,15 +31,14 @@ module.exports = {
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
// new webpack.optimize.UglifyJsPlugin({
// compressor: {
// warnings: false
// }
// })
],
externals: [
'electron',
'socket.io-client',
'md5',
'superagent',
@@ -46,11 +46,10 @@ module.exports = {
'lodash',
'markdown-it',
'moment',
'highlight.js',
'markdown-it-emoji',
'fs-jetpack'
'node-notifier'
],
resolve: {
extensions: ['', '.js', '.jsx', 'styl']
}
},
target: 'atom'
}