@cappitolian/http-local-server-swifter 0.0.21 → 0.0.22
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.
|
@@ -65,8 +65,13 @@ import UIKit
|
|
|
65
65
|
|
|
66
66
|
// Timeout fallback — if neither probe resolves, allow startup.
|
|
67
67
|
// Covers: simulator, already-granted permission where iOS skips the callback.
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
// 6s gives iOS enough time to evaluate a previously-revoked permission,
|
|
69
|
+
// which can take longer than a first-time denial.
|
|
70
|
+
let timeout = DispatchWorkItem {
|
|
71
|
+
print("⚠️ LocalNetworkPermission: timeout reached — resolving as .unknown")
|
|
72
|
+
finish(.unknown)
|
|
73
|
+
}
|
|
74
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 6.0, execute: timeout)
|
|
70
75
|
|
|
71
76
|
// --- Probe 1: NWBrowser (authoritative for permission status) ---
|
|
72
77
|
// Uses the app's registered Bonjour type so iOS evaluates the real permission.
|
|
@@ -81,11 +86,13 @@ import UIKit
|
|
|
81
86
|
self.browser = browser
|
|
82
87
|
|
|
83
88
|
browser.stateUpdateHandler = { state in
|
|
89
|
+
print("🔍 LocalNetworkPermission NWBrowser state: \(state)")
|
|
84
90
|
switch state {
|
|
85
91
|
case .ready:
|
|
86
92
|
timeout.cancel()
|
|
87
93
|
finish(.granted)
|
|
88
94
|
case .failed(let error):
|
|
95
|
+
print("🔍 LocalNetworkPermission NWBrowser error code: \((error as NSError).code) — \(error.localizedDescription)")
|
|
89
96
|
if Self.isPolicyDenied(error) {
|
|
90
97
|
timeout.cancel()
|
|
91
98
|
finish(.denied)
|
|
@@ -110,14 +117,17 @@ import UIKit
|
|
|
110
117
|
self.udpConnection = conn
|
|
111
118
|
|
|
112
119
|
conn.stateUpdateHandler = { state in
|
|
120
|
+
print("🔍 LocalNetworkPermission UDP state: \(state)")
|
|
113
121
|
switch state {
|
|
114
122
|
case .waiting(let error):
|
|
123
|
+
print("🔍 LocalNetworkPermission UDP waiting error code: \((error as NSError).code) — \(error.localizedDescription)")
|
|
115
124
|
if Self.isPolicyDenied(error) {
|
|
116
125
|
timeout.cancel()
|
|
117
126
|
finish(.denied)
|
|
118
127
|
}
|
|
119
128
|
// Other .waiting errors (no route, offline) are transient — ignore
|
|
120
129
|
case .failed(let error):
|
|
130
|
+
print("🔍 LocalNetworkPermission UDP failed error code: \((error as NSError).code) — \(error.localizedDescription)")
|
|
121
131
|
if Self.isPolicyDenied(error) {
|
|
122
132
|
timeout.cancel()
|
|
123
133
|
finish(.denied)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cappitolian/http-local-server-swifter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Runs a local HTTP server on your device, accessible over LAN. Supports connect, disconnect, GET, and POST methods with IP and port discovery.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|