diff options
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | data/botPolicies.json | 6 | ||||
| -rw-r--r-- | docs/docs/CHANGELOG.md | 2 | ||||
| -rw-r--r-- | docs/docs/developer/building-anubis.md | 11 | ||||
| -rw-r--r-- | internal/test/playwright_test.go | 6 | ||||
| -rw-r--r-- | package.json | 1 |
6 files changed, 47 insertions, 4 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..380d9f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +NODE_MODULES = node_modules + +.PHONY: build assets deps lint test + +$(NODE_MODULES): + npm run assets + +assets: $(NODE_MODULES) + +deps: assets + npm ci + go mod download + +build: deps + npm run build + @echo "Anubis is now built to ./var/anubis" + +all: build + +lint: + go vet ./... + staticcheck ./... + +test: + npm run test
\ No newline at end of file diff --git a/data/botPolicies.json b/data/botPolicies.json index d0e27a2..25a7b77 100644 --- a/data/botPolicies.json +++ b/data/botPolicies.json @@ -344,6 +344,12 @@ ] }, { + "_comment": "This has been reverse-engineered through making iMessage's preview function hit a URL that prints the user-agent in the server logs.", + "name": "iMessage preview", + "user_agent_regex": ".*facebookexternalhit/1\\.1 Facebot Twitterbot/1\\.0$", + "action": "ALLOW" + }, + { "name": "us-artificial-intelligence-scraper", "user_agent_regex": "\\+https\\://github\\.com/US-Artificial-Intelligence/scraper", "action": "DENY" diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index 48b3c74..2527946 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - The placeholder Anubis mascot has been replaced with a design by [CELPHASE](https://bsky.app/profile/celphase.bsky.social). +- Allow iMessage's link preview fetcher through Anubis by default. - Added a periodic cleanup routine for the decaymap that removes expired entries, ensuring stale data is properly pruned. - Added a no-store Cache-Control header to the challenge page - Hide the directory listings for Anubis' internal static content @@ -31,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Disabled running integration tests on Windows hosts due to it's reliance on posix features (see [#133](https://github.com/TecharoHQ/anubis/pull/133#issuecomment-2764732309)). - Added support for passing the ed25519 signing key in a file with `-ed25519-private-key-hex-file` or `ED25519_PRIVATE_KEY_HEX_FILE`. - Fixed minor typos +- Added a Makefile to enable comfortable workflows for downstream packagers. - Added `zizmor` for GitHub Actions static analysis - Fixed most `zizmor` findings - Enabled Dependabot diff --git a/docs/docs/developer/building-anubis.md b/docs/docs/developer/building-anubis.md index a55b8e7..69b2404 100644 --- a/docs/docs/developer/building-anubis.md +++ b/docs/docs/developer/building-anubis.md @@ -22,20 +22,23 @@ In order to build a production-ready binary of Anubis, you need the following pa ## Install dependencies ```text -go mod download -npm ci +make deps ``` +This will download Go and NPM dependencies. + ## Building static assets ```text -npm run assets +make assets ``` +This will build all static assets (CSS, JavaScript) for distribution. + ## Building Anubis to the `./var` folder ```text -go build -o ./var/anubis ./cmd/anubis +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. diff --git a/internal/test/playwright_test.go b/internal/test/playwright_test.go index ae4022e..88368c7 100644 --- a/internal/test/playwright_test.go +++ b/internal/test/playwright_test.go @@ -64,6 +64,12 @@ var ( userAgent: "Mozilla/5.0 (compatible; Kagibot/1.0; +https://kagi.com/bot)", }, { + name: "iMessageScraper", + action: actionAllow, + realIP: placeholderIP, + userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.4 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.4 facebookexternalhit/1.1 Facebot Twitterbot/1.0", + }, + { name: "unknownAgent", action: actionAllow, realIP: placeholderIP, diff --git a/package.json b/package.json index bf1fd6e..844c92d 100644 --- a/package.json +++ b/package.json @@ -7,6 +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", "dev": "npm run assets && go run ./cmd/anubis --use-remote-address", "container": "npm run assets && go run ./cmd/containerbuild" }, |
