1
0
mirror of https://github.com/NickKaramoff/toot synced 2025-02-11 17:20:48 +01:00

Add a proper user agent for API requests

This commit is contained in:
Nikita Karamov 2025-01-16 16:44:22 +01:00
parent 2362ccffb6
commit 7f81bb0f58
No known key found for this signature in database

View File

@ -6,7 +6,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import process from "node:process";
import { supportedProjects } from "./project";
import {
version,
repository,
} from "../../package.json" assert { type: "json" };
interface Instance {
domain: string;
@ -25,6 +30,7 @@ const getInstancesForProject = async (
Accept: "*/*",
"Accept-Language": "en;q=1.0",
"Content-Type": "application/json",
"User-Agent": `Share2Fedi/${version} (+${repository.url}) node/${process.versions.node}`,
},
body: JSON.stringify({
query: `{nodes(status:"UP",softwarename:"${project}"){domain score active_users_monthly total_users}}`,