@davmash/bygone 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ - Fixed desktop tours showing unstyled HTML after temporary asset cleanup during long-running app sessions
6
+ - Made presentation asset read failures return HTTP 500 and added HTTP and Electron ASAR regression coverage
7
+
3
8
  ## 0.10.0
4
9
 
5
10
  - Restored detailed highlighting for long prose and expanded instructions; unavailable word detail now has a uniform blue fill and an explanatory `≠` marker
package/cli/present.js CHANGED
@@ -1,4 +1,4 @@
1
- const { createReadStream, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } = require('fs');
1
+ const { existsSync, mkdirSync, readFile, readFileSync, realpathSync, writeFileSync } = require('fs');
2
2
  const { createServer } = require('http');
3
3
  const path = require('path');
4
4
  const { spawn } = require('child_process');
@@ -178,11 +178,20 @@ async function startPresentation(args, cwd, packageRoot, options = {}) {
178
178
  respond(response, 404, 'Not found');
179
179
  return;
180
180
  }
181
- response.writeHead(200, {
182
- 'Content-Type': MIME_TYPES.get(path.extname(targetPath)) || 'application/octet-stream',
183
- 'Cache-Control': 'no-store'
181
+ // Electron streams extract ASAR entries to cached temporary files. Those
182
+ // can disappear during a long-running session; readFile reads the archive
183
+ // directly and lets us report failures before committing success headers.
184
+ readFile(targetPath, (error, content) => {
185
+ if (error) {
186
+ respond(response, 500, 'Read failed');
187
+ return;
188
+ }
189
+ response.writeHead(200, {
190
+ 'Content-Type': MIME_TYPES.get(path.extname(targetPath)) || 'application/octet-stream',
191
+ 'Cache-Control': 'no-store'
192
+ });
193
+ response.end(content);
184
194
  });
185
- createReadStream(targetPath).on('error', () => respond(response, 500, 'Read failed')).pipe(response);
186
195
  });
187
196
  const requestedPort = readPort(options.ignoreEnvironment ? undefined : process.env.BYGONE_TOUR_PORT);
188
197
  await new Promise((resolve, reject) => {