@onekeyfe/inpage-providers-hub 2.2.65 → 2.2.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/clipboardOverride.js +182 -0
- package/dist/cjs/injectWeb3Provider.js +5 -1
- package/dist/clipboardOverride.d.ts +2 -0
- package/dist/clipboardOverride.js +179 -0
- package/dist/connectButtonHack/utils/utilsDomNodes.d.ts +1 -1
- package/dist/injectWeb3Provider.d.ts +2 -1
- package/dist/injectWeb3Provider.js +5 -1
- package/package.json +24 -24
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.injectClipboardOverride = injectClipboardOverride;
|
|
13
|
+
// Save original references immediately at module load time,
|
|
14
|
+
// before any DApp code can tamper with them.
|
|
15
|
+
const originalClipboard = typeof navigator !== 'undefined' ? navigator.clipboard : undefined;
|
|
16
|
+
const originalExecCommand = typeof document !== 'undefined' ? document.execCommand.bind(document) : undefined;
|
|
17
|
+
function createNotAllowedError() {
|
|
18
|
+
return new DOMException('Clipboard permission denied by wallet', 'NotAllowedError');
|
|
19
|
+
}
|
|
20
|
+
function injectClipboardOverride($private) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
if (typeof navigator === 'undefined')
|
|
23
|
+
return;
|
|
24
|
+
console.log('[OneKey] Clipboard override: initializing');
|
|
25
|
+
const rememberedOrigins = new Set();
|
|
26
|
+
const clipboardProxy = {
|
|
27
|
+
readText() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
var _a;
|
|
30
|
+
console.log('[OneKey] Clipboard: readText() intercepted');
|
|
31
|
+
if (rememberedOrigins.has(window.location.origin)) {
|
|
32
|
+
console.log('[OneKey] Clipboard: readText() - origin remembered, using original API');
|
|
33
|
+
if (!originalClipboard) {
|
|
34
|
+
throw new DOMException('Clipboard API not available', 'NotSupportedError');
|
|
35
|
+
}
|
|
36
|
+
return originalClipboard.readText();
|
|
37
|
+
}
|
|
38
|
+
console.log('[OneKey] Clipboard: readText() requesting permission');
|
|
39
|
+
try {
|
|
40
|
+
const result = yield $private.request({
|
|
41
|
+
method: 'wallet_requestClipboardPermission',
|
|
42
|
+
params: { type: 'read' },
|
|
43
|
+
});
|
|
44
|
+
console.log('[OneKey] Clipboard: readText() permission result:', result === null || result === void 0 ? void 0 : result.allowed);
|
|
45
|
+
if (!(result === null || result === void 0 ? void 0 : result.allowed))
|
|
46
|
+
throw createNotAllowedError();
|
|
47
|
+
if (result.remember) {
|
|
48
|
+
rememberedOrigins.add(window.location.origin);
|
|
49
|
+
console.log('[OneKey] Clipboard: origin remembered for this session');
|
|
50
|
+
}
|
|
51
|
+
return (_a = result.content) !== null && _a !== void 0 ? _a : '';
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
if (e instanceof DOMException)
|
|
55
|
+
throw e;
|
|
56
|
+
throw createNotAllowedError();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
read() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
// ClipboardItems are complex (binary data), not supported through bridge
|
|
63
|
+
// Fall back to readText and wrap as plain text ClipboardItem
|
|
64
|
+
const text = yield clipboardProxy.readText();
|
|
65
|
+
const blob = new Blob([text], { type: 'text/plain' });
|
|
66
|
+
return [new ClipboardItem({ 'text/plain': blob })];
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
writeText(text) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
console.log('[OneKey] Clipboard: writeText() intercepted');
|
|
72
|
+
if (rememberedOrigins.has(window.location.origin)) {
|
|
73
|
+
console.log('[OneKey] Clipboard: writeText() - origin remembered, using original API');
|
|
74
|
+
if (!originalClipboard) {
|
|
75
|
+
throw new DOMException('Clipboard API not available', 'NotSupportedError');
|
|
76
|
+
}
|
|
77
|
+
return originalClipboard.writeText(text);
|
|
78
|
+
}
|
|
79
|
+
console.log('[OneKey] Clipboard: writeText() requesting permission');
|
|
80
|
+
try {
|
|
81
|
+
const result = yield $private.request({
|
|
82
|
+
method: 'wallet_requestClipboardPermission',
|
|
83
|
+
params: { type: 'write', text },
|
|
84
|
+
});
|
|
85
|
+
console.log('[OneKey] Clipboard: writeText() permission result:', result === null || result === void 0 ? void 0 : result.allowed);
|
|
86
|
+
if (!(result === null || result === void 0 ? void 0 : result.allowed))
|
|
87
|
+
throw createNotAllowedError();
|
|
88
|
+
if (result.remember) {
|
|
89
|
+
rememberedOrigins.add(window.location.origin);
|
|
90
|
+
console.log('[OneKey] Clipboard: origin remembered for this session');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
if (e instanceof DOMException)
|
|
95
|
+
throw e;
|
|
96
|
+
throw createNotAllowedError();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
write(data) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
// Extract text from ClipboardItems and delegate to writeText
|
|
103
|
+
for (const item of data) {
|
|
104
|
+
if (item.types.includes('text/plain')) {
|
|
105
|
+
const blob = yield item.getType('text/plain');
|
|
106
|
+
const text = yield blob.text();
|
|
107
|
+
return clipboardProxy.writeText(text);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw new DOMException('No text/plain data in ClipboardItems', 'NotSupportedError');
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
addEventListener: (_a = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.addEventListener) === null || _a === void 0 ? void 0 : _a.bind(originalClipboard),
|
|
114
|
+
removeEventListener: (_b = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.removeEventListener) === null || _b === void 0 ? void 0 : _b.bind(originalClipboard),
|
|
115
|
+
dispatchEvent: (_c = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.dispatchEvent) === null || _c === void 0 ? void 0 : _c.bind(originalClipboard),
|
|
116
|
+
};
|
|
117
|
+
const navigatorProxy = new Proxy(navigator, {
|
|
118
|
+
get(target, prop) {
|
|
119
|
+
if (prop === 'clipboard')
|
|
120
|
+
return clipboardProxy;
|
|
121
|
+
// Use target (not receiver) so native getters run with the real
|
|
122
|
+
// Navigator as `this`, avoiding "Illegal invocation" in Electron
|
|
123
|
+
// webFrame.executeJavaScript() and other sandboxed contexts.
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
125
|
+
const value = Reflect.get(target, prop, target);
|
|
126
|
+
if (typeof value === 'function') {
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/ban-types
|
|
128
|
+
return value.bind(target);
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
try {
|
|
134
|
+
Object.defineProperty(window, 'navigator', {
|
|
135
|
+
value: navigatorProxy,
|
|
136
|
+
configurable: false,
|
|
137
|
+
enumerable: true,
|
|
138
|
+
});
|
|
139
|
+
console.log('[OneKey] Clipboard override: success (navigator proxy)');
|
|
140
|
+
}
|
|
141
|
+
catch (_d) {
|
|
142
|
+
try {
|
|
143
|
+
Object.defineProperty(navigator, 'clipboard', {
|
|
144
|
+
value: clipboardProxy,
|
|
145
|
+
configurable: false,
|
|
146
|
+
enumerable: true,
|
|
147
|
+
});
|
|
148
|
+
console.log('[OneKey] Clipboard override: success (clipboard direct)');
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
console.warn('[OneKey] Clipboard override: FAILED - clipboard access is NOT protected', e);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Override document.execCommand for 'copy' and 'paste'
|
|
155
|
+
if (typeof document !== 'undefined' && originalExecCommand) {
|
|
156
|
+
try {
|
|
157
|
+
Object.defineProperty(document, 'execCommand', {
|
|
158
|
+
value: function (command, showUI, value) {
|
|
159
|
+
const cmd = command.toLowerCase();
|
|
160
|
+
if (cmd === 'copy' || cmd === 'paste') {
|
|
161
|
+
console.log(`[OneKey] Clipboard: execCommand('${cmd}') blocked`);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
return originalExecCommand(command, showUI, value);
|
|
165
|
+
},
|
|
166
|
+
configurable: false,
|
|
167
|
+
writable: false,
|
|
168
|
+
});
|
|
169
|
+
console.log('[OneKey] Clipboard override: execCommand locked');
|
|
170
|
+
}
|
|
171
|
+
catch (_e) {
|
|
172
|
+
// Fallback to simple assignment if defineProperty fails
|
|
173
|
+
document.execCommand = function (command, showUI, value) {
|
|
174
|
+
const cmd = command.toLowerCase();
|
|
175
|
+
if (cmd === 'copy' || cmd === 'paste') {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
return originalExecCommand(command, showUI, value);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -33,10 +33,11 @@ const consts_1 = require("./connectButtonHack/consts");
|
|
|
33
33
|
const detectRiskWebsite_1 = require("./detectRiskWebsite");
|
|
34
34
|
const floatingButton_1 = require("./floatingButton");
|
|
35
35
|
const hyperLiquidOneKeyWalletApi_1 = __importDefault(require("./builtInPerpInjected/hyperLiquidOneKeyWalletApi"));
|
|
36
|
+
const clipboardOverride_1 = require("./clipboardOverride");
|
|
36
37
|
function isMobileWeb() {
|
|
37
38
|
return (typeof navigator !== 'undefined' && /iPhone|iPad|iPod|Android|Mobi/i.test(navigator.userAgent));
|
|
38
39
|
}
|
|
39
|
-
function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
40
|
+
function injectWeb3Provider({ showFloatingButton = false, enableClipboardOverride = true, } = {}) {
|
|
40
41
|
var _a, _b;
|
|
41
42
|
if (!((_a = window === null || window === void 0 ? void 0 : window.$onekey) === null || _a === void 0 ? void 0 : _a.jsBridge)) {
|
|
42
43
|
throw new Error('OneKey jsBridge not found.');
|
|
@@ -57,6 +58,9 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
57
58
|
const $private = new onekey_private_provider_1.ProviderPrivate({
|
|
58
59
|
bridge,
|
|
59
60
|
});
|
|
61
|
+
if (enableClipboardOverride) {
|
|
62
|
+
(0, clipboardOverride_1.injectClipboardOverride)($private);
|
|
63
|
+
}
|
|
60
64
|
const solana = new onekey_solana_provider_1.ProviderSolana({
|
|
61
65
|
bridge,
|
|
62
66
|
});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
// Save original references immediately at module load time,
|
|
11
|
+
// before any DApp code can tamper with them.
|
|
12
|
+
const originalClipboard = typeof navigator !== 'undefined' ? navigator.clipboard : undefined;
|
|
13
|
+
const originalExecCommand = typeof document !== 'undefined' ? document.execCommand.bind(document) : undefined;
|
|
14
|
+
function createNotAllowedError() {
|
|
15
|
+
return new DOMException('Clipboard permission denied by wallet', 'NotAllowedError');
|
|
16
|
+
}
|
|
17
|
+
export function injectClipboardOverride($private) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (typeof navigator === 'undefined')
|
|
20
|
+
return;
|
|
21
|
+
console.log('[OneKey] Clipboard override: initializing');
|
|
22
|
+
const rememberedOrigins = new Set();
|
|
23
|
+
const clipboardProxy = {
|
|
24
|
+
readText() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a;
|
|
27
|
+
console.log('[OneKey] Clipboard: readText() intercepted');
|
|
28
|
+
if (rememberedOrigins.has(window.location.origin)) {
|
|
29
|
+
console.log('[OneKey] Clipboard: readText() - origin remembered, using original API');
|
|
30
|
+
if (!originalClipboard) {
|
|
31
|
+
throw new DOMException('Clipboard API not available', 'NotSupportedError');
|
|
32
|
+
}
|
|
33
|
+
return originalClipboard.readText();
|
|
34
|
+
}
|
|
35
|
+
console.log('[OneKey] Clipboard: readText() requesting permission');
|
|
36
|
+
try {
|
|
37
|
+
const result = yield $private.request({
|
|
38
|
+
method: 'wallet_requestClipboardPermission',
|
|
39
|
+
params: { type: 'read' },
|
|
40
|
+
});
|
|
41
|
+
console.log('[OneKey] Clipboard: readText() permission result:', result === null || result === void 0 ? void 0 : result.allowed);
|
|
42
|
+
if (!(result === null || result === void 0 ? void 0 : result.allowed))
|
|
43
|
+
throw createNotAllowedError();
|
|
44
|
+
if (result.remember) {
|
|
45
|
+
rememberedOrigins.add(window.location.origin);
|
|
46
|
+
console.log('[OneKey] Clipboard: origin remembered for this session');
|
|
47
|
+
}
|
|
48
|
+
return (_a = result.content) !== null && _a !== void 0 ? _a : '';
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
if (e instanceof DOMException)
|
|
52
|
+
throw e;
|
|
53
|
+
throw createNotAllowedError();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
read() {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
// ClipboardItems are complex (binary data), not supported through bridge
|
|
60
|
+
// Fall back to readText and wrap as plain text ClipboardItem
|
|
61
|
+
const text = yield clipboardProxy.readText();
|
|
62
|
+
const blob = new Blob([text], { type: 'text/plain' });
|
|
63
|
+
return [new ClipboardItem({ 'text/plain': blob })];
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
writeText(text) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
console.log('[OneKey] Clipboard: writeText() intercepted');
|
|
69
|
+
if (rememberedOrigins.has(window.location.origin)) {
|
|
70
|
+
console.log('[OneKey] Clipboard: writeText() - origin remembered, using original API');
|
|
71
|
+
if (!originalClipboard) {
|
|
72
|
+
throw new DOMException('Clipboard API not available', 'NotSupportedError');
|
|
73
|
+
}
|
|
74
|
+
return originalClipboard.writeText(text);
|
|
75
|
+
}
|
|
76
|
+
console.log('[OneKey] Clipboard: writeText() requesting permission');
|
|
77
|
+
try {
|
|
78
|
+
const result = yield $private.request({
|
|
79
|
+
method: 'wallet_requestClipboardPermission',
|
|
80
|
+
params: { type: 'write', text },
|
|
81
|
+
});
|
|
82
|
+
console.log('[OneKey] Clipboard: writeText() permission result:', result === null || result === void 0 ? void 0 : result.allowed);
|
|
83
|
+
if (!(result === null || result === void 0 ? void 0 : result.allowed))
|
|
84
|
+
throw createNotAllowedError();
|
|
85
|
+
if (result.remember) {
|
|
86
|
+
rememberedOrigins.add(window.location.origin);
|
|
87
|
+
console.log('[OneKey] Clipboard: origin remembered for this session');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
if (e instanceof DOMException)
|
|
92
|
+
throw e;
|
|
93
|
+
throw createNotAllowedError();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
write(data) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
// Extract text from ClipboardItems and delegate to writeText
|
|
100
|
+
for (const item of data) {
|
|
101
|
+
if (item.types.includes('text/plain')) {
|
|
102
|
+
const blob = yield item.getType('text/plain');
|
|
103
|
+
const text = yield blob.text();
|
|
104
|
+
return clipboardProxy.writeText(text);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
throw new DOMException('No text/plain data in ClipboardItems', 'NotSupportedError');
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
addEventListener: (_a = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.addEventListener) === null || _a === void 0 ? void 0 : _a.bind(originalClipboard),
|
|
111
|
+
removeEventListener: (_b = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.removeEventListener) === null || _b === void 0 ? void 0 : _b.bind(originalClipboard),
|
|
112
|
+
dispatchEvent: (_c = originalClipboard === null || originalClipboard === void 0 ? void 0 : originalClipboard.dispatchEvent) === null || _c === void 0 ? void 0 : _c.bind(originalClipboard),
|
|
113
|
+
};
|
|
114
|
+
const navigatorProxy = new Proxy(navigator, {
|
|
115
|
+
get(target, prop) {
|
|
116
|
+
if (prop === 'clipboard')
|
|
117
|
+
return clipboardProxy;
|
|
118
|
+
// Use target (not receiver) so native getters run with the real
|
|
119
|
+
// Navigator as `this`, avoiding "Illegal invocation" in Electron
|
|
120
|
+
// webFrame.executeJavaScript() and other sandboxed contexts.
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
122
|
+
const value = Reflect.get(target, prop, target);
|
|
123
|
+
if (typeof value === 'function') {
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/ban-types
|
|
125
|
+
return value.bind(target);
|
|
126
|
+
}
|
|
127
|
+
return value;
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
try {
|
|
131
|
+
Object.defineProperty(window, 'navigator', {
|
|
132
|
+
value: navigatorProxy,
|
|
133
|
+
configurable: false,
|
|
134
|
+
enumerable: true,
|
|
135
|
+
});
|
|
136
|
+
console.log('[OneKey] Clipboard override: success (navigator proxy)');
|
|
137
|
+
}
|
|
138
|
+
catch (_d) {
|
|
139
|
+
try {
|
|
140
|
+
Object.defineProperty(navigator, 'clipboard', {
|
|
141
|
+
value: clipboardProxy,
|
|
142
|
+
configurable: false,
|
|
143
|
+
enumerable: true,
|
|
144
|
+
});
|
|
145
|
+
console.log('[OneKey] Clipboard override: success (clipboard direct)');
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
console.warn('[OneKey] Clipboard override: FAILED - clipboard access is NOT protected', e);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Override document.execCommand for 'copy' and 'paste'
|
|
152
|
+
if (typeof document !== 'undefined' && originalExecCommand) {
|
|
153
|
+
try {
|
|
154
|
+
Object.defineProperty(document, 'execCommand', {
|
|
155
|
+
value: function (command, showUI, value) {
|
|
156
|
+
const cmd = command.toLowerCase();
|
|
157
|
+
if (cmd === 'copy' || cmd === 'paste') {
|
|
158
|
+
console.log(`[OneKey] Clipboard: execCommand('${cmd}') blocked`);
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return originalExecCommand(command, showUI, value);
|
|
162
|
+
},
|
|
163
|
+
configurable: false,
|
|
164
|
+
writable: false,
|
|
165
|
+
});
|
|
166
|
+
console.log('[OneKey] Clipboard override: execCommand locked');
|
|
167
|
+
}
|
|
168
|
+
catch (_e) {
|
|
169
|
+
// Fallback to simple assignment if defineProperty fails
|
|
170
|
+
document.execCommand = function (command, showUI, value) {
|
|
171
|
+
const cmd = command.toLowerCase();
|
|
172
|
+
if (cmd === 'copy' || cmd === 'paste') {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
return originalExecCommand(command, showUI, value);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -6,7 +6,7 @@ declare function isInnerContentMatch(ele: HTMLElement | Element, text: string, o
|
|
|
6
6
|
findAsHtml?: boolean;
|
|
7
7
|
exactMatch?: boolean;
|
|
8
8
|
}): boolean;
|
|
9
|
-
declare function createElementFromHTML(htmlString: string):
|
|
9
|
+
declare function createElementFromHTML(htmlString: string): "" | ChildNode;
|
|
10
10
|
/**
|
|
11
11
|
* @description:
|
|
12
12
|
* only find the first text node match the text
|
|
@@ -54,7 +54,8 @@ export type IWindowOneKeyHub = {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
declare function injectWeb3Provider({ showFloatingButton, }?: {
|
|
57
|
+
declare function injectWeb3Provider({ showFloatingButton, enableClipboardOverride, }?: {
|
|
58
58
|
showFloatingButton?: boolean;
|
|
59
|
+
enableClipboardOverride?: boolean;
|
|
59
60
|
}): unknown;
|
|
60
61
|
export { injectWeb3Provider };
|
|
@@ -27,10 +27,11 @@ import { WALLET_CONNECT_INFO } from './connectButtonHack/consts';
|
|
|
27
27
|
import { detectWebsiteRiskLevel, listenPageFocus } from './detectRiskWebsite';
|
|
28
28
|
import { injectFloatingButton } from './floatingButton';
|
|
29
29
|
import hyperLiquidOneKeyWalletApi from './builtInPerpInjected/hyperLiquidOneKeyWalletApi';
|
|
30
|
+
import { injectClipboardOverride } from './clipboardOverride';
|
|
30
31
|
function isMobileWeb() {
|
|
31
32
|
return (typeof navigator !== 'undefined' && /iPhone|iPad|iPod|Android|Mobi/i.test(navigator.userAgent));
|
|
32
33
|
}
|
|
33
|
-
function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
34
|
+
function injectWeb3Provider({ showFloatingButton = false, enableClipboardOverride = true, } = {}) {
|
|
34
35
|
var _a, _b;
|
|
35
36
|
if (!((_a = window === null || window === void 0 ? void 0 : window.$onekey) === null || _a === void 0 ? void 0 : _a.jsBridge)) {
|
|
36
37
|
throw new Error('OneKey jsBridge not found.');
|
|
@@ -51,6 +52,9 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
51
52
|
const $private = new ProviderPrivate({
|
|
52
53
|
bridge,
|
|
53
54
|
});
|
|
55
|
+
if (enableClipboardOverride) {
|
|
56
|
+
injectClipboardOverride($private);
|
|
57
|
+
}
|
|
54
58
|
const solana = new ProviderSolana({
|
|
55
59
|
bridge,
|
|
56
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.66",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -27,28 +27,28 @@
|
|
|
27
27
|
"start": "tsc --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
32
|
-
"@onekeyfe/onekey-algo-provider": "2.2.
|
|
33
|
-
"@onekeyfe/onekey-alph-provider": "2.2.
|
|
34
|
-
"@onekeyfe/onekey-aptos-provider": "2.2.
|
|
35
|
-
"@onekeyfe/onekey-bfc-provider": "2.2.
|
|
36
|
-
"@onekeyfe/onekey-btc-provider": "2.2.
|
|
37
|
-
"@onekeyfe/onekey-cardano-provider": "2.2.
|
|
38
|
-
"@onekeyfe/onekey-conflux-provider": "2.2.
|
|
39
|
-
"@onekeyfe/onekey-cosmos-provider": "2.2.
|
|
40
|
-
"@onekeyfe/onekey-eth-provider": "2.2.
|
|
41
|
-
"@onekeyfe/onekey-neo-provider": "2.2.
|
|
42
|
-
"@onekeyfe/onekey-nostr-provider": "2.2.
|
|
43
|
-
"@onekeyfe/onekey-polkadot-provider": "2.2.
|
|
44
|
-
"@onekeyfe/onekey-private-provider": "2.2.
|
|
45
|
-
"@onekeyfe/onekey-scdo-provider": "2.2.
|
|
46
|
-
"@onekeyfe/onekey-solana-provider": "2.2.
|
|
47
|
-
"@onekeyfe/onekey-stellar-provider": "2.2.
|
|
48
|
-
"@onekeyfe/onekey-sui-provider": "2.2.
|
|
49
|
-
"@onekeyfe/onekey-ton-provider": "2.2.
|
|
50
|
-
"@onekeyfe/onekey-tron-provider": "2.2.
|
|
51
|
-
"@onekeyfe/onekey-webln-provider": "2.2.
|
|
30
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.66",
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.66",
|
|
32
|
+
"@onekeyfe/onekey-algo-provider": "2.2.66",
|
|
33
|
+
"@onekeyfe/onekey-alph-provider": "2.2.66",
|
|
34
|
+
"@onekeyfe/onekey-aptos-provider": "2.2.66",
|
|
35
|
+
"@onekeyfe/onekey-bfc-provider": "2.2.66",
|
|
36
|
+
"@onekeyfe/onekey-btc-provider": "2.2.66",
|
|
37
|
+
"@onekeyfe/onekey-cardano-provider": "2.2.66",
|
|
38
|
+
"@onekeyfe/onekey-conflux-provider": "2.2.66",
|
|
39
|
+
"@onekeyfe/onekey-cosmos-provider": "2.2.66",
|
|
40
|
+
"@onekeyfe/onekey-eth-provider": "2.2.66",
|
|
41
|
+
"@onekeyfe/onekey-neo-provider": "2.2.66",
|
|
42
|
+
"@onekeyfe/onekey-nostr-provider": "2.2.66",
|
|
43
|
+
"@onekeyfe/onekey-polkadot-provider": "2.2.66",
|
|
44
|
+
"@onekeyfe/onekey-private-provider": "2.2.66",
|
|
45
|
+
"@onekeyfe/onekey-scdo-provider": "2.2.66",
|
|
46
|
+
"@onekeyfe/onekey-solana-provider": "2.2.66",
|
|
47
|
+
"@onekeyfe/onekey-stellar-provider": "2.2.66",
|
|
48
|
+
"@onekeyfe/onekey-sui-provider": "2.2.66",
|
|
49
|
+
"@onekeyfe/onekey-ton-provider": "2.2.66",
|
|
50
|
+
"@onekeyfe/onekey-tron-provider": "2.2.66",
|
|
51
|
+
"@onekeyfe/onekey-webln-provider": "2.2.66",
|
|
52
52
|
"cipher-base": "^1.0.6",
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
54
|
"preact": "^10.25.1"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"@types/lodash-es": "^4.17.12",
|
|
58
58
|
"@types/node": "^20.12.7"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "9d42482e04f7562926dca8a47ef1617e7f77a91e"
|
|
61
61
|
}
|