Skip to content

Commit

Permalink
0.9.1 update dependencies + global counter bug video2gif
Browse files Browse the repository at this point in the history
  • Loading branch information
jolav committed Oct 25, 2023
1 parent 4f2e37c commit b54a7f0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

![Version](https://img.shields.io/badge/version-0.9.0-orange.svg)
![Version](https://img.shields.io/badge/version-0.9.1-orange.svg)
![Maintained YES](https://img.shields.io/badge/Maintained%3F-yes-green.svg)
![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)

# ![logo](https://github.com/jolav/codetabs/blob/master/www/_public/icons/ct/ct64r.png?raw=true) **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)
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -87,18 +87,19 @@ func main() {

go alexa.OnceADayTask()
index := loc.NewIndex(false)
index2 := video2gif.NewIndex(false)

mux := http.NewServeMux()

mux.HandleFunc("/v1/alexa/", mw(alexa.Router, "alexa", c))
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)
Expand Down
29 changes: 19 additions & 10 deletions video2gif/video2gif.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 /
Expand All @@ -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)
Expand Down Expand Up @@ -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
}

/*
Expand Down
2 changes: 1 addition & 1 deletion www/_public/templates/version.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h2 class="centerText">
API doc
<small>
<small>(version 0.9.0)</small>
<small>(version 0.9.1)</small>
</small>
</h2>
<!-- End -->

0 comments on commit b54a7f0

Please sign in to comment.