Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
console.log('Handling expo-playground sub-route:', path);
// 保存完整的原始URL到sessionStorage供应用恢复路由
sessionStorage.setItem('spa_redirect_url', path + fullUrl);
// 重定向到应用首页,让React Router处理路由恢复
window.location.replace('/expo-playground/');
// 直接重定向到 index.html,保持 URL 不变
window.location.replace('/expo-playground/index.html');
return;
}
return;
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-examples/electron-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hardware-example",
"productName": "HardwareExample",
"executableName": "onekey-hardware-example",
"version": "1.1.14",
"version": "1.1.15-alpha.0",
"author": "OneKey",
"description": "End-to-end encrypted workspaces for teams",
"main": "dist/index.js",
Expand All @@ -22,7 +22,7 @@
"ts:check": "yarn tsc --noEmit"
},
"dependencies": {
"@onekeyfe/hd-transport-electron": "1.1.14",
"@onekeyfe/hd-transport-electron": "1.1.15-alpha.0",
"@stoprocent/noble": "2.3.4",
"debug": "4.3.4",
"electron-is-dev": "^3.0.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/connect-examples/expo-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo-example",
"version": "1.1.14",
"version": "1.1.15-alpha.0",
"scripts": {
"start": "cross-env CONNECT_SRC=https://localhost:8087/ yarn expo start --dev-client",
"android": "yarn expo run:android",
Expand All @@ -19,10 +19,10 @@
"@noble/ed25519": "^2.1.0",
"@noble/hashes": "^1.3.3",
"@noble/secp256k1": "^1.7.1",
"@onekeyfe/hd-ble-sdk": "1.1.14",
"@onekeyfe/hd-common-connect-sdk": "1.1.14",
"@onekeyfe/hd-core": "1.1.14",
"@onekeyfe/hd-web-sdk": "1.1.14",
"@onekeyfe/hd-ble-sdk": "1.1.15-alpha.0",
"@onekeyfe/hd-common-connect-sdk": "1.1.15-alpha.0",
"@onekeyfe/hd-core": "1.1.15-alpha.0",
"@onekeyfe/hd-web-sdk": "1.1.15-alpha.0",
"@onekeyfe/react-native-ble-utils": "^0.1.3",
"@polkadot/util-crypto": "13.1.1",
"@react-native-async-storage/async-storage": "1.21.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,30 +278,37 @@ const ParameterInput: React.FC<ParameterInputProps> = ({
const acceptTypes = field.accept || config.accept;

return (
<div key={field.name} className="flex items-center gap-2">
<div className="min-w-0 flex-shrink-0 w-32">{renderFieldLabel(field)}</div>
<div className="flex-1 min-w-0">
<div className="relative">
<input
type="file"
accept={acceptTypes}
onChange={e => {
const file = e.target.files?.[0] || null;
handleParamChange(field.name, file);
}}
className="absolute inset-0 w-full h-full opacity-0 z-10"
/>
<div className="bg-background border border-border rounded-md px-3 py-1.5 text-xs hover:bg-muted/50 hover:border-primary cursor-pointer transition-colors select-none">
{currentValue ? (
<span className="text-foreground cursor-pointer">{currentValue.name}</span>
) : (
<span className="text-muted-foreground cursor-pointer">
{t('components.parameterInput.selectFirmwareFile', { title: config.title })}
</span>
)}
<div key={field.name} className="space-y-2">
<div className="flex items-center gap-2">
<div className="min-w-0 flex-shrink-0 w-32">{renderFieldLabel(field)}</div>
<div className="flex-1 min-w-0">
<div className="relative">
<input
type="file"
accept={acceptTypes}
onChange={e => {
const file = e.target.files?.[0] || null;
handleParamChange(field.name, file);
}}
className="absolute inset-0 w-full h-full opacity-0 z-10"
/>
<div className="bg-background border border-border rounded-md px-3 py-1.5 text-xs hover:bg-muted/50 hover:border-primary cursor-pointer transition-colors select-none">
{currentValue ? (
<span className="text-foreground cursor-pointer">{currentValue.name}</span>
) : (
<span className="text-muted-foreground cursor-pointer">
{t('components.parameterInput.selectFirmwareFile', { title: config.title })}
</span>
)}
</div>
</div>
</div>
</div>
{(field.description || config.description) && (
<div className="text-xs text-muted-foreground ml-34">
{field.description || config.description}
</div>
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const WebUsbAuthorizeDialog: React.FC<WebUsbAuthorizeDialogProps> = ({
</div>
<div className="flex-1">
<DialogTitle className="text-lg font-semibold mb-1">
{t('webusb.authorize.title', 'Authorize WebUSB')}
{t('firmware.webusb.authorize.title', 'Authorize WebUSB')}
</DialogTitle>
<DialogDescription className="text-xs text-muted-foreground leading-relaxed">
{t(
'webusb.authorize.description',
'firmware.webusb.authorize.description',
'Your device switched to bootloader mode to apply the update. Chrome treats this as a new USB device. Please authorize it to continue the firmware update.'
)}
</DialogDescription>
Expand All @@ -56,8 +56,8 @@ const WebUsbAuthorizeDialog: React.FC<WebUsbAuthorizeDialogProps> = ({
<ShieldCheck className="h-4 w-4 mt-0.5 text-foreground/60" />
<span>
{t(
'webusb.authorize.tip',
'Ensure your device is connected. If the chooser doesn’t appear, try a different USB port or reconnect the cable.'
'firmware.webusb.authorize.tip',
'Ensure your device is connected. If the chooser does not appear, try a different USB port or reconnect the cable.'
)}
</span>
</AlertDescription>
Expand Down Expand Up @@ -88,10 +88,10 @@ const WebUsbAuthorizeDialog: React.FC<WebUsbAuthorizeDialogProps> = ({
{loading ? (
<span className="inline-flex items-center gap-2">
<Loader2 className="h-4 w-4 animate-spin" />
{t('webusb.authorize.selecting', 'Selecting...')}
{t('firmware.webusb.authorize.selecting', 'Selecting...')}
</span>
) : (
t('webusb.authorize.selectButton', 'Select Device')
t('firmware.webusb.authorize.selectButton', 'Select Device')
)}
</Button>
</DialogFooter>
Expand All @@ -101,7 +101,7 @@ const WebUsbAuthorizeDialog: React.FC<WebUsbAuthorizeDialogProps> = ({
<AlertCircle className="h-3.5 w-3.5 mt-0.5" />
<p>
{t(
'webusb.authorize.troubleshooting',
'firmware.webusb.authorize.troubleshooting',
'If you close this dialog or dismiss the chooser, the update will pause. Reopen this dialog to continue when ready.'
)}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,36 +104,6 @@ const api: UnifiedMethodConfig[] = [
},
],
},
{
method: 'emmcFileWrite',
description: 'methodDescriptions.emmcFileWrite',
noDeviceIdReq: true,
presets: [
{
title: 'EMMC write file',
parameters: [
{
name: 'filePath',
type: 'string',
required: true,
label: 'EMMC Path',
placeholder: '0:boot/bootloader.bin',
value: '0:boot/bootloader.bin',
},
{
name: 'payload',
type: 'file',
required: true,
label: 'Binary',
description: 'Upload binary file (.bin) to write into EMMC',
accept: '.bin',
visible: true,
editable: true,
},
],
},
],
},
{
method: 'firmwareUpdateV3',
description: 'methodDescriptions.firmwareUpdateV3',
Expand Down Expand Up @@ -263,7 +233,23 @@ const api: UnifiedMethodConfig[] = [
method: 'deviceUpdateBootloader',
description: 'methodDescriptions.deviceUpdateBootloader',
noDeviceIdReq: true,
presets: [],
presets: [
{
title: 'Update bootloader',
parameters: [
{
name: 'binary',
type: 'file',
required: false,
label: 'Bootloader Binary',
description: 'Upload bootloader binary file (.bin). If not provided, latest will be downloaded automatically.',
accept: '.bin',
visible: true,
editable: true,
},
],
},
],
},
{
method: 'deviceRebootToBootloader',
Expand Down
23 changes: 8 additions & 15 deletions packages/connect-examples/expo-playground/app/entry.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,21 @@ const basename = process.env.NODE_ENV === 'production' ? '/expo-playground' : ''
// 处理从404页面重定向过来的路径恢复
function handleSpaRedirect() {
const redirectUrl = sessionStorage.getItem('spa_redirect_url');

if (redirectUrl) {
console.log('Found SPA redirect URL in sessionStorage:', redirectUrl);

// 清除 sessionStorage 中的重定向 URL
sessionStorage.removeItem('spa_redirect_url');

// 检查当前 URL 是否已经是目标 URL
const currentUrl = window.location.pathname + window.location.search + window.location.hash;
console.log('SPA redirect check:', { redirectUrl, currentUrl });

if (redirectUrl !== currentUrl) {
console.log('Restoring SPA route from redirect:', redirectUrl);
sessionStorage.removeItem('spa_redirect_url');

// 移除 basename 前缀来获取相对路径
const basename = '/expo-playground';
let targetPath = redirectUrl;
if (targetPath.startsWith(basename)) {
targetPath = targetPath.substring(basename.length) || '/';
}

console.log('Target path for router:', targetPath);

// 使用 window.history.replaceState 替换当前历史记录
// 使用 window.history.replaceState 恢复原始 URL
window.history.replaceState(null, '', redirectUrl);
} else {
// 如果路径已经匹配,清除重定向标记
sessionStorage.removeItem('spa_redirect_url');
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions packages/connect-examples/expo-playground/app/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const en = {
edit: 'Edit',
save: 'Save',
clear: 'Clear',
select: 'Select',
seInfo: 'Device SE Information',
},
deviceInfo: {
Expand Down Expand Up @@ -595,6 +596,20 @@ export const en = {
initError: 'SDK initialization failed',
initFailed: 'Initialization failed: {{error}}',
},
firmware: {
webusb: {
authorize: {
title: 'Authorize WebUSB',
description:
'Your device switched to bootloader mode to apply the update. Chrome treats this as a new USB device. Please authorize it to continue the firmware update.',
tip: 'Ensure your device is connected. If the chooser doesn\'t appear, try a different USB port or reconnect the cable.',
selectButton: 'Select Device',
selecting: 'Selecting...',
troubleshooting:
'If you close this dialog or dismiss the chooser, the update will pause. Reopen this dialog to continue when ready.',
},
},
},
search: {
sections: {
interface: 'Interface Control',
Expand Down
8 changes: 4 additions & 4 deletions packages/connect-examples/expo-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onekey-hardware-playground",
"version": "1.1.14",
"version": "1.1.15-alpha.0",
"private": true,
"sideEffects": [
"app/utils/shim.js",
Expand All @@ -17,9 +17,9 @@
},
"dependencies": {
"@noble/hashes": "^1.8.0",
"@onekeyfe/hd-core": "1.1.14",
"@onekeyfe/hd-shared": "1.1.14",
"@onekeyfe/hd-web-sdk": "1.1.14",
"@onekeyfe/hd-core": "1.1.15-alpha.0",
"@onekeyfe/hd-shared": "1.1.15-alpha.0",
"@onekeyfe/hd-web-sdk": "1.1.15-alpha.0",
"@radix-ui/react-checkbox": "^1.3.2",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-dropdown-menu": "^2.1.15",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* /index.html 200
/* /index.html 200
3 changes: 2 additions & 1 deletion packages/connect-examples/shared-constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
* - "dev": "CONNECT_SRC=https://localhost:8087 webpack serve --mode=development"
* - "start": "webpack serve --mode=development" (uses CDN)
*/
export const getConnectSrc = () => process.env.CONNECT_SRC || `https://jssdk.onekey.so/1.1.14/`;
export const getConnectSrc = () =>
process.env.CONNECT_SRC || `https://jssdk.onekey.so/1.1.15-alpha.0/`;
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-core",
"version": "1.1.14",
"version": "1.1.15-alpha.0",
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
Expand All @@ -25,8 +25,8 @@
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
},
"dependencies": {
"@onekeyfe/hd-shared": "1.1.14",
"@onekeyfe/hd-transport": "1.1.14",
"@onekeyfe/hd-shared": "1.1.15-alpha.0",
"@onekeyfe/hd-transport": "1.1.15-alpha.0",
"axios": "1.12.2",
"bignumber.js": "^9.0.2",
"bytebuffer": "^5.0.1",
Expand Down
49 changes: 0 additions & 49 deletions packages/core/src/api/EmmcFileWrite.ts

This file was deleted.

Loading