@@ -14,6 +14,8 @@ import { commit, rootPath } from "../constants"
1414import { Heart } from "../heart"
1515import { ensureAuthenticated , redirect } from "../http"
1616import { PluginAPI } from "../plugin"
17+ import { UpdateProvider } from "../update"
18+ import { CoderSettings , SettingsProvider } from "../settings"
1719import { getMediaMime , paths } from "../util"
1820import * as apps from "./apps"
1921import * as domainProxy from "./domainProxy"
@@ -47,6 +49,9 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
4749 app . router . use ( cookieParser ( ) )
4850 app . wsRouter . use ( cookieParser ( ) )
4951
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+
5055 const common : express . RequestHandler = ( req , _ , next ) => {
5156 // /healthz|/healthz/ needs to be excluded otherwise health checks will make
5257 // it look like code-server is always in use.
@@ -57,6 +62,8 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
5762 // Add common variables routes can use.
5863 req . args = args
5964 req . heart = heart
65+ req . settings = settings
66+ req . updater = updater
6067
6168 next ( )
6269 }
0 commit comments