fix: Add basic user-agent to all mastodon-bound requests (#2277)
This commit is contained in:
parent
008248ee0f
commit
302da09248
2 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
import { stringifyQuery } from 'ufo'
|
||||
|
||||
import { defaultUserAgent } from '~/server/utils/shared'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
let { server, origin } = getRouterParams(event)
|
||||
server = server.toLocaleLowerCase().trim()
|
||||
|
@ -24,6 +26,9 @@ export default defineEventHandler(async (event) => {
|
|||
try {
|
||||
const result: any = await $fetch(`https://${server}/oauth/token`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'user-agent': defaultUserAgent,
|
||||
},
|
||||
body: {
|
||||
client_id: app.client_id,
|
||||
client_secret: app.client_secret,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue