From 06ce3c889b3b0af4948b96693ca98b98a75bf698 Mon Sep 17 00:00:00 2001 From: Leyang Date: Fri, 18 Apr 2025 17:03:00 +0800 Subject: [PATCH] android playground compatible with windows (#592) * fix(playground): simplify class property definitions and add root redirect for static file serving * fix(scrcpy-player): update empty state rendering logic to handle server validity more accurately --- apps/android-playground/src/scrcpy-player/index.tsx | 5 +++-- packages/web-integration/src/playground/server.ts | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/android-playground/src/scrcpy-player/index.tsx b/apps/android-playground/src/scrcpy-player/index.tsx index 199c6ede4..104a1608e 100644 --- a/apps/android-playground/src/scrcpy-player/index.tsx +++ b/apps/android-playground/src/scrcpy-player/index.tsx @@ -785,7 +785,7 @@ export const ScrcpyPlayer = forwardRef(
- {!connected && serverValid ? ( + {!connected && serverValid && (
📱
@@ -809,7 +809,8 @@ export const ScrcpyPlayer = forwardRef(
)}
- ) : ( + )} + {!serverValid && ( Please launch playground server! )}
diff --git a/packages/web-integration/src/playground/server.ts b/packages/web-integration/src/playground/server.ts index a00aa1d53..b88d36b01 100644 --- a/packages/web-integration/src/playground/server.ts +++ b/packages/web-integration/src/playground/server.ts @@ -269,6 +269,11 @@ export default class PlaygroundServer { // Set up static file serving after all API routes are defined if (this.staticPath) { + this.app.get('/', (req, res) => { + // compatible with windows + res.redirect('/index.html'); + }); + this.app.get('*', (req, res) => { const requestedPath = join(this.staticPath!, req.path); if (existsSync(requestedPath)) {