Skip to content

Commit 1c75c4c

Browse files
authored
[timo-vn] Web client's version update (#911)
1 parent 26ad485 commit 1c75c4c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/plugins/timo-vn/api.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import forge from 'node-forge'
55
import { TemporaryError, ZPAPIError } from '../../errors'
66

77
export async function login (preferences: Preferences, auth: Auth): Promise<Session> {
8-
const session: Session = {
8+
let session: Session = {
99
auth,
1010
token: '',
1111
refNo: '',
@@ -36,8 +36,18 @@ export async function login (preferences: Preferences, auth: Auth): Promise<Sess
3636
case ApiResponseCode.TECHNICAL_DIFFICULT:
3737
throw new TemporaryError('Connection to bank is temporary unavailable')
3838

39-
case ApiResponseCode.NEED_UPGRADE_APP_VERSION:
40-
throw new TemporaryError('NEED UPGRADE APP VERSION')
39+
case ApiResponseCode.NEED_UPGRADE_APP_VERSION: {
40+
const manualAppVersion = await ZenMoney.readLine('App version too old. Enter actual version:', { inputType: 'number' })
41+
if ((manualAppVersion === null || manualAppVersion === '')) {
42+
throw new TemporaryError('NEED UPGRADE APP VERSION')
43+
}
44+
auth.appVersion = manualAppVersion
45+
auth.deviceReg = auth.deviceUUID + ':WEB:WEB:' + auth.appVersion + ':WEB:desktop:zenmoney'
46+
ZenMoney.setData('auth', auth)
47+
ZenMoney.saveData()
48+
session = await login(preferences, auth)
49+
break
50+
}
4151

4252
default:
4353
throw new ZPAPIError('Authorization failed', false, false)

src/plugins/timo-vn/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { generateRandomString } from '../../common/utils'
77
export const scrape: ScrapeFunc<Preferences> = async ({ preferences, fromDate, toDate, isFirstRun }) => {
88
toDate = toDate ?? new Date()
99

10-
const appVersion = '291'
10+
const appVersion = '293'
1111

1212
if (isFirstRun) {
1313
const auth: Auth = {

0 commit comments

Comments
 (0)