Compare commits

..

2 commits

Author SHA1 Message Date
Craig
3ee936ea5e rename and fix bug 2024-11-12 14:50:51 +00:00
Craig
4a83e14a52 Fixed bugs 2024-11-12 14:48:26 +00:00
3 changed files with 7 additions and 3 deletions

View file

@ -1,2 +1,2 @@
# Craig's Custom URL Shortener # 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.

View file

@ -36,8 +36,11 @@ async def slug_only(slug: str):
if slug == "favicon.ico": if slug == "favicon.ico":
return HTTPException(404) return HTTPException(404)
else: else:
if slug in urls["public"].keys():
return RedirectResponse(urls["public"][slug]) return RedirectResponse(urls["public"][slug])
else:
return RedirectResponse("/")
if __name__ == "__main__": if __name__ == "__main__":
import uvicorn import uvicorn
uvicorn.run(app) uvicorn.run(app, host="0.0.0.0", port=43599)

View file

@ -5,6 +5,7 @@
"public": { "public": {
"hc": "https://hackclub.com", "hc": "https://hackclub.com",
"portfolio": "https://craigg.dev", "portfolio": "https://craigg.dev",
"slack-summarizer ": "https://crates.io/crates/slack-summarizer",
"url-shortener": "https://go.craigg.dev" "url-shortener": "https://go.craigg.dev"
} }
} }