summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-01 20:42:54 +0530
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-01 21:13:19 +0530
commit11f99ffaac3529b1ef61fa5360923a78ee7ce7d5 (patch)
tree00431d7bec188df401d30ee71daab8eb06456dcf /src
parentfix: fix repo name in dev app update config (diff)
downloadferdium-app-11f99ffaac3529b1ef61fa5360923a78ee7ce7d5.tar.gz
ferdium-app-11f99ffaac3529b1ef61fa5360923a78ee7ce7d5.tar.zst
ferdium-app-11f99ffaac3529b1ef61fa5360923a78ee7ce7d5.zip
refactor: move 'asarRecipesPath' into 'asar-helpers'
Diffstat (limited to 'src')
-rw-r--r--src/api/server/ServerApi.js2
-rw-r--r--src/containers/settings/RecipesScreen.js3
-rw-r--r--src/environment.ts7
-rw-r--r--src/helpers/asar-helpers.ts7
-rw-r--r--src/stores/RecipesStore.js2
5 files changed, 11 insertions, 10 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js
index ef3d51796..fb0d64dc3 100644
--- a/src/api/server/ServerApi.js
+++ b/src/api/server/ServerApi.js
@@ -25,11 +25,11 @@ import { SERVER_NOT_LOADED } from '../../config';
25import { 25import {
26 osArch, 26 osArch,
27 osPlatform, 27 osPlatform,
28 asarRecipesPath,
29 userDataRecipesPath, 28 userDataRecipesPath,
30 userDataPath, 29 userDataPath,
31 ferdiVersion, 30 ferdiVersion,
32} from '../../environment'; 31} from '../../environment';
32import { asarRecipesPath } from '../../helpers/asar-helpers';
33import apiBase from '../apiBase'; 33import apiBase from '../apiBase';
34import { prepareAuthRequest, sendAuthRequest } from '../utils/auth'; 34import { prepareAuthRequest, sendAuthRequest } from '../utils/auth';
35 35
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index 06ddabe4c..162390d57 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -12,7 +12,8 @@ import UserStore from '../../stores/UserStore';
12import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; 12import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard';
13import ErrorBoundary from '../../components/util/ErrorBoundary'; 13import ErrorBoundary from '../../components/util/ErrorBoundary';
14import { CUSTOM_WEBSITE_RECIPE_ID, FRANZ_DEV_DOCS } from '../../config'; 14import { CUSTOM_WEBSITE_RECIPE_ID, FRANZ_DEV_DOCS } from '../../config';
15import { asarRecipesPath, userDataRecipesPath } from '../../environment'; 15import { userDataRecipesPath } from '../../environment';
16import { asarRecipesPath } from '../../helpers/asar-helpers';
16import { communityRecipesStore } from '../../features/communityRecipes'; 17import { communityRecipesStore } from '../../features/communityRecipes';
17import RecipePreview from '../../models/RecipePreview'; 18import RecipePreview from '../../models/RecipePreview';
18import AppStore from '../../stores/AppStore'; 19import AppStore from '../../stores/AppStore';
diff --git a/src/environment.ts b/src/environment.ts
index 3e63f449b..9478f803c 100644
--- a/src/environment.ts
+++ b/src/environment.ts
@@ -23,8 +23,6 @@ import {
23 iconSizeBias, 23 iconSizeBias,
24} from './config'; 24} from './config';
25 25
26import { asarPath } from './helpers/asar-helpers';
27
28// @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations. 26// @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations.
29import * as buildInfo from './buildInfo.json'; 27import * as buildInfo from './buildInfo.json';
30 28
@@ -64,11 +62,6 @@ export function userDataRecipesPath(...segments: any[]) {
64 return userDataPath('recipes', ...[segments].flat()); 62 return userDataPath('recipes', ...[segments].flat());
65} 63}
66 64
67// Replacing app.asar is not beautiful but unfortunately necessary
68export function asarRecipesPath(...segments: any[]) {
69 return join(asarPath(join(__dirname, 'recipes')), ...[segments].flat());
70}
71
72export const useLiveAPI = process.env.USE_LIVE_API; 65export const useLiveAPI = process.env.USE_LIVE_API;
73const useLocalAPI = process.env.USE_LOCAL_API; 66const useLocalAPI = process.env.USE_LOCAL_API;
74 67
diff --git a/src/helpers/asar-helpers.ts b/src/helpers/asar-helpers.ts
index 3d9f0d941..3da90625d 100644
--- a/src/helpers/asar-helpers.ts
+++ b/src/helpers/asar-helpers.ts
@@ -1,3 +1,10 @@
1import { join } from 'path';
2
1export function asarPath(dir: string = '') { 3export function asarPath(dir: string = '') {
2 return dir.replace('app.asar', 'app.asar.unpacked'); 4 return dir.replace('app.asar', 'app.asar.unpacked');
3} 5}
6
7// Replacing app.asar is not beautiful but unfortunately necessary
8export function asarRecipesPath(...segments: any[]) {
9 return join(asarPath(join(__dirname, '..', 'recipes')), ...[segments].flat());
10}
diff --git a/src/stores/RecipesStore.js b/src/stores/RecipesStore.js
index bfbdc57a8..95d662e79 100644
--- a/src/stores/RecipesStore.js
+++ b/src/stores/RecipesStore.js
@@ -6,7 +6,7 @@ import Store from './lib/Store';
6import CachedRequest from './lib/CachedRequest'; 6import CachedRequest from './lib/CachedRequest';
7import Request from './lib/Request'; 7import Request from './lib/Request';
8import { matchRoute } from '../helpers/routing-helpers'; 8import { matchRoute } from '../helpers/routing-helpers';
9import { asarRecipesPath } from '../environment'; 9import { asarRecipesPath } from '../helpers/asar-helpers';
10 10
11const debug = require('debug')('Ferdi:RecipeStore'); 11const debug = require('debug')('Ferdi:RecipeStore');
12 12