feat: update RNode product configurations and improve code readability in Capabilities.js and test files

This commit is contained in:
Ivan 2026-07-24 11:29:43 -05:00
parent e0f1f99cd1
commit f89f91e267
No known key found for this signature in database
6 changed files with 519 additions and 525 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -48,9 +48,9 @@ function detectSerial(env, platform) {
const hasUsbPolyfillTarget = Boolean(env.navigator?.usb);
const hasPolyfillModule = Boolean(env.serial);
const hasNativeFlasher =
Boolean(env.MeshChatXAndroid)
&& typeof env.MeshChatXAndroid.hasNativeRNodeFlasher === "function"
&& Boolean(env.MeshChatXAndroid.hasNativeRNodeFlasher());
Boolean(env.MeshChatXAndroid) &&
typeof env.MeshChatXAndroid.hasNativeRNodeFlasher === "function" &&
Boolean(env.MeshChatXAndroid.hasNativeRNodeFlasher());
if (hasNativeFlasher) {
return {
@ -112,18 +112,14 @@ function detectBluetooth(env, platform) {
if (platform.hasMeshChatXAndroid) {
const bridge = env.MeshChatXAndroid;
const hasPerms =
typeof bridge?.hasBluetoothPermissions === "function"
? Boolean(bridge.hasBluetoothPermissions())
: false;
typeof bridge?.hasBluetoothPermissions === "function" ? Boolean(bridge.hasBluetoothPermissions()) : false;
return {
// WebView still has no Web Bluetooth GATT. Permissions matter for
// mesh RNode BLE and OS pairing. Keep transport disabled for flash
// selection, but surface a clearer reason + actions.
available: false,
kind: "android-bridge",
reason: hasPerms
? "android_bridge_no_web_bluetooth"
: "android_bluetooth_permission_required",
reason: hasPerms ? "android_bridge_no_web_bluetooth" : "android_bluetooth_permission_required",
};
}
return {

View file

@ -45,7 +45,9 @@ def test_ensure_codec2_prefers_java_load_library():
android_codec2.reset_codec2_preload_state_for_tests()
with (
patch.object(android_codec2, "_is_chaquopy_android", return_value=True),
patch.object(android_codec2, "_java_system_load_library", return_value=True) as java_load,
patch.object(
android_codec2, "_java_system_load_library", return_value=True
) as java_load,
patch.object(android_codec2, "_cdll_load") as cdll,
):
assert android_codec2.ensure_codec2_native_library() is True

View file

@ -61,9 +61,7 @@ describe("Capabilities.detectCapabilities", () => {
});
const caps = detectCapabilities({ env });
expect(caps.transports[TRANSPORT_BLUETOOTH].available).toBe(false);
expect(caps.transports[TRANSPORT_BLUETOOTH].reason).toBe(
"android_bluetooth_permission_required"
);
expect(caps.transports[TRANSPORT_BLUETOOTH].reason).toBe("android_bluetooth_permission_required");
});
it("reports bluetooth available when navigator.bluetooth is present", () => {

View file

@ -16,9 +16,7 @@ describe("remoteBackendUrl", () => {
it("normalizes http(s) LAN origins", () => {
expect(normalizeRemoteBackendUrl("http://192.168.1.10:9337/")).toBe("http://192.168.1.10:9337");
expect(normalizeRemoteBackendUrl("HTTPS://Mesh.Example:8443/app/")).toBe(
"https://mesh.example:8443/app"
);
expect(normalizeRemoteBackendUrl("HTTPS://Mesh.Example:8443/app/")).toBe("https://mesh.example:8443/app");
});
it("rejects unsafe URLs", () => {