Compare commits
8 Commits
15ffbfae4d
...
renovate/g
Author | SHA1 | Date | |
---|---|---|---|
6ca2145826 | |||
5f2c7cee77 | |||
1e449f4143 | |||
91f17b8815
|
|||
577040830b | |||
ce6f4a6553 | |||
7755d6c2fe
|
|||
06fa48351b
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.24.0 AS builder
|
||||
FROM golang:1.24.5 AS builder
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y sassc
|
||||
|
@ -15,7 +15,7 @@ var Dicts []dictionary = []dictionary{
|
||||
{ShortName: "EN-FR", Name: "French - English", Url: "/french-english"},
|
||||
}
|
||||
|
||||
func find_dict(sn string) (*dictionary) {
|
||||
func find_dict(sn string) *dictionary {
|
||||
for i := range Dicts {
|
||||
if Dicts[i].ShortName == sn {
|
||||
return &Dicts[i]
|
||||
@ -25,7 +25,7 @@ func find_dict(sn string) (*dictionary) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *dictionary) Path(term string) string{
|
||||
func (d *dictionary) Path(term string) string {
|
||||
term_escaped := url.PathEscape(term)
|
||||
return d.Url + "/" + term_escaped
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ type Translation struct {
|
||||
}
|
||||
|
||||
func (t *Translation) getSuggestions(doc *goquery.Document) error {
|
||||
doc.Find(".suggestion-list li").Each(func(_ int, sel *goquery.Selection){
|
||||
doc.Find(".suggestion-list li").Each(func(_ int, sel *goquery.Selection) {
|
||||
if link := sel.Find("a"); link != nil {
|
||||
t.Suggestions = append(t.Suggestions, link.Text())
|
||||
}
|
||||
@ -29,7 +29,7 @@ func (t *Translation) getSuggestions(doc *goquery.Document) error {
|
||||
}
|
||||
|
||||
func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
if tds == nil || tds.Length() < 4{
|
||||
if tds == nil || tds.Length() < 4 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
index int = 0
|
||||
)
|
||||
|
||||
tds.Each(func(_ int,sel *goquery.Selection){
|
||||
tds.Each(func(_ int, sel *goquery.Selection) {
|
||||
if index < 1 || index > 3 {
|
||||
index++
|
||||
return
|
||||
@ -58,7 +58,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
entries = append(entries, Entry{
|
||||
Text: text,
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
entries = append(entries, Entry{
|
||||
Text: text,
|
||||
Detail: detail.Text(),
|
||||
@ -72,7 +72,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
}
|
||||
|
||||
func (t *Translation) getEntries(trs *goquery.Selection) {
|
||||
trs.Each(func(_ int, sel *goquery.Selection){
|
||||
trs.Each(func(_ int, sel *goquery.Selection) {
|
||||
tds := sel.Find("td")
|
||||
|
||||
if tds == nil {
|
||||
@ -81,7 +81,7 @@ func (t *Translation) getEntries(trs *goquery.Selection) {
|
||||
|
||||
if class, ok := tds.Last().Attr("class"); !ok {
|
||||
return
|
||||
}else if !strings.Contains(class, "rc4 hidden-xs"){
|
||||
} else if !strings.Contains(class, "rc4 hidden-xs") {
|
||||
return
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ func (t *Translation) GetResults(doc *goquery.Document) error {
|
||||
return fmt.Errorf("failed to get table body")
|
||||
}
|
||||
|
||||
trs.First().Find("th").Each(func(_ int, sel *goquery.Selection){
|
||||
trs.First().Find("th").Each(func(_ int, sel *goquery.Selection) {
|
||||
if sel.Text() != "" {
|
||||
t.Fields = append(t.Fields, sel.Text())
|
||||
}
|
||||
|
15
go.mod
15
go.mod
@ -1,14 +1,17 @@
|
||||
module git.ngn.tf/ngn/tren
|
||||
|
||||
go 1.24.0
|
||||
go 1.24.5
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.10.3
|
||||
github.com/gofiber/fiber/v2 v2.52.8
|
||||
github.com/gofiber/template/html/v2 v2.1.3
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.10.2 // indirect
|
||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
github.com/gofiber/fiber/v2 v2.52.6 // indirect
|
||||
github.com/gofiber/template v1.8.3 // indirect
|
||||
github.com/gofiber/template/html/v2 v2.1.3 // indirect
|
||||
github.com/gofiber/utils v1.1.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
@ -19,6 +22,6 @@ require (
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.51.0 // indirect
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
golang.org/x/net v0.38.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/net v0.39.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
)
|
||||
|
17
go.sum
17
go.sum
@ -1,11 +1,17 @@
|
||||
github.com/PuerkitoBio/goquery v1.10.2 h1:7fh2BdHcG6VFZsK7toXBT/Bh1z5Wmy8Q9MV9HqT2AM8=
|
||||
github.com/PuerkitoBio/goquery v1.10.2/go.mod h1:0guWGjcLu9AYC7C1GHnpysHy056u9aEkUHwhdnePMCU=
|
||||
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
|
||||
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||
github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4=
|
||||
github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
|
||||
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
||||
github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o=
|
||||
@ -24,8 +30,12 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||
@ -55,6 +65,8 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
|
||||
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -74,10 +86,11 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@ -103,3 +116,5 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
4
renovate.json
Normal file
4
renovate.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": ["config:recommended"],
|
||||
"prHourlyLimit": 20
|
||||
}
|
@ -16,8 +16,8 @@ func Render(c *fiber.Ctx, template string, data fiber.Map) error {
|
||||
return c.Render(template, data)
|
||||
}
|
||||
|
||||
func RenderError(c *fiber.Ctx, code int, err... error) error {
|
||||
if code == 500 && len(err) > 0 && err[0] != nil{
|
||||
func RenderError(c *fiber.Ctx, code int, err ...error) error {
|
||||
if code == 500 && len(err) > 0 && err[0] != nil {
|
||||
log.Printf("server error: %s", err[0].Error())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user