aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/server/ServerApi.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/server/ServerApi.ts')
-rw-r--r--src/api/server/ServerApi.ts36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts
index 1530dd478..9e7582e1e 100644
--- a/src/api/server/ServerApi.ts
+++ b/src/api/server/ServerApi.ts
@@ -22,7 +22,7 @@ import UserModel from '../../models/User';
22import sleep from '../../helpers/async-helpers'; 22import sleep from '../../helpers/async-helpers';
23 23
24import { SERVER_NOT_LOADED } from '../../config'; 24import { SERVER_NOT_LOADED } from '../../config';
25import { userDataRecipesPath, userDataPath } from '../../environment-remote'; 25import { userDataRecipesPath } from '../../environment-remote';
26import { asarRecipesPath } from '../../helpers/asar-helpers'; 26import { asarRecipesPath } from '../../helpers/asar-helpers';
27import apiBase from '../apiBase'; 27import apiBase from '../apiBase';
28import { 28import {
@@ -500,40 +500,6 @@ export default class ServerApi {
500 debug('ServerApi::healthCheck resolves'); 500 debug('ServerApi::healthCheck resolves');
501 } 501 }
502 502
503 async getLegacyServices() {
504 const file = userDataPath('settings', 'services.json');
505
506 try {
507 const config = readJsonSync(file);
508
509 if (Object.hasOwn(config, 'services')) {
510 const services = await Promise.all(
511 config.services.map(async (s: { service: any }) => {
512 const service = s;
513 const request = await sendAuthRequest(
514 `${apiBase()}/recipes/${s.service}`,
515 );
516
517 if (request.status === 200) {
518 const data = await request.json();
519 // @ts-expect-error Property 'recipe' does not exist on type '{ service: any; }'.
520 service.recipe = new RecipePreviewModel(data);
521 }
522
523 return service;
524 }),
525 );
526
527 debug('ServerApi::getLegacyServices resolves', services);
528 return services;
529 }
530 } catch {
531 console.error('ServerApi::getLegacyServices no config found');
532 }
533
534 return [];
535 }
536
537 // Helper 503 // Helper
538 async _mapServiceModels(services: any[]) { 504 async _mapServiceModels(services: any[]) {
539 const recipes = services.map((s: { recipeId: string }) => s.recipeId); 505 const recipes = services.map((s: { recipeId: string }) => s.recipeId);