27 lines
671 B
TypeScript
27 lines
671 B
TypeScript
import { IN_ELECTRON } from "@follow/shared/constants"
|
|
import { nanoid } from "nanoid"
|
|
|
|
import { detectBrowser, getOS } from "./utils"
|
|
|
|
declare const APP_VERSION: string
|
|
export const appSessionTraceId = nanoid()
|
|
|
|
export const getCurrentEnvironment = () => {
|
|
const ua = navigator.userAgent
|
|
const appVersion = APP_VERSION
|
|
const env = IN_ELECTRON ? "electron" : "web"
|
|
const os = getOS()
|
|
const browser = detectBrowser()
|
|
|
|
return [
|
|
"### Environment",
|
|
"",
|
|
`**App Version**: ${appVersion}`,
|
|
`**OS**: ${os}`,
|
|
`**User Agent**: ${ua}`,
|
|
`**Env**: ${env}`,
|
|
`**Browser**: ${browser}`,
|
|
`**Session Trace Id**: \`${appSessionTraceId}\``,
|
|
]
|
|
}
|