@@ -19,7 +19,7 @@ export const router = Router()
1919const vscode = new VscodeProvider ( )
2020
2121router . get ( "/" , async ( req , res ) => {
22- if ( ! authenticated ( req ) ) {
22+ if ( await ! authenticated ( req ) ) {
2323 return redirect ( req , res , "login" , {
2424 // req.baseUrl can be blank if already at the root.
2525 to : req . baseUrl && req . baseUrl !== "/" ? req . baseUrl : undefined ,
@@ -61,6 +61,7 @@ router.get("/", async (req, res) => {
6161
6262/**
6363 * TODO: Might currently be unused.
64+ * TODO@jsjoeio might break because ensureAuthenticated is async
6465 */
6566router . get ( "/resource(/*)?" , ensureAuthenticated , async ( req , res ) => {
6667 if ( typeof req . query . path === "string" ) {
@@ -71,6 +72,7 @@ router.get("/resource(/*)?", ensureAuthenticated, async (req, res) => {
7172
7273/**
7374 * Used by VS Code to load files.
75+ * TODO@jsjoeio might break because ensureAuthenticated is async
7476 */
7577router . get ( "/vscode-remote-resource(/*)?" , ensureAuthenticated , async ( req , res ) => {
7678 if ( typeof req . query . path === "string" ) {
@@ -82,6 +84,7 @@ router.get("/vscode-remote-resource(/*)?", ensureAuthenticated, async (req, res)
8284/**
8385 * VS Code webviews use these paths to load files and to load webview assets
8486 * like HTML and JavaScript.
87+ * TODO@jsjoeio might break because ensureAuthenticated is async
8588 */
8689router . get ( "/webview/*" , ensureAuthenticated , async ( req , res ) => {
8790 res . set ( "Content-Type" , getMediaMime ( req . path ) )
@@ -128,6 +131,7 @@ const fetchTimeout = 5 * 60 * 1000
128131// The callback endpoints are used during authentication. A URI is stored on
129132// /callback and then fetched later on /fetch-callback.
130133// See ../../../lib/vscode/resources/web/code-web.js
134+ // TODO@jsjoeio might break because ensureAuthenticated is async
131135router . get ( "/callback" , ensureAuthenticated , async ( req , res ) => {
132136 const uriKeys = [
133137 "vscode-requestId" ,
@@ -167,6 +171,7 @@ router.get("/callback", ensureAuthenticated, async (req, res) => {
167171 res . sendFile ( path . join ( rootPath , "lib/vscode/resources/web/callback.html" ) )
168172} )
169173
174+ // TODO@jsjoeio might break becasue ensureAuthenticated is async
170175router . get ( "/fetch-callback" , ensureAuthenticated , async ( req , res ) => {
171176 const id = getRequestId ( req )
172177
@@ -195,7 +200,7 @@ router.get("/fetch-callback", ensureAuthenticated, async (req, res) => {
195200} )
196201
197202export const wsRouter = WsRouter ( )
198-
203+ // TODO @jsjoeio might break becasue ensureAuthenticated is async
199204wsRouter . ws ( "/" , ensureAuthenticated , async ( req ) => {
200205 const magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
201206 const reply = crypto
0 commit comments