1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 10:46:32 +00:00

Compare commits

..

11 Commits

Author SHA1 Message Date
dependabot[bot]
4c45108a95 Bump sockjs from 0.3.19 to 0.3.21
Bumps [sockjs](https://github.com/sockjs/sockjs-node) from 0.3.19 to 0.3.21.
- [Release notes](https://github.com/sockjs/sockjs-node/releases)
- [Changelog](https://github.com/sockjs/sockjs-node/blob/v0.3.21/Changelog)
- [Commits](https://github.com/sockjs/sockjs-node/compare/v0.3.19...v0.3.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-21 00:55:47 +00:00
Baptiste Augrain
58c4a78be1 avoids conflicting styles between inline codes and code blocks 2020-12-27 11:16:55 +09:00
Gonçalo Santos
2603dfc1ed Fix Analytics save bug 2020-12-12 00:15:37 +09:00
Gonçalo Santos
2df590600b AutoUpdate is auto saved 2020-12-12 00:15:37 +09:00
Gonçalo Santos
ef20a8f3e5 Remove debug statements 2020-12-12 00:15:37 +09:00
Gonçalo Santos
3e405e1abf Fix Cancel update 2020-12-12 00:15:37 +09:00
Gonçalo Santos
553832bdfa Create confirm download dialog 2020-12-12 00:15:37 +09:00
Gonçalo Santos
18d65d999a Menu item calls update-check 2020-12-12 00:15:37 +09:00
Gonçalo Santos
3b5eff582a Update not found message 2020-12-12 00:15:37 +09:00
Gonçalo Santos
85d09b3b3d Add update menu item 2020-12-12 00:15:37 +09:00
Baptiste Augrain
8958e67fcf fix unwanted deletion of attachments 2020-09-15 12:33:12 +09:00
10 changed files with 154 additions and 77 deletions

View File

@@ -63,7 +63,7 @@ export default class CodeEditor extends React.Component {
this.focusHandler = () => { this.focusHandler = () => {
ipcRenderer.send('editor:focused', true) ipcRenderer.send('editor:focused', true)
} }
const debouncedDeletionOfAttachments = _.debounce( this.debouncedDeletionOfAttachments = _.debounce(
attachmentManagement.deleteAttachmentsNotPresentInNote, attachmentManagement.deleteAttachmentsNotPresentInNote,
30000 30000
) )
@@ -80,7 +80,7 @@ export default class CodeEditor extends React.Component {
this.props.onBlur != null && this.props.onBlur(e) this.props.onBlur != null && this.props.onBlur(e)
const { storageKey, noteKey } = this.props const { storageKey, noteKey } = this.props
if (this.props.deleteUnusedAttachments === true) { if (this.props.deleteUnusedAttachments === true) {
debouncedDeletionOfAttachments( this.debouncedDeletionOfAttachments(
this.editor.getValue(), this.editor.getValue(),
storageKey, storageKey,
noteKey noteKey
@@ -810,6 +810,8 @@ export default class CodeEditor extends React.Component {
} }
handleChange(editor, changeObject) { handleChange(editor, changeObject) {
this.debouncedDeletionOfAttachments.cancel()
spellcheck.handleChange(editor, changeObject) spellcheck.handleChange(editor, changeObject)
// The current note contains an toc. We'll check for changes on headlines. // The current note contains an toc. We'll check for changes on headlines.

View File

@@ -8,7 +8,7 @@ import markdownItTocAndAnchor from '@hikerpig/markdown-it-toc-and-anchor'
import _ from 'lodash' import _ from 'lodash'
import ConfigManager from 'browser/main/lib/ConfigManager' import ConfigManager from 'browser/main/lib/ConfigManager'
import katex from 'katex' import katex from 'katex'
import { lastFindInArray } from './utils' import { escapeHtmlCharacters, lastFindInArray } from './utils'
function createGutter(str, firstLineNumber) { function createGutter(str, firstLineNumber) {
if (Number.isNaN(firstLineNumber)) firstLineNumber = 1 if (Number.isNaN(firstLineNumber)) firstLineNumber = 1
@@ -479,6 +479,16 @@ class Markdown {
return true return true
}) })
this.md.renderer.rules.code_inline = function(tokens, idx) {
const token = tokens[idx]
return (
'<code class="inline">' +
escapeHtmlCharacters(token.content) +
'</code>'
)
}
if (config.preview.smartArrows) { if (config.preview.smartArrows) {
this.md.use(smartArrows) this.md.use(smartArrows)
} }

View File

@@ -18,6 +18,7 @@ import { getLocales } from 'browser/lib/Languages'
import applyShortcuts from 'browser/main/lib/shortcutManager' import applyShortcuts from 'browser/main/lib/shortcutManager'
import { chooseTheme, applyTheme } from 'browser/main/lib/ThemeManager' import { chooseTheme, applyTheme } from 'browser/main/lib/ThemeManager'
import { push } from 'connected-react-router' import { push } from 'connected-react-router'
import { ipcRenderer } from 'electron'
const path = require('path') const path = require('path')
const electron = require('electron') const electron = require('electron')
@@ -184,6 +185,7 @@ class Main extends React.Component {
this.toggleMenuBarVisible.bind(this) this.toggleMenuBarVisible.bind(this)
) )
eventEmitter.on('dispatch:push', this.changeRoutePush.bind(this)) eventEmitter.on('dispatch:push', this.changeRoutePush.bind(this))
eventEmitter.on('update', () => ipcRenderer.send('update-check', 'manual'))
} }
componentWillUnmount() { componentWillUnmount() {

View File

@@ -12,6 +12,7 @@ import DevTools from './DevTools'
require('./lib/ipcClient') require('./lib/ipcClient')
require('../lib/customMeta') require('../lib/customMeta')
import i18n from 'browser/lib/i18n' import i18n from 'browser/lib/i18n'
import ConfigManager from './lib/ConfigManager'
const electron = require('electron') const electron = require('electron')
@@ -107,6 +108,22 @@ function updateApp() {
} }
} }
function downloadUpdate() {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: i18n.__('Update Boostnote'),
detail: i18n.__('New Boostnote is ready to be downloaded.'),
buttons: [i18n.__('Download now'), i18n.__('Ignore updates')]
})
if (index === 0) {
ipcRenderer.send('update-download-confirm')
} else if (index === 1) {
ipcRenderer.send('update-cancel')
ConfigManager.set({ autoUpdateEnabled: false })
}
}
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>
<ConnectedRouter history={history}> <ConnectedRouter history={history}>
@@ -147,8 +164,12 @@ ReactDOM.render(
}) })
ipcRenderer.on('update-found', function() { ipcRenderer.on('update-found', function() {
notify('Update found!', { downloadUpdate()
body: 'Preparing to update...' })
ipcRenderer.on('update-not-found', function(_, msg) {
notify('Update not found!', {
body: msg
}) })
}) })

View File

@@ -18,9 +18,9 @@ const DEFAULT_MARKDOWN_LINT_CONFIG = `{
const DEFAULT_CSS_CONFIG = ` const DEFAULT_CSS_CONFIG = `
/* Drop Your Custom CSS Code Here */ /* Drop Your Custom CSS Code Here */
[data-theme="default"] p code, [data-theme="default"] p code.inline,
[data-theme="default"] li code, [data-theme="default"] li code.inline,
[data-theme="default"] td code [data-theme="default"] td code.inline
{ {
padding: 2px; padding: 2px;
border-width: 1px; border-width: 1px;

View File

@@ -638,74 +638,74 @@ code {
direction: ltr; direction: ltr;
} }
p code, p code.inline,
li code, li code.inline,
td code td code.inline
{ {
padding: 2px; padding: 2px;
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
border-radius: 5px; border-radius: 5px;
} }
[data-theme="default"] p code, [data-theme="default"] p code.inline,
[data-theme="default"] li code, [data-theme="default"] li code.inline,
[data-theme="default"] td code [data-theme="default"] td code.inline
{ {
background-color: #F4F4F4; background-color: #F4F4F4;
border-color: #d9d9d9; border-color: #d9d9d9;
color: inherit; color: inherit;
} }
[data-theme="white"] p code, [data-theme="white"] p code.inline,
[data-theme="white"] li code, [data-theme="white"] li code.inline,
[data-theme="white"] td code [data-theme="white"] td code.inline
{ {
background-color: #F4F4F4; background-color: #F4F4F4;
border-color: #d9d9d9; border-color: #d9d9d9;
color: inherit; color: inherit;
} }
[data-theme="dark"] p code, [data-theme="dark"] p code.inline,
[data-theme="dark"] li code, [data-theme="dark"] li code.inline,
[data-theme="dark"] td code [data-theme="dark"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;
color: #FFFFFF; color: #FFFFFF;
} }
[data-theme="dracula"] p code, [data-theme="dracula"] p code.inline,
[data-theme="dracula"] li code, [data-theme="dracula"] li code.inline,
[data-theme="dracula"] td code [data-theme="dracula"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;
color: #FFFFFF; color: #FFFFFF;
} }
[data-theme="monokai"] p code, [data-theme="monokai"] p code.inline,
[data-theme="monokai"] li code, [data-theme="monokai"] li code.inline,
[data-theme="monokai"] td code [data-theme="monokai"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;
color: #FFFFFF; color: #FFFFFF;
} }
[data-theme="nord"] p code, [data-theme="nord"] p code.inline,
[data-theme="nord"] li code, [data-theme="nord"] li code.inline,
[data-theme="nord"] td code [data-theme="nord"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;
color: #FFFFFF; color: #FFFFFF;
} }
[data-theme="solarized-dark"] p code, [data-theme="solarized-dark"] p code.inline,
[data-theme="solarized-dark"] li code, [data-theme="solarized-dark"] li code.inline,
[data-theme="solarized-dark"] td code [data-theme="solarized-dark"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;
color: #FFFFFF; color: #FFFFFF;
} }
[data-theme="vulcan"] p code, [data-theme="vulcan"] p code.inline,
[data-theme="vulcan"] li code, [data-theme="vulcan"] li code.inline,
[data-theme="vulcan"] td code [data-theme="vulcan"] td code.inline
{ {
background-color: #444444; background-color: #444444;
border-color: #555; border-color: #555;

View File

@@ -23,15 +23,25 @@ class InfoTab extends React.Component {
} }
} }
componentDidMount() {
const { autoUpdateEnabled, amaEnabled } = ConfigManager.get()
this.setState({ config: { autoUpdateEnabled, amaEnabled } })
}
handleLinkClick(e) { handleLinkClick(e) {
shell.openExternal(e.currentTarget.href) shell.openExternal(e.currentTarget.href)
e.preventDefault() e.preventDefault()
} }
handleConfigChange(e) { handleConfigChange(e) {
const newConfig = { amaEnabled: this.refs.amaEnabled.checked } const newConfig = {
amaEnabled: this.refs.amaEnabled.checked,
autoUpdateEnabled: this.refs.autoUpdateEnabled.checked
}
this.setState({ config: newConfig }) this.setState({ config: newConfig })
return newConfig
} }
handleSubscriptionFormSubmit(e) { handleSubscriptionFormSubmit(e) {
@@ -77,9 +87,7 @@ class InfoTab extends React.Component {
} }
handleSaveButtonClick(e) { handleSaveButtonClick(e) {
const newConfig = { const newConfig = this.state.config
amaEnabled: this.state.config.amaEnabled
}
if (!newConfig.amaEnabled) { if (!newConfig.amaEnabled) {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('DISABLE_AMA') AwsMobileAnalyticsConfig.recordDynamicCustomEvent('DISABLE_AMA')
@@ -106,20 +114,17 @@ class InfoTab extends React.Component {
}) })
} }
toggleAutoUpdate() {
const newConfig = {
autoUpdateEnabled: !this.state.config.autoUpdateEnabled
}
this.setState({ config: newConfig })
ConfigManager.set(newConfig)
}
infoMessage() { infoMessage() {
const { amaMessage } = this.state const { amaMessage } = this.state
return amaMessage ? <p styleName='policy-confirm'>{amaMessage}</p> : null return amaMessage ? <p styleName='policy-confirm'>{amaMessage}</p> : null
} }
handleAutoUpdateChange() {
const { autoUpdateEnabled } = this.handleConfigChange()
ConfigManager.set({ autoUpdateEnabled })
}
render() { render() {
return ( return (
<div styleName='root'> <div styleName='root'>
@@ -260,7 +265,8 @@ class InfoTab extends React.Component {
<label> <label>
<input <input
type='checkbox' type='checkbox'
onChange={this.toggleAutoUpdate.bind(this)} ref='autoUpdateEnabled'
onChange={() => this.handleAutoUpdateChange()}
checked={this.state.config.autoUpdateEnabled} checked={this.state.config.autoUpdateEnabled}
/> />
{i18n.__('Enable Auto Update')} {i18n.__('Enable Auto Update')}

View File

@@ -26,6 +26,7 @@ if (!singleInstance) {
} }
var isUpdateReady = false var isUpdateReady = false
let updateFound = false
var ghReleasesOpts = { var ghReleasesOpts = {
repo: 'BoostIO/boost-releases', repo: 'BoostIO/boost-releases',
@@ -36,25 +37,33 @@ const updater = new GhReleases(ghReleasesOpts)
// Check for updates // Check for updates
// `status` returns true if there is a new update available // `status` returns true if there is a new update available
function checkUpdate() { function checkUpdate(manualTriggered = false) {
if (!isPackaged) { if (!isPackaged) {
// Prevents app from attempting to update when in dev mode. // Prevents app from attempting to update when in dev mode.
console.log('Updates are disabled in Development mode, see main-app.js') console.log('Updates are disabled in Development mode, see main-app.js')
return true return true
} }
if (!electronConfig.get('autoUpdateEnabled', true)) return
if (process.platform === 'linux' || isUpdateReady) { // End if auto updates disabled and it is an automatic check
if (!electronConfig.get('autoUpdateEnabled', true) && !manualTriggered) return
if (process.platform === 'linux' || isUpdateReady || updateFound) {
return true return true
} }
updater.check((err, status) => { updater.check((err, status) => {
if (err) { if (err) {
var isLatest = err.message === 'There is no newer version.' var isLatest = err.message === 'There is no newer version.'
if (!isLatest) console.error('Updater error! %s', err.message) if (!isLatest) console.error('Updater error! %s', err.message)
mainWindow.webContents.send(
'update-not-found',
isLatest ? 'There is no newer version.' : 'Updater error'
)
return return
} }
if (status) { if (status) {
mainWindow.webContents.send('update-found', 'Update available!') mainWindow.webContents.send('update-found', 'Update available!')
updater.download() updateFound = true
} }
}) })
} }
@@ -63,6 +72,7 @@ updater.on('update-downloaded', info => {
if (mainWindow != null) { if (mainWindow != null) {
mainWindow.webContents.send('update-ready', 'Update available!') mainWindow.webContents.send('update-ready', 'Update available!')
isUpdateReady = true isUpdateReady = true
updateFound = false
} }
}) })
@@ -77,6 +87,14 @@ ipc.on('update-app-confirm', function(event, msg) {
} }
}) })
ipc.on('update-cancel', () => {
updateFound = false
})
ipc.on('update-download-confirm', () => {
updater.download()
})
app.on('window-all-closed', function() { app.on('window-all-closed', function() {
app.quit() app.quit()
}) })
@@ -113,7 +131,7 @@ app.on('ready', function() {
if (isUpdateReady) { if (isUpdateReady) {
mainWindow.webContents.send('update-ready', 'Update available!') mainWindow.webContents.send('update-ready', 'Update available!')
} else { } else {
checkUpdate() checkUpdate(msg === 'manual')
} }
}) })
}, 10 * 1000) }, 10 * 1000)

View File

@@ -178,6 +178,18 @@ const file = {
mainWindow.webContents.send('list:isMarkdownNote', 'print') mainWindow.webContents.send('list:isMarkdownNote', 'print')
mainWindow.webContents.send('print') mainWindow.webContents.send('print')
} }
},
{
type: 'separator'
},
{
label: 'Update',
click() {
mainWindow.webContents.send('update')
}
},
{
type: 'separator'
} }
] ]
} }

View File

@@ -3786,15 +3786,10 @@ fastparse@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8"
faye-websocket@^0.10.0: faye-websocket@^0.11.3, faye-websocket@~0.11.0:
version "0.10.0" version "0.11.3"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e"
dependencies: integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==
websocket-driver ">=0.5.1"
faye-websocket@~0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.1.tgz#f0efe18c4f56e4f40afc7e06c719fd5ee6188f38"
dependencies: dependencies:
websocket-driver ">=0.5.1" websocket-driver ">=0.5.1"
@@ -4660,9 +4655,10 @@ http-errors@~1.6.2:
setprototypeof "1.1.0" setprototypeof "1.1.0"
statuses ">= 1.4.0 < 2" statuses ">= 1.4.0 < 2"
http-parser-js@>=0.4.0: http-parser-js@>=0.5.1:
version "0.4.13" version "0.5.3"
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.13.tgz#3bd6d6fde6e3172c9334c3b33b6c193d80fe1137" resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.3.tgz#01d2709c79d41698bb01d4decc5e9da4e4a033d9"
integrity sha512-t7hjvef/5HEK7RWTdUzVUhl8zkEu+LlaE0IYzdMuvbSDipxBRpOn4Uhw8ZyECEa808iVT8XCjzo6xmYt4CiLZg==
http-proxy-middleware@~0.17.1: http-proxy-middleware@~0.17.1:
version "0.17.4" version "0.17.4"
@@ -8612,6 +8608,11 @@ safe-buffer@5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
safe-buffer@>=5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2" version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -8939,11 +8940,13 @@ sockjs-client@^1.0.3:
url-parse "^1.1.8" url-parse "^1.1.8"
sockjs@^0.3.15: sockjs@^0.3.15:
version "0.3.19" version "0.3.21"
resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.19.tgz#d976bbe800af7bd20ae08598d582393508993c0d" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.21.tgz#b34ffb98e796930b60a0cfa11904d6a339a7d417"
integrity sha512-DhbPFGpxjc6Z3I+uX07Id5ZO2XwYsWOrYjaSeieES78cq+JaJvVe5q/m1uvjIQhXinhIeCFRH6JgXe+mvVMyXw==
dependencies: dependencies:
faye-websocket "^0.10.0" faye-websocket "^0.11.3"
uuid "^3.0.1" uuid "^3.4.0"
websocket-driver "^0.7.4"
sort-keys@^1.0.0: sort-keys@^1.0.0:
version "1.1.2" version "1.1.2"
@@ -9950,9 +9953,10 @@ uuid@3.1.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
uuid@^3.0.1, uuid@^3.1.0, uuid@^3.2.1: uuid@^3.1.0, uuid@^3.2.1, uuid@^3.4.0:
version "3.2.1" version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
validate-npm-package-license@^3.0.1: validate-npm-package-license@^3.0.1:
version "3.0.3" version "3.0.3"
@@ -10078,11 +10082,13 @@ webpack@^1.12.2:
watchpack "^0.2.1" watchpack "^0.2.1"
webpack-core "~0.6.9" webpack-core "~0.6.9"
websocket-driver@>=0.5.1: websocket-driver@>=0.5.1, websocket-driver@^0.7.4:
version "0.7.0" version "0.7.4"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.0.tgz#0caf9d2d755d93aee049d4bdd0d3fe2cca2a24eb" resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760"
integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==
dependencies: dependencies:
http-parser-js ">=0.4.0" http-parser-js ">=0.5.1"
safe-buffer ">=5.1.0"
websocket-extensions ">=0.1.1" websocket-extensions ">=0.1.1"
websocket-extensions@>=0.1.1: websocket-extensions@>=0.1.1: