diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..e0edf34 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,30 @@ +name: Build and publish the docker image + +on: + push: + branches: ["custom"] + +env: + REGISTRY: git.ngn.tf + IMAGE: ${{gitea.repository}} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: "https://github.com/actions/checkout@v4" + + - name: Login to container repo + uses: "https://github.com/docker/login-action@v1" + with: + registry: ${{env.REGISTRY}} + username: ${{gitea.actor}} + password: ${{secrets.PACKAGES_TOKEN}} + + - name: Build 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 push ${{env.REGISTRY}}/${{env.IMAGE}}:latest diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index fba8a54..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 2 -updates: - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "monthly" - groups: - all: - patterns: - - "*" - - # Maintain dependencies for Golang - - package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "monthly" - groups: - all: - patterns: - - "*" diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml deleted file mode 100644 index a0301de..0000000 --- a/.github/workflows/image.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Build and publish container images - -on: - push: { branches: [ main ] } - -permissions: - packages: write - -jobs: - build: - if: ${{ startsWith(github.event.head_commit.message, 'feat:') || startsWith(github.event.head_commit.message, 'fix:') || startsWith(github.event.head_commit.message, 'ci:') }} - runs-on: ubuntu-20.04 - outputs: - commit: ${{ steps.metadata.outputs.commit }} - strategy: - matrix: - architecture: [ amd64, arm64v8 ] - include: - - architecture: amd64 - platform: linux/amd64 - - architecture: arm64v8 - platform: linux/arm64 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Obtain project metadata - id: metadata - run: echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate image metadata - uses: docker/metadata-action@v5 - id: image-metadata - with: - images: ghcr.io/${{ github.repository }} - tags: | - type=raw,value=${{ matrix.architecture }}-${{ steps.metadata.outputs.commit }},enable={{is_default_branch}} - type=raw,value=${{ matrix.architecture }},enable={{is_default_branch}} - - - name: Build and push platform specific images - uses: docker/build-push-action@v6 - with: - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - platforms: ${{ matrix.platform }} - tags: ${{ steps.image-metadata.outputs.tags }} - build-args: | - BUILDKIT_CONTEXT_KEEP_GIT_DIR=true - - merge: - runs-on: ubuntu-20.04 - needs: [ build ] - env: - IMAGE: ghcr.io/${{ github.repository }} - COMMIT: ${{ needs.build.outputs.commit }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate manifest for multi-arch images from source manifests - run: | - docker buildx imagetools create \ - --tag ${IMAGE}:${COMMIT} ${IMAGE}:{amd64,arm64v8}-${COMMIT} - docker buildx imagetools create \ - --tag ${IMAGE}:latest ${IMAGE}:{amd64,arm64v8} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 11c6e69..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: linter - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -permissions: - contents: read - -jobs: - golangci: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - run: go install github.com/a-h/templ/cmd/templ@latest - - run: make build - - name: golangci-lint - uses: golangci/golangci-lint-action@v6.1.1 - with: - version: latest - only-new-issues: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 420f3e3..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Test and Build -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - run: go install github.com/a-h/templ/cmd/templ@latest - - run: make build - #- run: make test diff --git a/Dockerfile b/Dockerfile index 98812e4..6c52d2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,16 @@ -FROM docker.io/golang:1.22.10-alpine3.21 AS build +FROM golang:1.23.4 AS build -RUN apk add make git curl +RUN go install github.com/a-h/templ/cmd/templ@latest WORKDIR /code +COPY go.mod ./ +COPY go.sum ./ -COPY go.mod go.sum ./ RUN go mod download +RUN make CGO_ENABLED=0 -COPY . . -COPY .git . -RUN make build - -############################################################### - -FROM docker.io/alpine:3.21 - -LABEL org.opencontainers.image.source="https://github.com/rramiachraf/dumb" -LABEL org.opencontainers.image.url="https://github.com/rramiachraf/dumb" -LABEL org.opencontainers.image.licenses="MIT" -LABEL org.opencontainers.image.description="Private alternative front-end for Genius." +FROM alpine:3.21 COPY --from=build /code/dumb . -EXPOSE 5555/tcp - CMD ["./dumb"] - diff --git a/LICENCE b/LICENCE.txt similarity index 100% rename from LICENCE rename to LICENCE.txt diff --git a/Makefile b/Makefile index 982ee8e..b046df2 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,15 @@ -VERSION=`git rev-parse --short HEAD` +CGO_ENABLED=1 -gentempl: - command -v templ &> /dev/null || go install github.com/a-h/templ/cmd/templ@latest -esbuild: - [ ! -f ./esbuild ] && curl -fsSL https://esbuild.github.io/dl/latest | sh -build:gentempl esbuild +all: templ generate - cat ./style/*.css | ./esbuild --loader=css --minify > ./static/style.css - go build -ldflags="-X 'github.com/rramiachraf/dumb/data.Version=$(VERSION)' -s -w" + cat ./style/*.css > ./static/style.css + CGO_ENABLED=$(CGO_ENABLED) go build + test: go test ./... -v -fmt: + +format: + gofmt -s -w . templ fmt . + +.PHONY: test format diff --git a/README.md b/README.md index 4796f8d..670435c 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,5 @@ -# dumb -With the massive daily increase of useless scripts on Genius's web frontend, and having to download megabytes of clutter, [dumb](https://github.com/rramiachraf/dumb) tries to make reading lyrics from Genius a pleasant experience, and as lightweight as possible. +# [ngn.tf] | dumb - - -![Screenshot](https://raw.githubusercontent.com/rramiachraf/dumb/main/screenshot.png) - -## Installation & Usage -### Docker -```bash -docker run -p 8080:5555 --name dumb ghcr.io/rramiachraf/dumb:latest -``` - -### Build from source -[Go 1.22+](https://go.dev/dl) is required. -```bash -git clone https://github.com/rramiachraf/dumb -cd dumb -make build -./dumb -``` - -#### Notes: -- The default port is 5555, you can use other ports by setting the `PORT` environment variable. -- Genius servers are behind a Cloudflare reverse proxy, which means certain IPs won't be able to send requests, to partially mitigate this, you can specify a proxy by setting the `PROXY` variable (must be a valid URI). - -## Public Instances -| URL | Tor | I2P | Region | CDN? | Operator | -| --- | :----: | :----: | :----: | :----: | --- | -| | No | No | NL | No | https://ducks.party | -| | [Yes](http://dumb.g4c3eya4clenolymqbpgwz3q3tawoxw56yhzk4vugqrl6dtu3ejvhjid.onion) | No | FR | No | https://privacydev.net | -| | No | No | US | No | https://hyperreal.coffee | -| | [Yes](http://dm.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion) | [Yes](http://vernxpcpqi2y4uhu7to4rnjmyjjgzh3x3qxyzpmkhykefchkmleq.b32.i2p) | US | No | https://vern.cc | -| | No | No | DE | Yes | @MaximilianGT500 | -| | No | No | DE | - | https://privacyfucking.rocks | -| | No | No | US/DE | Yes | Whatever Social | -| | No | No | DE | No | https://bloat.cat | -| | No | No | DE | No | https://gitro.xyz | -| | No | No | DE | Yes | https://jeikobu.net | - -[Status Page](https://github.com/rramiachraf/dumb-instances) - -#### Notes: -- Instances list in JSON format can be found in [instances.json](instances.json) file. -- For people who might be capable and interested in hosting a public instance feel free to do so, and don't forget to open a pull request, so your instance can be included here. - -## Contributing -Contributions are welcome. - -## License -[MIT](https://github.com/rramiachraf/dumb/blob/main/LICENCE) +![](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. diff --git a/data/data.go b/data/data.go deleted file mode 100644 index 48d6f81..0000000 --- a/data/data.go +++ /dev/null @@ -1,3 +0,0 @@ -package data - -var Version = "DEVELOPMENT" diff --git a/data/proxy.go b/data/proxy.go index 4b432d8..6f8795f 100644 --- a/data/proxy.go +++ b/data/proxy.go @@ -13,4 +13,3 @@ func ExtractImageURL(image string) string { return fmt.Sprintf("/images%s", u.Path) } - diff --git a/instances.json b/instances.json deleted file mode 100644 index 34dbac8..0000000 --- a/instances.json +++ /dev/null @@ -1,55 +0,0 @@ -[ - { - "clearnet": "https://dm.vern.cc/", - "tor": "http://dm.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/", - "i2p": "http://vernxpcpqi2y4uhu7to4rnjmyjjgzh3x3qxyzpmkhykefchkmleq.b32.i2p/", - "country": "US", - "cdn": false - }, - { - "clearnet": "https://sing.whatever.social/", - "country": "US/DE", - "cdn": true - }, - { - "clearnet": "https://dumb.lunar.icu/", - "country": "DE", - "cdn": true - }, - { - "clearnet": "https://dumb.privacydev.net/", - "tor": "http://dumb.g4c3eya4clenolymqbpgwz3q3tawoxw56yhzk4vugqrl6dtu3ejvhjid.onion/", - "country": "FR", - "cdn": false - }, - { - "clearnet": "https://dumb.ducks.party/", - "country": "NL", - "cdn": false - }, - { - "clearnet": "https://dumb.privacyfucking.rocks/", - "country": "DE", - "cdn": false - }, - { - "clearnet": "https://dumb.hyperreal.coffee/", - "country": "DE", - "cdn": true - }, - { - "clearnet": "https://dumb.bloat.cat/", - "country": "DE", - "cdn": false - }, - { - "clearnet": "https://dumb.gitro.xyz/", - "country": "DE", - "cdn": false - }, - { - "clearnet": "https://dumb.jeikobu.net/", - "country": "DE", - "cdn": true - } -] diff --git a/screenshot.png b/screenshot.png deleted file mode 100644 index 168c657..0000000 Binary files a/screenshot.png and /dev/null differ diff --git a/static/script.js b/static/script.js index f33106f..113f4c5 100644 --- a/static/script.js +++ b/static/script.js @@ -75,35 +75,3 @@ function getAnnotation(e) { } }; } - -window._currentTheme = localStorage.getItem("_theme") || (window.matchMedia("(prefers-color-scheme:dark)").matches ? "dark" : "light"); -setTheme(window._currentTheme); - -const themeChooser = document.getElementById("choose-theme"); -themeChooser.addEventListener("click", function () { - if (window._currentTheme === "dark") { - setTheme("light"); - } else { - setTheme("dark"); - } -}); - -function setTheme(theme) { - const toggler = document.getElementById( - "ic_fluent_dark_theme_24_regular" - ); - switch (theme) { - case "dark": - toggler.setAttribute("fill", "#fff"); - localStorage.setItem("_theme", "dark"); - document.body.classList.add("dark"); - window._currentTheme = "dark"; - return; - case "light": - toggler.setAttribute("fill", "#181d31"); - localStorage.setItem("_theme", "light"); - document.body.classList.remove("dark"); - window._currentTheme = "light"; - return; - } -} diff --git a/style/album.css b/style/album.css index 4c277d4..2617d83 100644 --- a/style/album.css +++ b/style/album.css @@ -22,20 +22,12 @@ } #album-single-track p { - color: #181d31; - font-weight: 500; -} - -.dark #album-single-track p { color: #ddd; + font-weight: 500; } #album-single-track small { font-size: 1.5rem; - color: #333; -} - -.dark #album-single-track small { color: #ccc; } diff --git a/style/annotation.css b/style/annotation.css index f8976d4..deba350 100644 --- a/style/annotation.css +++ b/style/annotation.css @@ -8,9 +8,9 @@ blockquote { padding: 1rem; border-radius: 4px; - background: #eee; + background-color: #272d44; + color: inherit; border: 1px solid #ddd; - color: #222; margin: 1rem 0; } @@ -37,9 +37,3 @@ blockquote ul { color: #be3144; margin-bottom: 1rem; } - -.dark .annotation, -.dark blockquote { - background-color: #272d44; - color: inherit; -} diff --git a/style/article.css b/style/article.css index 0be76b9..cb7f17b 100644 --- a/style/article.css +++ b/style/article.css @@ -8,7 +8,11 @@ #article-body { line-height: 1.75; - color: #171717; + color: #eee; +} + +#article-title { + color: #eee; } #article-subtitle { @@ -22,39 +26,19 @@ border-radius: 5px; object-fit: contain; object-position: center; - background-color: #f7f7f7; - border: 1px solid #e4e4e4; -} - -#metadata, -#article-subtitle, -#article-date { - color: #333; -} - -#article-authors { - color: #1e1e1e; - display: flex; - flex-direction: column; - gap: 0.5rem; -} - -.dark #article-image { background-color: #151515; border: 1px solid #2f2f2f; } -.dark #metadata, -.dark #article-subtitle, -.dark #article-date, -.dark #article-authors { +#metadata, +#article-subtitle, +#article-date, +#article-authors { color: #ccc; } -.dark #article-title { - color: #eee; -} - -.dark #article-body { - color: #eee; +#article-authors { + display: flex; + flex-direction: column; + gap: 0.5rem; } diff --git a/style/artist.css b/style/artist.css index 06f64b2..ae931fa 100644 --- a/style/artist.css +++ b/style/artist.css @@ -30,7 +30,7 @@ text-align: center; } -.dark #artist-albumlist p { +#artist-albumlist p { color: #ddd; } @@ -39,15 +39,11 @@ color: #333; } -.dark #artist-albumlist small { +#artist-albumlist small { color: #ccc; } -#metadata p { - color: #171717; -} - -.dark #metadata p { +.#metadata p { color: #ddd; } @@ -64,9 +60,5 @@ } #artist-section h2 { - font-size: 2rem; -} - -.dark #artist-section h2 { color: #ddd; } diff --git a/style/error.css b/style/error.css index 95fff45..c72981c 100644 --- a/style/error.css +++ b/style/error.css @@ -10,20 +10,12 @@ #error h1 { font-size: 5rem; - color: #111; + color: #eee; } #error p { text-transform: uppercase; font-size: 1.6rem; - color: #222; + color: #ddd; text-align: center; } - -.dark #error h1 { - color: #eee; -} - -.dark #error p { - color: #ddd; -} diff --git a/style/footer.css b/style/footer.css index 80fbe81..e217165 100644 --- a/style/footer.css +++ b/style/footer.css @@ -1,14 +1,14 @@ footer { - background-color: #ffcd38; + background: #000; + border-top: solid 1px #fff; padding: 1rem 0; } footer a { + color: #fff; font-weight: 500; - color: #1b1a17; transition: 0.3s ease text-decoration; font-size: 1.4rem; - text-transform: uppercase; } footer a:hover { @@ -18,21 +18,12 @@ footer a:hover { #footer-container { width: 1024px; display: flex; - justify-content: space-between; + justify-content: center; align-items: center; margin: 0 auto; -} - -#footer-links { - display: flex; gap: 1rem; } -#version { - font-size: 1.3rem; - color: #1b1b1b; -} - @media screen and (max-width: 1080px) { #footer-container { width: 100%; @@ -40,7 +31,3 @@ footer a:hover { box-sizing: border-box; } } - -.dark footer { - background-color: #fec260; -} diff --git a/style/home.css b/style/home.css index a766d32..b0b489d 100644 --- a/style/home.css +++ b/style/home.css @@ -14,11 +14,11 @@ #home h1 { font-weight: 600; font-size: 2.2rem; - color: #222; + color: #eee; } #home p { - color: #333; + color: #ddd; } #home code { @@ -34,17 +34,6 @@ box-sizing: border-box; border-radius: 5px; border: 1px solid #ddd; + background-color: #ddd; color: #222; } - -.dark #home h1 { - color: #eee; -} - -.dark #home p { - color: #ddd; -} - -.dark #search-input { - background-color: #ddd; -} diff --git a/style/lyrics.css b/style/lyrics.css index 99db93a..34fee3e 100644 --- a/style/lyrics.css +++ b/style/lyrics.css @@ -1,19 +1,19 @@ #lyrics { - color: #171717; line-height: 2.5rem; flex-basis: 0; flex-shrink: 0; flex-grow: 1; + color: #ccc; } #lyrics a { color: inherit; - background-color: #ddd; + background-color: #272d44; color: inherit; } #lyrics a:hover { - background-color: #ccc; + background-color: #32384f; } #metadata { @@ -25,13 +25,13 @@ #metadata h1 { font-size: 2rem; - color: #171717; + color: #ddd; } #metadata h2 { font-size: 1.4rem; - color: #1e1e1e; font-weight: 500; + color: #eee; } #metadata-info { @@ -55,9 +55,9 @@ #description p { font-size: 1.4rem; - color: #171717; line-height: 1.8rem; cursor: pointer; + color: #ccc; } #title { @@ -78,11 +78,10 @@ gap: 0.5rem; } - #credits summary { font-size: 1.4rem; cursor: pointer; - color: #1e1e1e; + color: #ccc; } #credits p { @@ -95,37 +94,10 @@ display: none; } -.dark #lyrics { - color: #ccc; -} - -.dark #lyrics a { - background-color: #272d44; - color: inherit; -} - -.dark #lyrics a:hover { - background-color: #32384f; -} - -.dark #metadata h1 { +#title { color: #ddd; } -.dark #metadata h2, -.dark #credits p { - color: #eee; -} - -.dark #title { - color: #ddd; -} - -.dark #description p, -.dark #credits summary { - color: #ccc; -} - @media screen and (max-width: 1080px) { #metadata { align-items: center; diff --git a/style/main.css b/style/main.css index 5b94c27..67d9cc2 100644 --- a/style/main.css +++ b/style/main.css @@ -49,7 +49,7 @@ html { body { font-size: 1.5rem; font-family: inter; - background-color: #f9f9f9; + background-color: #000; } @@ -60,7 +60,3 @@ a { a:hover { text-decoration: underline; } - -body.dark { - background-color: #181d31; -} diff --git a/style/navbar.css b/style/navbar.css index 8efece6..9cacc2b 100644 --- a/style/navbar.css +++ b/style/navbar.css @@ -1,5 +1,6 @@ nav { - background-color: #ffcd38; + background: #000; + border-bottom: solid 1px #fff; padding: 1rem 0; } @@ -19,26 +20,6 @@ nav { } } - nav img { width: 50px; } - -#nav-icons { - display: flex; - align-items: center; - gap: 1rem; -} - -.nav-icon { - background: none; - border: none; - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; -} - -.dark nav { - background-color: #fec260; -} diff --git a/style/search.css b/style/search.css index 70fd4c6..65ce640 100644 --- a/style/search.css +++ b/style/search.css @@ -19,25 +19,25 @@ } #search-results h2 { - color: #222; font-size: 1.8rem; font-weight: 500; + color: #ddd; } #search-section { display: flex; - flex-direction: column; + flex-direction: column; gap: 1rem; } #search-item { display: flex; height: 8rem; - border: 1px solid #eee; border-radius: 5px; gap: 1rem; padding: 1rem; box-shadow: 0 1px 1px #ddd; + border: 1px solid #888; } #search-item h3 { @@ -47,7 +47,7 @@ #search-item span { font-size: 1.3rem; - color: #333; + color: #bbb; } #search-item img { @@ -63,19 +63,3 @@ border: 1px solid #ddd; color: #222; } - -.dark #search-page h2 { - color: #eee; -} - -.dark #search-item { - border: 1px solid #888; -} - -.dark #search-item h3 { - color: #ddd; -} - -.dark #search-item span { - color: #bbb; -} diff --git a/views/footer.templ b/views/footer.templ index 102451e..99ffe8b 100644 --- a/views/footer.templ +++ b/views/footer.templ @@ -5,11 +5,8 @@ import "github.com/rramiachraf/dumb/data" templ footer() { } diff --git a/views/navbar.templ b/views/navbar.templ index 588f1f8..80a2dce 100644 --- a/views/navbar.templ +++ b/views/navbar.templ @@ -4,38 +4,6 @@ templ navbar() { }