@@ -76,6 +76,7 @@ import {TagChecker} from 'app/server/lib/TagChecker';
76
76
import { ITelemetry } from 'app/server/lib/Telemetry' ;
77
77
import { startTestingHooks } from 'app/server/lib/TestingHooks' ;
78
78
import { getTestLoginSystem } from 'app/server/lib/TestLogin' ;
79
+ import { compareWithLatest } from 'app/server/lib/updateChecker' ;
79
80
import { UpdateManager } from 'app/server/lib/UpdateManager' ;
80
81
import { addUploadRoute } from 'app/server/lib/uploads' ;
81
82
import { buildWidgetRepository , getWidgetsInPlugins , IWidgetRepository } from 'app/server/lib/WidgetRepository' ;
@@ -103,6 +104,9 @@ const HEALTH_CHECK_LOG_SHOW_FIRST_N = 10;
103
104
// And we show every Nth health check:
104
105
const HEALTH_CHECK_LOG_SHOW_EVERY_N = 100 ;
105
106
107
+ // In milliseconds
108
+ const ONE_WEEK = 7 * 24 * 60 * 60 * 1000 ;
109
+
106
110
// DocID of Grist doc to collect the Welcome questionnaire responses, such
107
111
// as "GristNewUserInfo".
108
112
const DOC_ID_NEW_USER_INFO = process . env . DOC_ID_NEW_USER_INFO ;
@@ -200,6 +204,7 @@ export class FlexServer implements GristServer {
200
204
private _jobs ?: GristJobs ;
201
205
private _emitNotifier = new EmitNotifier ( ) ;
202
206
private _testPendingNotifications : number = 0 ;
207
+ private _intervalCheckID : ReturnType < typeof setInterval > ;
203
208
204
209
constructor ( public port : number , public name : string = 'flexServer' ,
205
210
public readonly options : FlexServerOptions = { } ) {
@@ -1983,6 +1988,13 @@ export class FlexServer implements GristServer {
1983
1988
this . create . addExtraHomeEndpoints ( this , this . app ) ;
1984
1989
}
1985
1990
1991
+ public startCheckingForUpdates ( ) {
1992
+ const gristServer = this ;
1993
+ compareWithLatest ( gristServer ) ;
1994
+ this . _intervalCheckID = setInterval ( ( ) => { compareWithLatest ( gristServer ) ; } , ONE_WEEK ) ;
1995
+ log . debug ( `started version check task with ID ${ this . _intervalCheckID } ` ) ;
1996
+ }
1997
+
1986
1998
// Get the HTML template sent for document pages.
1987
1999
public async getDocTemplate ( ) : Promise < DocTemplate > {
1988
2000
const page = await fse . readFile ( path . join ( getAppPathTo ( this . appRoot , 'static' ) ,
0 commit comments