fix: TTLock — correct OAuth server (api.sciener.com) and API servers (euapi/cnapi)
- OAuth token: always https://api.sciener.com/oauth2/token (was euopen.ttlock.com = wrong) - EU API: https://euapi.ttlock.com/v3/... (was euopen.ttlock.com) - CN API: https://cnapi.ttlock.com/v3/... (was open.ttlock.com) - Migration 054: update existing DB records with old server URLs - UI: update radio button values to correct server names Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,14 +51,14 @@ const ttlockRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
[hotelId],
|
||||
)
|
||||
if (!rows[0]) {
|
||||
return { isEnabled: false, clientId: '', cardSectors: '1,2,3,4,5,6,7,8,9,10', apiServer: 'https://euopen.ttlock.com' }
|
||||
return { isEnabled: false, clientId: '', cardSectors: '1,2,3,4,5,6,7,8,9,10', apiServer: 'https://euapi.ttlock.com' }
|
||||
}
|
||||
const r = rows[0]
|
||||
return {
|
||||
isEnabled: r.is_enabled,
|
||||
clientId: r.client_id,
|
||||
cardSectors: r.card_sectors,
|
||||
apiServer: r.api_server ?? 'https://euopen.ttlock.com',
|
||||
apiServer: r.api_server ?? 'https://euapi.ttlock.com',
|
||||
}
|
||||
})
|
||||
|
||||
@@ -187,7 +187,7 @@ const ttlockRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
type: 'ttlock:test_api',
|
||||
clientId: cfg.client_id,
|
||||
clientSecret: cfg.client_secret,
|
||||
apiServer: cfg.api_server ?? 'https://euopen.ttlock.com',
|
||||
apiServer: cfg.api_server ?? 'https://euapi.ttlock.com',
|
||||
}, 15_000) as { ok?: boolean; lockCount?: number; error?: string }
|
||||
|
||||
if (!result.ok) return reply.code(502).send({ error: result.error ?? 'Ошибка API' })
|
||||
@@ -394,7 +394,7 @@ const ttlockRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
cardSectors: cfg.card_sectors,
|
||||
clientId: cfg.client_id,
|
||||
clientSecret: cfg.client_secret,
|
||||
apiServer: cfg.api_server ?? 'https://euopen.ttlock.com',
|
||||
apiServer: cfg.api_server ?? 'https://euapi.ttlock.com',
|
||||
startDate: checkIn,
|
||||
endDate: checkOut,
|
||||
}, 30_000)
|
||||
|
||||
Reference in New Issue
Block a user