api/config: add cobalt user agent

This commit is contained in:
wukko 2024-09-01 14:15:16 +06:00
parent f3521da9c1
commit 4478a963c5
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -1,6 +1,7 @@
import { getVersion } from "@imput/version-info";
import { services } from "./processing/service-config.js"; import { services } from "./processing/service-config.js";
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"; const version = await getVersion();
const disabledServices = process.env.DISABLED_SERVICES?.split(',') || []; const disabledServices = process.env.DISABLED_SERVICES?.split(',') || [];
const enabledServices = new Set(Object.keys(services).filter(e => { const enabledServices = new Set(Object.keys(services).filter(e => {
@ -40,7 +41,11 @@ const env = {
enabledServices, enabledServices,
} }
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
const cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
export { export {
env, env,
genericUserAgent, genericUserAgent,
cobaltUserAgent,
} }