Skip to content

Commit

Permalink
style: a tiny change makes a huge difference (+1rem to border radius)
Browse files Browse the repository at this point in the history
deps(update/auth): update authjs so that it works with nextjs 15

fix(ui/navbar): fix the hydration error

refactor: make container auth thing less sped, and middleware more granular
  • Loading branch information
IncognitoTGT committed Oct 30, 2024
1 parent 4068b5f commit 9620ffb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"input-otp": "^1.2.4",
"lucide-react": "^0.358.0",
"next": "15.0.2-canary.9",
"next-auth": "5.0.0-beta.18",
"next-auth": "5.0.0-beta.24",
"next-themes": "^0.3.0",
"node-loader": "^2.0.0",
"otplib": "^12.0.1",
Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/app/api/container-auth/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export async function GET(req: NextRequest) {
if (req.nextUrl.hostname !== "localhost") {
return new Response("Unauthorized - IP does not match", { status: 401 });
}
const [{ Id }] = (await docker.listContainers()).filter((container) => container.Id.startsWith(containerId));
const { Id } = (await docker.listContainers()).find((container) => container.Id.startsWith(containerId)) || {};
if (!Id) {
return new Response("Unauthorized - ehh this aint supposed to happen: container not found", { status: 401 });
}
const [dbEntry] = await db
.select()
.from(session)
Expand Down
2 changes: 1 addition & 1 deletion src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
--destructive-foreground: 220 21.951% 91.961%;
--ring: 233.793 16.022% 35.49%;

--radius: 0.5rem;
--radius: 1.5rem;
}

.dark {
Expand Down
17 changes: 7 additions & 10 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
import packageJson from "@/../package.json";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import {
DropdownMenu,
DropdownMenuContent,
Expand Down Expand Up @@ -75,6 +68,10 @@ export default function Navigation({
name: "Next.js",
url: "https://nextjs.org/",
},
{
name: "Docker",
url: "https://www.docker.com/",
},
{
name: "noVNC",
url: "https://github.com/noVNC/noVNC",
Expand Down Expand Up @@ -120,7 +117,7 @@ export default function Navigation({
Stardust {packageJson.version}
</DialogTitle>
</DialogHeader>
<DialogDescription className="flex flex-col items-start justify-start gap-2 text-foreground">
<div className="flex flex-col items-start justify-start gap-2 text-foreground text-sm">
Stardust is the platform for streaming isolated desktop containers.
<br />
Stardust uses the following things in an important way:
Expand Down Expand Up @@ -200,7 +197,7 @@ export default function Navigation({
<TooltipContent>Spaceness</TooltipContent>
</Tooltip>
</DialogFooter>
</DialogDescription>
</div>
</DialogContent>
</Dialog>
<div className="flex justify-end">
Expand Down
4 changes: 2 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { config as authConfig } from "@/lib/auth.config";
import NextAuth from "next-auth";
import { NextResponse } from "next/server";
const { auth } = NextAuth(authConfig);
const allowedPaths = ["/auth/login", "/auth/error", "/auth/verify", "/auth/signup"];
const allowedPaths = ["/auth/login", "/auth/error", "/auth/verify", "/auth/signup", "/api/container-auth"];
export const middleware = auth(async (req) => {
if (req.auth || allowedPaths.includes(req.nextUrl.pathname)) {
return NextResponse.next();
Expand All @@ -12,5 +12,5 @@ export const middleware = auth(async (req) => {
return NextResponse.redirect(url);
});
export const config = {
matcher: ["/((?!_next/static|_next/image|icon.svg|websockify|api/container-auth|api/auth|manifest.webmanifest).*)"],
matcher: ["/((?!_next/static|_next/image|icon.svg|websockify|api/auth|manifest.webmanifest).*)"],
};

0 comments on commit 9620ffb

Please sign in to comment.