Remove experimental Bluetooth key transfer module
- Deleted BluetoothKeyTransfer.js and related classes - Removed BluetoothKeyTransfer.jsx UI component - Cleaned up Bluetooth imports from app-boot.js and bootstrap-modules.js - Removed Bluetooth buttons and handlers from main app - Eliminated all Bluetooth functionality due to Web Bluetooth API limitations - Browsers cannot create GATT servers or advertise devices - Reduced bundle size by ~78KB - Application now focuses on supported browser technologies (QR codes, manual key exchange, WebRTC)
This commit is contained in:
222
dist/app.js
vendored
222
dist/app.js
vendored
@@ -564,28 +564,7 @@ var EnhancedConnectionSetup = ({
|
||||
}
|
||||
})(),
|
||||
className: "flex-1 px-3 py-2 bg-orange-500/10 hover:bg-orange-500/20 text-orange-400 border border-orange-500/20 rounded text-sm font-medium"
|
||||
}, "Copy invitation code"),
|
||||
React.createElement("button", {
|
||||
key: "bluetooth-offer",
|
||||
onClick: () => {
|
||||
try {
|
||||
document.dispatchEvent(new CustomEvent("open-bluetooth-transfer", {
|
||||
detail: {
|
||||
role: "initiator",
|
||||
offerData
|
||||
}
|
||||
}));
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
className: "flex-1 px-3 py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border border-blue-500/20 rounded text-sm font-medium transition-all duration-200"
|
||||
}, [
|
||||
React.createElement("i", {
|
||||
key: "icon",
|
||||
className: "fas fa-bluetooth mr-2"
|
||||
}),
|
||||
"Send via Bluetooth"
|
||||
])
|
||||
}, "Copy invitation code")
|
||||
]),
|
||||
showQRCode && qrCodeUrl && React.createElement("div", {
|
||||
key: "qr-container",
|
||||
@@ -730,22 +709,6 @@ var EnhancedConnectionSetup = ({
|
||||
className: "fas fa-qrcode mr-2"
|
||||
}),
|
||||
"Scan QR Code"
|
||||
]),
|
||||
React.createElement("button", {
|
||||
key: "bluetooth-btn",
|
||||
onClick: () => {
|
||||
try {
|
||||
document.dispatchEvent(new CustomEvent("open-bluetooth-transfer", { detail: { role: "responder" } }));
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
className: "px-4 py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border border-blue-500/20 rounded text-sm font-medium transition-all duration-200"
|
||||
}, [
|
||||
React.createElement("i", {
|
||||
key: "icon",
|
||||
className: "fas fa-bluetooth mr-2"
|
||||
}),
|
||||
"Bluetooth"
|
||||
])
|
||||
]),
|
||||
React.createElement("textarea", {
|
||||
@@ -856,22 +819,6 @@ var EnhancedConnectionSetup = ({
|
||||
}),
|
||||
"Scan QR Code"
|
||||
]),
|
||||
React.createElement("button", {
|
||||
key: "bluetooth-btn",
|
||||
onClick: () => {
|
||||
try {
|
||||
document.dispatchEvent(new CustomEvent("open-bluetooth-transfer", { detail: { role: "initiator" } }));
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
className: "px-4 py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border border-blue-500/20 rounded text-sm font-medium transition-all duration-200"
|
||||
}, [
|
||||
React.createElement("i", {
|
||||
key: "icon",
|
||||
className: "fas fa-bluetooth mr-2"
|
||||
}),
|
||||
"Bluetooth"
|
||||
]),
|
||||
React.createElement("button", {
|
||||
key: "process-btn",
|
||||
onClick: onCreateAnswer,
|
||||
@@ -1385,24 +1332,6 @@ var EnhancedSecureP2PChat = () => {
|
||||
const [qrCodeUrl, setQrCodeUrl] = React.useState("");
|
||||
const [showQRScanner, setShowQRScanner] = React.useState(false);
|
||||
const [showQRScannerModal, setShowQRScannerModal] = React.useState(false);
|
||||
const [showBluetoothTransfer, setShowBluetoothTransfer] = React.useState(false);
|
||||
const [bluetoothAutoRole, setBluetoothAutoRole] = React.useState(null);
|
||||
const [bluetoothOfferData, setBluetoothOfferData] = React.useState(null);
|
||||
React.useEffect(() => {
|
||||
const openBt = (e) => {
|
||||
try {
|
||||
const role = e?.detail?.role || null;
|
||||
const offerData2 = e?.detail?.offerData || null;
|
||||
setBluetoothAutoRole(role);
|
||||
setBluetoothOfferData(offerData2);
|
||||
setShowBluetoothTransfer(true);
|
||||
} catch {
|
||||
}
|
||||
};
|
||||
document.addEventListener("open-bluetooth-transfer", openBt);
|
||||
return () => document.removeEventListener("open-bluetooth-transfer", openBt);
|
||||
}, []);
|
||||
const [bluetoothManager, setBluetoothManager] = React.useState(null);
|
||||
const [isVerified, setIsVerified] = React.useState(false);
|
||||
const [securityLevel, setSecurityLevel] = React.useState(null);
|
||||
const [sessionTimeLeft, setSessionTimeLeft] = React.useState(0);
|
||||
@@ -2479,138 +2408,6 @@ var EnhancedSecureP2PChat = () => {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const handleBluetoothKeyReceived = async (keyData, deviceId) => {
|
||||
try {
|
||||
console.log("Bluetooth key received from device:", deviceId);
|
||||
const keyString = JSON.stringify(keyData, null, 2);
|
||||
if (showOfferStep) {
|
||||
setAnswerInput(keyString);
|
||||
} else {
|
||||
setOfferInput(keyString);
|
||||
}
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Bluetooth key received successfully!",
|
||||
type: "success"
|
||||
}]);
|
||||
setShowBluetoothTransfer(false);
|
||||
} catch (error) {
|
||||
console.error("Failed to process Bluetooth key:", error);
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "Failed to process Bluetooth key: " + error.message,
|
||||
type: "error"
|
||||
}]);
|
||||
}
|
||||
};
|
||||
const handleBluetoothStatusChange = (statusType, data) => {
|
||||
console.log("Bluetooth status change:", statusType, data);
|
||||
switch (statusType) {
|
||||
case "bluetooth_ready":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Bluetooth ready for key exchange",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "connected":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: `\u{1F535} Connected to device: ${data.deviceName}`,
|
||||
type: "success"
|
||||
}]);
|
||||
break;
|
||||
case "key_sent":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Public key sent via Bluetooth",
|
||||
type: "success"
|
||||
}]);
|
||||
break;
|
||||
case "key_received":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Public key received via Bluetooth",
|
||||
type: "success"
|
||||
}]);
|
||||
break;
|
||||
case "auto_connection_starting":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Starting automatic connection...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "creating_offer":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Creating secure offer...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "offer_sent":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Offer sent, waiting for answer...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "waiting_for_answer":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Waiting for answer...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "processing_answer":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Processing answer...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "waiting_for_verification":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Waiting for verification...",
|
||||
type: "info"
|
||||
}]);
|
||||
break;
|
||||
case "auto_connection_complete":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Automatic connection completed!",
|
||||
type: "success"
|
||||
}]);
|
||||
break;
|
||||
case "auto_connection_failed":
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Automatic connection failed: " + (data.error || "Unknown error"),
|
||||
type: "error"
|
||||
}]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
const handleBluetoothError = (error) => {
|
||||
console.error("Bluetooth error:", error);
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "Bluetooth error: " + error.message,
|
||||
type: "error"
|
||||
}]);
|
||||
};
|
||||
const handleBluetoothAutoConnection = async (answerData2, deviceId) => {
|
||||
try {
|
||||
console.log("Bluetooth auto connection - answer received:", answerData2);
|
||||
setAnswerData(answerData2);
|
||||
if (webrtcManagerRef.current) {
|
||||
await webrtcManagerRef.current.processAnswer(answerData2);
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "\u{1F535} Bluetooth connection established successfully!",
|
||||
type: "success",
|
||||
id: Date.now(),
|
||||
timestamp: Date.now()
|
||||
}]);
|
||||
setConnectionStatus("connected");
|
||||
setShowBluetoothTransfer(false);
|
||||
setShowVerification(true);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to process auto connection:", error);
|
||||
setMessages((prev) => [...prev, {
|
||||
message: "Failed to process auto connection: " + error.message,
|
||||
type: "error",
|
||||
id: Date.now(),
|
||||
timestamp: Date.now()
|
||||
}]);
|
||||
}
|
||||
};
|
||||
const handleCreateOffer = async () => {
|
||||
try {
|
||||
setOfferData("");
|
||||
@@ -3081,8 +2878,6 @@ var EnhancedSecureP2PChat = () => {
|
||||
setQrCodeUrl("");
|
||||
setShowQRScanner(false);
|
||||
setShowQRScannerModal(false);
|
||||
setShowBluetoothTransfer(false);
|
||||
setBluetoothAutoRole(null);
|
||||
setMessages([]);
|
||||
if (typeof console.clear === "function") {
|
||||
console.clear();
|
||||
@@ -3354,20 +3149,7 @@ var EnhancedSecureP2PChat = () => {
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
// Bluetooth Key Transfer Modal
|
||||
showBluetoothTransfer && window.BluetoothKeyTransfer && React.createElement(window.BluetoothKeyTransfer, {
|
||||
key: "bluetooth-transfer-modal",
|
||||
webrtcManager: webrtcManagerRef.current,
|
||||
onKeyReceived: handleBluetoothKeyReceived,
|
||||
onStatusChange: handleBluetoothStatusChange,
|
||||
onError: handleBluetoothError,
|
||||
onAutoConnection: handleBluetoothAutoConnection,
|
||||
isVisible: showBluetoothTransfer,
|
||||
onClose: () => setShowBluetoothTransfer(false),
|
||||
role: bluetoothAutoRole,
|
||||
offerData: bluetoothOfferData
|
||||
})
|
||||
])
|
||||
]);
|
||||
};
|
||||
function initializeApp() {
|
||||
|
||||
Reference in New Issue
Block a user