diff --git a/local_backend/services/netinfo_helper.py b/local_backend/services/netinfo_helper.py index 4357ab5..ee50041 100644 --- a/local_backend/services/netinfo_helper.py +++ b/local_backend/services/netinfo_helper.py @@ -21,7 +21,6 @@ reports no IP instead of a wrong one. Standalone on purpose: standard library only, no app imports, no database. Run: python -m services.netinfo_helper """ -import fcntl import json import os import platform @@ -37,6 +36,7 @@ SIOCGIFADDR = 0x8915 def ipv4_of(ifname: str) -> str | None: """Primary IPv4 address of an interface, or None if it has none.""" + import fcntl # Linux-only; imported here so detect() stays testable anywhere with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s: try: packed = fcntl.ioctl(s.fileno(), SIOCGIFADDR, struct.pack("256s", ifname[:15].encode())) diff --git a/waiter_pwa/src/native/apiVersion.js b/waiter_pwa/src/native/apiVersion.js new file mode 100644 index 0000000..17b78fe --- /dev/null +++ b/waiter_pwa/src/native/apiVersion.js @@ -0,0 +1,3 @@ +// api_version values (from /api/system/identity) this build can talk to. +// Own module (no Vite-only imports) so the pure native logic stays testable in Node. +export const SUPPORTED_API_VERSIONS = [1] diff --git a/waiter_pwa/src/native/pairing.js b/waiter_pwa/src/native/pairing.js index 2c16d14..c8f8330 100644 --- a/waiter_pwa/src/native/pairing.js +++ b/waiter_pwa/src/native/pairing.js @@ -13,8 +13,9 @@ import { deliveryMode, saveVenue } from '../config/server' import { syncTrustedKeys, tlsBaseUrl } from './tls' -// api_version values (from /api/system/identity) this build can talk to. -export const SUPPORTED_API_VERSIONS = [1] +import { SUPPORTED_API_VERSIONS } from './apiVersion' + +export { SUPPORTED_API_VERSIONS } const PROBE_TIMEOUT_MS = 5000 diff --git a/waiter_pwa/src/native/rediscovery.js b/waiter_pwa/src/native/rediscovery.js index 528b057..6b4333c 100644 --- a/waiter_pwa/src/native/rediscovery.js +++ b/waiter_pwa/src/native/rediscovery.js @@ -11,7 +11,7 @@ * (new router, different subnet) still has the manual fallback: scan the QR. * Contract: docs/reference/lan-access.md */ -import { SUPPORTED_API_VERSIONS } from './pairing' +import { SUPPORTED_API_VERSIONS } from './apiVersion.js' const PROBE_TIMEOUT_MS = 1500 // The first TLS connection to a venue server in a fresh app process takes ~2s