Skip to content

Commit

Permalink
feat: redirect to https://hunt.deno.land (#305)
Browse files Browse the repository at this point in the history
* feat: redirect to new host

* better
  • Loading branch information
iuioiua authored Jun 27, 2023
1 parent 5a75926 commit f468fe7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions routes/_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { MiddlewareHandlerContext } from "$fresh/server.ts";
import { walk } from "std/fs/walk.ts";
import { getSessionId } from "kv_oauth";
import { setRedirectUrlCookie } from "@/utils/redirect.ts";
import { redirect, setRedirectUrlCookie } from "@/utils/redirect.ts";
import { Status } from "std/http/http_status.ts";

export interface State {
sessionId?: string;
Expand All @@ -18,7 +19,12 @@ export async function handler(
req: Request,
ctx: MiddlewareHandlerContext<State>,
) {
const { pathname } = new URL(req.url);
const { pathname, hostname } = new URL(req.url);

if (hostname === "saaskit.deno.dev") {
return redirect("https://hunt.deno.land", Status.Found);
}

// Don't process session-related data for keepalive and static requests
if (["_frsh", ...staticFileNames].some((part) => pathname.includes(part))) {
return await ctx.next();
Expand Down

0 comments on commit f468fe7

Please sign in to comment.