@@ -19,7 +19,7 @@ export const router = Router()
19
19
const vscode = new VscodeProvider ( )
20
20
21
21
router . get ( "/" , async ( req , res ) => {
22
- if ( ! authenticated ( req ) ) {
22
+ if ( await ! authenticated ( req ) ) {
23
23
return redirect ( req , res , "login" , {
24
24
// req.baseUrl can be blank if already at the root.
25
25
to : req . baseUrl && req . baseUrl !== "/" ? req . baseUrl : undefined ,
@@ -61,6 +61,7 @@ router.get("/", async (req, res) => {
61
61
62
62
/**
63
63
* TODO: Might currently be unused.
64
+ * TODO@jsjoeio might break because ensureAuthenticated is async
64
65
*/
65
66
router . get ( "/resource(/*)?" , ensureAuthenticated , async ( req , res ) => {
66
67
if ( typeof req . query . path === "string" ) {
@@ -71,6 +72,7 @@ router.get("/resource(/*)?", ensureAuthenticated, async (req, res) => {
71
72
72
73
/**
73
74
* Used by VS Code to load files.
75
+ * TODO@jsjoeio might break because ensureAuthenticated is async
74
76
*/
75
77
router . get ( "/vscode-remote-resource(/*)?" , ensureAuthenticated , async ( req , res ) => {
76
78
if ( typeof req . query . path === "string" ) {
@@ -82,6 +84,7 @@ router.get("/vscode-remote-resource(/*)?", ensureAuthenticated, async (req, res)
82
84
/**
83
85
* VS Code webviews use these paths to load files and to load webview assets
84
86
* like HTML and JavaScript.
87
+ * TODO@jsjoeio might break because ensureAuthenticated is async
85
88
*/
86
89
router . get ( "/webview/*" , ensureAuthenticated , async ( req , res ) => {
87
90
res . set ( "Content-Type" , getMediaMime ( req . path ) )
@@ -128,6 +131,7 @@ const fetchTimeout = 5 * 60 * 1000
128
131
// The callback endpoints are used during authentication. A URI is stored on
129
132
// /callback and then fetched later on /fetch-callback.
130
133
// See ../../../lib/vscode/resources/web/code-web.js
134
+ // TODO@jsjoeio might break because ensureAuthenticated is async
131
135
router . get ( "/callback" , ensureAuthenticated , async ( req , res ) => {
132
136
const uriKeys = [
133
137
"vscode-requestId" ,
@@ -167,6 +171,7 @@ router.get("/callback", ensureAuthenticated, async (req, res) => {
167
171
res . sendFile ( path . join ( rootPath , "lib/vscode/resources/web/callback.html" ) )
168
172
} )
169
173
174
+ // TODO@jsjoeio might break becasue ensureAuthenticated is async
170
175
router . get ( "/fetch-callback" , ensureAuthenticated , async ( req , res ) => {
171
176
const id = getRequestId ( req )
172
177
@@ -195,7 +200,7 @@ router.get("/fetch-callback", ensureAuthenticated, async (req, res) => {
195
200
} )
196
201
197
202
export const wsRouter = WsRouter ( )
198
-
203
+ // TODO @jsjoeio might break becasue ensureAuthenticated is async
199
204
wsRouter . ws ( "/" , ensureAuthenticated , async ( req ) => {
200
205
const magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
201
206
const reply = crypto
0 commit comments