| 151 | }; |
| 152 | |
| 153 | var onKeyValidated = function () { |
| 154 | if (config.document.blob) { // This is a reload |
| 155 | blob = config.document.blob; |
| 156 | return start(); |
| 157 | } |
| 158 | // NOTE: Nextcloud will log us out if we try from the client |
| 159 | // TODO: make sure the server plugin is installed if we don't |
| 160 | // call getBlob() |
| 161 | if (!config.events?.onSave) { |
| 162 | return void start(); |
| 163 | } |
| 164 | getBlob(function (err, _blob) { |
| 165 | if (err) { // Can't get blob from client, try from server |
| 166 | console.warn(err); |
| 167 | return void start(); |
| 168 | } |
| 169 | _blob.name = `document.${config.document.fileType}`; |
| 170 | blob = _blob; |
| 171 | start(); |
| 172 | }); |
| 173 | }; |
| 174 | |
| 175 | var getSession = function (cb) { |
| 176 | chan.send('GET_SESSION', { |