Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3249054
D5371.id17620.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5371.id17620.diff
View Options
diff --git a/keyserver/src/responders/landing-handler.js b/keyserver/src/responders/landing-handler.js
--- a/keyserver/src/responders/landing-handler.js
+++ b/keyserver/src/responders/landing-handler.js
@@ -27,6 +27,8 @@
}
const access = promisify(fs.access);
+const readFile = promisify(fs.readFile);
+
const googleFontsURL =
'https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500&family=IBM+Plex+Sans:wght@400;500&display=swap';
const iaDuoFontsURL = 'fonts/duo.css';
@@ -60,8 +62,8 @@
return assetInfo;
}
try {
- // $FlowFixMe landing/dist doesn't always exist
- const { default: assets } = await import('landing/dist/assets');
+ const assetsString = await readFile('../landing/dist/assets.json', 'utf8');
+ const assets = JSON.parse(assetsString);
assetInfo = {
jsURL: `compiled/${assets.browser.js}`,
fontURLs: [googleFontsURL, iaDuoFontsURL],
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -54,6 +54,8 @@
const { renderToNodeStream } = ReactDOMServer;
const access = promisify(fs.access);
+const readFile = promisify(fs.readFile);
+
const googleFontsURL =
'https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Inter:wght@400;500;600&display=swap';
const localFontsURL = 'fonts/local-fonts.css';
@@ -82,8 +84,8 @@
return assetInfo;
}
try {
- // $FlowFixMe web/dist doesn't always exist
- const { default: assets } = await import('web/dist/assets');
+ const assetsString = await readFile('../web/dist/assets.json', 'utf8');
+ const assets = JSON.parse(assetsString);
assetInfo = {
jsURL: `compiled/${assets.browser.js}`,
fontsURL: googleFontsURL,
diff --git a/keyserver/src/utils/import-json.js b/keyserver/src/utils/import-json.js
--- a/keyserver/src/utils/import-json.js
+++ b/keyserver/src/utils/import-json.js
@@ -1,6 +1,9 @@
// @flow
import fs from 'fs';
+import { promisify } from 'util';
+
+const readFile = promisify(fs.readFile);
type ConfigName = {
+folder: 'secrets' | 'facts',
@@ -44,7 +47,8 @@
}
const path = getPathForConfigName(configName);
try {
- return JSON.parse(fs.readFileSync(path, 'utf8'));
+ const pathString = await readFile(path, 'utf8');
+ return JSON.parse(pathString);
} catch (e) {
if (e.code !== 'ENOENT') {
console.log(`Failed to read JSON from ${path}`, e);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 12:11 PM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497570
Default Alt Text
D5371.id17620.diff (2 KB)
Attached To
Mode
D5371: [keyserver] Update assets.json imports to use fs instead of import
Attached
Detach File
Event Timeline
Log In to Comment