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
This commit is contained in:
Leyang 2025-04-18 17:03:00 +08:00 committed by GitHub
parent 8fc7d74d0a
commit 06ce3c889b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -785,7 +785,7 @@ export const ScrcpyPlayer = forwardRef<ScrcpyRefMethods, ScrcpyProps>(
<div className="video-section">
<div ref={videoContainerRef} className="video-container">
<div className="canvas-wrapper" />
{!connected && serverValid ? (
{!connected && serverValid && (
<div className="empty-state">
<div className="empty-state-icon">📱</div>
<div className="empty-state-text">
@ -809,7 +809,8 @@ export const ScrcpyPlayer = forwardRef<ScrcpyRefMethods, ScrcpyProps>(
</div>
)}
</div>
) : (
)}
{!serverValid && (
<span>Please launch playground server!</span>
)}
</div>

View File

@ -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)) {