diff --git a/README.md b/README.md index 7c4bc70..13bb2cd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Craig's Custom URL Shortener -A simple, versatile URL shortener with a web interface and API. It currently supports short links in the format go.craigg.dev/[tag]/[slug] (tag is optional), although support for more domains will be added soon. +A simple, versatile URL shortener with a web interface and API. It currently supports short links in the format go.craigg.dev/[slug], although support for more domains will be added soon. diff --git a/main.py b/main.py index 9c12b08..695f6f4 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,10 @@ async def slug_only(slug: str): if slug == "favicon.ico": return HTTPException(404) else: - return RedirectResponse(urls["public"][slug]) + if slug in urls["public"].keys(): + return RedirectResponse(urls["public"][slug]) + else: + return RedirectResponse("/") if __name__ == "__main__": import uvicorn diff --git a/urls.json b/urls.json index 7ab911a..466da11 100644 --- a/urls.json +++ b/urls.json @@ -5,6 +5,7 @@ "public": { "hc": "https://hackclub.com", "portfolio": "https://craigg.dev", + "slack-summarizer ": "https://crates.io/crates/slack-summarizer", "url-shortener": "https://go.craigg.dev" } } \ No newline at end of file