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:
2026-04-02 11:21:37 +03:00
parent ee7e515f61
commit 84ead2af99
3 changed files with 21 additions and 9 deletions

View File

@@ -143,7 +143,7 @@ export function TTLockPage() {
const [clientId, setClientId] = useState('')
const [clientSecret, setClientSecret] = useState('')
const [cardSectors, setCardSectors] = useState('1,2,3,4,5,6,7,8,9,10')
const [apiServer, setApiServer] = useState('https://euopen.ttlock.com')
const [apiServer, setApiServer] = useState('https://euapi.ttlock.com')
// Per-workstation COM port state
const [wsComPorts, setWsComPorts] = useState<Record<string, string>>({})
@@ -243,7 +243,7 @@ export function TTLockPage() {
setIsEnabled(cfg.isEnabled)
setClientId(cfg.clientId)
setCardSectors(cfg.cardSectors || '1,2,3,4,5,6,7,8,9,10')
setApiServer(cfg.apiServer || 'https://euopen.ttlock.com')
setApiServer(cfg.apiServer || 'https://euapi.ttlock.com')
setMappings(maps)
setRooms(roomList)
setWorkstations(wsList)
@@ -415,8 +415,8 @@ export function TTLockPage() {
<label className="form-label">Сервер TTLock API</label>
<div className="flex gap-3 mt-1">
{[
{ value: 'https://euopen.ttlock.com', label: 'EU', hint: 'euopen.ttlock.com' },
{ value: 'https://open.ttlock.com', label: 'China', hint: 'open.ttlock.com' },
{ value: 'https://euapi.ttlock.com', label: 'EU', hint: 'euapi.ttlock.com' },
{ value: 'https://cnapi.ttlock.com', label: 'China', hint: 'cnapi.ttlock.com' },
].map(opt => (
<label
key={opt.value}
@@ -441,7 +441,7 @@ export function TTLockPage() {
))}
</div>
<p className="text-xs text-slate-400 mt-1.5">
Если получаете ошибку 404 при выдаче карты попробуйте другой сервер.
OAuth авторизация всегда через api.sciener.com. Выберите регион для /v3/ API.
</p>
</div>