Compare commits
21 Commits
7cea387f02
...
main
Author | SHA1 | Date | |
---|---|---|---|
77c8c099ae | |||
b1b895b9c1 | |||
0fbfee706c
|
|||
0474c2dcb6
|
|||
50784a6ab5
|
|||
a01a4febf5
|
|||
1c8cd6ed32
|
|||
d40dce624b | |||
6db6680a16 | |||
527fa8c13d | |||
9270fa919f | |||
77cdfa0e96 | |||
70ec918a10 | |||
2a10f8bc2f
|
|||
a551ba326c
|
|||
1beb629811
|
|||
6f1cad19ac
|
|||
04fca77aec
|
|||
939b7cc1e9
|
|||
20eed09f38
|
|||
e9dfb890dc
|
@ -1,30 +1,34 @@
|
||||
name: Build and publish the docker image
|
||||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["custom"]
|
||||
branches:
|
||||
- "main"
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "LICENSE.txt"
|
||||
- "docker-compose.example.yml"
|
||||
- "ups.json"
|
||||
|
||||
env:
|
||||
REGISTRY: git.ngn.tf
|
||||
IMAGE: ${{gitea.repository}}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: "https://github.com/actions/checkout@v4"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to container repo
|
||||
uses: "https://github.com/docker/login-action@v1"
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{gitea.actor}}
|
||||
password: ${{secrets.PACKAGES_TOKEN}}
|
||||
|
||||
- name: Build image
|
||||
- name: Build docker image
|
||||
run: |
|
||||
hash=${{gitea.sha}}
|
||||
docker build . --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest --tag ${{env.REGISTRY}}/${{env.IMAGE}}:${hash::7}
|
||||
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:${hash::7}
|
||||
docker build . --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest
|
||||
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest
|
25
.gitea/workflows/ups.yml
Normal file
25
.gitea/workflows/ups.yml
Normal file
@ -0,0 +1,25 @@
|
||||
name: ups
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "@weekly"
|
||||
|
||||
jobs:
|
||||
ups:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y python3 python3-build python3-requests make
|
||||
|
||||
- name: Install ups
|
||||
run: |
|
||||
git clone https://git.ngn.tf/ngn/ups && cd ups
|
||||
make && make install
|
||||
|
||||
- name: Run ups
|
||||
run: PATH=~/.local/bin:$PATH ups-check
|
11
Dockerfile
11
Dockerfile
@ -1,15 +1,16 @@
|
||||
FROM golang:1.23.4 AS build
|
||||
|
||||
RUN go install github.com/a-h/templ/cmd/templ@latest
|
||||
FROM golang:1.24.2 AS build
|
||||
|
||||
WORKDIR /code
|
||||
RUN go install github.com/a-h/templ/cmd/templ@latest
|
||||
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN make CGO_ENABLED=0
|
||||
|
||||
FROM alpine:3.21
|
||||
FROM alpine:3.22
|
||||
|
||||
COPY --from=build /code/dumb .
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# [ngn.tf] | dumb
|
||||
# dumb - frontend for Genius
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
A fork of the [dumb](https://github.com/rramiachraf/dumb) project, with my personal changes.
|
||||
A fork of the [dumb](https://github.com/rramiachraf/dumb) project, with my
|
||||
personal changes.
|
||||
|
@ -58,6 +58,8 @@ type customPerformance struct {
|
||||
func (s *Song) parseLyrics(doc *goquery.Document) error {
|
||||
var htmlError error
|
||||
|
||||
doc.Find("[class^=LyricsHeader]").Remove()
|
||||
|
||||
doc.Find("[data-lyrics-container='true']").Each(func(i int, ss *goquery.Selection) {
|
||||
h, err := ss.Html()
|
||||
if err != nil {
|
||||
|
12
go.mod
12
go.mod
@ -1,17 +1,19 @@
|
||||
module github.com/rramiachraf/dumb
|
||||
|
||||
go 1.22.2
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.4
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.9.2
|
||||
github.com/a-h/templ v0.2.747
|
||||
github.com/PuerkitoBio/goquery v1.10.1
|
||||
github.com/a-h/templ v0.3.819
|
||||
github.com/allegro/bigcache/v3 v3.1.0
|
||||
github.com/gorilla/handlers v1.5.2
|
||||
github.com/gorilla/mux v1.8.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/andybalholm/cascadia v1.3.2 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
)
|
||||
|
41
go.sum
41
go.sum
@ -1,11 +1,17 @@
|
||||
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
|
||||
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
|
||||
github.com/PuerkitoBio/goquery v1.10.1 h1:Y8JGYUkXWTGRB6Ars3+j3kN0xg1YqqlwvdTV8WTFQcU=
|
||||
github.com/PuerkitoBio/goquery v1.10.1/go.mod h1:IYiHrOMps66ag56LEH7QYDDupKXyo5A8qrjIx3ZtujY=
|
||||
github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
|
||||
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
|
||||
github.com/a-h/templ v0.3.819 h1:KDJ5jTFN15FyJnmSmo2gNirIqt7hfvBD2VXVDTySckM=
|
||||
github.com/a-h/templ v0.3.819/go.mod h1:iDJKJktpttVKdWoTkRNNLcllRI+BlpopJc+8au3gOUo=
|
||||
github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=
|
||||
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
|
||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
||||
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/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
@ -17,18 +23,36 @@ github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWS
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
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.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
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=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -36,17 +60,34 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
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=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
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=
|
||||
|
@ -47,7 +47,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
|
||||
buf := new(bytes.Buffer)
|
||||
_, err = buf.ReadFrom(resp.Body)
|
||||
if err != nil {
|
||||
l.Error("Error paring genius api response: %s", err.Error())
|
||||
l.Errorf("Error paring genius api response: %s", err.Error())
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
utils.RenderTemplate(w, views.ErrorPage(500, "something went wrong"), l)
|
||||
return
|
||||
@ -56,7 +56,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
|
||||
var data data.AnnotationsResponse
|
||||
err = json.Unmarshal(buf.Bytes(), &data)
|
||||
if err != nil {
|
||||
l.Error("could not unmarshal json: %s\n", err)
|
||||
l.Errorf("could not unmarshal json: %s\n", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
utils.RenderTemplate(w, views.ErrorPage(500, "something went wrong"), l)
|
||||
return
|
||||
@ -69,7 +69,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
|
||||
encoder := json.NewEncoder(w)
|
||||
|
||||
if err = encoder.Encode(&annotation); err != nil {
|
||||
l.Error("Error sending response: %s", err.Error())
|
||||
l.Errorf("Error sending response: %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
@ -25,6 +26,7 @@ func TestLyrics(t *testing.T) {
|
||||
func testLyrics(t *testing.T, url string) {
|
||||
title := "The Silver Seas"
|
||||
artist := "Catch Yer Own Train"
|
||||
firstLyricLine := "[Verse 1]"
|
||||
|
||||
r, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
@ -46,6 +48,7 @@ func testLyrics(t *testing.T, url string) {
|
||||
|
||||
docArtist := doc.Find("#metadata-info h1").Text()
|
||||
docTitle := doc.Find("#metadata-info h2").Text()
|
||||
docLyrics := doc.Find("#lyrics").Text()
|
||||
|
||||
if docTitle != title {
|
||||
t.Fatalf("expected %q, got %q\n", title, docTitle)
|
||||
@ -54,4 +57,8 @@ func testLyrics(t *testing.T, url string) {
|
||||
if docArtist != artist {
|
||||
t.Fatalf("expected %q, got %q\n", artist, docArtist)
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(docLyrics, firstLyricLine) {
|
||||
t.Fatalf("expected lyrics to start with %q, got %q\n", firstLyricLine, docLyrics)
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ func imageProxy(l *utils.Logger) http.HandlerFunc {
|
||||
w.Header().Set("Content-type", mime.TypeByExtension("."+ext))
|
||||
w.Header().Add("Cache-Control", "max-age=1296000")
|
||||
if _, err = io.Copy(w, res.Body); err != nil {
|
||||
l.Error("unable to write image, %s", err.Error())
|
||||
l.Errorf("unable to write image, %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
main.go
4
main.go
@ -39,7 +39,7 @@ func main() {
|
||||
|
||||
if port == 0 {
|
||||
port = 5555
|
||||
logger.Info("using default port %d", port)
|
||||
logger.Infof("using default port %d", port)
|
||||
}
|
||||
|
||||
l, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||
@ -47,7 +47,7 @@ func main() {
|
||||
logger.Fatal(err.Error())
|
||||
}
|
||||
|
||||
logger.Info("server is listening on port %d", port)
|
||||
logger.Infof("server is listening on port %d", port)
|
||||
|
||||
if err := server.Serve(l); err != nil {
|
||||
logger.Fatal(err.Error())
|
||||
|
4
renovate.json
Normal file
4
renovate.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": ["config:recommended"],
|
||||
"prHourlyLimit": 20
|
||||
}
|
BIN
static/logo.png
BIN
static/logo.png
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.2 KiB |
@ -12,11 +12,6 @@ description &&
|
||||
);
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
const geniusURL =
|
||||
"https://genius.com" +
|
||||
document.location.pathname +
|
||||
document.location.search;
|
||||
document.getElementById("goto-genius").setAttribute("href", geniusURL);
|
||||
document.querySelectorAll("#lyrics a").forEach((item) => {
|
||||
item.addEventListener("click", getAnnotation);
|
||||
});
|
||||
|
@ -24,6 +24,11 @@ footer a:hover {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#footer-container span {
|
||||
color: #fff;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1080px) {
|
||||
#footer-container {
|
||||
width: 100%;
|
||||
|
@ -79,6 +79,7 @@
|
||||
}
|
||||
|
||||
#credits summary {
|
||||
font-weight: 900;
|
||||
font-size: 1.4rem;
|
||||
cursor: pointer;
|
||||
color: #ccc;
|
||||
@ -87,7 +88,7 @@
|
||||
#credits p {
|
||||
font-size: 1.3rem;
|
||||
padding: 0.5rem;
|
||||
color: #171717;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
|
@ -8,7 +8,7 @@ nav {
|
||||
width: 1024px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#search-item h3 {
|
||||
font-size: 1.8rem;
|
||||
color: #333;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
#search-item span {
|
||||
|
5
ups.json
Normal file
5
ups.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"upstream": "https://github.com/rramiachraf/dumb",
|
||||
"provider": "github",
|
||||
"commit": "f5df91fffe50283295f82488e4ec63a4be23f04e"
|
||||
}
|
@ -18,15 +18,27 @@ func NewLogger(w io.WriteCloser) *Logger {
|
||||
return &Logger{slog: sl}
|
||||
}
|
||||
|
||||
func (l *Logger) Error(f string, args ...any) {
|
||||
func (l *Logger) Errorf(f string, args ...any) {
|
||||
l.slog.Error(fmt.Sprintf(f, args...))
|
||||
}
|
||||
|
||||
func (l *Logger) Info(f string, args ...any) {
|
||||
func (l *Logger) Error(e string) {
|
||||
l.Errorf("%s", e)
|
||||
}
|
||||
|
||||
func (l *Logger) Infof(f string, args ...any) {
|
||||
l.slog.Info(fmt.Sprintf(f, args...))
|
||||
}
|
||||
|
||||
func (l *Logger) Fatal(f string, args ...any) {
|
||||
l.Error(f, args...)
|
||||
func (l *Logger) Info(m string) {
|
||||
l.Infof("%s", m)
|
||||
}
|
||||
|
||||
func (l *Logger) Fatalf(f string, args ...any) {
|
||||
l.Errorf(f, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func (l *Logger) Fatal(e string) {
|
||||
l.Fatalf("%s", e)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func RenderTemplate(w http.ResponseWriter, t templ.Component, l *Logger) {
|
||||
if err := t.Render(context.Background(), w); err != nil {
|
||||
l.Error("unable to render template %s", err)
|
||||
l.Errorf("unable to render template %s", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
_, err := w.Write([]byte{})
|
||||
if err != nil {
|
||||
|
@ -1,11 +1,10 @@
|
||||
package views
|
||||
|
||||
import "github.com/rramiachraf/dumb/data"
|
||||
|
||||
templ footer() {
|
||||
<footer>
|
||||
<div id="footer-container">
|
||||
<a rel="noopener noreferrer" target="_blank" href="https://github.com/rramiachraf/dumb">Source</a>
|
||||
<span> | </span>
|
||||
<a rel="noopener noreferrer" target="_blank" href="https://git.ngn.tf/ngn/dumb">Modified Source</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
Reference in New Issue
Block a user