mirror of
https://github.com/CragglesG/url-shortener.git
synced 2024-11-21 12:33:39 +00:00
Compare commits
2 commits
f079d5a26b
...
3ee936ea5e
Author | SHA1 | Date | |
---|---|---|---|
|
3ee936ea5e | ||
|
4a83e14a52 |
3 changed files with 7 additions and 3 deletions
|
@ -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.
|
||||
|
|
|
@ -36,8 +36,11 @@ 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
|
||||
uvicorn.run(app)
|
||||
uvicorn.run(app, host="0.0.0.0", port=43599)
|
|
@ -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"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue