Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3512325
D6716.id22616.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6716.id22616.diff
View Options
diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -24,6 +24,7 @@
markVersionDeployedResponder,
} from './responders/version-responders.js';
import { websiteResponder } from './responders/website-responders.js';
+import { webWorkerResponder } from './responders/webworker-responders.js';
import { onConnection } from './socket/socket.js';
import {
multerProcessor,
@@ -119,6 +120,7 @@
// $FlowFixMe express-ws has side effects that can't be typed
router.ws('/ws', onConnection);
+ router.get('/worker/:worker', webWorkerResponder);
router.get('*', htmlHandler(websiteResponder));
router.post(
diff --git a/keyserver/src/responders/webworker-responders.js b/keyserver/src/responders/webworker-responders.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/responders/webworker-responders.js
@@ -0,0 +1,26 @@
+// @flow
+
+import type { $Request, $Response } from 'express';
+import path from 'path';
+
+function webWorkerResponder(req: $Request, res: $Response): void {
+ let workerPath;
+
+ if (req.params.worker === 'notif') {
+ workerPath = 'pushNotif.build.cjs';
+ }
+
+ if (!workerPath) {
+ res.sendStatus(404);
+ return;
+ }
+
+ const filePath = path.resolve('app_compiled', 'webworkers', workerPath);
+ res.sendFile(filePath, {
+ headers: {
+ 'Content-Type': 'application/javascript',
+ },
+ });
+}
+
+export { webWorkerResponder };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 7:06 PM (18 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692225
Default Alt Text
D6716.id22616.diff (1 KB)
Attached To
Mode
D6716: [keyserver] Serve web worker files
Attached
Detach File
Event Timeline
Log In to Comment