-
Notifications
You must be signed in to change notification settings - Fork 278
feat: introduce UA Blocker Middleware #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: d561bc6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Can you add a CI for this middleware, referring to https://github.com/honojs/middleware/blob/main/.github/workflows/ci-hello.yml? |
|
Hey @finxol This middleware is interesting! The idea is good. I've left some comments. |
|
@yusukebe Thanks for the feedback! I'll make the appropriate changes. Let me know if there's anything else. |
|
I've addressed all comments in the latest commit, the architecture and goal of the package is now broader than just an AI bots blocker. The main export is now a generic User Agent based blocker, with a path export for the |
|
|
Yes, it can be ignored by adding I included this change, along with some other suggestions, in finxol#1. Feel free to include them or not 😅 |
BarryThePenguin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your Readme and tests are very comprehensive 👏🏻
|
Wooow. Making this UA Blocker Middleware for general user agents is a great idea. Including |
|
@yusukebe Thank you for the feedback! I just want to make a small change first, I'll push it later today and I'll let you know. And thank you for the great work on Hono :) |
|
I've moved the generator script back out of |
|
@yusukebe it's now ready for review :) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1181 +/- ##
==========================================
- Coverage 79.32% 78.25% -1.08%
==========================================
Files 81 88 +7
Lines 2443 2538 +95
Branches 633 652 +19
==========================================
+ Hits 1938 1986 +48
- Misses 419 464 +45
- Partials 86 88 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Suggested changes are applied, ci should now pass |
|
I tried using this UA Blocker middleware, and it felt good. The rest is making CI/test pass. |
It might be a markdown link, so not the exact string, but "[Yes](<link>)"
generated regex should use the version-controled robots.json, not directly the upstream file
|
Sorry for the force push, needed to rebase to have CI pass with |
| .vscode | ||
| .yarn | ||
| .yarn | ||
| **/generated.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generated.ts should be ignored by Prettier, but having it in packages/ua-blocker/.prettierignore doesn't get picked up because of the prettier --check . '!packages' packages/ua-blocker path specification.
|
@yusukebe Sorry for the ci and test issues. Everything should be fixed now. |
yusukebe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Thanks! Let's go with this. I'll merge and release an initial version. |
Create a new middleware for AI bots blocking.
Inspired by ai.robots.txt.
This provides several options:
robots.txtrobots.txtfile to be served (also offered as a middleware)See README for details
The author should do the following, if applicable
yarn changesetat the top of this repo and push the changeset