Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hardware-example

Package Overview
Dependencies
Maintainers
0
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardware-example - npm Package Compare versions

Comparing version 1.0.0-alpha.12 to 1.0.0

src/config.ts

28

electron-builder.config.js
/* eslint-disable no-template-curly-in-string */
// eslint-disable-next-line import/no-import-module-exports, @typescript-eslint/no-var-requires
const { version } = require('./package.json');
module.exports = {
extraMetadata: {
main: 'dist/index.js',
version: '1',
version,
},

@@ -11,3 +14,3 @@ appId: 'so.onekey.example.hardware-desktop',

asar: true,
buildVersion: '1',
buildVersion: version,
directories: {

@@ -24,2 +27,3 @@ output: 'out',

'package.json',
'!scripts/**',
],

@@ -69,4 +73,4 @@ extraResources: [

target: [
// { target: 'dmg', arch: ['x64', 'arm64'] },
{ target: 'zip', arch: ['x64', 'arm64'] },
{ target: 'dmg', arch: ['x64', 'arm64'] },
// { target: 'zip', arch: ['x64', 'arm64'] },
],

@@ -88,3 +92,8 @@ entitlements: 'entitlements.mac.plist',

verifyUpdateCodeSignature: false,
target: ['nsis'],
target: [
{
target: 'nsis',
arch: ['x64'],
},
],
},

@@ -104,2 +113,11 @@ linux: {

},
publish: [
{
provider: 'github',
owner: 'OneKeyHQ',
repo: 'hardware-js-sdk',
private: false,
vPrefixedTagName: true,
},
],
};

10

package.json

@@ -5,3 +5,3 @@ {

"executableName": "onekey-hardware-example",
"version": "1.0.0-alpha.12",
"version": "1.0.0",
"author": "OneKey",

@@ -18,5 +18,4 @@ "description": "End-to-end encrypted workspaces for teams",

"dev:electron": "electron --inspect=5858 dist/index.js",
"build:package": "yarn build-electron-web && electron-forge package",
"build:main": "webpack --config webpack.config.ts",
"make": "yarn clean:build && yarn build-electron-web && electron-builder build -mw --config electron-builder.config.js --publish never",
"make": "yarn clean:build && yarn build-electron-web && electron-builder build -mw --config electron-builder.config.js --publish always",
"lint": "eslint --ext .tsx --ext .ts ./",

@@ -28,2 +27,5 @@ "ts:check": "yarn tsc --noEmit"

"electron-is-dev": "^3.0.1",
"electron-log": "^5.1.5",
"electron-updater": "^6.2.1",
"fs-extra": "^11.2.0",
"node-fetch": "^2.6.7"

@@ -41,3 +43,3 @@ },

},
"gitHead": "6d0a628ca0e177cdb2052b8c141cb94cf0875d7a"
"gitHead": "95900f4bc9cb2a286b154e2e742cfe97c5c31b1e"
}

@@ -1,7 +0,15 @@

import { screen, app, BrowserWindow, session } from 'electron';
import { screen, app, BrowserWindow, session, ipcMain } from 'electron';
import path from 'path';
import isDevelopment from 'electron-is-dev';
import { format as formatUrl } from 'url';
import initProcess from './process';
import log from 'electron-log';
import { autoUpdater } from 'electron-updater';
import initProcess, { restartBridge } from './process';
import { ipcMessageKeys } from './config';
// Set log level
log.transports.file.level = 'info';
log.transports.console.level = 'info';
autoUpdater.logger = log;
const isMac = process.platform === 'darwin';

@@ -89,3 +97,3 @@ const isWin = process.platform === 'win32';

console.log('browserWindow >>>> did-finish-load');
browserWindow.webContents.send('SET_ONEKEY_DESKTOP_GLOBALS', {
browserWindow.webContents.send(ipcMessageKeys.INJECT_ONEKEY_DESKTOP_GLOBALS, {
resourcesPath: (global as any).resourcesPath,

@@ -214,2 +222,38 @@ staticPath: `file://${staticPath}`,

ipcMain.on(ipcMessageKeys.UPDATE_RESTART, () => {
log.info('App Quit And Install');
autoUpdater.quitAndInstall();
});
ipcMain.on(ipcMessageKeys.APP_RELOAD_BRIDGE_PROCESS, () => {
restartBridge();
});
// 配置 GitHub 发布提供者
autoUpdater.setFeedURL({
provider: 'github',
owner: 'OneKeyHQ',
repo: 'hardware-js-sdk',
private: false,
releaseType: 'release',
});
// 检查更新
app.on('ready', () => {
autoUpdater.on('update-available', () => {
log.info('Update available.');
mainWindow?.webContents?.send(ipcMessageKeys.UPDATE_AVAILABLE);
});
autoUpdater.on('update-downloaded', () => {
log.info('Update downloaded.');
mainWindow?.webContents?.send(ipcMessageKeys.UPDATE_DOWNLOADED);
});
setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
autoUpdater.checkForUpdatesAndNotify();
}, 5000);
});
// wuit when all windows are closed, except on macOS. There, it's common

@@ -216,0 +260,0 @@ // for applications and their menu bar to stay active until the user quits

/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unused-vars,@typescript-eslint/require-await */
import { ipcRenderer, contextBridge } from 'electron';
import { off } from 'process';
import { ipcMessageKeys } from './config';

@@ -15,3 +17,9 @@ export type DesktopAPI = {

ipcRenderer.on('SET_ONEKEY_DESKTOP_GLOBALS', (_, globals) => {
const validChannels = [
// Update events
ipcMessageKeys.UPDATE_AVAILABLE,
ipcMessageKeys.UPDATE_DOWNLOADED,
];
ipcRenderer.on(ipcMessageKeys.INJECT_ONEKEY_DESKTOP_GLOBALS, (_, globals) => {
// @ts-expect-error

@@ -23,4 +31,12 @@ window.ONEKEY_DESKTOP_GLOBALS = globals;

const desktopApi = {
on: (channel: string, func: (...args: any[]) => any) => {
if (validChannels.includes(channel)) {
ipcRenderer.on(channel, (_, ...args) => func(...args));
}
},
updateReload: () => {
ipcRenderer.send(ipcMessageKeys.UPDATE_RESTART);
},
reloadBridgeProcess: () => {
ipcRenderer.send('app/reloadBridgeProcess');
ipcRenderer.send(ipcMessageKeys.APP_RELOAD_BRIDGE_PROCESS);
},

@@ -27,0 +43,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc