import { Context } from "koa"; import { Mountable } from "@sealcode/sealgen"; import Router from "@koa/router"; import { sleep } from "../util"; import { CollectionItem } from "sealious"; import { Posts } from "../collections/collections"; import { getMOTD } from "./motd.post"; export const actionName = "ssr2"; async function footer() { return /* HTML */ ``; } function navbar() { return /* HTML */ ` `; } function sidebar() { return /* HTML */ ` `; } function renderItem(item: CollectionItem) { return /* HTML */ `
  • ${item.get("title")}

    ${item.get("description")}

  • `; } async function content() {} export default new (class ssr2Redirect extends Mountable { // eslint-disable-next-line @typescript-eslint/no-unused-vars async canAccess(_: Context) { return { canAccess: true, message: "" }; } mount(router: Router, path: string) { router.get(path, async (ctx) => { ctx.res.write(` SSR2 version
    `); ctx.res.write(navbar()); ctx.res.write(sidebar()); ctx.res.write(`
    `); // ctx.res.write(``); ctx.res.write(`
    Loading.....
    `); const { items } = await Posts.suList().fetch(); ctx.res.write(/* HTML */ `
      ${items.map((item) => renderItem(item)).join("")}
    `); ctx.res.write("
    "); ctx.res.write(await footer()); ctx.res.end(); ctx.body = ctx.res; }); } })();