diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ebeb1165..c3261e3dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Improved the content of the pricing page +- Improved the language localization for Spanish (`es`) - Upgraded `ngx-skeleton-loader` from version `13.0.0` to `14.0.0` +## 3.98.0 - 2026-11-04 + +### Changed + +- Improved the content of the pricing page +- Changed the viewport to resize the content when the on-screen keyboard opens on _Android_ (`interactive-widget=resizes-content`) +- Improved the meta descriptions of the public pages and the blog posts +- Disabled the biometric authentication on all devices when generating a new _Security Token_ +- Improved the language localization for German (`de`) + ### Fixed - Fixed the flickering of the navigation items in the header for logged-in users +- Fixed the height of the dialogs on mobile +- Fixed the description of the `ROOT_URL` requirement for the server of the Model Context Protocol (MCP) (experimental) ## 3.97.0 - 2026-11-02 diff --git a/README.md b/README.md index 00ae13e290..f8c3c92b89 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Find answers to commonly asked questions about self-hosting Ghostfolio in our [F | `REDIS_PORT` | `number` | | The port where _Redis_ is running | | `REDIS_TLS` | `boolean` (optional) | `false` | Enables TLS/SSL connection to _Redis_ | | `REQUEST_TIMEOUT` | `number` (optional) | `3000` | The timeout of network requests to data providers in milliseconds | -| `ROOT_URL` | `string` (optional) | `http://0.0.0.0:3333` | The root URL of the Ghostfolio application, used for generating callback URLs and external links. | +| `ROOT_URL` | `string` (optional) | `http://0.0.0.0:3333` | The root URL of the Ghostfolio application, used for generating callback URLs and external links. The endpoint of the _Model Context Protocol_ (MCP) accepts only requests to the host name of this URL. | | `TRUST_PROXY` | `string` (optional) | | The [trust proxy](https://expressjs.com/en/guide/behind-proxies.html) setting of _Express.js_ to determine the client IP address for rate limiting, e.g. `1` if the Ghostfolio application runs behind a single reverse proxy | #### OpenID Connect OIDC (experimental) @@ -405,7 +405,7 @@ The _Model Context Protocol_ (MCP) server lets an AI client read your portfolio, ### Prerequisites - Set `ENABLE_FEATURE_MCP` to `true` -- Set `ROOT_URL` to the public URL of your instance if a client calls the endpoint from a browser page. The host name of `ROOT_URL` is the only accepted origin. +- Set `ROOT_URL` to the public URL of your instance. The clients must use the host name of this URL: the endpoint accepts only requests to this host name, and a request from a browser page only with this host name as origin. If a reverse proxy is in front of your instance, it must send the original `Host` header. - Grant an access of the type _MCP_ in _My Ghostfolio_ under _Access_ and copy its token An _MCP_ access with the _Restricted view_ permission reads the portfolio without the monetary values. Grant the _View_ permission to let the client also read the monetary values. Grant the _Restricted view and manage_ or the _View and manage_ permission to let the client also import activities and update the cash balances of your accounts. @@ -415,7 +415,7 @@ An _MCP_ access with the _Restricted view_ permission reads the portfolio withou Point the client to the endpoint below and set the MCP access token as the _Bearer Token_. ``` -POST http://localhost:3333/mcp +POST /mcp "Authorization": "Bearer " ``` diff --git a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts b/apps/api/src/app/endpoints/sitemap/sitemap.service.ts index 6b3a99a8ba..c80fc260f3 100644 --- a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts +++ b/apps/api/src/app/endpoints/sitemap/sitemap.service.ts @@ -9,9 +9,6 @@ import { Injectable } from '@nestjs/common'; @Injectable() export class SitemapService { - private static readonly TRANSLATION_TAGGED_MESSAGE_REGEX = - /:.*@@(?[a-zA-Z0-9.]+):(?.+)/; - public constructor( private readonly configurationService: ConfigurationService, private readonly i18nService: I18nService @@ -148,26 +145,13 @@ export class SitemapService { const rootUrl = this.configurationService.get('ROOT_URL'); return SUPPORTED_LANGUAGE_CODES.flatMap((languageCode) => { - const resourcesPath = this.i18nService.getTranslation({ - languageCode, - id: publicRoutes.resources.path.match( - SitemapService.TRANSLATION_TAGGED_MESSAGE_REGEX - ).groups.id - }); - - const personalFinanceToolsPath = this.i18nService.getTranslation({ - languageCode, - id: publicRoutes.resources.subRoutes.personalFinanceTools.path.match( - SitemapService.TRANSLATION_TAGGED_MESSAGE_REGEX - ).groups.id - }); - - const productPath = this.i18nService.getTranslation({ - languageCode, - id: publicRoutes.resources.subRoutes.personalFinanceTools.subRoutes.product.path.match( - SitemapService.TRANSLATION_TAGGED_MESSAGE_REGEX - ).groups.id - }); + const [resourcesPath, personalFinanceToolsPath, productPath] = + this.i18nService.getLocalizedRouterLink({ + languageCode, + routerLink: + publicRoutes.resources.subRoutes.personalFinanceTools.subRoutes + .product.routerLink + }); return personalFinanceTools.map(({ alias, key }) => { const routerLink = [ @@ -217,21 +201,10 @@ export class SitemapService { rootUrl: string; route?: PublicRoute; }): string { - const segments = - route?.routerLink.map((link) => { - const match = link.match( - SitemapService.TRANSLATION_TAGGED_MESSAGE_REGEX - ); - - const segment = match - ? (this.i18nService.getTranslation({ - languageCode, - id: match.groups.id - }) ?? match.groups.message) - : link; - - return segment.replace(/^\/+|\/+$/, ''); - }) ?? []; + const segments = this.i18nService.getLocalizedRouterLink({ + languageCode, + routerLink: route?.routerLink ?? [] + }); const location = [rootUrl, languageCode, ...segments].join('/'); diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 8139feea45..6b60d49c05 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -151,7 +151,7 @@ async function bootstrap() { const { hostname } = new URL(configurationService.get('ROOT_URL')); logger.warn( - `The Model Context Protocol (MCP) is enabled, but ROOT_URL is not set. A client which calls the endpoint from a browser page is accepted only with the origin ${hostname}.` + `The Model Context Protocol (MCP) is enabled, but ROOT_URL is not set. The endpoint accepts only requests to the host name ${hostname}. Set ROOT_URL to the public URL of the instance.` ); } diff --git a/apps/api/src/middlewares/html-template.middleware.spec.ts b/apps/api/src/middlewares/html-template.middleware.spec.ts new file mode 100644 index 0000000000..4ff76a2baf --- /dev/null +++ b/apps/api/src/middlewares/html-template.middleware.spec.ts @@ -0,0 +1,161 @@ +import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service'; +import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools'; + +import { Logger } from '@nestjs/common'; +import { NextFunction, Request, Response } from 'express'; +import { readFileSync, readdirSync } from 'node:fs'; + +import { HtmlTemplateMiddleware } from './html-template.middleware'; + +jest.mock('@ghostfolio/api/environments/environment', () => { + return { environment: { production: true, rootUrl: 'https://ghostfol.io' } }; +}); + +jest.mock('node:fs', () => { + return { + ...jest.requireActual('node:fs'), + readFileSync: jest.fn(), + readdirSync: jest.fn() + }; +}); + +const genericDescription = 'Generic description'; +const indexHtml = ''; +const productPath = + '/en/resources/personal-finance-tools/open-source-alternative-to-8figures'; + +function createLocale({ + pricingDescription = 'Pricing description', + productDescription +}: { + pricingDescription?: string; + productDescription: string; +}) { + return ` + + + ${genericDescription} + + + ${pricingDescription} + + + ${productDescription} + + + pricing + + + resources + + + personal-finance-tools + + + open-source-alternative-to + + + `; +} + +function getResponseBody({ + locale, + originalUrl +}: { + locale: string; + originalUrl: string; +}) { + (readdirSync as jest.Mock).mockReturnValue(['messages.xlf']); + (readFileSync as jest.Mock).mockImplementation((path: string) => { + return path.endsWith('index.html') ? indexHtml : locale; + }); + + const i18nService = new I18nService(); + i18nService.onModuleInit(); + + const send = jest.fn(); + + new HtmlTemplateMiddleware(i18nService).use( + { originalUrl } as Request, + { send } as unknown as Response, + jest.fn() as NextFunction + ); + + return send.mock.calls[0][0]; +} + +describe('HtmlTemplateMiddleware', () => { + beforeEach(() => { + jest.spyOn(Logger.prototype, 'warn').mockImplementation(); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + it('serves the description of a public route', () => { + expect( + getResponseBody({ + locale: createLocale({ productDescription: 'Compare ${name}' }), + originalUrl: '/en/pricing' + }) + ).toContain('content="Pricing description"'); + }); + + it('interpolates the name into the description of a personal finance tool', () => { + expect( + getResponseBody({ + locale: createLocale({ productDescription: 'Compare ${name}' }), + originalUrl: productPath + }) + ).toContain('content="Compare 8FIGURES"'); + }); + + it.each( + personalFinanceTools.filter(({ alias, key }) => { + return (alias ?? key).includes('.'); + }) + )( + 'serves the template of a personal finance tool with a dot in the key ($key)', + ({ alias, key, name }) => { + expect( + getResponseBody({ + locale: createLocale({ productDescription: 'Compare ${name}' }), + originalUrl: `/en/resources/personal-finance-tools/open-source-alternative-to-${alias ?? key}` + }) + ).toContain(`content="Compare ${name}"`); + } + ); + + it('falls back to the generic description if the name token is not in the description of a personal finance tool', () => { + expect( + getResponseBody({ + locale: createLocale({ productDescription: 'Compare ${product}' }), + originalUrl: productPath + }) + ).toContain(`content="${genericDescription}"`); + }); + + it('falls back to the generic description if the description of a personal finance tool contains another token than the name token', () => { + expect( + getResponseBody({ + locale: createLocale({ + productDescription: 'Compare ${name} (${product})' + }), + originalUrl: productPath + }) + ).toContain(`content="${genericDescription}"`); + }); + + it('escapes the description for the use in an attribute', () => { + expect( + getResponseBody({ + locale: createLocale({ + pricingDescription: 'Compare "plans" & prices', + productDescription: 'Compare ${name}' + }), + originalUrl: '/en/pricing' + }) + ).toContain('content="Compare "plans" & prices"'); + }); +}); diff --git a/apps/api/src/middlewares/html-template.middleware.ts b/apps/api/src/middlewares/html-template.middleware.ts index 09e9af68f8..4f5ca433b0 100644 --- a/apps/api/src/middlewares/html-template.middleware.ts +++ b/apps/api/src/middlewares/html-template.middleware.ts @@ -6,6 +6,9 @@ import { SUPPORTED_LANGUAGE_CODES } from '@ghostfolio/common/config'; import { DATE_FORMAT, interpolate } from '@ghostfolio/common/helper'; +import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools'; +import { PublicRoute } from '@ghostfolio/common/routes/interfaces/public-route.interface'; +import { publicRoutes } from '@ghostfolio/common/routes/routes'; import { Injectable, Logger, NestMiddleware } from '@nestjs/common'; import { format } from 'date-fns'; @@ -16,75 +19,135 @@ import { join } from 'node:path'; const title = 'Ghostfolio'; const locales = { + '/de/blog/2021/07/hallo-ghostfolio': { + description: + 'Hallo Ghostfolio: Die Vorstellung des Open Source Projekts für die persönlichen Finanzen. Welches Problem es löst und welche Vision dahinter steht.' + }, '/de/blog/2023/01/ghostfolio-auf-sackgeld-vorgestellt': { + description: + 'Ghostfolio auf Sackgeld.com: Der Bericht erläutert die Funktionsweise, die unterstützten Assets und die Preisstruktur der Open Source Software.', featureGraphicPath: 'assets/images/blog/ghostfolio-x-sackgeld.png', title: `Ghostfolio auf Sackgeld.com vorgestellt - ${title}` }, + '/en/blog/2021/07/hello-ghostfolio': { + description: + 'Meet Ghostfolio, an open source personal finance software. Learn which problem it solves and the vision of an overview of all your assets in real time.' + }, + '/en/blog/2022/01/ghostfolio-first-months-in-open-source': { + description: + 'A look back at the first months of Ghostfolio in open source: the road to 100 stars on GitHub and why the benefits of public development outweigh the drawbacks.' + }, + '/en/blog/2022/07/ghostfolio-meets-internet-identity': { + description: + 'Ghostfolio now supports passwordless sign-in with Internet Identity, a blockchain authentication system. Track your portfolio without being tracked.' + }, + '/en/blog/2022/07/how-do-i-get-my-finances-in-order': { + description: + 'Before you start long-term investing, get your finances in order. Follow Peter as he plans his monthly budget, saves money and sets financial goals.' + }, '/en/blog/2022/08/500-stars-on-github': { + description: + 'Ghostfolio celebrates 500 stars on GitHub. A recap of the growing community, the new message queue and the Internet Identity integration for Web3.', featureGraphicPath: 'assets/images/blog/500-stars-on-github.jpg', title: `500 Stars - ${title}` }, '/en/blog/2022/10/hacktoberfest-2022': { + description: + 'Ghostfolio joins Hacktoberfest for the first time. Make your first pull request on GitHub and contribute to the open source personal finance software.', featureGraphicPath: 'assets/images/blog/hacktoberfest-2022.png', title: `Hacktoberfest 2022 - ${title}` }, + '/en/blog/2022/11/black-friday-2022': { + description: + 'Black Friday 2022 offer: 75% off the annual plan of Ghostfolio Premium. This offer has ended. See the pricing page for the current plans.' + }, '/en/blog/2022/12/the-importance-of-tracking-your-personal-finances': { + description: + 'Tracking your assets helps you reach your financial goals. Learn why to monitor your personal finances, understand your net worth and act when required.', featureGraphicPath: 'assets/images/blog/20221226.jpg', title: `The importance of tracking your personal finances - ${title}` }, '/en/blog/2023/02/ghostfolio-meets-umbrel': { + description: + 'Ghostfolio is now available in the Umbrel App Store. Self-host the open source personal finance software on a home server and stay in control of your data.', featureGraphicPath: 'assets/images/blog/ghostfolio-x-umbrel.png', title: `Ghostfolio meets Umbrel - ${title}` }, '/en/blog/2023/03/ghostfolio-reaches-1000-stars-on-github': { + description: + 'Ghostfolio reaches 1’000 stars on GitHub. A look at the achievements of the open source personal finance software, its community and future developments.', featureGraphicPath: 'assets/images/blog/1000-stars-on-github.jpg', title: `Ghostfolio reaches 1’000 Stars on GitHub - ${title}` }, '/en/blog/2023/05/unlock-your-financial-potential-with-ghostfolio': { + description: + 'Discover why Ghostfolio is the ideal open source tool to manage stocks, ETFs and cryptocurrencies across multiple platforms, with insights and privacy.', featureGraphicPath: 'assets/images/blog/20230520.jpg', title: `Unlock your Financial Potential with Ghostfolio - ${title}` }, '/en/blog/2023/07/exploring-the-path-to-fire': { + description: + 'What is FIRE? Explore the concept of Financial Independence and Retiring Early, the famous 4% rule, and the pros and cons of this popular movement.', featureGraphicPath: 'assets/images/blog/20230701.jpg', title: `Exploring the Path to FIRE - ${title}` }, '/en/blog/2023/08/ghostfolio-joins-oss-friends': { + description: + 'Ghostfolio is now part of OSS Friends, a new initiative that helps open source projects grow. Read the story behind the movement and how to join it.', featureGraphicPath: 'assets/images/blog/ghostfolio-joins-oss-friends.png', title: `Ghostfolio joins OSS Friends - ${title}` }, '/en/blog/2023/09/ghostfolio-2': { + description: + 'Ghostfolio 2.0 is here: extended data import, comprehensive analytics, increased stability and the latest technology in open source wealth management.', featureGraphicPath: 'assets/images/blog/ghostfolio-2.jpg', title: `Announcing Ghostfolio 2.0 - ${title}` }, '/en/blog/2023/09/hacktoberfest-2023': { + description: + 'Ghostfolio joins Hacktoberfest for the second time. Make your first pull request on GitHub and contribute to the open source personal finance software.', featureGraphicPath: 'assets/images/blog/hacktoberfest-2023.png', title: `Hacktoberfest 2023 - ${title}` }, '/en/blog/2023/11/black-week-2023': { + description: + 'Black Week 2023 offer: 33% off the annual plan of Ghostfolio Premium. This offer has ended. See the pricing page for the current plans.', featureGraphicPath: 'assets/images/blog/black-week-2023.jpg', title: `Black Week 2023 - ${title}` }, '/en/blog/2023/11/hacktoberfest-2023-debriefing': { + description: + 'Looking back at Hacktoberfest 2023 at Ghostfolio: 20 developers from around the world and as many as 100 new features and improvements in the project.', featureGraphicPath: 'assets/images/blog/hacktoberfest-2023.png', title: `Hacktoberfest 2023 Debriefing - ${title}` }, '/en/blog/2024/09/hacktoberfest-2024': { + description: + 'Ghostfolio joins Hacktoberfest for the third time. Make your first pull request on GitHub and contribute to the open source personal finance dashboard.', featureGraphicPath: 'assets/images/blog/hacktoberfest-2024.png', title: `Hacktoberfest 2024 - ${title}` }, '/en/blog/2024/11/black-weeks-2024': { + description: + 'Black Weeks 2024 offer: 25% off the annual plan of Ghostfolio Premium plus 3 extra months. This offer has ended. See the pricing page for the current plans.', featureGraphicPath: 'assets/images/blog/black-weeks-2024.jpg', title: `Black Weeks 2024 - ${title}` }, '/en/blog/2025/09/hacktoberfest-2025': { + description: + 'Ghostfolio joins Hacktoberfest for the fourth time. Make your first pull request on GitHub and contribute to the modern personal finance dashboard.', featureGraphicPath: 'assets/images/blog/hacktoberfest-2025.png', title: `Hacktoberfest 2025 - ${title}` }, '/en/blog/2025/11/black-weeks-2025': { + description: + 'Black Weeks 2025 offer: 25% off the annual plan of Ghostfolio Premium plus 3 extra months. This offer has ended. See the pricing page for the current plans.', featureGraphicPath: 'assets/images/blog/black-weeks-2025.jpg', title: `Black Weeks 2025 - ${title}` }, '/en/blog/2026/04/ghostfolio-3': { + description: + 'Ghostfolio 3.0 is here: a refreshed user interface, expanded analytics, improved stability, more languages and an updated technology stack.', featureGraphicPath: 'assets/images/blog/ghostfolio-3.jpg', title: `Announcing Ghostfolio 3.0 - ${title}` }, @@ -101,6 +164,9 @@ export class HtmlTemplateMiddleware implements NestMiddleware { private readonly logger = new Logger(HtmlTemplateMiddleware.name); private indexHtmlMap: { [languageCode: string]: string } = {}; + private routeDescriptionsMap: { + [languageCode: string]: { [path: string]: string }; + } = {}; public constructor(private readonly i18nService: I18nService) { if (!environment.production) { @@ -135,7 +201,7 @@ export class HtmlTemplateMiddleware implements NestMiddleware { } public use(request: Request, response: Response, next: NextFunction) { - const path = request.originalUrl.replace(/\/$/, ''); + const path = request.originalUrl.split('?')[0].replace(/\/$/, ''); let languageCode = path.substr(1, 2); if ( @@ -162,12 +228,14 @@ export class HtmlTemplateMiddleware implements NestMiddleware { languageCode, path, rootUrl, - description: + description: this.escapeAttribute( locales[path]?.description ?? - this.i18nService.getTranslation({ - languageCode, - id: 'metaDescription' - }), + this.getRouteDescription({ languageCode, path }) ?? + this.i18nService.getTranslation({ + languageCode, + id: 'metaDescription' + }) + ), featureGraphicPath: locales[path]?.featureGraphicPath ?? 'assets/cover.png', keywords: this.i18nService.getTranslation({ @@ -186,13 +254,120 @@ export class HtmlTemplateMiddleware implements NestMiddleware { } } + private escapeAttribute(value: string) { + return value.replace(/&/g, '&').replace(/"/g, '"'); + } + + private getPersonalFinanceToolDescriptions( + languageCode: string + ): [string, string][] { + const description = this.i18nService.getTranslation({ + languageCode, + id: 'metaDescription.resources.personalFinanceTools.product', + skipUntranslated: true + }); + + const tokens = description.match(/[$]{[^}]+}/g) ?? []; + + if ( + tokens.length === 0 || + tokens.some((token) => { + return token !== '${name}'; + }) + ) { + return []; + } + + const path = [ + '', + languageCode, + ...this.i18nService.getLocalizedRouterLink({ + languageCode, + routerLink: + publicRoutes.resources.subRoutes.personalFinanceTools.subRoutes + .product.routerLink + }) + ].join('/'); + + return personalFinanceTools.map(({ alias, key, name }) => { + return [`${path}-${alias ?? key}`, interpolate(description, { name })]; + }); + } + + private getPublicRouteDescriptions({ + id, + languageCode, + routes + }: { + id: string; + languageCode: string; + routes: Record; + }): [string, string][] { + return Object.entries(routes).flatMap(([key, route]) => { + if (route.excludeFromSitemap) { + return []; + } + + const routeId = `${id}.${key}`; + + const path = [ + '', + languageCode, + ...this.i18nService.getLocalizedRouterLink({ + languageCode, + routerLink: route.routerLink + }) + ].join('/'); + + const description = this.i18nService.getTranslation({ + languageCode, + id: routeId, + skipUntranslated: true + }); + + return [ + [path, description] as [string, string], + ...this.getPublicRouteDescriptions({ + languageCode, + id: routeId, + routes: route.subRoutes ?? {} + }) + ]; + }); + } + + private getRouteDescription({ + languageCode, + path + }: { + languageCode: string; + path: string; + }): string | undefined { + // Build once per language since the translation lookups are expensive + this.routeDescriptionsMap[languageCode] ??= Object.fromEntries( + [ + ...this.getPersonalFinanceToolDescriptions(languageCode), + ...this.getPublicRouteDescriptions({ + languageCode, + id: 'metaDescription', + routes: publicRoutes + }) + ].filter(([, description]) => { + return description; + }) + ); + + return this.routeDescriptionsMap[languageCode][path]; + } + private isFileRequest(filename: string) { if (filename === '/assets/LICENSE') { return true; } else if ( - filename.endsWith('-de.fi') || - filename.endsWith('-markets.sh') || - filename.includes('auth/ey') + filename.includes('auth/ey') || + personalFinanceTools.some(({ alias, key }) => { + return filename.endsWith(`-${alias ?? key}`); + }) ) { return false; } diff --git a/apps/api/src/services/benchmark/benchmark.service.ts b/apps/api/src/services/benchmark/benchmark.service.ts index e0120bf127..6b9b1e6bcc 100644 --- a/apps/api/src/services/benchmark/benchmark.service.ts +++ b/apps/api/src/services/benchmark/benchmark.service.ts @@ -16,7 +16,8 @@ import { AssetProfileIdentifier, Benchmark, BenchmarkProperty, - BenchmarkResponse + BenchmarkResponse, + EnhancedAssetProfile } from '@ghostfolio/common/interfaces'; import { Injectable, Logger } from '@nestjs/common'; @@ -88,18 +89,20 @@ export class BenchmarkService { this.CACHE_KEY_BENCHMARKS ); - const { benchmarks, expiration }: BenchmarkValue = - JSON.parse(cachedBenchmarkValue); + if (cachedBenchmarkValue) { + const { benchmarks, expiration }: BenchmarkValue = + JSON.parse(cachedBenchmarkValue); - this.logger.debug('Fetched benchmarks from cache'); + this.logger.debug('Fetched benchmarks from cache'); - if (isPast(new Date(expiration))) { - this.calculateAndCacheBenchmarks({ - enableSharing - }); - } + if (isPast(new Date(expiration))) { + this.calculateAndCacheBenchmarks({ + enableSharing + }); + } - return benchmarks; + return benchmarks; + } } catch {} } @@ -108,7 +111,9 @@ export class BenchmarkService { public async getBenchmarkAssetProfiles({ enableSharing = false - } = {}): Promise[]> { + } = {}): Promise< + Pick[] + > { const symbolProfileIds: string[] = ( (await this.propertyService.getByKey( PROPERTY_BENCHMARKS @@ -293,7 +298,7 @@ export class BenchmarkService { name: benchmarkAssetProfiles[index].name, performances: { allTimeHigh: { - date: allTimeHigh?.date, + date: allTimeHigh?.date as Date, performancePercent: this.getPerformancePercentFromAllTimeHigh( performancePercentFromAllTimeHigh ) diff --git a/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts b/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts index f67748c007..d547de0233 100644 --- a/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts +++ b/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts @@ -88,7 +88,7 @@ export class ExchangeRateDataService { ); const lastDateString = dateStrings.reduce((a, b) => { return a > b ? a : b; - }, undefined); + }, ''); let previousExchangeRate = exchangeRatesByCurrency[`${currency}${targetCurrency}`]?.[ @@ -214,7 +214,7 @@ export class ExchangeRateDataService { const resultExtended = result; for (const symbol of Object.keys(result)) { - const [currency1, currency2] = symbol.match(/.{1,3}/g); + const [currency1, currency2] = symbol.match(/.{1,3}/g) ?? []; const [date] = Object.keys(result[symbol]); // Calculate the opposite direction @@ -226,7 +226,7 @@ export class ExchangeRateDataService { } for (const symbol of Object.keys(resultExtended)) { - const [currency1, currency2] = symbol.match(/.{1,3}/g); + const [currency1, currency2] = symbol.match(/.{1,3}/g) ?? []; this.exchangeRates[symbol] = resultExtended[symbol]?.[dateStringOfYesterday]?.marketPrice; @@ -302,7 +302,7 @@ export class ExchangeRateDataService { const derivedCurrencyFactor = this.derivedCurrencyFactors[`${aFromCurrency}${aToCurrency}`]; - let factor: number; + let factor: number | undefined; if (aFromCurrency === aToCurrency) { factor = 1; @@ -324,8 +324,8 @@ export class ExchangeRateDataService { } else { // Calculate indirectly via base currency - let marketPriceBaseCurrencyFromCurrency: number; - let marketPriceBaseCurrencyToCurrency: number; + let marketPriceBaseCurrencyFromCurrency: number | undefined; + let marketPriceBaseCurrencyToCurrency: number | undefined; try { if (aFromCurrency === DEFAULT_CURRENCY) { @@ -337,7 +337,7 @@ export class ExchangeRateDataService { date: aDate, symbol: `${DEFAULT_CURRENCY}${aFromCurrency}` }) - )?.marketPrice as number; + )?.marketPrice; } } catch {} @@ -351,14 +351,19 @@ export class ExchangeRateDataService { date: aDate, symbol: `${DEFAULT_CURRENCY}${aToCurrency}` }) - )?.marketPrice as number; + )?.marketPrice; } } catch {} - // Calculate the opposite direction - factor = - (1 / marketPriceBaseCurrencyFromCurrency) * - marketPriceBaseCurrencyToCurrency; + if ( + isNumber(marketPriceBaseCurrencyFromCurrency) && + isNumber(marketPriceBaseCurrencyToCurrency) + ) { + // Calculate the opposite direction + factor = + (1 / marketPriceBaseCurrencyFromCurrency) * + marketPriceBaseCurrencyToCurrency; + } } } @@ -530,7 +535,9 @@ export class ExchangeRateDataService { } }) ).forEach(({ currency }) => { - currencies.push(currency); + if (currency) { + currencies.push(currency); + } }); ( diff --git a/apps/api/src/services/i18n/i18n.service.spec.ts b/apps/api/src/services/i18n/i18n.service.spec.ts new file mode 100644 index 0000000000..611977bd87 --- /dev/null +++ b/apps/api/src/services/i18n/i18n.service.spec.ts @@ -0,0 +1,109 @@ +import { Logger } from '@nestjs/common'; +import { readFileSync, readdirSync } from 'node:fs'; + +import { I18nService } from './i18n.service'; + +jest.mock('node:fs', () => { + return { + ...jest.requireActual('node:fs'), + readFileSync: jest.fn(), + readdirSync: jest.fn() + }; +}); + +const germanLocale = ` + + + New + New + + + Translated + Übersetzt + + + faq + haeufig-gestellte-fragen + + + self-hosting + selbst-hosting + + +`; + +describe('I18nService', () => { + let i18nService: I18nService; + let warnSpy: jest.SpyInstance; + + beforeEach(() => { + (readdirSync as jest.Mock).mockReturnValue(['messages.de.xlf']); + (readFileSync as jest.Mock).mockReturnValue(germanLocale); + + warnSpy = jest.spyOn(Logger.prototype, 'warn').mockImplementation(); + + i18nService = new I18nService(); + i18nService.onModuleInit(); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + describe('getTranslation', () => { + it('returns a target with the state "new" by default', () => { + expect( + i18nService.getTranslation({ + id: 'metaDescription.new', + languageCode: 'de' + }) + ).toBe('New'); + }); + + it('skips a target with the state "new" without a warning if skipUntranslated is true', () => { + expect( + i18nService.getTranslation({ + id: 'metaDescription.new', + languageCode: 'de', + skipUntranslated: true + }) + ).toBe(''); + expect(warnSpy).not.toHaveBeenCalled(); + }); + + it('returns a translated target if skipUntranslated is true', () => { + expect( + i18nService.getTranslation({ + id: 'metaDescription.translated', + languageCode: 'de', + skipUntranslated: true + }) + ).toBe('Übersetzt'); + }); + + it('logs a warning for an unknown id by default', () => { + expect( + i18nService.getTranslation({ + id: 'metaDescription.unknown', + languageCode: 'de' + }) + ).toBe(''); + expect(warnSpy).toHaveBeenCalledTimes(1); + }); + }); + + describe('getLocalizedRouterLink', () => { + it('localizes the tagged segments and keeps the other segments', () => { + expect( + i18nService.getLocalizedRouterLink({ + languageCode: 'de', + routerLink: [ + '/:kebab-case@@routes.faq:faq', + ':kebab-case@@routes.faq.selfHosting:self-hosting', + 'saas' + ] + }) + ).toEqual(['haeufig-gestellte-fragen', 'selbst-hosting', 'saas']); + }); + }); +}); diff --git a/apps/api/src/services/i18n/i18n.service.ts b/apps/api/src/services/i18n/i18n.service.ts index cd8f85369c..834b0a65e1 100644 --- a/apps/api/src/services/i18n/i18n.service.ts +++ b/apps/api/src/services/i18n/i18n.service.ts @@ -7,6 +7,9 @@ import { join } from 'node:path'; @Injectable() export class I18nService implements OnModuleInit { + private static readonly TRANSLATION_TAGGED_MESSAGE_REGEX = + /:.*@@(?[a-zA-Z0-9.]+):(?.+)/; + private readonly logger = new Logger(I18nService.name); private localesPath = join(__dirname, 'assets', 'locales'); @@ -16,14 +19,37 @@ export class I18nService implements OnModuleInit { this.loadFiles(); } + public getLocalizedRouterLink({ + languageCode, + routerLink + }: { + languageCode: string; + routerLink: string[]; + }): string[] { + return routerLink.map((link) => { + const match = link.match(I18nService.TRANSLATION_TAGGED_MESSAGE_REGEX); + + const segment = match + ? this.getTranslation({ + languageCode, + id: match.groups.id + }) || match.groups.message + : link; + + return segment.replace(/^\/+|\/+$/g, ''); + }); + } + public getTranslation({ id, languageCode, - placeholders + placeholders, + skipUntranslated = false }: { id: string; languageCode: string; placeholders?: Record; + skipUntranslated?: boolean; }): string { const languageCodeToUse = this.translations[languageCode] ? languageCode @@ -37,13 +63,17 @@ export class I18nService implements OnModuleInit { return ''; } + const targetSelector = skipUntranslated + ? 'target:not([state="new"])' + : 'target'; + let translatedText = $( `trans-unit[id="${id}"] > ${ - languageCodeToUse === DEFAULT_LANGUAGE_CODE ? 'source' : 'target' + languageCodeToUse === DEFAULT_LANGUAGE_CODE ? 'source' : targetSelector }` ).text(); - if (!translatedText) { + if (!translatedText && !skipUntranslated) { this.logger.warn( `Translation not found for id '${id}' in locale '${languageCode}'` ); diff --git a/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts b/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts index 4a213684b8..ecb09b2093 100644 --- a/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts +++ b/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts @@ -121,6 +121,7 @@ function createHolding({ assetSubClass = AssetSubClass.STOCK, dataSource = DataSource.YAHOO, isin, + name, symbol = 'AAPL' }: { allocationInPercentage?: number; @@ -128,6 +129,7 @@ function createHolding({ assetSubClass?: AssetSubClass; dataSource?: DataSource; isin?: string | null; + name?: string | null; symbol?: string; } = {}) { return { @@ -140,7 +142,7 @@ function createHolding({ isin, symbol, currency: 'CHF', - name: `Name of ${symbol}` + name: name === undefined ? `Name of ${symbol}` : name }, dateOfFirstActivity: new Date('2024-01-01'), grossPerformance: 100, @@ -631,6 +633,16 @@ describe('PortfolioTableService', () => { expect(row).toContain('| Name of AAPL | | AAPL |'); }); + it('gives an empty name if the asset profile has none', async () => { + const result = await getHoldingsTable([createHolding({ name: null })]); + + const [row] = result.split('\n').filter((line) => { + return line.includes('| AAPL |'); + }); + + expect(row).toContain('| | | AAPL |'); + }); + it('gives the translation of the asset class and of the asset sub class', async () => { const result = await getHoldingsTable([createHolding()]); diff --git a/apps/api/src/services/portfolio-table/portfolio-table.service.ts b/apps/api/src/services/portfolio-table/portfolio-table.service.ts index bcf2839fba..1f51bd5b9b 100644 --- a/apps/api/src/services/portfolio-table/portfolio-table.service.ts +++ b/apps/api/src/services/portfolio-table/portfolio-table.service.ts @@ -52,7 +52,10 @@ function getDataSourceColumnDefinition( const dataSource = getDataSource(row); return dataSource - ? transformDataSourceInResponse({ configurationService, dataSource }) + ? (transformDataSourceInResponse({ + configurationService, + dataSource + }) ?? '') : ''; }, name: DATA_SOURCE_COLUMN_NAME @@ -176,7 +179,7 @@ export class PortfolioTableService { }), { getValue: ({ assetProfile, currency }) => { - return currency ?? assetProfile.currency; + return currency ?? assetProfile.currency ?? ''; }, name: 'Currency' }, @@ -226,7 +229,7 @@ export class PortfolioTableService { [ { getValue: ({ assetProfile }) => { - return assetProfile.name; + return assetProfile.name ?? ''; }, name: 'Name' }, @@ -249,7 +252,7 @@ export class PortfolioTableService { }), { getValue: ({ assetProfile }) => { - return assetProfile.currency; + return assetProfile.currency ?? ''; }, name: 'Currency' }, @@ -696,7 +699,7 @@ export class PortfolioTableService { const performanceSection = ['## Performance', '']; - if (chart?.length > 0) { + if (chart && chart.length > 0) { performanceSection.push( await getMarkdownTable({ columnDefinitions: this.getColumnDefinitions({ diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.spec.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.spec.ts index bf28718ebc..74487fd31e 100644 --- a/apps/api/src/services/symbol-profile/symbol-profile.service.spec.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.spec.ts @@ -81,4 +81,89 @@ describe('SymbolProfileService', () => { ).resolves.toEqual([expect.objectContaining({ name: 'Apple' })]); }); }); + + describe('getSymbolProfiles', () => { + let findManySymbolProfiles: jest.Mock; + let symbolProfileService: SymbolProfileService; + + beforeEach(() => { + findManySymbolProfiles = jest.fn(); + + symbolProfileService = new SymbolProfileService({ + symbolProfile: { findMany: findManySymbolProfiles } + } as unknown as PrismaService); + }); + + it('enhances the symbol profile and excludes relational metadata', async () => { + const dateOfFirstActivity = new Date('2024-01-15T00:00:00.000Z'); + + findManySymbolProfiles.mockResolvedValue([ + { + _count: { activities: 3, watchedBy: 1 }, + activities: [{ date: dateOfFirstActivity }], + assetProfileOverrides: { name: 'Apple Inc. (Custom)' }, + currency: 'USD', + dataSource: DataSource.YAHOO, + isin: 'US0378331005', + name: 'Apple Inc.', + scraperConfiguration: { + defaultMarketPrice: 100, + headers: { 'User-Agent': 'Test' }, + locale: 'en', + mode: 'lazy', + selector: '.price', + url: 'https://example.com' + }, + symbol: 'AAPL' + } + ]); + + const [result] = await symbolProfileService.getSymbolProfiles([ + { dataSource: DataSource.YAHOO, symbol: 'AAPL' } + ]); + + expect(result).toEqual( + expect.objectContaining({ + activitiesCount: 3, + dateOfFirstActivity, + name: 'Apple Inc. (Custom)', + scraperConfiguration: { + defaultMarketPrice: 100, + headers: { 'User-Agent': 'Test' }, + locale: 'en', + mode: 'lazy', + selector: '.price', + url: 'https://example.com' + }, + watchedByCount: 1 + }) + ); + expect(result).not.toHaveProperty('_count'); + expect(result).not.toHaveProperty('activities'); + expect(result).not.toHaveProperty('assetProfileOverrides'); + }); + + it('gives null for scraperConfiguration if none exists', async () => { + findManySymbolProfiles.mockResolvedValue([ + { + _count: { activities: 0 }, + assetProfileOverrides: null, + currency: 'USD', + dataSource: DataSource.YAHOO, + isin: 'US0378331005', + name: 'Apple Inc.', + scraperConfiguration: null, + symbol: 'AAPL' + } + ]); + + const [result] = await symbolProfileService.getSymbolProfiles([ + { dataSource: DataSource.YAHOO, symbol: 'AAPL' } + ]); + + expect(result.scraperConfiguration).toBeNull(); + expect(result.dateOfFirstActivity).toBeUndefined(); + expect(result.watchedByCount).toBe(0); + }); + }); }); diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.ts index 98a1ce1cba..58f26c2184 100644 --- a/apps/api/src/services/symbol-profile/symbol-profile.service.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts @@ -21,6 +21,7 @@ import { SymbolProfile } from '@prisma/client'; import { continents, countries } from 'countries-list'; +import { omit } from 'lodash-es'; @Injectable() export class SymbolProfileService { @@ -284,7 +285,7 @@ export class SymbolProfileService { activities?: { date: Date; }[]; - assetProfileOverrides: AssetProfileOverrides; + assetProfileOverrides: AssetProfileOverrides | null; })[] ): EnhancedAssetProfile[] { return symbolProfiles.map((symbolProfile) => { @@ -293,13 +294,19 @@ export class SymbolProfileService { symbolProfile.assetProfileOverrides ); - const item = { - ...symbolProfileWithOverrides, - activitiesCount: 0, + const symbolProfileWithoutExtras = omit(symbolProfileWithOverrides, [ + '_count', + 'activities', + 'assetProfileOverrides' + ]); + + return { + ...symbolProfileWithoutExtras, + activitiesCount: symbolProfile._count.activities, countries: this.getCountries( symbolProfileWithOverrides?.countries as unknown as Prisma.JsonArray ), - dateOfFirstActivity: undefined as Date, + dateOfFirstActivity: symbolProfile.activities?.[0]?.date, holdings: this.getHoldings( symbolProfileWithOverrides?.holdings as unknown as Prisma.JsonArray ), @@ -310,19 +317,8 @@ export class SymbolProfileService { symbolProfileWithOverrides?.sectors as unknown as Prisma.JsonArray ), symbolMapping: this.getSymbolMapping(symbolProfileWithOverrides), - watchedByCount: 0 - }; - - item.activitiesCount = symbolProfile._count.activities; - item.watchedByCount = symbolProfile._count.watchedBy ?? 0; - delete item._count; - - item.dateOfFirstActivity = symbolProfile.activities?.[0]?.date; - delete item.activities; - - delete item.assetProfileOverrides; - - return item; + watchedByCount: symbolProfile._count.watchedBy ?? 0 + } as EnhancedAssetProfile; }); } @@ -361,7 +357,7 @@ export class SymbolProfileService { private getScraperConfiguration( symbolProfile: SymbolProfile - ): ScraperConfiguration { + ): ScraperConfiguration | null { const scraperConfiguration = symbolProfile.scraperConfiguration as Prisma.JsonObject; diff --git a/apps/api/src/services/symbol/symbol.service.ts b/apps/api/src/services/symbol/symbol.service.ts index 856ed4bf01..618ffc1ffd 100644 --- a/apps/api/src/services/symbol/symbol.service.ts +++ b/apps/api/src/services/symbol/symbol.service.ts @@ -40,7 +40,7 @@ export class SymbolService { dataGatheringItem: DataGatheringItem; includeHistoricalData?: number; useIntradayData?: boolean; - }): Promise { + }): Promise { let currency: string; let marketPrice: number; @@ -63,7 +63,7 @@ export class SymbolService { if (dataGatheringItem.dataSource && marketPrice >= 0) { let historicalData: HistoricalDataItem[] = []; - if (includeHistoricalData > 0) { + if (includeHistoricalData && includeHistoricalData > 0) { const days = includeHistoricalData; const marketData = await this.marketDataService.getRange({ @@ -168,10 +168,10 @@ export class SymbolService { fearAndGreedIndex: { CRYPTOCURRENCIES: { ...marketDataFearAndGreedIndexCryptocurrencies - }, + } as SymbolItem, STOCKS: { ...marketDataFearAndGreedIndexStocks - } + } as SymbolItem } }; } diff --git a/apps/api/src/services/user/user.service.ts b/apps/api/src/services/user/user.service.ts index b566332f40..b3d7ea89bb 100644 --- a/apps/api/src/services/user/user.service.ts +++ b/apps/api/src/services/user/user.service.ts @@ -708,6 +708,8 @@ export class UserService { userId }); + await this.prismaService.authDevice.deleteMany({ where: { userId } }); + await this.prismaService.user.update({ data: { accessToken: hashedAccessToken }, where: { id: userId } diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts index 53d3505a1c..bd9dece2f3 100644 --- a/apps/client/src/app/app.component.ts +++ b/apps/client/src/app/app.component.ts @@ -337,7 +337,9 @@ export class GfAppComponent implements OnInit { impersonationId: this.impersonationId, locale: this.user?.settings?.locale }, - height: this.deviceType === 'mobile' ? '98vh' : '80vh', + height: this.deviceType === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog-host/asset-profile-dialog-host.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog-host/asset-profile-dialog-host.component.ts index 26af45e20b..d97225a225 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog-host/asset-profile-dialog-host.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog-host/asset-profile-dialog-host.component.ts @@ -151,7 +151,9 @@ export class GfAssetProfileDialogHostComponent implements OnDestroy, OnInit { deviceType: this.deviceType(), locale: user?.settings?.locale ?? DEFAULT_LOCALE } satisfies AssetProfileDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/components/admin-platform/admin-platform.component.ts b/apps/client/src/app/components/admin-platform/admin-platform.component.ts index 10634d5dfb..cd5341142f 100644 --- a/apps/client/src/app/components/admin-platform/admin-platform.component.ts +++ b/apps/client/src/app/components/admin-platform/admin-platform.component.ts @@ -184,7 +184,9 @@ export class GfAdminPlatformComponent implements OnInit { CreateOrUpdatePlatformDialogParams >(GfCreateOrUpdatePlatformDialogComponent, { data: {} satisfies CreateOrUpdatePlatformDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); @@ -224,7 +226,9 @@ export class GfAdminPlatformComponent implements OnInit { url } } satisfies CreateOrUpdatePlatformDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.ts b/apps/client/src/app/components/admin-tag/admin-tag.component.ts index e46044d1e4..2481c7202a 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.ts +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.ts @@ -204,7 +204,9 @@ export class GfAdminTagComponent implements OnInit { CreateOrUpdateTagDialogParams >(GfCreateOrUpdateTagDialogComponent, { data: {} satisfies CreateOrUpdateTagDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); @@ -243,7 +245,9 @@ export class GfAdminTagComponent implements OnInit { name } } satisfies CreateOrUpdateTagDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/components/admin-users/admin-users.component.ts b/apps/client/src/app/components/admin-users/admin-users.component.ts index 8e459b4a40..e0bbf84d55 100644 --- a/apps/client/src/app/components/admin-users/admin-users.component.ts +++ b/apps/client/src/app/components/admin-users/admin-users.component.ts @@ -339,7 +339,9 @@ export class GfAdminUsersComponent implements OnInit { locale: this.user?.settings?.locale ?? DEFAULT_LOCALE, userId: aUserId } satisfies UserDetailDialogParams, - height: this.deviceType() === 'mobile' ? '98vh' : '60vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '60vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/components/user-account-access/access-dialog-host/access-dialog-host.component.ts b/apps/client/src/app/components/user-account-access/access-dialog-host/access-dialog-host.component.ts index 1adafb118b..bc1f579d86 100644 --- a/apps/client/src/app/components/user-account-access/access-dialog-host/access-dialog-host.component.ts +++ b/apps/client/src/app/components/user-account-access/access-dialog-host/access-dialog-host.component.ts @@ -157,7 +157,9 @@ export class GfAccessDialogHostComponent implements OnDestroy, OnInit { CreateOrUpdateAccessDialogParams >(GfCreateOrUpdateAccessDialogComponent, { data, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/pages/accounts/account-dialog-host/account-dialog-host.component.ts b/apps/client/src/app/pages/accounts/account-dialog-host/account-dialog-host.component.ts index 0cc9476e3b..bf22be8ecb 100644 --- a/apps/client/src/app/pages/accounts/account-dialog-host/account-dialog-host.component.ts +++ b/apps/client/src/app/pages/accounts/account-dialog-host/account-dialog-host.component.ts @@ -256,7 +256,9 @@ export class GfAccountDialogHostComponent implements OnDestroy, OnInit { hasPermission(user?.permissions, permissions.updateActivity) && !user?.settings?.isRestrictedView }, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); @@ -292,7 +294,9 @@ export class GfAccountDialogHostComponent implements OnDestroy, OnInit { account, user }, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/pages/i18n/i18n-page.html b/apps/client/src/app/pages/i18n/i18n-page.html index 707c3a0b4e..9c1f0b25fa 100644 --- a/apps/client/src/app/pages/i18n/i18n-page.html +++ b/apps/client/src/app/pages/i18n/i18n-page.html @@ -8,6 +8,105 @@ worth including cash, stocks, ETFs and cryptocurrencies across multiple platforms. +
  • + Learn about Ghostfolio, the open source wealth management application to + track stocks, ETFs and cryptocurrencies, and the community behind the + project. +
  • +
  • + See what is new in Ghostfolio. The changelog lists the features, + improvements and fixes of each release of the open source wealth + management software. +
  • +
  • + Ghostfolio is open source software under the AGPL-3.0 license. Read the + full license text that applies to the source code of the wealth + management software. +
  • +
  • + Discover the OSS Friends of Ghostfolio: a collection of other exciting + open source software projects that you can explore and support. +
  • +
  • + Read the Privacy Policy of Ghostfolio to learn how the open source + wealth management software handles your personal data and protects your + privacy. +
  • +
  • + Read the Terms of Service for the use of Ghostfolio, the web application + and API of the open source software to manage your wealth. +
  • +
  • + Read the latest Ghostfolio updates and insights on personal finance: + release announcements, investing topics, community news and open source + milestones. +
  • +
  • + Find answers to common questions about Ghostfolio: what the open source + wealth management software does, which assets it tracks and how it + protects privacy. +
  • +
  • + Find answers to common questions about the managed Ghostfolio cloud + offering: how to sign up, what you get for free and what Ghostfolio + Premium includes. +
  • +
  • + Find answers to common questions about self-hosting Ghostfolio: how to + start, which home server systems are available and how to add a new + currency. +
  • +
  • + Explore the features of Ghostfolio: track stocks, ETFs, bonds, + cryptocurrencies, dividends and liabilities, and analyze your portfolio + with open source tools. +
  • +
  • + Check the current mood of the financial markets with the Fear and Greed + Index and compare the trends of major benchmarks in Ghostfolio. +
  • +
  • + Ghostfolio is an Open Startup: see the public key metrics of the + platform, including active users, GitHub stars, Docker Hub pulls and + uptime. +
  • +
  • + Compare the plans of Ghostfolio: run the open source software on your + own infrastructure for free or get the managed Ghostfolio Premium cloud + offering. +
  • +
  • + Create your account and get started with Ghostfolio, the open source + software to track stocks, ETFs and cryptocurrencies. +
  • +
  • + Explore the Ghostfolio resources on personal finance and investing: + guides, a glossary, market tools and comparisons of personal finance + tools. +
  • +
  • + Learn the key terms of personal finance and investing in the Ghostfolio + glossary, from buy and hold and dollar-cost averaging to FIRE and + stagflation. +
  • +
  • + Get started with investing with the Ghostfolio guides: a diversified, + low-cost strategy and the steps to get your personal finances in order. +
  • +
  • + Follow the financial markets with tools such as the Crypto Coins + Heatmap, the Fear and Greed Index, the Inflation Chart and the Stock + Heatmap. +
  • +
  • + Discover open source alternatives for personal finance tools. Compare + popular apps with Ghostfolio and take control of your finances, data and + privacy. +
  • +
  • + Compare Ghostfolio vs ${name}: the open source alternative on + features, data privacy and pricing. +
  • app, asset, cryptocurrency, dashboard, etf, finance, management, performance, portfolio, software, stock, trading, wealth, web3 diff --git a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts index b52339ddfa..2c442f0403 100644 --- a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts @@ -227,7 +227,8 @@ export class GfActivitiesPageComponent implements OnInit { deviceType: this.deviceType, user: this.user }, - height: this.deviceType === 'mobile' ? '98vh' : undefined, + height: this.deviceType === 'mobile' ? '98dvh' : undefined, + panelClass: this.deviceType === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType === 'mobile' ? '100vw' : '50rem' }); @@ -259,7 +260,8 @@ export class GfActivitiesPageComponent implements OnInit { deviceType: this.deviceType, user: this.user }, - height: this.deviceType === 'mobile' ? '98vh' : undefined, + height: this.deviceType === 'mobile' ? '98dvh' : undefined, + panelClass: this.deviceType === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/pages/portfolio/activities/activity-dialog-host/activity-dialog-host.component.ts b/apps/client/src/app/pages/portfolio/activities/activity-dialog-host/activity-dialog-host.component.ts index 0d4ea8a14d..1315d5b52f 100644 --- a/apps/client/src/app/pages/portfolio/activities/activity-dialog-host/activity-dialog-host.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/activity-dialog-host/activity-dialog-host.component.ts @@ -186,7 +186,8 @@ export class GfActivityDialogHostComponent implements OnDestroy, OnInit { user, accounts: user?.accounts }, - height: deviceType === 'mobile' ? '98vh' : '80vh', + height: deviceType === 'mobile' ? '98dvh' : '80vh', + panelClass: deviceType === 'mobile' ? 'gf-mobile-dialog' : undefined, width: deviceType === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 915c6833ab..e2ae6a6edf 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -670,7 +670,9 @@ export class GfAllocationsPageComponent implements OnInit { !this.user?.settings?.isRestrictedView, impersonationId: this.impersonationId }, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/app/pages/register/register-page.component.ts b/apps/client/src/app/pages/register/register-page.component.ts index 6a4825c4da..18dee0ed9c 100644 --- a/apps/client/src/app/pages/register/register-page.component.ts +++ b/apps/client/src/app/pages/register/register-page.component.ts @@ -89,7 +89,8 @@ export class GfRegisterPageComponent implements OnInit { needsToAcceptTermsOfService: this.hasPermissionForSubscription }, disableClose: true, - height: this.deviceType === 'mobile' ? '98vh' : undefined, + height: this.deviceType === 'mobile' ? '98dvh' : undefined, + panelClass: this.deviceType === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType === 'mobile' ? '100vw' : '30rem' }); diff --git a/apps/client/src/app/services/user/user.service.ts b/apps/client/src/app/services/user/user.service.ts index ebc3a5fb96..9ea225f7c9 100644 --- a/apps/client/src/app/services/user/user.service.ts +++ b/apps/client/src/app/services/user/user.service.ts @@ -167,7 +167,9 @@ export class UserService extends ObservableStore { user }, disableClose: true, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/apps/client/src/index.html b/apps/client/src/index.html index 105e7bcae9..05264b2ff3 100644 --- a/apps/client/src/index.html +++ b/apps/client/src/index.html @@ -13,7 +13,7 @@ diff --git a/apps/client/src/locales/messages.de.xlf b/apps/client/src/locales/messages.de.xlf index 7f1d635edb..0d6b6fa537 100644 --- a/apps/client/src/locales/messages.de.xlf +++ b/apps/client/src/locales/messages.de.xlf @@ -5203,7 +5203,7 @@ For seasoned investors who manage multiple portfolios. - For seasoned investors who manage multiple portfolios. + Für erfahrene Anleger, die mehrere Portfolios verwalten. apps/client/src/app/pages/pricing/pricing-page.html 233 diff --git a/apps/client/src/locales/messages.es.xlf b/apps/client/src/locales/messages.es.xlf index 13baa85853..053f3f3d86 100644 --- a/apps/client/src/locales/messages.es.xlf +++ b/apps/client/src/locales/messages.es.xlf @@ -444,7 +444,7 @@ Ghostfolio AI has processed the maximum of activities. The file can have more activities. - Ghostfolio AI has processed the maximum of activities. The file can have more activities. + Ghostfolio AI ha procesado el máximo de operaciones. El archivo puede tener más operaciones. apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.html 158 @@ -584,7 +584,7 @@ Request a free trial - Request a free trial + Solicitar una prueba gratuita apps/client/src/app/components/subscription-interstitial-dialog/subscription-interstitial-dialog.html 211 @@ -892,7 +892,7 @@ No credit card required. The trial ends automatically. - No credit card required. The trial ends automatically. + No se requiere tarjeta de crédito. La prueba finaliza automáticamente. apps/client/src/app/components/subscription-interstitial-dialog/subscription-interstitial-dialog.html 214 @@ -968,7 +968,7 @@ Manual - Manual + Manual libs/ui/src/lib/i18n.ts 30 @@ -1396,7 +1396,7 @@ Fully managed cloud offering, with - Fully managed cloud offering, with + Oferta en la nube totalmente gestionada, con apps/client/src/app/pages/pricing/pricing-page.html 37 @@ -2068,7 +2068,7 @@ The CSV file has more than rows of activities - The CSV file has more than rows of activities + El archivo CSV tiene más de filas de operaciones apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts 445 @@ -2816,7 +2816,7 @@ By , this is projected to increase to per year or per month, assuming a annual interest rate. - Para , se prevé que esto aumente a por año o por mes, asumiendo una tasa de interés anual del . + Para , se prevé que esto aumente a por año o por mes, asumiendo una tasa de interés anual del . apps/client/src/app/pages/portfolio/fire/fire-page.html 144 @@ -2948,7 +2948,7 @@ The file is larger than MB - The file is larger than MB + El archivo supera los MB apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts 437 @@ -3412,7 +3412,7 @@ If you retire today, you would be able to withdraw per year or per month, based on your total assets of and a safe withdrawal rate (SWR) of - Si te jubilas hoy, podrías retirar por año o por mes, basado en tus activos totales de y una tasa de retiro segura (SWR) de + Si te jubilas hoy, podrías retirar por año o por mes, basado en tus activos totales de y una tasa de retiro segura (SWR) de apps/client/src/app/pages/portfolio/fire/fire-page.html 69 @@ -4032,7 +4032,7 @@ Everything in Premium, plus - Everything in Premium, plus + Todo lo incluido en Premium, más apps/client/src/app/pages/pricing/pricing-page.html 238 @@ -4096,7 +4096,7 @@ Please find the source code and further instructions on GitHub. - Please find the source code and further instructions on GitHub. + Encuentra el código fuente y más instrucciones en GitHub. apps/client/src/app/pages/pricing/pricing-page.html 425 @@ -4104,7 +4104,7 @@ Powered by third-party AI providers - Powered by third-party AI providers + Con la tecnología de proveedores de IA de terceros apps/client/src/app/components/user-account-settings/user-account-settings.html 306 @@ -4216,7 +4216,7 @@ Return on Investment (total return with dividends) - Return on Investment (total return with dividends) + Rentabilidad sobre la inversión (rentabilidad total con dividendos) apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html 165 @@ -5180,7 +5180,7 @@ For seasoned investors who manage multiple portfolios. - For seasoned investors who manage multiple portfolios. + Para inversores experimentados que gestionan múltiples carteras. apps/client/src/app/pages/pricing/pricing-page.html 233 @@ -5252,7 +5252,7 @@ Client - Client + Cliente apps/client/src/app/components/user-detail-dialog/user-detail-dialog.html 182 @@ -5961,7 +5961,7 @@ Up to 5 User Accounts - Up to 5 User Accounts + Hasta 5 cuentas de usuario apps/client/src/app/pages/pricing/pricing-page.html 244 @@ -6086,7 +6086,7 @@ Centralized User Management - Centralized User Management + Gestión centralizada de usuarios apps/client/src/app/pages/pricing/pricing-page.html 248 @@ -6882,7 +6882,7 @@ Ghostfolio AI is processing the file... - Ghostfolio AI is processing the file... + Ghostfolio AI está procesando el archivo... apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts 167 @@ -7211,7 +7211,7 @@ The content of your file will be processed by third-party AI providers. Please remove any personal data before uploading. - The content of your file will be processed by third-party AI providers. Please remove any personal data before uploading. + El contenido de tu archivo será procesado por proveedores de IA de terceros. Elimina cualquier dato personal antes de subirlo. apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts 168 @@ -7647,7 +7647,7 @@ Get Max - Get Max + Obtener Max apps/client/src/app/pages/pricing/pricing-page.html 269 @@ -8133,7 +8133,7 @@ AI-assisted import - AI-assisted import + Importación asistida por IA apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.html 97 @@ -8217,7 +8217,7 @@ All in One Place - All in One Place + Todo en un solo lugar apps/client/src/app/pages/landing/landing-page.html 142 @@ -8489,7 +8489,7 @@ Performance Timeline - Performance Timeline + Cronología del rendimiento apps/client/src/app/pages/portfolio/analysis/analysis-page.html 447 @@ -8582,7 +8582,7 @@ and I agree to the Terms of Service. - y acepto los Términos de servicio. + y acepto los Términos de servicio. apps/client/src/app/pages/register/user-account-registration-dialog/user-account-registration-dialog.html 35 @@ -8751,7 +8751,7 @@ {VAR_PLURAL, plural, =1 {Ghostfolio AI could not match 1 activity of the file } other {Ghostfolio AI could not match activities of the file }} - {VAR_PLURAL, plural, =1 {Ghostfolio AI could not match 1 activity of the file } other {Ghostfolio AI could not match activities of the file }} + {VAR_PLURAL, plural, =1 {Ghostfolio AI no pudo reconocer 1 operación del archivo } other {Ghostfolio AI no pudo reconocer operaciones del archivo }} apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.html 137 @@ -9005,7 +9005,7 @@ Privacy First - Privacy First + Privacidad ante todo apps/client/src/app/pages/landing/landing-page.html 153 diff --git a/apps/client/src/styles.scss b/apps/client/src/styles.scss index 6304a1c081..fd843c65db 100644 --- a/apps/client/src/styles.scss +++ b/apps/client/src/styles.scss @@ -346,6 +346,12 @@ ngx-skeleton-loader { cursor: pointer; } +.gf-mobile-dialog { + .mat-mdc-dialog-surface { + padding-bottom: max(0px, env(safe-area-inset-bottom) - 1dvh); + } +} + .gf-promotion-badge { background-color: var(--oc-orange-5); } diff --git a/libs/ui/src/lib/benchmark/benchmark.component.ts b/libs/ui/src/lib/benchmark/benchmark.component.ts index 485a9e371f..d0749e20d5 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.ts +++ b/libs/ui/src/lib/benchmark/benchmark.component.ts @@ -179,7 +179,9 @@ export class GfBenchmarkComponent implements OnInit { deviceType: this.deviceType(), locale: this.locale() }, - height: this.deviceType() === 'mobile' ? '98vh' : undefined, + height: this.deviceType() === 'mobile' ? '98dvh' : undefined, + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts index 03df8837c3..6da916a8ef 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts @@ -236,7 +236,9 @@ export class GfHistoricalMarketDataEditorComponent dateString: `${yearMonth}-${day}`, symbol: this.symbol }, - height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + height: this.deviceType() === 'mobile' ? '98dvh' : '80vh', + panelClass: + this.deviceType() === 'mobile' ? 'gf-mobile-dialog' : undefined, width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); diff --git a/package-lock.json b/package-lock.json index 8d91a863e8..9e94b49be1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostfolio", - "version": "3.97.0", + "version": "3.98.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostfolio", - "version": "3.97.0", + "version": "3.98.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/package.json b/package.json index cf0b726aea..b8f483a097 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "3.97.0", + "version": "3.98.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio",