Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version first run flag #555

Merged
merged 2 commits into from Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions pyinstaller/electron/main.js
Expand Up @@ -9,6 +9,7 @@ const defaultMenu = require('electron-default-menu');
const { spawn, exec } = require('child_process');
const console = require('console')
const getAppSettings = require('./helpers').getAppSettings
const appSettingsPath = require('./helpers').appSettingsPath
let appSettings = getAppSettings()

let dimensions = { widIth: 1500, height: 1000 };
Expand Down Expand Up @@ -113,6 +114,14 @@ function downloadSpecterd(specterdPath) {
updatingLoaderMsg('Fetching the Specter binary...')
console.log("Using version ", appSettings.specterdVersion);
console.log(`https://github.com/cryptoadvance/specter-desktop/releases/download/${appSettings.specterdVersion}/specterd-${appSettings.specterdVersion}-${platformName}.zip`);
let versionData = require('./version-data.json')
if (!('versionInitialized' in versionData) || !versionData.versionInitialized) {
appSettings.specterdVersion = versionData.version
appSettings.specterdHash = versionData.sha256
versionData.versionInitialized = true
fs.writeFileSync(appSettingsPath, JSON.stringify(appSettings))
fs.writeFileSync('./version-data.json', JSON.stringify(versionData));
}
download(`https://github.com/cryptoadvance/specter-desktop/releases/download/${appSettings.specterdVersion}/specterd-${appSettings.specterdVersion}-${platformName}.zip`, specterdPath + '.zip', function() {
updatingLoaderMsg('Unpacking files...')

Expand Down
3 changes: 2 additions & 1 deletion pyinstaller/electron/set-version.js
Expand Up @@ -10,7 +10,8 @@ async function setVersion() {
if (process.argv[3]) {
let versionData = {
version,
sha256: (await createHashFromFile(process.argv[3]))
sha256: (await createHashFromFile(process.argv[3])),
versionInitialized: false
}

fs.writeFileSync('./version-data.json', JSON.stringify(versionData, undefined, 2))
Expand Down