diff options
author | 2021-07-15 23:10:08 +0530 | |
---|---|---|
committer | 2021-07-15 23:10:08 +0530 | |
commit | c3711a2b577a10584bac0fbddfb7bde108eb706c (patch) | |
tree | afd2210823b6e7dbbc250186c21496c19aff1217 /src/api/server/ServerApi.js | |
parent | Revert 'useragent-generator' to published npm version without github repo ref... (diff) | |
download | ferdium-app-c3711a2b577a10584bac0fbddfb7bde108eb706c.tar.gz ferdium-app-c3711a2b577a10584bac0fbddfb7bde108eb706c.tar.zst ferdium-app-c3711a2b577a10584bac0fbddfb7bde108eb706c.zip |
Minor perf tweaks to evaluate capturing of env-specific values only once in the application.
Diffstat (limited to 'src/api/server/ServerApi.js')
-rw-r--r-- | src/api/server/ServerApi.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 24d095556..c63aa7dda 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -1,4 +1,3 @@ | |||
1 | import os from 'os'; | ||
2 | import path from 'path'; | 1 | import path from 'path'; |
3 | import tar from 'tar'; | 2 | import tar from 'tar'; |
4 | import fs from 'fs-extra'; | 3 | import fs from 'fs-extra'; |
@@ -15,7 +14,7 @@ import OrderModel from '../../models/Order'; | |||
15 | import { sleep } from '../../helpers/async-helpers'; | 14 | import { sleep } from '../../helpers/async-helpers'; |
16 | 15 | ||
17 | import { SERVER_NOT_LOADED } from '../../config'; | 16 | import { SERVER_NOT_LOADED } from '../../config'; |
18 | import { RECIPES_PATH } from '../../environment'; | 17 | import { osArch, osPlatform, RECIPES_PATH } from '../../environment'; |
19 | import apiBase from '../apiBase'; | 18 | import apiBase from '../apiBase'; |
20 | import { prepareAuthRequest, sendAuthRequest } from '../utils/auth'; | 19 | import { prepareAuthRequest, sendAuthRequest } from '../utils/auth'; |
21 | 20 | ||
@@ -456,7 +455,7 @@ export default class ServerApi { | |||
456 | 455 | ||
457 | // News | 456 | // News |
458 | async getLatestNews() { | 457 | async getLatestNews() { |
459 | const url = `${apiBase(true)}/news?platform=${os.platform()}&arch=${os.arch()}&version=${app.getVersion()}`; | 458 | const url = `${apiBase(true)}/news?platform=${osPlatform}&arch=${osArch}&version=${app.getVersion()}`; |
460 | const request = await sendAuthRequest(url); | 459 | const request = await sendAuthRequest(url); |
461 | if (!request.ok) throw request; | 460 | if (!request.ok) throw request; |
462 | const data = await request.json(); | 461 | const data = await request.json(); |