This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 1 file changed +20
-6
lines changed
scripts/code.angularjs.org-firebase/functions
1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ function sendStoredFile(request, response) {
31
31
}
32
32
33
33
if ( ! fileName ) {
34
- //Root
34
+ // Root
35
35
return getDirectoryListing ( '/' ) . catch ( sendErrorResponse ) ;
36
36
}
37
37
@@ -111,6 +111,11 @@ function sendStoredFile(request, response) {
111
111
return getContent ( getFilesOptions ) . then ( ( ) => {
112
112
let contentList = '' ;
113
113
114
+ if ( path === '/' ) {
115
+ // Let the latest versions appear first
116
+ directoryList . reverse ( ) ;
117
+ }
118
+
114
119
directoryList . forEach ( directoryPath => {
115
120
const dirName = directoryPath . split ( '/' ) . reverse ( ) [ 1 ] ;
116
121
contentList += `<a href="${ dirName } /">${ dirName } /</a><br>` ;
@@ -125,11 +130,20 @@ function sendStoredFile(request, response) {
125
130
// without trailing slash
126
131
const base = request . originalUrl . endsWith ( '/' ) ? request . originalUrl : request . originalUrl + '/' ;
127
132
128
- let directoryListing = `
129
- <base href="${ base } ">
130
- <h1>Index of ${ path } </h1>
131
- <hr>
132
- <pre>${ contentList } </pre>` ;
133
+ const directoryListing = `
134
+ <!DOCTYPE html>
135
+ <html lang="en">
136
+ <head>
137
+ <meta charset="utf-8" />
138
+ <meta name="viewport" content="width=device-width, initial-scale=1">
139
+ <base href="${ base } ">
140
+ </head>
141
+ <body>
142
+ <h1>Index of ${ path } </h1>
143
+ <hr>
144
+ <pre>${ contentList } </pre>
145
+ </body>
146
+ </html>` ;
133
147
134
148
return response
135
149
. status ( 200 )
You can’t perform that action at this time.
0 commit comments