From e58abbe4ded17c1a6cca57b54f0eecf16654c146 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 6 Apr 2025 00:21:13 -0400 Subject: web: add noindex to base HTML template (#229) Closes #227 Signed-off-by: Xe Iaso --- docs/docs/CHANGELOG.md | 1 + web/index.templ | 1 + web/index_templ.go | 18 +++++++++--------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index 620fd40..d4aac89 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed most `zizmor` findings - Enabled Dependabot - Added an `--extract-resources` flag to extract static resources to a local folder. +- Add noindex flag to all Anubis pages ([#227](https://github.com/TecharoHQ/anubis/issues/227)). ## v1.15.1 diff --git a/web/index.templ b/web/index.templ index ff3994f..90ee5a4 100644 --- a/web/index.templ +++ b/web/index.templ @@ -12,6 +12,7 @@ templ base(title string, body templ.Component) { { title } + ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -75,7 +75,7 @@ func base(title string, body templ.Component) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 59, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 60, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -126,7 +126,7 @@ func index() templ.Component { templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/img/pensive.webp?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 83, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 84, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -140,7 +140,7 @@ func index() templ.Component { templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/img/happy.webp?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 89, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 90, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -153,7 +153,7 @@ func index() templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/js/main.mjs?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 92, Col: 116} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 93, Col: 116} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -195,7 +195,7 @@ func errorPage(message string) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/img/reject.webp?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 118, Col: 93} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 119, Col: 93} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -208,7 +208,7 @@ func errorPage(message string) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(message) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 120, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 121, Col: 14} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -251,7 +251,7 @@ func bench() templ.Component { templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/img/pensive.webp?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 148, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 149, Col: 19} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -264,7 +264,7 @@ func bench() templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs("/.within.website/x/cmd/anubis/static/js/bench.mjs?cacheBuster=" + anubis.Version) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 151, Col: 118} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 152, Col: 118} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { -- cgit v1.2.3 From 95416dfe82ae8aefdad7537584db32710d41b287 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 6 Apr 2025 00:28:08 -0400 Subject: Makefile: fix subtle logic bug (#228) Closes #226 Makefile dependencies are backwards, apparently. Also add staticcheck as a `go tool` dependency. --- Makefile | 8 +++----- docs/docs/developer/building-anubis.md | 23 ++++++++++++++++++----- go.mod | 6 +++++- go.sum | 7 +++++++ 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 380d9f1..c16fa57 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,10 @@ NODE_MODULES = node_modules .PHONY: build assets deps lint test -$(NODE_MODULES): +assets: npm run assets -assets: $(NODE_MODULES) - -deps: assets +deps: npm ci go mod download @@ -19,7 +17,7 @@ all: build lint: go vet ./... - staticcheck ./... + go tool staticcheck ./... test: npm run test \ No newline at end of file diff --git a/docs/docs/developer/building-anubis.md b/docs/docs/developer/building-anubis.md index 69b2404..ebc8e21 100644 --- a/docs/docs/developer/building-anubis.md +++ b/docs/docs/developer/building-anubis.md @@ -4,7 +4,7 @@ title: Building Anubis without Docker :::note -These instructions may work, but for right now they are informative for downstream packagers more than they are ready-made instructions for administrators wanting to run Anubis on their servers. +These instructions may work, but for right now they are informative for downstream packagers more than they are ready-made instructions for administrators wanting to run Anubis on their servers. Pre-made binary package support is being tracked in [#156](https://github.com/TecharoHQ/anubis/issues/156). ::: @@ -12,14 +12,21 @@ These instructions may work, but for right now they are informative for downstre In order to build a production-ready binary of Anubis, you need the following packages in your environment: -- [Go](https://go.dev) - the programming language that Anubis is written in +- [Go](https://go.dev) at least version 1.24 - the programming language that Anubis is written in - [esbuild](https://esbuild.github.io/) - the JavaScript bundler Anubis uses for its production JS assets - [Node.JS & NPM](https://nodejs.org/en) - manages some build dependencies - `gzip` - compresses production JS (part of coreutils) - `zstd` - compresses production JS - `brotli` - compresses production JS -## Install dependencies +To upgrade your version of Go without system package manager support, install `golang.org/dl/go1.24.2` (this can be done from any version of Go): + +```text +go install golang.org/dl/go1.24.2@latest +go1.24.2 download +``` + +### Install dependencies ```text make deps @@ -27,7 +34,7 @@ make deps This will download Go and NPM dependencies. -## Building static assets +### Building static assets ```text make assets @@ -35,10 +42,16 @@ make assets This will build all static assets (CSS, JavaScript) for distribution. -## Building Anubis to the `./var` folder +### Building Anubis to the `./var` folder ```text make build ``` From this point it is up to you to make sure that `./var/anubis` ends up in the right place. You may want to consult the `./run` folder for useful files such as a systemd unit and `anubis.env.default` file. + +## Development dependencies + +Optionally, you can install the following dependencies for development: + +- [Staticcheck](https://staticcheck.dev/docs/getting-started/) (optional, not required due to [`go tool staticcheck`](https://www.alexedwards.net/blog/how-to-manage-tool-dependencies-in-go-1.24-plus), but required if you are using any version of Go older than 1.24) diff --git a/go.mod b/go.mod index 5bb3cca..91d2545 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/TecharoHQ/anubis -go 1.24.1 +go 1.24.2 require ( github.com/a-h/templ v0.3.833 @@ -13,6 +13,7 @@ require ( ) require ( + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect github.com/PuerkitoBio/goquery v1.10.1 // indirect github.com/a-h/parse v0.0.0-20250122154542-74294addb73e // indirect github.com/andybalholm/brotli v1.1.0 // indirect @@ -39,15 +40,18 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.62.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 // indirect golang.org/x/mod v0.24.0 // indirect golang.org/x/net v0.37.0 // indirect golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/tools v0.31.0 // indirect google.golang.org/protobuf v1.36.4 // indirect + honnef.co/go/tools v0.6.1 // indirect ) tool ( github.com/a-h/templ/cmd/templ golang.org/x/tools/cmd/stringer + honnef.co/go/tools/cmd/staticcheck ) diff --git a/go.sum b/go.sum index 2d620a7..3b2ba48 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= 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/parse v0.0.0-20250122154542-74294addb73e h1:HjVbSQHy+dnlS6C3XajZ69NYAb5jbGNfHanvm1+iYlo= @@ -86,6 +88,9 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY 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/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ= +golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= 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= @@ -162,3 +167,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.6.1 h1:R094WgE8K4JirYjBaOpz/AvTyUu/3wbmAoskKN/pxTI= +honnef.co/go/tools v0.6.1/go.mod h1:3puzxxljPCe8RGJX7BIy1plGbxEOZni5mR2aXe3/uk4= -- cgit v1.2.3 From f1f8fdf7529daccad8fffe97ca6c868f7a9472c7 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 6 Apr 2025 00:29:52 -0400 Subject: package.json: fix build command (#230) Closes #225 Signed-off-by: Xe Iaso --- .github/workflows/go.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0be7b37..18a8df7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -77,7 +77,7 @@ jobs: npm run assets - name: Build - run: go build ./... + run: npm run build - name: Test run: npm run test diff --git a/package.json b/package.json index e8b4eb2..cfff0b6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "npm run assets && go test ./...", "test:integration": "npm run assets && go test -v ./internal/test", "assets": "go generate ./... && ./web/build.sh && ./xess/build.sh", - "build": "npm run assets && go build -o ./var/anubis ../cmd/anubis", + "build": "npm run assets && go build -o ./var/anubis ./cmd/anubis", "dev": "npm run assets && go run ./cmd/anubis --use-remote-address", "container": "npm run assets && go run ./cmd/containerbuild", "package": "yeet" -- cgit v1.2.3