fix: gate signaling behind profile setup, fix SW cache
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 37s

This commit is contained in:
ordinarthur 2026-04-14 11:55:51 +02:00
parent e3085ea7a2
commit d8d747276a
3 changed files with 35 additions and 10 deletions

View File

@ -11,6 +11,16 @@ import PublicRoomPanel from "../components/PublicRoomPanel";
import ProfileSetup from "../components/ProfileSetup";
export default function Home() {
const isSetUp = useProfileStore((s) => s.isSetUp);
if (!isSetUp) {
return <ProfileSetup onDone={() => {}} />;
}
return <HomeConnected />;
}
function HomeConnected() {
const { sendFiles, sendText, acceptTransfer, rejectTransfer, createPublicRoom } =
useSignaling();
@ -22,7 +32,7 @@ export default function Home() {
const setShowTextModal = useStore((s) => s.setShowTextModal);
const setError = useStore((s) => s.setError);
const { deviceName, avatar, isSetUp } = useProfileStore();
const { deviceName, avatar } = useProfileStore();
const [showProfileEdit, setShowProfileEdit] = useState(false);
const handlePeerSelect = useCallback(
@ -145,10 +155,7 @@ export default function Home() {
</footer>
</div>
{/* Profile setup — first time or edit */}
{!isSetUp && (
<ProfileSetup onDone={() => {}} />
)}
{/* Profile edit modal */}
{showProfileEdit && (
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
)}

View File

@ -12,9 +12,19 @@ import ProfileSetup from "../components/ProfileSetup";
export default function JoinRoom() {
const { code } = useParams<{ code: string }>();
const isSetUp = useProfileStore((s) => s.isSetUp);
if (!isSetUp) {
return <ProfileSetup onDone={() => {}} />;
}
return <JoinRoomConnected code={code} />;
}
function JoinRoomConnected({ code }: { code?: string }) {
const { sendFiles, sendText, acceptTransfer, rejectTransfer } = useSignaling(code);
const { deviceName, avatar, isSetUp } = useProfileStore();
const { deviceName, avatar } = useProfileStore();
const [showProfileEdit, setShowProfileEdit] = useState(false);
const selectedPeerId = useStore((s) => s.selectedPeerId);
const showTextModal = useStore((s) => s.showTextModal);
@ -146,10 +156,7 @@ export default function JoinRoom() {
</footer>
</div>
{/* Profile setup — first time or edit */}
{!isSetUp && (
<ProfileSetup onDone={() => {}} />
)}
{/* Profile edit modal */}
{showProfileEdit && (
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
)}

View File

@ -15,6 +15,17 @@ export default defineConfig({
VitePWA({
registerType: "autoUpdate",
includeAssets: ["favicon.svg"],
workbox: {
skipWaiting: true,
clientsClaim: true,
navigateFallback: "index.html",
runtimeCaching: [
{
urlPattern: ({ request }) => request.mode === "navigate",
handler: "NetworkFirst",
},
],
},
manifest: {
name: "AnyDrop",
short_name: "AnyDrop",