You are now viewing a rendered version of the markdown file.

Allowing login for testing

In client.ts replacing the top of the app.get("/callback"

app.get("/callback", RateLimiter.HIGH, async (req, res) => {
  const username = "ainioanvias"
  const hostname = "programming.dev"
  const sub = [username, hostname].join("@");
  await prisma.user.upsert({
    where: {
      sub,
    },
    update: {
      sub,
      display_name: undefined,
      picture_url: "https://bytes.programming.dev/files/4ce62a78-1476-4842-a2df-fcb84049a52a",
      profile_url: "https://example2.com",
    },
    create: {
      sub,
      display_name: undefined,
      picture_url: "https://bytes.programming.dev/files/4ce62a78-1476-4842-a2df-fcb84049a52a",
      profile_url: "https://example2.com",
    },
  });

  req.session.user = {
    service: {
      software: {
        name: "mastodon",
        version: "1.2.3"
      },
      instance: {
        hostname: hostname,
      },
    },
    user: {
      username: username,
    },
  };

  req.session.save();
  res.redirect("http://localhost:5173/");
  return;

In Palette.tsx replacing the you are not logged in at the bottom

<div className="flex gap-3 items-center">
  You are not logged in
  <Button as={Link} href="/api/login" className="user-login" variant="faded">
    Login
  </Button>
</div>