- Notifications
You must be signed in to change notification settings - Fork584
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix: Add basic user-agent to all mastodon-bound requests#2277
Conversation
Default UA "undici" is not very nice, and I blocked it on my instance toblock a certain botwave.
|
✅ Deploy Preview forelk-docs canceled.
|
✅ Deploy Preview forelk-zone ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
@@ -24,6 +26,9 @@ export default defineEventHandler(async (event) => { | |||
try { | |||
const result: any = await $fetch(`https://${server}/oauth/token`, { | |||
method: 'POST', | |||
headers: { | |||
'user-agent': APP_NAME, |
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.
I guess we should append the version as well,Elk/0.x.x
. Could put in the constants module.
I am not sure if we should also include other UA for compatibility, otherwise it LGTM
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.
what changes need to be done to the release process so that this constant gets updated?
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.
You can get the version here
Line 4 in5781491
export{version}from'../package.json' |
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.
ah okay, ty. i thought you were suggesting to add a new constant. will fix soon
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.
I am not sure if we should also include other UA for compatibility, otherwise it LGTM
I believe this should not be necessary, considering you got away with literally hte string"undici"
so far
@antfu can you take another look? |
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.
Thank you for updating the PR!🙂
I confirmed both fetch requests (/api/v1/apps
and/oauth/token
) now have the user-agent valueElk/0.15.1
in headers on the Elk server side.
I haven't checked the received request on the server side (Mastodon) by myself but that should be fine. Have you already tested on your server?
yes, IIRC I tested it fully. but it's been a long time. |
OK, recent commits only modified user-agent string so it should work as expected. Let's see how it goes on Canary version (https://main.elk.zone) after merging. |
Default UA "undici" is not very nice, and I blocked it on my instance to
block a certain botwave.