diff options
author | 2021-10-14 18:20:26 +0200 | |
---|---|---|
committer | 2021-10-14 18:20:26 +0200 | |
commit | c27972c12b2d0dba2aee9e3dcffadcf7806a9afd (patch) | |
tree | 46fcfe261ae55e6faab604e9c75f94f6ffe326ee /src/api/server/ServerApi.js | |
parent | chore: upgrade 'electron-builder' to '22.14.5' to fix upstream issues. (#2068) (diff) | |
download | ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.tar.gz ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.tar.zst ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.zip |
chore: remove all code related to news (#2069)
Diffstat (limited to 'src/api/server/ServerApi.js')
-rw-r--r-- | src/api/server/ServerApi.js | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index e321f9372..6bbf572fa 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -16,14 +16,12 @@ import fetch from 'electron-fetch'; | |||
16 | import ServiceModel from '../../models/Service'; | 16 | import ServiceModel from '../../models/Service'; |
17 | import RecipePreviewModel from '../../models/RecipePreview'; | 17 | import RecipePreviewModel from '../../models/RecipePreview'; |
18 | import RecipeModel from '../../models/Recipe'; | 18 | import RecipeModel from '../../models/Recipe'; |
19 | import NewsModel from '../../models/News'; | ||
20 | import UserModel from '../../models/User'; | 19 | import UserModel from '../../models/User'; |
21 | 20 | ||
22 | import { sleep } from '../../helpers/async-helpers'; | 21 | import { sleep } from '../../helpers/async-helpers'; |
23 | 22 | ||
24 | import { SERVER_NOT_LOADED } from '../../config'; | 23 | import { SERVER_NOT_LOADED } from '../../config'; |
25 | import { osArch, osPlatform } from '../../environment'; | 24 | import { userDataRecipesPath, userDataPath } from '../../environment-remote'; |
26 | import { userDataRecipesPath, userDataPath, ferdiVersion } from '../../environment-remote'; | ||
27 | import { asarRecipesPath } from '../../helpers/asar-helpers'; | 25 | import { asarRecipesPath } from '../../helpers/asar-helpers'; |
28 | import apiBase from '../apiBase'; | 26 | import apiBase from '../apiBase'; |
29 | import { prepareAuthRequest, sendAuthRequest } from '../utils/auth'; | 27 | import { prepareAuthRequest, sendAuthRequest } from '../utils/auth'; |
@@ -442,25 +440,6 @@ export default class ServerApi { | |||
442 | } | 440 | } |
443 | } | 441 | } |
444 | 442 | ||
445 | // News | ||
446 | async getLatestNews() { | ||
447 | const url = `${apiBase( | ||
448 | true, | ||
449 | )}/news?platform=${osPlatform}&arch=${osArch}&version=${ferdiVersion}`; | ||
450 | const request = await sendAuthRequest(url); | ||
451 | if (!request.ok) throw request; | ||
452 | const data = await request.json(); | ||
453 | const news = this._mapNewsModels(data); | ||
454 | debug('ServerApi::getLatestNews resolves', news); | ||
455 | return news; | ||
456 | } | ||
457 | |||
458 | async hideNews(id) { | ||
459 | const request = await sendAuthRequest(`${apiBase()}/news/${id}/read`); | ||
460 | if (!request.ok) throw request; | ||
461 | debug('ServerApi::hideNews resolves', id); | ||
462 | } | ||
463 | |||
464 | // Health Check | 443 | // Health Check |
465 | async healthCheck() { | 444 | async healthCheck() { |
466 | if (apiBase() === SERVER_NOT_LOADED) { | 445 | if (apiBase() === SERVER_NOT_LOADED) { |
@@ -587,19 +566,6 @@ export default class ServerApi { | |||
587 | .filter(recipe => recipe !== null); | 566 | .filter(recipe => recipe !== null); |
588 | } | 567 | } |
589 | 568 | ||
590 | _mapNewsModels(news) { | ||
591 | return news | ||
592 | .map(newsItem => { | ||
593 | try { | ||
594 | return new NewsModel(newsItem); | ||
595 | } catch (error) { | ||
596 | console.error(error); | ||
597 | return null; | ||
598 | } | ||
599 | }) | ||
600 | .filter(newsItem => newsItem !== null); | ||
601 | } | ||
602 | |||
603 | _getDevRecipes() { | 569 | _getDevRecipes() { |
604 | const recipesDirectory = getDevRecipeDirectory(); | 570 | const recipesDirectory = getDevRecipeDirectory(); |
605 | try { | 571 | try { |