diff options
Diffstat (limited to 'src/api/server/ServerApi.ts')
-rw-r--r-- | src/api/server/ServerApi.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts index b5dd499ab..5434880dc 100644 --- a/src/api/server/ServerApi.ts +++ b/src/api/server/ServerApi.ts | |||
@@ -12,6 +12,7 @@ import { | |||
12 | statSync, | 12 | statSync, |
13 | writeFileSync, | 13 | writeFileSync, |
14 | } from 'fs-extra'; | 14 | } from 'fs-extra'; |
15 | import ms from 'ms'; | ||
15 | import tar from 'tar'; | 16 | import tar from 'tar'; |
16 | 17 | ||
17 | import RecipeModel, { type IRecipe } from '../../models/Recipe'; | 18 | import RecipeModel, { type IRecipe } from '../../models/Recipe'; |
@@ -460,7 +461,7 @@ export default class ServerApi { | |||
460 | } | 461 | } |
461 | debug(archivePath); | 462 | debug(archivePath); |
462 | 463 | ||
463 | await sleep(10); | 464 | await sleep(ms('10ms')); |
464 | 465 | ||
465 | await tar.x({ | 466 | await tar.x({ |
466 | file: archivePath, | 467 | file: archivePath, |
@@ -471,14 +472,21 @@ export default class ServerApi { | |||
471 | onwarn: x => debug('warn', recipeId, x), | 472 | onwarn: x => debug('warn', recipeId, x), |
472 | }); | 473 | }); |
473 | 474 | ||
474 | await sleep(10); | 475 | await sleep(ms('10ms')); |
475 | 476 | ||
476 | const { id } = readJsonSync(join(recipeTempDirectory, 'package.json')); | 477 | const { id, defaultIcon } = readJsonSync( |
478 | join(recipeTempDirectory, 'package.json'), | ||
479 | ); | ||
477 | const recipeDirectory = join(recipesDirectory, id); | 480 | const recipeDirectory = join(recipesDirectory, id); |
478 | copySync(recipeTempDirectory, recipeDirectory); | 481 | copySync(recipeTempDirectory, recipeDirectory); |
479 | removeSync(recipeTempDirectory); | 482 | removeSync(recipeTempDirectory); |
480 | removeSync(join(recipesDirectory, recipeId, 'recipe.tar.gz')); | 483 | removeSync(join(recipesDirectory, recipeId, 'recipe.tar.gz')); |
481 | 484 | ||
485 | // TODO: This is a temporary fix to remove svg icons from the user AppData. This should be removed after versions of all recipes have been bumped up | ||
486 | if (defaultIcon) { | ||
487 | removeSync(join(recipeDirectory, 'icon.svg')); | ||
488 | } | ||
489 | |||
482 | return id; | 490 | return id; |
483 | } | 491 | } |
484 | 492 | ||