From d6a78afee7a409d9f875b253a96bf7d516f7388b Mon Sep 17 00:00:00 2001 From: statulr <122219240+resslr@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:43:00 -0500 Subject: [PATCH] fix: rename --- Dockerfile | 4 ++-- README.md | 10 +++++----- asserts/assert.go | 2 +- config/config.go | 6 +++--- go.mod | 2 +- handlers/redirect.go | 12 ++++++------ handlers/shawty.go | 10 +++++----- handlers/stats.go | 8 ++++---- handlers/unshort.go | 16 ++++++++-------- main.go | 18 +++++++++--------- package.json | 2 +- partial-html/short-link.html | 2 +- pretty-logger/log.go | 2 +- static/index.html | 18 +++++++++--------- static/unshort.html | 12 ++++++------ templs/404.html | 6 +++--- templs/server-error.html | 2 +- templs/stat.html | 14 +++++++------- templs/url-info.html | 12 ++++++------ utils/database.go | 4 ++-- utils/live-reload.go | 6 +++--- utils/server_error_templ.go | 2 +- validate/evict_old_links.go | 4 ++-- validate/evict_old_links_test.go | 2 +- validate/validate_code.go | 2 +- validate/validate_url.go | 2 +- 26 files changed, 90 insertions(+), 90 deletions(-) diff --git a/Dockerfile b/Dockerfile index c0610e0..0fb685c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.io/golang:latest -WORKDIR shawty +WORKDIR surf COPY . . @@ -8,4 +8,4 @@ EXPOSE 1234 RUN go mod tidy RUN go build -CMD ["./shawty"] +CMD ["./surf"] diff --git a/README.md b/README.md index 2bcd88f..850f70c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Shawty +# Surf -**Shawty** is a URL shortener built using [Golang](https://go.dev), +**Surf** is a URL shortener built using [Golang](https://go.dev), [Turso](https://turso.tech) and [HTMX](https://htmx.org). It provides a simple web interface for shortening URLs, tracking their usage, and offering statistics about shortened URLs. @@ -33,8 +33,8 @@ also checks if the URL contains a valid 1. **Clone the repository**: ```bash - git clone https://github.com/wavly/shawty.git - cd shawty + git clone https://github.com/wavly/surf.git + cd surf ``` 2. **Set ENV Variables**: @@ -86,4 +86,4 @@ We welcome any contributions to this project! For major changes, please open an ## LICENSE -- Shawty is [Licensed](LICENSE) under MIT +- Surf is [Licensed](LICENSE) under MIT diff --git a/asserts/assert.go b/asserts/assert.go index fba67c0..5925e4c 100644 --- a/asserts/assert.go +++ b/asserts/assert.go @@ -3,7 +3,7 @@ package asserts import ( "os" - prettylogger "github.com/wavly/shawty/pretty-logger" + prettylogger "github.com/wavly/surf/pretty-logger" ) var logger = prettylogger.GetLogger(nil) diff --git a/config/config.go b/config/config.go index b6b0cd8..a09bf55 100644 --- a/config/config.go +++ b/config/config.go @@ -4,9 +4,9 @@ import ( "os" "github.com/joho/godotenv" - "github.com/wavly/shawty/asserts" - . "github.com/wavly/shawty/env" - prettylogger "github.com/wavly/shawty/pretty-logger" + "github.com/wavly/surf/asserts" + . "github.com/wavly/surf/env" + prettylogger "github.com/wavly/surf/pretty-logger" ) var logger = prettylogger.GetLogger(nil) diff --git a/go.mod b/go.mod index c0f009b..e482649 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/wavly/shawty +module github.com/wavly/surf go 1.23.1 diff --git a/handlers/redirect.go b/handlers/redirect.go index 4792f65..7f1714b 100644 --- a/handlers/redirect.go +++ b/handlers/redirect.go @@ -6,12 +6,12 @@ import ( "time" "github.com/patrickmn/go-cache" - "github.com/wavly/shawty/asserts" - . "github.com/wavly/shawty/cache" - "github.com/wavly/shawty/internal/database" - prettylogger "github.com/wavly/shawty/pretty-logger" - "github.com/wavly/shawty/utils" - "github.com/wavly/shawty/validate" + "github.com/wavly/surf/asserts" + . "github.com/wavly/surf/cache" + "github.com/wavly/surf/internal/database" + prettylogger "github.com/wavly/surf/pretty-logger" + "github.com/wavly/surf/utils" + "github.com/wavly/surf/validate" ) var Logger = prettylogger.GetLogger(nil) diff --git a/handlers/shawty.go b/handlers/shawty.go index 1f15dca..3618af9 100644 --- a/handlers/shawty.go +++ b/handlers/shawty.go @@ -7,17 +7,17 @@ import ( "html/template" "net/http" - "github.com/wavly/shawty/asserts" - "github.com/wavly/shawty/internal/database" - "github.com/wavly/shawty/utils" - "github.com/wavly/shawty/validate" + "github.com/wavly/surf/asserts" + "github.com/wavly/surf/internal/database" + "github.com/wavly/surf/utils" + "github.com/wavly/surf/validate" ) type ShortLink struct { ShortUrl string } -func Shawty(w http.ResponseWriter, r *http.Request) { +func Surf(w http.ResponseWriter, r *http.Request) { inputUrl := r.FormValue("url") Logger.Info("Shorten the URL", "url", inputUrl, "user-agent", r.UserAgent()) diff --git a/handlers/stats.go b/handlers/stats.go index 8609fbd..f0487df 100644 --- a/handlers/stats.go +++ b/handlers/stats.go @@ -5,10 +5,10 @@ import ( "net/http" "github.com/mergestat/timediff" - "github.com/wavly/shawty/asserts" - "github.com/wavly/shawty/internal/database" - "github.com/wavly/shawty/utils" - "github.com/wavly/shawty/validate" + "github.com/wavly/surf/asserts" + "github.com/wavly/surf/internal/database" + "github.com/wavly/surf/utils" + "github.com/wavly/surf/validate" ) type AccessCount struct { diff --git a/handlers/unshort.go b/handlers/unshort.go index 2f3e74d..d3521f1 100644 --- a/handlers/unshort.go +++ b/handlers/unshort.go @@ -8,11 +8,11 @@ import ( "strings" "github.com/patrickmn/go-cache" - "github.com/wavly/shawty/asserts" - . "github.com/wavly/shawty/cache" - "github.com/wavly/shawty/internal/database" - "github.com/wavly/shawty/utils" - "github.com/wavly/shawty/validate" + "github.com/wavly/surf/asserts" + . "github.com/wavly/surf/cache" + "github.com/wavly/surf/internal/database" + "github.com/wavly/surf/utils" + "github.com/wavly/surf/validate" ) func Unshort(w http.ResponseWriter, r *http.Request) { @@ -37,8 +37,8 @@ func Unshort(w http.ResponseWriter, r *http.Request) { } // Check if domain matches - if parsedUrl.Host != "shawty.wavly.tech" || parsedUrl.Scheme != "https" { - asserts.NoErr(errorTempl.Execute(w, "URL must use 'https://shawty.wavly.tech'"), "Failed to execute template short-link-error.html") + if parsedUrl.Host != "surf.wavly.tech" || parsedUrl.Scheme != "https" { + asserts.NoErr(errorTempl.Execute(w, "URL must use 'https://surf.wavly.tech'"), "Failed to execute template short-link-error.html") return } @@ -68,7 +68,7 @@ func Unshort(w http.ResponseWriter, r *http.Request) { if err != nil { if err == sql.ErrNoRows { Logger.Warn("url doesn't exists in the database", "code", code, "user-agent", r.UserAgent(), "error", err) - asserts.NoErr(errorTempl.Execute(w, "There is no destination URL for this short URL: "+"shawty.wavly.tech/s/"+code), "Failed to execute template short-link-error.html") + asserts.NoErr(errorTempl.Execute(w, "There is no destination URL for this short URL: "+"surf.wavly.tech/s/"+code), "Failed to execute template short-link-error.html") return } diff --git a/main.go b/main.go index b509fa5..a2e33a2 100644 --- a/main.go +++ b/main.go @@ -9,14 +9,14 @@ import ( "syscall" "time" - "github.com/wavly/shawty/asserts" - "github.com/wavly/shawty/config" - "github.com/wavly/shawty/env" - "github.com/wavly/shawty/handlers" - "github.com/wavly/shawty/internal/database" - prettylogger "github.com/wavly/shawty/pretty-logger" - "github.com/wavly/shawty/utils" - "github.com/wavly/shawty/validate" + "github.com/wavly/surf/asserts" + "github.com/wavly/surf/config" + "github.com/wavly/surf/env" + "github.com/wavly/surf/handlers" + "github.com/wavly/surf/internal/database" + prettylogger "github.com/wavly/surf/pretty-logger" + "github.com/wavly/surf/utils" + "github.com/wavly/surf/validate" ) func main() { @@ -84,7 +84,7 @@ func main() { }) // API route for shortening the URL - router.HandleFunc("POST /shawty", handlers.Shawty) + router.HandleFunc("POST /surf", handlers.Surf) // API route for unshortening the URL router.HandleFunc("POST /unshort", handlers.Unshort) diff --git a/package.json b/package.json index 00192c8..b5f2f3a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "shawty", + "name": "surf", "dependencies": { "tailwindcss": "^3.4.14" }, diff --git a/partial-html/short-link.html b/partial-html/short-link.html index bf89b28..7b51ec6 100644 --- a/partial-html/short-link.html +++ b/partial-html/short-link.html @@ -1,6 +1,6 @@
- shawty/s/{{ .ShortUrl }} + surf/s/{{ .ShortUrl }} diff --git a/pretty-logger/log.go b/pretty-logger/log.go index 66e0f0e..b2f7888 100644 --- a/pretty-logger/log.go +++ b/pretty-logger/log.go @@ -10,7 +10,7 @@ import ( "strconv" "sync" - "github.com/wavly/shawty/env" + "github.com/wavly/surf/env" ) const ( diff --git a/static/index.html b/static/index.html index 4c06d28..71ff94e 100644 --- a/static/index.html +++ b/static/index.html @@ -3,17 +3,17 @@ - + - Shawty + Surf