···6363 </p>
6464 <p>
6565 Think you might need to migrate in the future but your PDS might be
6666- hostile or offline? No worries! You can head to the ticket booth and
6767- get a PLC key free of charge and use it for account recovery in the
6868- future. You can also go to baggage claim (take the air shuttle to
6666+ hostile or offline? No worries! Soon you'll be able to go to the
6767+ ticket booth and get a PLC key free of charge and use it for account
6868+ recovery in the future. You can also go to baggage claim (take the air
6969+ shuttle to terminal four) and get a downloadable backup of all your
7070+ current PDS data in case that were to happen.
6971 terminal four) and get a downloadable backup of all your current PDS
7072 data in case that were to happen.
7173 </p>
+17-3
main.ts
···88app.use(staticFiles());
991010// this can also be defined via a file. feel free to delete this!
1111-const exampleLoggerMiddleware = define.middleware((ctx) => {
1212- console.log(`${ctx.req.method} ${ctx.req.url}`);
1111+const authMiddleware = define.middleware(async (ctx) => {
1212+ const url = new URL(ctx.req.url);
1313+ if (url.pathname.startsWith("/migrate")) {
1414+ ctx.state.auth = true
1515+ }
1616+ if (ctx.state.auth) {
1717+ const me = await fetch(`${url.origin}/api/me`, {
1818+ credentials: "include",
1919+ });
2020+ const json = await me.json();
2121+ if (json !== null && json.did) {
2222+ return ctx.next();
2323+ } else {
2424+ return ctx.redirect("/login");
2525+ }
2626+ }
1327 return ctx.next();
1428});
1515-app.use(exampleLoggerMiddleware);
2929+app.use(authMiddleware);
16301731await fsRoutes(app, {
1832 loadIsland: (path) => import(`./islands/${path}`),
+1-1
routes/index.tsx
···2828 />
2929 </div>
3030 <p class="font-mono text-lg sm:text-xl mb-4 mt-4 sm:mb-6 mt-0 text-center text-gray-600 dark:text-gray-300">
3131- Airport is made with love by <a class="text-blue-500 hover:underline" href="https://bsky.app/profile/knotbin.com">Roscoe</a> in collaboration with <a class="text-blue-500 hover:underline" href="https://sprk.so">Spark</a>.
3131+ Airport is made with love by <a class="text-blue-500 hover:underline" href="https://bsky.app/profile/knotbin.com">Roscoe</a> for <a class="text-blue-500 hover:underline" href="https://sprk.so">Spark</a>, a new short-video platform for AT Protocol.
3232 </p>
3333 <SocialLinks />
3434 </div>
+4-2
utils.ts
···11import { createDefine } from "fresh";
2233-// deno-lint-ignore no-empty-interface
44-export interface State {}
33+export interface State {
44+ title?: string;
55+ auth: boolean;
66+}
5768export const define = createDefine<State>();