|
107 | 107 | """
|
108 | 108 | @response.send 200 content
|
109 | 109 | return
|
110 |
| - csv <~ SC[room].exportCSV |
111 |
| - _, body <~ csv-parse(csv, delimiter: \,) |
112 |
| - body.shift! # header |
113 |
| - todo = DB.multi! |
114 |
| - names = [] |
115 |
| - for [link, title], idx in body | link and title and link is /^\// |
116 |
| - names ++= title |
117 |
| - todo.=get "snapshot-#{ link.slice(1) }" |
118 |
| - _, saves <~ todo.exec! |
119 |
| - [type, content] = cb-multiple.call @params, names, saves |
120 |
| - @response.type type |
121 |
| - @response.set \Content-Disposition """ |
122 |
| - attachment; filename="#room.xlsx" |
123 |
| - """ |
124 |
| - @response.send 200 content |
| 110 | + if SC[room] != undefined |
| 111 | + csv <~ SC[room].exportCSV |
| 112 | + _, body <~ csv-parse(csv, delimiter: \,) |
| 113 | + body.shift! # header |
| 114 | + todo = DB.multi! |
| 115 | + names = [] |
| 116 | + for [link, title], idx in body | link and title and link is /^\// |
| 117 | + names ++= title |
| 118 | + todo.=get "snapshot-#{ link.slice(1) }" |
| 119 | + _, saves <~ todo.exec! |
| 120 | + [type, content] = cb-multiple.call @params, names, saves |
| 121 | + @response.type type |
| 122 | + @response.set \Content-Disposition """ |
| 123 | + attachment; filename="#room.xlsx" |
| 124 | + """ |
| 125 | + @response.send 200 content |
| 126 | + else |
| 127 | + @response.type Text |
| 128 | + @response.send 404 '' |
125 | 129 | else
|
126 | 130 | {snapshot} <~ SC._get room, IO
|
127 | 131 | if snapshot
|
|
0 commit comments