mirror of
https://github.com/laurent22/joplin.git
synced 2025-04-07 21:38:58 +02:00
Desktop: Added support for pre-releases
This commit is contained in:
parent
f6640bcc32
commit
8ff2418b02
@ -589,7 +589,7 @@ class Application extends BaseApplication {
|
|||||||
}, {
|
}, {
|
||||||
label: _('Check for updates...'),
|
label: _('Check for updates...'),
|
||||||
click: () => {
|
click: () => {
|
||||||
bridge().checkForUpdates(false, bridge().window(), this.checkForUpdateLoggerPath());
|
bridge().checkForUpdates(false, bridge().window(), this.checkForUpdateLoggerPath(), { includePreReleases: Setting.value('autoUpdate.includePreReleases') });
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
type: 'separator',
|
type: 'separator',
|
||||||
@ -772,7 +772,7 @@ class Application extends BaseApplication {
|
|||||||
if (shim.isWindows() || shim.isMac()) {
|
if (shim.isWindows() || shim.isMac()) {
|
||||||
const runAutoUpdateCheck = () => {
|
const runAutoUpdateCheck = () => {
|
||||||
if (Setting.value('autoUpdateEnabled')) {
|
if (Setting.value('autoUpdateEnabled')) {
|
||||||
bridge().checkForUpdates(true, bridge().window(), this.checkForUpdateLoggerPath());
|
bridge().checkForUpdates(true, bridge().window(), this.checkForUpdateLoggerPath(), { includePreReleases: Setting.value('autoUpdate.includePreReleases') });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ class Bridge {
|
|||||||
return require('electron').shell.openItem(fullPath)
|
return require('electron').shell.openItem(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdates(inBackground, window, logFilePath) {
|
checkForUpdates(inBackground, window, logFilePath, options) {
|
||||||
const { checkForUpdates } = require('./checkForUpdates.js');
|
const { checkForUpdates } = require('./checkForUpdates.js');
|
||||||
checkForUpdates(inBackground, window, logFilePath);
|
checkForUpdates(inBackground, window, logFilePath, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,35 @@ function onCheckEnded() {
|
|||||||
isCheckingForUpdate_ = false;
|
isCheckingForUpdate_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchLatestRelease() {
|
async function fetchLatestRelease(options) {
|
||||||
const response = await fetch('https://api.github.com/repos/laurent22/joplin/releases/latest');
|
options = Object.assign({}, { includePreReleases: false }, options);
|
||||||
|
|
||||||
if (!response.ok) {
|
let json = null;
|
||||||
const responseText = await response.text();
|
|
||||||
throw new Error('Cannot get latest release info: ' + responseText.substr(0,500));
|
if (options.includePreReleases) {
|
||||||
|
// This end-point will include all releases, including pre-releases (but not draft), so we take
|
||||||
|
// whatever is the latest release. It might be the same as releases/latest, or it might be
|
||||||
|
// a pre-release.
|
||||||
|
const response = await fetch('https://api.github.com/repos/laurent22/joplin/releases');
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const responseText = await response.text();
|
||||||
|
throw new Error('Cannot get latest release info: ' + responseText.substr(0,500));
|
||||||
|
}
|
||||||
|
|
||||||
|
json = await response.json();
|
||||||
|
if (!json.length) throw new Error('Cannot get latest release info: ' + responseText.substr(0,500));
|
||||||
|
json = json[0];
|
||||||
|
} else {
|
||||||
|
const response = await fetch('https://api.github.com/repos/laurent22/joplin/releases/latest');
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const responseText = await response.text();
|
||||||
|
throw new Error('Cannot get latest release info: ' + responseText.substr(0,500));
|
||||||
|
}
|
||||||
|
|
||||||
|
json = await response.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
|
||||||
|
|
||||||
const version = json.tag_name.substr(1);
|
const version = json.tag_name.substr(1);
|
||||||
let downloadUrl = null;
|
let downloadUrl = null;
|
||||||
@ -69,10 +89,11 @@ async function fetchLatestRelease() {
|
|||||||
downloadUrl: downloadUrl,
|
downloadUrl: downloadUrl,
|
||||||
notes: json.body,
|
notes: json.body,
|
||||||
pageUrl: json.html_url,
|
pageUrl: json.html_url,
|
||||||
|
prerelease: json.prerelease,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForUpdates(inBackground, window, logFilePath) {
|
function checkForUpdates(inBackground, window, logFilePath, options) {
|
||||||
if (isCheckingForUpdate_) {
|
if (isCheckingForUpdate_) {
|
||||||
autoUpdateLogger_.info('checkForUpdates: Skipping check because it is already running');
|
autoUpdateLogger_.info('checkForUpdates: Skipping check because it is already running');
|
||||||
return;
|
return;
|
||||||
@ -91,9 +112,12 @@ function checkForUpdates(inBackground, window, logFilePath) {
|
|||||||
|
|
||||||
checkInBackground_ = inBackground;
|
checkInBackground_ = inBackground;
|
||||||
|
|
||||||
fetchLatestRelease().then(release => {
|
autoUpdateLogger_.info('checkForUpdates: Checking with options ' + JSON.stringify(options));
|
||||||
|
|
||||||
|
fetchLatestRelease(options).then(release => {
|
||||||
autoUpdateLogger_.info('Current version: ' + packageInfo.version);
|
autoUpdateLogger_.info('Current version: ' + packageInfo.version);
|
||||||
autoUpdateLogger_.info('Latest version: ' + release.version);
|
autoUpdateLogger_.info('Latest version: ' + release.version);
|
||||||
|
autoUpdateLogger_.info('Is Pre-release:', release.prerelease);
|
||||||
|
|
||||||
if (compareVersions(release.version, packageInfo.version) <= 0) {
|
if (compareVersions(release.version, packageInfo.version) <= 0) {
|
||||||
if (!checkInBackground_) dialog.showMessageBox({ message: _('Current version is up-to-date.') })
|
if (!checkInBackground_) dialog.showMessageBox({ message: _('Current version is up-to-date.') })
|
||||||
|
@ -105,6 +105,7 @@ class Setting extends BaseModel {
|
|||||||
'style.editor.fontSize': {value: 12, type: Setting.TYPE_INT, public: true, appTypes: ['desktop'], label: () => _('Editor font size'), minimum: 4, maximum: 50, step: 1},
|
'style.editor.fontSize': {value: 12, type: Setting.TYPE_INT, public: true, appTypes: ['desktop'], label: () => _('Editor font size'), minimum: 4, maximum: 50, step: 1},
|
||||||
'style.editor.fontFamily': {value: "", type: Setting.TYPE_STRING, public: true, appTypes: ['desktop'], label: () => _('Editor font family'), description: () => _('This must be *monospace* font or it will not work properly. If the font is incorrect or empty, it will default to a generic monospace font.')},
|
'style.editor.fontFamily': {value: "", type: Setting.TYPE_STRING, public: true, appTypes: ['desktop'], label: () => _('Editor font family'), description: () => _('This must be *monospace* font or it will not work properly. If the font is incorrect or empty, it will default to a generic monospace font.')},
|
||||||
'autoUpdateEnabled': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
'autoUpdateEnabled': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
||||||
|
'autoUpdate.includePreReleases': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Get pre-releases when checking for updates'), description: () => _('See the pre-release page for more details: %s', 'https://joplin.cozic.net/prereleases') },
|
||||||
'clipperServer.autoStart': { value: false, type: Setting.TYPE_BOOL, public: false },
|
'clipperServer.autoStart': { value: false, type: Setting.TYPE_BOOL, public: false },
|
||||||
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
|
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
|
||||||
return {
|
return {
|
||||||
|
@ -24,7 +24,7 @@ async function main() {
|
|||||||
|
|
||||||
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
|
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
|
||||||
|
|
||||||
console.info('Release options: ' + releaseOptions);
|
console.info('Release options: ', releaseOptions);
|
||||||
|
|
||||||
const release = await githubRelease('joplin', tagName, releaseOptions);
|
const release = await githubRelease('joplin', tagName, releaseOptions);
|
||||||
|
|
||||||
|
9
readme/prereleases.md
Normal file
9
readme/prereleases.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Getting pre-releases
|
||||||
|
|
||||||
|
Pre-releases are available for the desktop application. They are pretty much like regular releases, except that they have not yet been tested by many users, so it is possible that a bug or two went through.
|
||||||
|
|
||||||
|
You can help the development of Joplin by choosing to receive these early releases when updating the application. If you find any bug or other issue, you may report it [on the forum](https://discourse.joplin.cozic.net/) or [GitHub](https://github.com/laurent22/joplin/issues).
|
||||||
|
|
||||||
|
In general it is safe to use these pre-releases (they do not include any experimental or unstable features). In fact most pre-release eventually become regular releases after a few days.
|
||||||
|
|
||||||
|
To have access to these pre-releases, simply go to **Configuration screen** and tick the box "**Also get pre-releases when checking for updates**".
|
Loading…
x
Reference in New Issue
Block a user