@@ -14,6 +14,8 @@ import { commit, rootPath } from "../constants"
14
14
import { Heart } from "../heart"
15
15
import { ensureAuthenticated , redirect } from "../http"
16
16
import { PluginAPI } from "../plugin"
17
+ import { UpdateProvider } from "../update"
18
+ import { CoderSettings , SettingsProvider } from "../settings"
17
19
import { getMediaMime , paths } from "../util"
18
20
import * as apps from "./apps"
19
21
import * as domainProxy from "./domainProxy"
@@ -47,6 +49,9 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
47
49
app . router . use ( cookieParser ( ) )
48
50
app . wsRouter . use ( cookieParser ( ) )
49
51
52
+ const settings = new SettingsProvider < CoderSettings > ( path . join ( args [ "user-data-dir" ] , "coder.json" ) )
53
+ const updater = new UpdateProvider ( "https://api.github.com/repos/cdr/code-server/releases/latest" , settings )
54
+
50
55
const common : express . RequestHandler = ( req , _ , next ) => {
51
56
// /healthz|/healthz/ needs to be excluded otherwise health checks will make
52
57
// it look like code-server is always in use.
@@ -57,6 +62,8 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
57
62
// Add common variables routes can use.
58
63
req . args = args
59
64
req . heart = heart
65
+ req . settings = settings
66
+ req . updater = updater
60
67
61
68
next ( )
62
69
}
0 commit comments