Rework the share dialog into two clear modes and add the public /watch player page: - ShareDialog: (A) 'Share with a user' — autocomplete picker over registered users (was a blind email box that 404'd on non-users); (B) 'Share a link' — create/list/copy/revoke public links with allow-download toggle, optional expiry (1/7/30d), optional password; per-link view count. - WatchPage: standalone login-free player at /watch/<token> (routed in main.tsx like /privacy), self-contained mini-i18n (en/hu/de by browser language); password gate → unlock → play; shows a Download button only when the link allows it. - api: ShareLink/ShareRecipient types + link CRUD + recipients; share i18n (en/hu/de). Verified end-to-end in a real browser: user picker, link create, public playback, stream-only vs downloadable, password gate + unlock, no console errors.
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import React from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import App from "./App";
|
|
import ErrorBoundary from "./components/ErrorBoundary";
|
|
import { ConfirmProvider } from "./components/ConfirmProvider";
|
|
import PrivacyPolicy from "./components/legal/PrivacyPolicy";
|
|
import Terms from "./components/legal/Terms";
|
|
import WatchPage from "./components/WatchPage";
|
|
import "./i18n";
|
|
import "./index.css";
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: { queries: { retry: false, staleTime: 30_000, refetchOnWindowFocus: false } },
|
|
});
|
|
|
|
// Public, login-free legal pages. They live outside the authenticated App tree (no /api/me)
|
|
// so Google's consent screen and reviewers can fetch them directly. Reached by full-page
|
|
// navigation (plain <a href>), so a simple pathname switch is enough — no router needed.
|
|
const path = window.location.pathname;
|
|
const root =
|
|
path === "/privacy" ? <PrivacyPolicy /> :
|
|
path === "/terms" ? <Terms /> :
|
|
path.startsWith("/watch/") ? <WatchPage /> : (
|
|
<QueryClientProvider client={queryClient}>
|
|
<ErrorBoundary>
|
|
<ConfirmProvider>
|
|
<App />
|
|
</ConfirmProvider>
|
|
</ErrorBoundary>
|
|
</QueryClientProvider>
|
|
);
|
|
|
|
createRoot(document.getElementById("root")!).render(
|
|
<React.StrictMode>{root}</React.StrictMode>
|
|
);
|