diff --git a/README.md b/README.md index 4860886..15cfb71 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ - +   #  **ONLINE TOOLS ([codetabs.com](https://codetabs.com))** -**version 0.9.0** +**version 0.9.1** 1. [Count LOC (lines of code) online from github/gitlab repos or zipped uploaded folder](#count-loc-online) 2. [CORS proxy](#cors-proxy) diff --git a/go.mod b/go.mod index c24263d..4ad63ae 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/jolav/codetabs go 1.14 require ( - github.com/ip2location/ip2location-go/v9 v9.1.0 - github.com/mattn/go-sqlite3 v1.14.16 // indirect + github.com/ip2location/ip2location-go/v9 v9.6.0 + github.com/mattn/go-sqlite3 v1.14.17 + lukechampine.com/uint128 v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index d82cce8..6b15213 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,11 @@ github.com/ip2location/ip2location-go/v9 v9.1.0 h1:DVlKxIcjA7CsA0cgzbidwe6eKzpbkS313LsH9ceutxI= github.com/ip2location/ip2location-go/v9 v9.1.0/go.mod h1:s5SV6YZL10TpfPpXw//7fEJC65G/yH7Oh+Tjq9JcQEQ= +github.com/ip2location/ip2location-go/v9 v9.6.0 h1:do+hKM2wbVG3lXMavZzWuy0znXxJBvGc7mv0wzRVoYc= +github.com/ip2location/ip2location-go/v9 v9.6.0/go.mod h1:MPLnsKxwQlvd2lBNcQCsLoyzJLDBFizuO67wXXdzoyI= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= +github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo= +lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= diff --git a/main.go b/main.go index 0e661fc..3d8b6b3 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ import ( "github.com/jolav/codetabs/weather" ) -var version = "0.9.0" +var version = "0.9.1" var when = "undefined" type Conf struct { @@ -87,6 +87,7 @@ func main() { go alexa.OnceADayTask() index := loc.NewIndex(false) + index2 := video2gif.NewIndex(false) mux := http.NewServeMux() @@ -94,11 +95,11 @@ func main() { mux.HandleFunc("/v1/geolocation/", mw(geolocation.Router, "geoip", c)) mux.HandleFunc("/v1/headers/", mw(headers.Router, "headers", c)) mux.HandleFunc("/v1/weather/", mw(weather.Router, "weather", c)) - mux.HandleFunc("/v1/video2gif/", mw(video2gif.Router, "video2gif", c)) + mux.HandleFunc("/v1/video2gif/", mw(index2.Router, "video2gif", c)) mux.HandleFunc("/v1/random/", mw(random.Router, "random", c)) mux.HandleFunc("/v1/stars/", mw(stars.Router, "stars", c)) mux.HandleFunc("/v1/proxy/", mw(proxy.Router, "proxy", c)) - mux.HandleFunc("/v1/tmp/", mw(proxy.Router, "proxy", c)) + //mux.HandleFunc("/v1/tmp/", mw(proxy.Router, "proxy", c)) mux.HandleFunc("/v1/loc/", mw(index.Router, "loc", c)) mux.HandleFunc("/", u.BadRequest) diff --git a/video2gif/video2gif.go b/video2gif/video2gif.go index 67d6feb..8cd1755 100644 --- a/video2gif/video2gif.go +++ b/video2gif/video2gif.go @@ -19,11 +19,14 @@ import ( u "github.com/jolav/codetabs/_utils" ) -type video2gif struct { +type index struct { order string orderInt int - in in - out out +} + +type video2gif struct { + in in + out out } type out struct { @@ -40,7 +43,7 @@ type in struct { scale string } -func Router(w http.ResponseWriter, r *http.Request) { +func (i *index) Router(w http.ResponseWriter, r *http.Request) { params := strings.Split(strings.ToLower(r.URL.Path), "/") path := params[1:len(params)] if path[len(path)-1] == "" { // remove last empty slot after / @@ -54,9 +57,9 @@ func Router(w http.ResponseWriter, r *http.Request) { vg := newVideo2Gif(false) r.ParseForm() if r.Method == "POST" { - vg.orderInt++ - vg.order = strconv.Itoa(vg.orderInt) - vg.doVideo2GifRequest(w, r, vg.order) + i.orderInt++ + i.order = strconv.Itoa(i.orderInt) + vg.doVideo2GifRequest(w, r, i.order) return } u.BadRequest(w, r) @@ -251,12 +254,18 @@ func rescale(big, small int) (big2, small2 int) { func newVideo2Gif(test bool) video2gif { vg := video2gif{ + in: in{}, + out: out{}, + } + return vg +} + +func NewIndex(test bool) index { + i := index{ order: "0", orderInt: 0, - in: in{}, - out: out{}, } - return vg + return i } /* diff --git a/www/_public/templates/version.html b/www/_public/templates/version.html index 7f9fe15..55247d7 100644 --- a/www/_public/templates/version.html +++ b/www/_public/templates/version.html @@ -2,7 +2,7 @@