mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
3480ca21fa
While account creation is disabled, the only way in is now an admin-issued single-use signup code (Discord-invite style), redeemed on the public site's /join page. Because the 2020 watch login is device-id-bound with no code field, the flow captures it server-side instead: a new device refused at the signups-disabled gate (PlatformLogin / account create) is stashed in a PendingDevices table keyed by the real client IP (CF-Connecting-IP aware). The /join page then shows the player the device their own client just reported, they enter their code + username, and the account is minted bound to that device — so the next launch logs straight in via the existing device-id path. No watch changes. - SignupCodeEntity (code, descriptor, optional expiry, redeemer) + PendingDeviceEntity; idempotent CREATE TABLE in DatabaseBootstrap so both providers pick them up without a new migration. - SignupCodeService: generate / list / revoke / redeem + pending-device capture, single-use + expiry + revoke validation. - Admin: GET/POST signup-codes + revoke endpoints and a Signup codes admin-ui page (generate with descriptor/expiry, status table, revoke). - Public: anonymous /api/site/v1/join pending-devices + redeem, and a /join site page (+ header link). - README documents the flow + the post-Initial table-create approach.
49 lines
2.1 KiB
TypeScript
49 lines
2.1 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
import { Header } from './components/Header';
|
|
import { Home } from './pages/Home';
|
|
import { Feed } from './pages/Feed';
|
|
import { PhotoDetail } from './pages/PhotoDetail';
|
|
import { Players } from './pages/Players';
|
|
import { PlayerProfile } from './pages/PlayerProfile';
|
|
import { Rooms } from './pages/Rooms';
|
|
import { Join } from './pages/Join';
|
|
import { NotFound } from './pages/NotFound';
|
|
|
|
export function App() {
|
|
return (
|
|
<div className="min-h-screen flex flex-col">
|
|
<Header />
|
|
<main className="flex-1 mx-auto w-full max-w-6xl px-4 sm:px-6 py-6">
|
|
<Routes>
|
|
<Route path="/" element={<Home />} />
|
|
<Route path="/feed" element={<Feed />} />
|
|
<Route path="/photo/:id" element={<PhotoDetail />} />
|
|
<Route path="/players" element={<Players />} />
|
|
<Route path="/players/:id" element={<PlayerProfile />} />
|
|
<Route path="/rooms" element={<Rooms />} />
|
|
<Route path="/join" element={<Join />} />
|
|
{/* Legacy paths from the vanilla-JS feed.localhost site */}
|
|
<Route path="/p/:id" element={<RedirectPhoto />} />
|
|
<Route path="/u/:id" element={<RedirectPlayer />} />
|
|
<Route path="*" element={<NotFound />} />
|
|
</Routes>
|
|
</main>
|
|
<footer className="border-t border-ink-800 text-xs text-ink-400">
|
|
<div className="mx-auto max-w-6xl px-4 sm:px-6 py-4 flex flex-wrap items-center justify-between gap-2">
|
|
<span>DorkNet — a private Rec Room server.</span>
|
|
<span>
|
|
<a className="hover:text-ink-200" href="https://github.com/Alexa-RR/Dorknet">GitHub</a>
|
|
<span className="mx-2">·</span>
|
|
<a className="hover:text-ink-200" href="/admin">Admin</a>
|
|
</span>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// Small redirect shims so old #/p/123 / #/u/45 links keep working.
|
|
import { useParams } from 'react-router-dom';
|
|
function RedirectPhoto() { const { id } = useParams(); return <Navigate to={`/photo/${id}`} replace />; }
|
|
function RedirectPlayer() { const { id } = useParams(); return <Navigate to={`/players/${id}`} replace />; }
|