From e78ff655e98462dc80c49469de4645e8dc90fac6 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Mon, 6 Nov 2023 15:43:59 +0530 Subject: [PATCH 1/2] feat: addd user_agent in default request options --- src/extension/background-script/connectors/alby.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index 3df2a38fd7..2d2439349b 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -322,8 +322,11 @@ export default class Alby implements Connector { private _getRequestOptions(): Partial { return { ...(process.env.ALBY_API_URL - ? { base_url: process.env.ALBY_API_URL } - : {}), + ? { + base_url: process.env.ALBY_API_URL, + user_agent: `lightning-browser-extension:${process.env.VERSION}`, + } + : { user_agent: `lightning-browser-extension:${process.env.VERSION}` }), }; } From 3036a303487966f78630b269257cbdac2ecf5660 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Mon, 6 Nov 2023 18:19:43 +0530 Subject: [PATCH 2/2] chore: assign user agent outside the conditionals --- src/extension/background-script/connectors/alby.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index 2d2439349b..c85b17a439 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -321,12 +321,12 @@ export default class Alby implements Connector { private _getRequestOptions(): Partial { return { + user_agent: `lightning-browser-extension:${process.env.VERSION}`, ...(process.env.ALBY_API_URL ? { base_url: process.env.ALBY_API_URL, - user_agent: `lightning-browser-extension:${process.env.VERSION}`, } - : { user_agent: `lightning-browser-extension:${process.env.VERSION}` }), + : {}), }; }