mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-24 09:16:43 +00:00
UBERF-4289: Allow to configure user agent (#3995)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
f8d0237bbb
commit
b74971e29d
@ -64,6 +64,7 @@ export function serveAccount (methods: Record<string, AccountMethod>, productId
|
|||||||
}
|
}
|
||||||
setMetadata(toolPlugin.metadata.Endpoint, endpointUri)
|
setMetadata(toolPlugin.metadata.Endpoint, endpointUri)
|
||||||
setMetadata(toolPlugin.metadata.Transactor, transactorUri)
|
setMetadata(toolPlugin.metadata.Transactor, transactorUri)
|
||||||
|
setMetadata(toolPlugin.metadata.UserAgent, 'AccountService')
|
||||||
|
|
||||||
let client: MongoClient
|
let client: MongoClient
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import serverToken from '@hcengineering/server-token'
|
|||||||
import got from 'got'
|
import got from 'got'
|
||||||
import { ObjectId } from 'mongodb'
|
import { ObjectId } from 'mongodb'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
|
import toolPlugin from '@hcengineering/server-tool'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -72,6 +73,8 @@ export class PlatformWorker {
|
|||||||
secretKey: config.MinioSecretKey
|
secretKey: config.MinioSecretKey
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setMetadata(toolPlugin.metadata.UserAgent, config.ServiceID)
|
||||||
|
|
||||||
await this.backup().then(() => {
|
await this.backup().then(() => {
|
||||||
void this.schedule()
|
void this.schedule()
|
||||||
})
|
})
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
import client, { clientId } from '@hcengineering/client'
|
import client, { clientId } from '@hcengineering/client'
|
||||||
import { Client, systemAccountEmail, WorkspaceId } from '@hcengineering/core'
|
import { Client, systemAccountEmail, WorkspaceId } from '@hcengineering/core'
|
||||||
import { addLocation, getResource, setMetadata } from '@hcengineering/platform'
|
import { addLocation, getMetadata, getResource, setMetadata } from '@hcengineering/platform'
|
||||||
import { generateToken } from '@hcengineering/server-token'
|
import { generateToken } from '@hcengineering/server-token'
|
||||||
|
import plugin from './plugin'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -37,7 +38,14 @@ export async function connect (
|
|||||||
setMetadata(client.metadata.UseBinaryProtocol, true)
|
setMetadata(client.metadata.UseBinaryProtocol, true)
|
||||||
setMetadata(client.metadata.UseProtocolCompression, true)
|
setMetadata(client.metadata.UseProtocolCompression, true)
|
||||||
|
|
||||||
setMetadata(client.metadata.ClientSocketFactory, (url) => new WebSocket(url))
|
setMetadata(client.metadata.ClientSocketFactory, (url) => {
|
||||||
|
const socket = new WebSocket(url, {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': getMetadata(plugin.metadata.UserAgent) ?? 'Anticrm Tool Client'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return socket
|
||||||
|
})
|
||||||
addLocation(clientId, () => import('@hcengineering/client-resources'))
|
addLocation(clientId, () => import('@hcengineering/client-resources'))
|
||||||
|
|
||||||
return await (
|
return await (
|
||||||
|
@ -12,7 +12,8 @@ const toolPlugin = plugin(toolId, {
|
|||||||
metadata: {
|
metadata: {
|
||||||
Endpoint: '' as Metadata<string>,
|
Endpoint: '' as Metadata<string>,
|
||||||
Transactor: '' as Metadata<string>,
|
Transactor: '' as Metadata<string>,
|
||||||
InitWorkspace: '' as Metadata<string>
|
InitWorkspace: '' as Metadata<string>,
|
||||||
|
UserAgent: '' as Metadata<string>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user