diff options
author | Profpatsch <mail@profpatsch.de> | 2024-10-05T12·19+0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2024-10-05T13·49+0000 |
commit | 05c7230127f59e3ef1fad2c8cb7e6769ab5eec08 (patch) | |
tree | 0f429cdfaeb8d923f5cf0cb03779c1e65d5b84d5 /users/Profpatsch | |
parent | c925902015b163706f860b7540148fb6302d98dd (diff) |
fix(users/Profpatsch/lyric/ext): set user agent in all fetches r/8772
Change-Id: I8de1ef76c4d5789536e528f49226e58ee90b8749 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12575 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
Diffstat (limited to 'users/Profpatsch')
-rw-r--r-- | users/Profpatsch/lyric/extension/src/upload-lrc.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/users/Profpatsch/lyric/extension/src/upload-lrc.ts b/users/Profpatsch/lyric/extension/src/upload-lrc.ts index 6686483847d8..8627e382726b 100644 --- a/users/Profpatsch/lyric/extension/src/upload-lrc.ts +++ b/users/Profpatsch/lyric/extension/src/upload-lrc.ts @@ -1,5 +1,8 @@ import * as crypto from 'crypto'; +const USER_AGENT = + 'lyric tool (source: https://code.tvl.fyi/tree/users/Profpatsch/lyric, contact: https://mastodon.xyz/@Profpatsch)'; + // Helper function to convert a hex string to a Buffer function hexToBytes(hex: string): Buffer { return Buffer.from(hex, 'hex'); @@ -48,8 +51,8 @@ async function getUploadNonce() { method: 'POST', headers: { 'Content-Type': 'application/json', - 'User-Agent': 'lyric tool (https://code.tvl.fyi/tree/users/Profpatsch/lyric)', - 'Lrclib-Client': 'lyric tool (https://code.tvl.fyi/tree/users/Profpatsch/lyric)', + 'User-Agent': USER_AGENT, + 'Lrclib-Client': USER_AGENT, }, }); @@ -96,8 +99,8 @@ export async function publishLyrics( method: 'POST', headers: { 'Content-Type': 'application/json', - 'User-Agent': 'lyric tool (https://code.tvl.fyi/tree/users/Profpatsch/lyric)', - 'Lrclib-Client': 'lyric tool (https://code.tvl.fyi/tree/users/Profpatsch/lyric)', + 'User-Agent': USER_AGENT, + 'Lrclib-Client': USER_AGENT, 'X-Publish-Token': publishToken, }, body: JSON.stringify(requestBody), |