TODO: 推翻整个项目重新建立根基
This commit is contained in:
18
client/getClient.ts
Normal file
18
client/getClient.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { LingChairClient } from 'lingchair-client-protocol'
|
||||
import data from "./Data.ts"
|
||||
import { UAParser } from 'ua-parser-js'
|
||||
import randomUUID from "./utils/randomUUID.ts"
|
||||
|
||||
if (!data.device_id) {
|
||||
const ua = new UAParser(navigator.userAgent)
|
||||
data.device_id = `LingChair_Web_${ua.getOS() || 'unknown-os'}-${ua.getDevice().type || 'unknown_device'}-${randomUUID()}`
|
||||
}
|
||||
const client = new LingChairClient({
|
||||
server_url: '',
|
||||
device_id: data.device_id,
|
||||
auto_fresh_token: true,
|
||||
})
|
||||
|
||||
export default function getClient() {
|
||||
return client
|
||||
}
|
||||
Reference in New Issue
Block a user