-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d79493c
commit 32ffbe6
Showing
8 changed files
with
4,781 additions
and
2,308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import type { Config } from 'https://edge.netlify.com/'; | ||
import { getShortUrl } from './scripts/supabase.ts'; | ||
import type { Config } from "https://edge.netlify.com/"; | ||
import { getShortUrl } from "./scripts/supabase.ts"; | ||
|
||
export default async function handler(req: Request) { | ||
// Search for the placeholder | ||
const url = new URL(req.url); | ||
const slug = url.searchParams.get('path'); | ||
// Search for the placeholder | ||
const url = new URL(req.url); | ||
const slug = url.searchParams.get("path"); | ||
|
||
if (slug) { | ||
try { | ||
const target = await getShortUrl(slug); | ||
if (slug) { | ||
try { | ||
const target = await getShortUrl(slug); | ||
|
||
if (target) { | ||
return Response.redirect(target, 301); | ||
} else { | ||
return Response.redirect('http://baldbeardedbuilder.com/404/', 301); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
if (target) { | ||
return Response.redirect(target, 301); | ||
} else { | ||
return Response.redirect("http://baldbeardedbuilder.com/404/", 301); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
return Response.redirect('http://baldbeardedbuilder.com/', 301); | ||
return Response.redirect("http://baldbeardedbuilder.com/", 301); | ||
} | ||
|
||
export const config: Config = { | ||
path: '/api/smolify', | ||
path: "/api/smolify", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ | |
"rehype-autolink-headings": "^7.1.0", | ||
"rehype-slug": "^6.0.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.