File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,20 @@ interface UserAgentStore {
99 }
1010}
1111
12- const _getUA = ( appVersion : string ) : string => {
12+ const _getUA = ( ) : string => {
1313 const maxIndex = userAgents . length - 1
1414 const index = crypto . randomInt ( 0 , maxIndex )
1515
16- const userAgent = userAgents [ index ] + ' DofusTouch Client ' + appVersion
17- return userAgent
16+ return userAgents [ index ]
1817}
1918
2019export const generateUserArgent = async ( appVersion : string ) => {
2120 const storage = new ElectronStore < UserAgentStore > ( )
2221 const now = new Date ( )
2322
23+ let ua : string
2424 if ( ! storage . get ( 'userAgent' ) || new Date ( storage . get ( 'userAgent' ) . maxAge ) < now ) {
25- const ua = _getUA ( appVersion )
25+ ua = _getUA ( )
2626
2727 const expireDay = crypto . randomInt ( 10 , 360 )
2828 const maxAge = new Date ( now . setDate ( now . getDate ( ) + expireDay ) ) . toString ( )
@@ -31,9 +31,9 @@ export const generateUserArgent = async (appVersion: string) => {
3131 ua,
3232 maxAge
3333 } as UserAgentStore [ 'userAgent' ] )
34-
35- return ua
3634 } else {
37- return storage . get ( 'userAgent' ) . ua
35+ ua = storage . get ( 'userAgent' ) . ua
3836 }
37+
38+ return ua + ' DofusTouch Client ' + appVersion
3939}
You can’t perform that action at this time.
0 commit comments