Skip to content

Commit

Permalink
ELECTRON: Backport dependency updates/changes from florin
Browse files Browse the repository at this point in the history
Also some misc formatting changes
  • Loading branch information
mjmacleod committed Apr 15, 2023
1 parent 9e856d2 commit ed1ac98
Show file tree
Hide file tree
Showing 13 changed files with 1,630 additions and 2,194 deletions.
79 changes: 50 additions & 29 deletions src/frontend/electron_vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,54 @@
},
"main": "background.js",
"dependencies": {
"@fortawesome/fontawesome-pro": "^6.2.1",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/pro-light-svg-icons": "^6.2.1",
"@fortawesome/pro-regular-svg-icons": "^6.2.1",
"@fortawesome/vue-fontawesome": "^2.0.9",
"axios": "^1.2.1",
"core-js": "^3.26.1",
"@fortawesome/fontawesome-pro": "^5.15.3",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/pro-light-svg-icons": "^5.15.3",
"@fortawesome/pro-regular-svg-icons": "^5.15.2",
"@fortawesome/vue-fontawesome": "^2.0.2",
"axios": "^1.3.4",
"core-js": "^3.28.0",
"electron-better-ipc": "^2.0.1",
"electron-context-menu": "^3.6.1",
"electron-store": "^8.1.0",
"lodash.clonedeep": "^4.5.0",
"portal-vue": "^2.1.7",
"qrcode": "^1.5.1",
"vue": "^3.2.45",
"vue-i18n": "^9.2.2",
"vue": "^2.6.12",
"vue-i18n": "^8.24.2",
"vue-js-toggle-button": "^1.3.3",
"vue-qrcode": "^2.2.0",
"vue-router": "^4.1.6",
"vue-slider-component": "^3.2.23",
"vuex": "^4.1.0",
"vue-qrcode": "^0.3.5",
"vue-router": "^3.5.1",
"vue-slider-component": "^3.2.11",
"vuex": "^3.6.2",
"vuex-electron": "https://github.com/devlz303/vuex-electron.git#v1.0.4"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@oshell/vue-cli-plugin-electron-builder-notarize": "^1.0.2",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-prettier": "^7.0.0",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.5",
"electron": "^22.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-plugin-import": "^1.13.3",
"electron": "^23.1.1",
"electron-builder": "^23.6.0",
"electron-icon-builder": "^2.0.1",
"eslint": "^8.29.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.8.0",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"less": "^4.1.1",
"less-loader": "^5.0.0",
"native-ext-loader": "^2.3.0",
"prettier": "^2.8.0",
"prettier": "^2.4.1",
"vue-cli-plugin-ant-design": "~1.0.1",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-cli-plugin-i18n": "~2.3.1",
"vue-template-compiler": "^2.7.14",
"webpack": "^5.75.0"
"vue-template-compiler": "^2.6.12",
"webpack": "^5.28.0"
},
"eslintConfig": {
"root": true,
Expand All @@ -77,7 +78,7 @@
"@vue/prettier"
],
"parserOptions": {
"parser": "babel-eslint"
"parser": "@babel/eslint-parser"
},
"rules": {
"no-unused-vars": [
Expand All @@ -86,11 +87,31 @@
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
]
],
"vue/multi-word-component-names": [
"error",
{
"ignores": [
"Send",
"Receive",
"Transactions",
"Account",
"index",
"Setup"
]
}
],
"comma-dangle": "off",
"wrap-iife": "off",
"arrow-parens": "off",
"linebreak-style": "off"
}
},
"prettier": {
"printWidth": 160
"printWidth": 160,
"trailingComma": "none",
"arrowParens": "avoid",
"singleAttributePerLine": false
},
"browserslist": [
"Electron >= 17.1.0"
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/electron_vue/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ const fs = require("fs");
const path = require("path");
let src = path.join(__dirname, `holdinAPI.js.in`);
let dst = path.join(__dirname, `holdinAPI.js`);
fs.copyFile(src, dst, fs.constants.COPYFILE_EXCL, (err) => {})
fs.copyFile(src, dst, fs.constants.COPYFILE_EXCL, err => {
console.warn(err);
});
2 changes: 1 addition & 1 deletion src/frontend/electron_vue/sign.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports.default = async function(configuration) {
exports.default = async function (configuration) {
const CERTIFICATE_PATH = process.env.CERTIFICATE_PATH;
const CERTIFICATE_KEY = process.env.CERTIFICATE_KEY;
const CERTIFICATE_NAME = process.env.CERTIFICATE_NAME;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/electron_vue/src/components/AccountHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="accountname ellipsis">{{ name }}</div>
<fa-icon class="pen" :icon="['fal', 'fa-pen']" />
</div>
<div style=" width: 40px; text-align: center" @click="deleteAccount" class="trash flex-row ">
<div style="width: 40px; text-align: center" @click="deleteAccount" class="trash flex-row">
<fa-icon :icon="['fal', 'fa-trash']" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {
}
},
methods: {
showTooltip: function() {
showTooltip: function () {
clearTimeout(this.timeout);
this.show = true;
this.getValues();
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/electron_vue/src/components/CurrencyInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
},
computed: {
displayValue: {
get: function() {
get: function () {
if (this.innerValue === null || this.innerValue === undefined || this.innerValue.toString().trim() === "") return null;
if (this.isFocussed) {
Expand All @@ -37,7 +37,7 @@ export default {
return `${this.currency} ${this.innerValue.toString().replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1 ")}`.trim();
}
},
set: function(modifiedValue) {
set: function (modifiedValue) {
let newValue = modifiedValue.replace(/[^0-9.]/g, "").replace(/(\..*)\./g, "$1");
let periodIdx = newValue.indexOf(".");
Expand Down
6 changes: 1 addition & 5 deletions src/frontend/electron_vue/src/components/PhraseInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ export default {
return typeof this.validate !== "string";
},
words() {
return this.isRecovery
? Array(this.validate.length)
.join(".")
.split(".")
: this.validate.split(" ");
return this.isRecovery ? Array(this.validate.length).join(".").split(".") : this.validate.split(" ");
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/electron_vue/src/layouts/AccountsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default {
getBalanceFor(category) {
let accounts = this.getAccountsFor(category);
return formatMoneyForDisplay(
accounts.reduce(function(acc, obj) {
accounts.reduce(function (acc, obj) {
return acc + obj.balance;
}, 0)
);
Expand Down
46 changes: 23 additions & 23 deletions src/frontend/electron_vue/src/unity/LibUnity.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,29 @@ class LibUnity {
_initializeWalletController() {
console.log("_initializeWalletController");

this.walletListener.notifyBalanceChange = function(new_balance) {
this.walletListener.notifyBalanceChange = function (new_balance) {
console.log(`walletListener.notifyBalanceChange`);
store.dispatch("wallet/SET_WALLET_BALANCE", new_balance);
};

this.walletListener.notifyWalletUnlocked = function() {
this.walletListener.notifyWalletUnlocked = function () {
console.log("receive: notifyWalletUnlocked");
store.dispatch("wallet/SET_UNLOCKED", true);
};

this.walletListener.notifyWalletLocked = function() {
this.walletListener.notifyWalletLocked = function () {
console.log("receive: notifyWalletLocked");
store.dispatch("wallet/SET_UNLOCKED", false);
};

/** Core wants the wallet to unlock; UI should respond to this by calling 'UnlockWallet' */
this.walletListener.notifyCoreWantsUnlock = function(reason) {
this.walletListener.notifyCoreWantsUnlock = function (reason) {
console.log("receive: notifyCoreWantsUnlock", reason);
// TODO: show unlock dialog with reason (localized?)
};

/** Core wants display info to the user, type can be one of "MSG_ERROR", "MSG_WARNING", "MSG_INFORMATION"; caption is the suggested caption and message the suggested message to display */
this.walletListener.notifyCoreInfo = function(type, caption, message) {
this.walletListener.notifyCoreInfo = function (type, caption, message) {
console.log("receive: notifyCoreInfo", type, caption, message);
// TODO: dispatch message event. add message to queue??
};
Expand Down Expand Up @@ -129,14 +129,14 @@ class LibUnity {
let self = this;
let libraryController = this.libraryController;

this.accountsListener.onAccountNameChanged = function(accountUUID, newAccountName) {
this.accountsListener.onAccountNameChanged = function (accountUUID, newAccountName) {
store.dispatch("wallet/SET_ACCOUNT_NAME", {
accountUUID,
newAccountName
});
};

this.accountsListener.onActiveAccountChanged = function(accountUUID) {
this.accountsListener.onActiveAccountChanged = function (accountUUID) {
// combine all properties into one payload object
const receiveAddress = libraryController.GetReceiveAddress();
const mutations = libraryController.getMutationHistory();
Expand All @@ -150,11 +150,11 @@ class LibUnity {
store.dispatch("wallet/SET_WALLET", payload);
};

this.accountsListener.onAccountAdded = function() {
this.accountsListener.onAccountAdded = function () {
self._updateAccounts();
};

this.accountsListener.onAccountDeleted = function() {
this.accountsListener.onAccountDeleted = function () {
self._updateAccounts();
};

Expand All @@ -164,19 +164,19 @@ class LibUnity {
_initializeGenerationController() {
console.log("_initializeGenerationController");

this.generationListener.onGenerationStarted = function() {
this.generationListener.onGenerationStarted = function () {
console.log("GENERATION STARTED");
store.dispatch("mining/SET_ACTIVE", true);
};

this.generationListener.onGenerationStopped = function() {
this.generationListener.onGenerationStopped = function () {
console.log("GENERATION STOPPED");

store.dispatch("mining/SET_ACTIVE", false);
store.dispatch("mining/SET_STATS", null);
};

this.generationListener.onStatsUpdated = function(
this.generationListener.onStatsUpdated = function (
hashesPerSecond,
hashesPerSecondUnit,
rollingHashesPerSecond,
Expand Down Expand Up @@ -243,7 +243,7 @@ class LibUnity {
let walletController = this.walletController;
let accountsController = this.accountsController;

libraryListener.notifyCoreReady = function() {
libraryListener.notifyCoreReady = function () {
console.log("received: notifyCoreReady");

self._initializeWalletController();
Expand All @@ -254,7 +254,7 @@ class LibUnity {
self._setStateWhenCoreAndMainWindowReady();
};

libraryListener.notifySyncDone = function() {
libraryListener.notifySyncDone = function () {
console.log("received: notifySyncDone");

console.log("get the wallet balance");
Expand Down Expand Up @@ -289,44 +289,44 @@ class LibUnity {
// console.log("unity_core: " + message);
// };

libraryListener.notifyBalanceChange = function(new_balance) {
libraryListener.notifyBalanceChange = function (new_balance) {
console.log("received: notifyBalanceChange");
store.dispatch("wallet/SET_BALANCE", new_balance);
};

libraryListener.notifyNewMutation = function(/*mutation, self_committed*/) {
libraryListener.notifyNewMutation = function (/*mutation, self_committed*/) {
console.log("received: notifyNewMutation");
store.dispatch("wallet/SET_MUTATIONS", libraryController.getMutationHistory());
store.dispatch("wallet/SET_RECEIVE_ADDRESS", libraryController.GetReceiveAddress());

self._updateAccounts();
};

libraryListener.notifyUpdatedTransaction = function(/*transaction*/) {
libraryListener.notifyUpdatedTransaction = function (/*transaction*/) {
console.log("received: notifyUpdatedTransaction");
store.dispatch("wallet/SET_MUTATIONS", libraryController.getMutationHistory());
};

libraryListener.notifyInitWithExistingWallet = function() {
libraryListener.notifyInitWithExistingWallet = function () {
console.log("received: notifyInitWithExistingWallet");
store.dispatch("app/SET_WALLET_EXISTS", true);
};

libraryListener.notifyInitWithoutExistingWallet = function() {
libraryListener.notifyInitWithoutExistingWallet = function () {
console.log("received: notifyInitWithoutExistingWallet");
self.newRecoveryPhrase = libraryController.GenerateRecoveryMnemonic();
store.dispatch("app/SET_WALLET_EXISTS", false);
};

libraryListener.notifyShutdown = function() {
libraryListener.notifyShutdown = function () {
//NB! It is important to set the libraryListener to null here as this is the last thing the core lib is waiting on for clean exit; once we set this to null we are free to quit the app
libraryListener = null;
console.log("received: notifyShutdown");
self.isTerminated = true;

// We call this inside a timeout because if we don't we get a crash on macOS; its not yet 100% clear why but for now its better to just avoid the crash until we can debug further
// TODO: Investigate this further
setTimeout(function() {
setTimeout(function () {
app.quit();
}, 1000);
};
Expand Down Expand Up @@ -2862,13 +2862,13 @@ class LibUnity {
};

axios(config)
.then(function(response) {
.then(function (response) {
event.returnValue = {
success: response.data.status_code === 200,
result: response.data
};
})
.catch(function(error) {
.catch(function (error) {
event.returnValue = handleError(error);
});
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
methods: {
moveToEnd() {
let command = this.$refs.command;
setTimeout(function() {
setTimeout(function () {
command.selectionStart = command.selectionEnd = command.value.length;
}, 0);
},
Expand Down
12 changes: 3 additions & 9 deletions src/frontend/electron_vue/src/views/Settings/SettingsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,9 @@
</div>
<div class="settings-row-no-hover flex-row">
<div class="flex-1">{{ $t("settings.choose_decimal_places") }}</div>
<div :class="`decimal-select ${this.decimals === 2 ? 'selected' : ''}`" @click="changeDecimals(2)">
2
</div>
<div :class="`decimal-select ${this.decimals === 3 ? 'selected' : ''}`" @click="changeDecimals(3)">
3
</div>
<div :class="`decimal-select ${this.decimals === 4 ? 'selected' : ''}`" @click="changeDecimals(4)">
4
</div>
<div :class="`decimal-select ${this.decimals === 2 ? 'selected' : ''}`" @click="changeDecimals(2)">2</div>
<div :class="`decimal-select ${this.decimals === 3 ? 'selected' : ''}`" @click="changeDecimals(3)">3</div>
<div :class="`decimal-select ${this.decimals === 4 ? 'selected' : ''}`" @click="changeDecimals(4)">4</div>
</div>
</div>
</template>
Expand Down
Loading

0 comments on commit ed1ac98

Please sign in to comment.