native modules for all available architectures

This commit is contained in:
antelle 2020-05-13 19:15:56 +02:00
parent cc750df077
commit 530316c25f
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
5 changed files with 8 additions and 10 deletions

View File

@ -1,4 +1,3 @@
import EventEmitter from 'events';
import { Events } from 'framework/events';
import { Logger } from 'util/logger';
import { Launcher } from 'comp/launcher';
@ -9,7 +8,7 @@ import { Features } from 'util/features';
const logger = new Logger('usb-listener');
const UsbListener = {
supported: Launcher && Features.canUseNativeModules,
supported: Features.isDesktop,
attachedYubiKeys: 0,
init() {

View File

@ -17,8 +17,6 @@ const Features = {
!/^http(s?):\/\/((localhost:8085)|((app|beta)\.keeweb\.info))/.test(location.href),
isLocal: location.origin.indexOf('localhost') >= 0,
canUseWasmInWebWorker: !isDesktop && !/Chrome/.test(navigator.appVersion),
canUseNativeModules:
isDesktop && !(process.platform === 'win32' && !process.arch.includes('64')),
supportsTitleBarStyles() {
return this.isMac;

View File

@ -148,7 +148,8 @@ app.getMainWindow = function() {
};
app.setGlobalShortcuts = setGlobalShortcuts;
app.reqNative = function(mod) {
const binding = require(`@keeweb/keeweb-native-modules/${mod}.${process.platform}.node`);
const fileName = `${mod}-${process.platform}-${process.arch}.node`;
const binding = require(`@keeweb/keeweb-native-modules/${fileName}`);
if (mod === 'usb') {
Object.keys(EventEmitter.prototype).forEach(key => {
binding[key] = EventEmitter.prototype[key];

8
package-lock.json generated
View File

@ -1407,8 +1407,8 @@
}
},
"@keeweb/keeweb-native-modules": {
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.1.6/keeweb-native-modules.tgz",
"integrity": "sha512-fPBfPB1iVZziG23YlZXw9jwd31veHtnkGARwu2JlosaGPFs//lcELmGirD2B0/31HcyzikG8GfIkEgfTBRij0A=="
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.1.8/keeweb-native-modules.tgz",
"integrity": "sha512-QT8VbgC8C6klfmxtEMMXnhefW6KcCcK1/YijZaN8Ix0XqC3EZM6VOtvGVcBxgXGGJ1ROt/Qg0gR5FJidK50jCA=="
},
"@sindresorhus/is": {
"version": "0.14.0",
@ -7327,8 +7327,8 @@
}
},
"grunt-appdmg": {
"version": "1.0.0",
"resolved": "github:keeweb/grunt-appdmg#874ad8356f9309401ecb99ab84bb4a693413fa7a",
"version": "github:keeweb/grunt-appdmg#874ad8356f9309401ecb99ab84bb4a693413fa7a",
"from": "github:keeweb/grunt-appdmg#874ad83",
"optional": true,
"requires": {
"appdmg": "^0.6.0",

View File

@ -15,7 +15,7 @@
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/preset-env": "^7.9.6",
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.1.6/keeweb-native-modules.tgz",
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.1.8/keeweb-native-modules.tgz",
"adm-zip": "^0.4.14",
"argon2-browser": "1.13.0",
"autoprefixer": "^9.7.6",