Initial MVP: local visual novel library with Ren'Py → PGVN converter
- FastAPI backend: admin bootstrap with forced credential change, admin-created users with one-time generated passwords, roles as permission sets - Games and versions with content-addressed blob storage; forks copy only the manifest, so mods share assets with the original - Worker: archive/RPA extraction, unrpyc for .rpyc, own .rpy parser, Python subset translated via ast, media converted to WebP/Opus/WebM - React panel (library search, game page, upload, users, roles) and a framework-free web player with saves, history, skip/auto, transitions - docker compose: postgres, backend, worker, nginx on a single HTTP port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
364b312064
72 files changed
+9707
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import type { Engine } from "../player/engine";
|
||||
|
||||
export function Play() {
|
||||
const { versionId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const host = useRef<HTMLDivElement>(null);
|
||||
const [status, setStatus] = useState("Загрузка…");
|
||||
const [error, setError] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
let engine: Engine | null = null;
|
||||
let cancelled = false;
|
||||
// the player is a separate chunk: the library UI does not pay for it
|
||||
import("../player").then(({ launch }) =>
|
||||
launch(host.current!, Number(versionId), () => navigate(-1), setStatus),
|
||||
).then((e) => {
|
||||
if (cancelled) e.destroy();
|
||||
else {
|
||||
engine = e;
|
||||
setStatus("");
|
||||
}
|
||||
}).catch((e) => setError((e as Error).message));
|
||||
return () => {
|
||||
cancelled = true;
|
||||
engine?.destroy();
|
||||
};
|
||||
}, [versionId, navigate]);
|
||||
|
||||
return (
|
||||
<div className="play">
|
||||
<div ref={host} className="play-host" />
|
||||
{(status || error) && (
|
||||
<div className="play-status">
|
||||
{error ? <span className="error">{error}</span> : status}
|
||||
{error && <button onClick={() => navigate(-1)}>Назад</button>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user