Use feed.json with macos updater
This commit is contained in:
parent
155213b57f
commit
572eecc322
1 changed files with 16 additions and 2 deletions
|
@ -3,8 +3,10 @@
|
|||
|
||||
import { pathToFileURL } from 'url';
|
||||
import { autoUpdater } from 'electron';
|
||||
import { writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
|
||||
import { Updater } from './common';
|
||||
import { Updater, getTempDir } from './common';
|
||||
import { explodePromise } from '../util/explodePromise';
|
||||
import * as Errors from '../types/errors';
|
||||
import { markShouldQuit } from '../../app/window_state';
|
||||
|
@ -59,8 +61,20 @@ export class MacOSUpdater extends Updater {
|
|||
resolve();
|
||||
});
|
||||
|
||||
// See: https://github.com/electron/electron/issues/5020#issuecomment-477636990
|
||||
const updateUrl = pathToFileURL(filePath).href;
|
||||
|
||||
const tempDir = await getTempDir();
|
||||
const feedPath = join(tempDir, 'feed.json');
|
||||
await writeFile(
|
||||
feedPath,
|
||||
JSON.stringify({
|
||||
url: updateUrl,
|
||||
})
|
||||
);
|
||||
|
||||
autoUpdater.setFeedURL({
|
||||
url: pathToFileURL(filePath).href,
|
||||
url: pathToFileURL(feedPath).href,
|
||||
serverType: 'json',
|
||||
});
|
||||
autoUpdater.checkForUpdates();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue