From 1720c5909322e28ec8d98cac5f19205d3b528dd9 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Wed, 30 Nov 2022 22:29:54 +0100 Subject: [PATCH] Fix missing user-agent headers --- CHANGELOG.md | 2 ++ src/fetcher/activitypub.js | 3 ++- src/fetcher/matrix.js | 5 ++++- src/fetcher/twitter.js | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98428d4..c070416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Added missing user-agent headers ## [0.18.0] - 2022-11-17 ### Changed diff --git a/src/fetcher/activitypub.js b/src/fetcher/activitypub.js index 655a0f0..c87a7c1 100644 --- a/src/fetcher/activitypub.js +++ b/src/fetcher/activitypub.js @@ -66,7 +66,8 @@ module.exports.fn = async (data, opts) => { const headers = { host, date: now.toUTCString(), - accept: 'application/activity+json' + accept: 'application/activity+json', + 'User-Agent': `doipjs/${require('../../package.json').version}` } if (isConfigured && jsEnv.isNode) { diff --git a/src/fetcher/matrix.js b/src/fetcher/matrix.js index 97a0a26..9771c37 100644 --- a/src/fetcher/matrix.js +++ b/src/fetcher/matrix.js @@ -58,7 +58,10 @@ module.exports.fn = async (data, opts) => { const url = `https://${opts.claims.matrix.instance}/_matrix/client/r0/rooms/${data.roomId}/event/${data.eventId}?access_token=${opts.claims.matrix.accessToken}` axios.get(url, { - headers: { Accept: 'application/json' } + headers: { + Accept: 'application/json', + 'User-Agent': `doipjs/${require('../../package.json').version}` + } }) .then(res => { return res.data diff --git a/src/fetcher/twitter.js b/src/fetcher/twitter.js index 97880f7..6b39800 100644 --- a/src/fetcher/twitter.js +++ b/src/fetcher/twitter.js @@ -59,6 +59,7 @@ module.exports.fn = async (data, opts) => { { headers: { Accept: 'application/json', + 'User-Agent': `doipjs/${require('../../package.json').version}`, Authorization: `Bearer ${opts.claims.twitter.bearerToken}` } }