1 Commits

Author SHA1 Message Date
b1c0733f8f fix(deps): update module github.com/puerkitobio/goquery to v1.10.3
Some checks failed
renovate/artifacts Artifact file update failure
2025-04-11 21:00:48 +00:00
11 changed files with 23 additions and 73 deletions

View File

@ -1,34 +1,28 @@
name: docker
name: Build and publish the docker image
on:
push:
branches:
- "main"
paths-ignore:
- "README.md"
- "LICENSE.txt"
- "docker-compose.example.yml"
- "ups.json"
branches: ["custom"]
env:
REGISTRY: git.ngn.tf
IMAGE: ${{gitea.repository}}
jobs:
docker:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: "https://github.com/actions/checkout@v4"
- name: Login to container repo
uses: docker/login-action@v1
uses: "https://github.com/docker/login-action@v1"
with:
registry: ${{env.REGISTRY}}
username: ${{gitea.actor}}
password: ${{secrets.PACKAGES_TOKEN}}
- name: Build docker image
- name: Build image
run: |
docker build . --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest

View File

@ -1,25 +0,0 @@
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

View File

@ -10,7 +10,7 @@ RUN go mod download
COPY . .
RUN make CGO_ENABLED=0
FROM alpine:3.22
FROM alpine:3.21
COPY --from=build /code/dumb .

View File

@ -1,7 +1,5 @@
# dumb - frontend for Genius
# [ngn.tf] | dumb
![](https://git.ngn.tf/ngn/dumb/actions/workflows/docker.yml/badge.svg)
![](https://git.ngn.tf/ngn/dumb/actions/workflows/ups.yml/badge.svg)
![](https://git.ngn.tf/ngn/dumb/actions/workflows/build.yml/badge.svg)
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.

4
go.mod
View File

@ -5,8 +5,8 @@ go 1.23
toolchain go1.23.4
require (
github.com/PuerkitoBio/goquery v1.10.1
github.com/a-h/templ v0.3.906
github.com/PuerkitoBio/goquery v1.10.3
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

View File

@ -47,7 +47,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
buf := new(bytes.Buffer)
_, err = buf.ReadFrom(resp.Body)
if err != nil {
l.Errorf("Error paring genius api response: %s", err.Error())
l.Error("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.Errorf("could not unmarshal json: %s\n", err)
l.Error("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.Errorf("Error sending response: %s", err.Error())
l.Error("Error sending response: %s", err.Error())
return
}

View File

@ -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.Errorf("unable to write image, %s", err.Error())
l.Error("unable to write image, %s", err.Error())
}
}
}

View File

@ -39,7 +39,7 @@ func main() {
if port == 0 {
port = 5555
logger.Infof("using default port %d", port)
logger.Info("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.Infof("server is listening on port %d", port)
logger.Info("server is listening on port %d", port)
if err := server.Serve(l); err != nil {
logger.Fatal(err.Error())

View File

@ -1,5 +0,0 @@
{
"upstream": "https://github.com/rramiachraf/dumb",
"provider": "github",
"commit": "f5df91fffe50283295f82488e4ec63a4be23f04e"
}

View File

@ -18,27 +18,15 @@ func NewLogger(w io.WriteCloser) *Logger {
return &Logger{slog: sl}
}
func (l *Logger) Errorf(f string, args ...any) {
func (l *Logger) Error(f string, args ...any) {
l.slog.Error(fmt.Sprintf(f, args...))
}
func (l *Logger) Error(e string) {
l.Errorf("%s", e)
}
func (l *Logger) Infof(f string, args ...any) {
func (l *Logger) Info(f string, args ...any) {
l.slog.Info(fmt.Sprintf(f, args...))
}
func (l *Logger) Info(m string) {
l.Infof("%s", m)
}
func (l *Logger) Fatalf(f string, args ...any) {
l.Errorf(f, args...)
func (l *Logger) Fatal(f string, args ...any) {
l.Error(f, args...)
os.Exit(1)
}
func (l *Logger) Fatal(e string) {
l.Fatalf("%s", e)
}

View File

@ -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.Errorf("unable to render template %s", err)
l.Error("unable to render template %s", err)
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte{})
if err != nil {