tangled
alpha
login
or
join now
finxol.io
/
bookmarker
0
fork
atom
A very simple bookmarking webapp
bookmarker.finxol.deno.net/
0
fork
atom
overview
issues
pulls
pipelines
feat: add ai blocker using `@hono/ua-blocker`
finxol.io
1 month ago
9a95f0df
8a81a9fa
verified
This commit was signed with the committer's
known signature
.
finxol.io
SSH Key Fingerprint:
SHA256:olFE3asYdoBMScuJOt60UxXdJ0RFdGv5kVKrdOtIcPI=
+18
3 changed files
expand all
collapse all
unified
split
deno.json
deno.lock
server
index.ts
+1
deno.json
···
10
10
"imports": {
11
11
"@arkenv/vite-plugin": "npm:@arkenv/vite-plugin@^0.0.29",
12
12
"@evilmartians/harmony": "npm:@evilmartians/harmony@^1.4.0",
13
13
+
"@hono/ua-blocker": "npm:@hono/ua-blocker@^0.1.24",
13
14
"@openauthjs/openauth": "npm:@openauthjs/openauth@^0.4.3",
14
15
"@std/assert": "jsr:@std/assert@1",
15
16
"@std/encoding": "jsr:@std/encoding@^1.0.10",
+8
deno.lock
···
16
16
"jsr:@std/streams@^1.0.17": "1.0.17",
17
17
"npm:@arkenv/vite-plugin@^0.0.29": "0.0.29_arktype@2.1.29_vite@7.3.1__picomatch@4.0.3",
18
18
"npm:@evilmartians/harmony@^1.4.0": "1.4.0",
19
19
+
"npm:@hono/ua-blocker@~0.1.24": "0.1.24_hono@4.9.8",
19
20
"npm:@openauthjs/openauth@~0.4.3": "0.4.3_arctic@2.3.4_hono@4.9.8",
20
21
"npm:@tanstack/router-plugin@^1.158.1": "1.158.1_vite@7.3.1__picomatch@4.0.3_vite-plugin-solid@2.11.10__solid-js@1.9.11___seroval@1.5.0__vite@7.3.1___picomatch@4.0.3__@babel+core@7.29.0_@babel+core@7.29.0_solid-js@1.9.11__seroval@1.5.0",
21
22
"npm:@tanstack/solid-query@^5.90.23": "5.90.23_solid-js@1.9.11__seroval@1.5.0",
···
1050
1051
},
1051
1052
"@evilmartians/harmony@1.4.0": {
1052
1053
"integrity": "sha512-NgKkhTnQOSE07IvDxHHPLzFF81TaWU1Ir5nmaRM+PebXAol5vNXnk+Lp2JPgj1P/PBTu6lzSWckSpNjC19XSUw=="
1054
1054
+
},
1055
1055
+
"@hono/ua-blocker@0.1.24_hono@4.9.8": {
1056
1056
+
"integrity": "sha512-rdEx83ssuEm5rcB69vndUQ37GTtucPakmSt0UmXd0ICTbDiQflTQzhtBR5HlTAWpa7eNkdEOA8bmqUMtnwdA6Q==",
1057
1057
+
"dependencies": [
1058
1058
+
"hono"
1059
1059
+
]
1053
1060
},
1054
1061
"@isaacs/balanced-match@4.0.1": {
1055
1062
"integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ=="
···
3781
3788
"jsr:@std/http@1",
3782
3789
"npm:@arkenv/vite-plugin@^0.0.29",
3783
3790
"npm:@evilmartians/harmony@^1.4.0",
3791
3791
+
"npm:@hono/ua-blocker@~0.1.24",
3784
3792
"npm:@openauthjs/openauth@~0.4.3",
3785
3793
"npm:@tanstack/router-plugin@^1.158.1",
3786
3794
"npm:@tanstack/solid-query@^5.90.23",
+9
server/index.ts
···
6
6
import { logger } from "hono/logger"
7
7
import { serveStatic } from "hono/deno"
8
8
import { showRoutes } from "hono/dev"
9
9
+
import { uaBlocker } from "@hono/ua-blocker"
10
10
+
import { aiBots, useAiRobotsTxt } from "@hono/ua-blocker/ai-bots"
9
11
import { unprotectedRoutes } from "./routes/public.ts"
10
12
import { Variables } from "./utils/globals.ts"
11
13
import account from "./routes/account.ts"
···
41
43
.use("*", logger())
42
44
.use("*", cors())
43
45
.use(trimTrailingSlash())
46
46
+
.use("/robots.txt", useAiRobotsTxt())
47
47
+
.use(
48
48
+
"*",
49
49
+
uaBlocker({
50
50
+
blocklist: aiBots,
51
51
+
}),
52
52
+
)
44
53
// TODO(@finxol): fix security headers
45
54
.use(
46
55
"*",