mirror of
https://github.com/heyman/heynote.git
synced 2024-11-28 10:54:22 +01:00
Merge pull request #4 from heyman/release-channels
Add Beta release channel
This commit is contained in:
commit
8a82863a70
@ -25,6 +25,7 @@ const schema = {
|
||||
"emacsMetaKey": { "enum": [null, "alt", "meta"], default: null },
|
||||
"showLineNumberGutter": {type: "boolean", default:true},
|
||||
"showFoldGutter": {type: "boolean", default:true},
|
||||
"allowBetaVersions": {type: "boolean", default: false},
|
||||
},
|
||||
},
|
||||
|
||||
@ -45,6 +46,7 @@ const defaults = {
|
||||
emacsMetaKey: "meta",
|
||||
showLineNumberGutter: true,
|
||||
showFoldGutter: true,
|
||||
allowBetaVersions: false,
|
||||
},
|
||||
theme: "system",
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { autoUpdater } from "electron-updater"
|
||||
import { app, dialog, ipcMain } from "electron"
|
||||
import CONFIG from "../config"
|
||||
|
||||
import {
|
||||
UPDATE_AVAILABLE_EVENT,
|
||||
@ -10,7 +11,7 @@ import {
|
||||
UPDATE_START_DOWNLOAD,
|
||||
UPDATE_INSTALL_AND_RESTART,
|
||||
UPDATE_CHECK_FOR_UPDATES,
|
||||
} from '../constants'
|
||||
} from '../constants'
|
||||
|
||||
|
||||
// will reference the main window
|
||||
@ -23,6 +24,7 @@ autoUpdater.logger = log
|
||||
autoUpdater.logger.transports.file.level = "info"
|
||||
|
||||
autoUpdater.autoDownload = false
|
||||
autoUpdater.allowDowngrade = true
|
||||
|
||||
autoUpdater.on('error', (error) => {
|
||||
window?.webContents.send(UPDATE_ERROR, error == null ? "unknown" : (error.stack || error).toString())
|
||||
@ -63,14 +65,33 @@ ipcMain.handle(UPDATE_INSTALL_AND_RESTART, () => {
|
||||
setImmediate(() => autoUpdater.quitAndInstall(true, true))
|
||||
})
|
||||
|
||||
ipcMain.handle(UPDATE_CHECK_FOR_UPDATES, () => {
|
||||
|
||||
export function checkForUpdates() {
|
||||
autoUpdater.allowPrerelease = CONFIG.get("settings.allowBetaVersions")
|
||||
autoUpdater.checkForUpdates()
|
||||
// for development, the autoUpdater will not work, so we need to trigger the event manually
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
window?.webContents.send(UPDATE_NOT_AVAILABLE_EVENT)
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle(UPDATE_CHECK_FOR_UPDATES, () => {
|
||||
checkForUpdates()
|
||||
})
|
||||
|
||||
export function initializeAutoUpdate(win) {
|
||||
window = win
|
||||
|
||||
/**
|
||||
* To debug auto updates (actually downloading an update won't work),
|
||||
* uncomment the lines below, and create a dev-app-update.yml with the content:
|
||||
*
|
||||
* owner: heyman
|
||||
* repo: heynote
|
||||
* provider: github
|
||||
*/
|
||||
// Useful for some dev/debugging tasks, but download can
|
||||
// not be validated becuase dev app is not signed
|
||||
//autoUpdater.updateConfigPath = "/Users/heyman/projects/heynote/dev-app-update.yml" //path.join(__dirname, 'dev-app-update.yml');
|
||||
//autoUpdater.forceDevUpdateConfig = true;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import { WINDOW_CLOSE_EVENT, SETTINGS_CHANGE_EVENT } from '../constants';
|
||||
import CONFIG from "../config"
|
||||
import { onBeforeInputEvent } from "../keymap"
|
||||
import { isMac } from '../detect-platform';
|
||||
import { initializeAutoUpdate } from './auto-update';
|
||||
import { initializeAutoUpdate, checkForUpdates } from './auto-update';
|
||||
import { fixElectronCors } from './cors';
|
||||
|
||||
|
||||
@ -59,6 +59,12 @@ const isDev = !!process.env.VITE_DEV_SERVER_URL
|
||||
let currentKeymap = CONFIG.get("settings.keymap")
|
||||
let contentSaved = false
|
||||
|
||||
// if this version is a beta version, set the release channel to beta
|
||||
const isBetaVersion = app.getVersion().includes("beta")
|
||||
if (isBetaVersion) {
|
||||
CONFIG.set("settings.allowBetaVersions", true)
|
||||
}
|
||||
|
||||
|
||||
async function createWindow() {
|
||||
// read any stored window settings from config, or use defaults
|
||||
@ -203,7 +209,7 @@ ipcMain.handle('buffer-content:saveAndQuit', async (event, content) => {
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:set', (event, settings) => {
|
||||
if (settings.keymap !== CONFIG.get("keymap")) {
|
||||
if (settings.keymap !== CONFIG.get("settings.keymap")) {
|
||||
currentKeymap = settings.keymap
|
||||
}
|
||||
CONFIG.set("settings", settings)
|
||||
|
68
package-lock.json
generated
68
package-lock.json
generated
@ -38,7 +38,7 @@
|
||||
"electron-builder": "^23.6.0",
|
||||
"electron-builder-notarize": "^1.5.1",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^5.3.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"fs-jetpack": "^5.1.0",
|
||||
"prettier": "^2.8.4",
|
||||
"rollup-plugin-license": "^3.0.1",
|
||||
@ -1328,12 +1328,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
|
||||
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/verror": {
|
||||
"version": "1.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",
|
||||
@ -3039,20 +3033,32 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron-updater": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-5.3.0.tgz",
|
||||
"integrity": "sha512-iKEr7yQBcvnQUPnSDYGSWC9t0eF2YbZWeYYYZzYxdl+HiRejXFENjYMnYjoOm2zxyD6Cr2JTHZhp9pqxiXuCOw==",
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.1.7.tgz",
|
||||
"integrity": "sha512-SNOhYizjkm4ET+Y8ilJyUzcVsFJDtINzVN1TyHnZeMidZEG3YoBebMyXc/J6WSiXdUaOjC7ngekN6rNp6ardHA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/semver": "^7.3.6",
|
||||
"builder-util-runtime": "9.1.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"builder-util-runtime": "9.2.3",
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lazy-val": "^1.0.5",
|
||||
"lodash.escaperegexp": "^4.1.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"semver": "^7.3.5",
|
||||
"typed-emitter": "^2.1.0"
|
||||
"semver": "^7.3.8",
|
||||
"tiny-typed-emitter": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-updater/node_modules/builder-util-runtime": {
|
||||
"version": "9.2.3",
|
||||
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.3.tgz",
|
||||
"integrity": "sha512-FGhkqXdFFZ5dNC4C+yuQB9ak311rpGAw+/ASz8ZdxwODCv1GGMWgLDeofRkdi0F3VCHQEWy/aXcJQozx2nOPiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-updater/node_modules/fs-extra": {
|
||||
@ -4854,16 +4860,6 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/rxjs": {
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz",
|
||||
"integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
@ -5252,6 +5248,12 @@
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tmp": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
|
||||
@ -5294,13 +5296,6 @@
|
||||
"utf8-byte-length": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
|
||||
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
||||
@ -5314,15 +5309,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==",
|
||||
"dev": true,
|
||||
"optionalDependencies": {
|
||||
"rxjs": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
|
||||
|
@ -14,6 +14,7 @@
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.heynote.app",
|
||||
"generateUpdatesFilesForAllChannels": true,
|
||||
"directories": {
|
||||
"buildResources": "resources"
|
||||
}
|
||||
@ -52,7 +53,7 @@
|
||||
"electron-builder": "^23.6.0",
|
||||
"electron-builder-notarize": "^1.5.1",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^5.3.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"fs-jetpack": "^5.1.0",
|
||||
"prettier": "^2.8.4",
|
||||
"rollup-plugin-license": "^3.0.1",
|
||||
|
@ -121,6 +121,7 @@
|
||||
:languageAuto="languageAuto"
|
||||
:theme="theme"
|
||||
:systemTheme="systemTheme"
|
||||
:allowBetaVersions="settings.allowBetaVersions"
|
||||
@toggleTheme="toggleTheme"
|
||||
@openLanguageSelector="openLanguageSelector"
|
||||
@formatCurrentBlock="formatCurrentBlock"
|
||||
|
@ -13,6 +13,7 @@
|
||||
"languageAuto",
|
||||
"theme",
|
||||
"systemTheme",
|
||||
"allowBetaVersions",
|
||||
],
|
||||
|
||||
components: {
|
||||
@ -63,7 +64,7 @@
|
||||
>
|
||||
<span class="icon icon-format"></span>
|
||||
</div>
|
||||
<UpdateStatusItem />
|
||||
<UpdateStatusItem :allowBetaVersions="allowBetaVersions" />
|
||||
<div class="status-block theme clickable" @click="$emit('toggleTheme')" title="Toggle dark/light mode">
|
||||
<span :class="'icon ' + systemTheme"></span>
|
||||
</div>
|
||||
|
@ -1,5 +1,9 @@
|
||||
<script>
|
||||
export default {
|
||||
props: [
|
||||
"allowBetaVersions",
|
||||
],
|
||||
|
||||
data() {
|
||||
return {
|
||||
updateAvailable: false,
|
||||
@ -62,6 +66,14 @@
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
allowBetaVersions: {
|
||||
handler: function (newValue) {
|
||||
this.checkForUpdate()
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
statusText() {
|
||||
if (this.downloading) {
|
||||
@ -123,6 +135,7 @@
|
||||
},
|
||||
|
||||
checkForUpdate() {
|
||||
this.updateAvailable = false
|
||||
this.checkingForUpdate = true
|
||||
window.heynote.autoUpdate.checkForUpdates()
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
isMac: window.heynote.platform.isMac,
|
||||
showLineNumberGutter: this.initialSettings.showLineNumberGutter,
|
||||
showFoldGutter: this.initialSettings.showFoldGutter,
|
||||
allowBetaVersions: this.initialSettings.allowBetaVersions,
|
||||
}
|
||||
},
|
||||
|
||||
@ -40,6 +41,7 @@
|
||||
showFoldGutter: this.showFoldGutter,
|
||||
keymap: this.keymap,
|
||||
emacsMetaKey: this.metaKey,
|
||||
allowBetaVersions: this.allowBetaVersions,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -91,6 +93,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="entry">
|
||||
<h2>Beta Versions</h2>
|
||||
<div class="checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="allowBetaVersions"
|
||||
v-model="allowBetaVersions"
|
||||
@change="updateSettings"
|
||||
/>
|
||||
<label for="allowBetaVersions">Use beta versions of Heynote</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
@click="$emit('closeSettings')"
|
||||
|
Loading…
Reference in New Issue
Block a user