serve-sim 0.0.7 → 0.0.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serve-sim",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Evan Bacon",
@@ -39,7 +39,6 @@
39
39
  "@types/bun": "latest",
40
40
  "mac-mini-client": "workspace:*",
41
41
  "preact": "^10.29.1",
42
- "radix-ui": "^1.4.3",
43
42
  "react": "^19.0.0",
44
43
  "react-dom": "^19.0.0",
45
44
  "typescript": "^5.7.0"
package/src/middleware.ts CHANGED
@@ -150,7 +150,9 @@ export function simMiddleware(options?: SimMiddlewareOptions) {
150
150
  const base = (options?.basePath ?? "/.sim").replace(/\/+$/, "");
151
151
 
152
152
  return (req: any, res: any, next?: () => void) => {
153
- const url: string = req.url ?? "";
153
+ const rawUrl: string = req.url ?? "";
154
+ const qIndex = rawUrl.indexOf("?");
155
+ const url = qIndex === -1 ? rawUrl : rawUrl.slice(0, qIndex);
154
156
 
155
157
  // Serve the preview page
156
158
  if (url === base || url === base + "/") {
@@ -220,7 +222,7 @@ export function simMiddleware(options?: SimMiddlewareOptions) {
220
222
  }
221
223
 
222
224
  // SSE: simctl log stream
223
- if (url === base + "/logs" || url.startsWith(base + "/logs?")) {
225
+ if (url === base + "/logs") {
224
226
  const states = readServeSimStates();
225
227
  if (states.length === 0) {
226
228
  res.writeHead(404);
@@ -262,7 +264,7 @@ export function simMiddleware(options?: SimMiddlewareOptions) {
262
264
  // parsed from SpringBoard's "Setting process visibility to: Foreground"
263
265
  // log line. Filtering is done here (not in the browser) so the SSE stream
264
266
  // stays narrow and the client can listen without rate-limit concerns.
265
- if (url === base + "/appstate" || url.startsWith(base + "/appstate?")) {
267
+ if (url === base + "/appstate") {
266
268
  const states = readServeSimStates();
267
269
  if (states.length === 0) {
268
270
  res.writeHead(404);