Browse Source

Merge branch 'main' into task/improve-meta-descriptions-of-public-pages

pull/8369/head
Thomas Kaul 4 weeks ago
committed by GitHub
parent
commit
3d912c0891
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      CHANGELOG.md
  2. 6
      README.md
  3. 2
      apps/api/src/main.ts
  4. 33
      apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts
  5. 14
      apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts
  6. 13
      apps/api/src/services/portfolio-table/portfolio-table.service.ts
  7. 2
      apps/api/src/services/user/user.service.ts
  8. 2
      apps/client/src/locales/messages.de.xlf

3
CHANGELOG.md

@ -11,10 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the content of the pricing page - Improved the content of the pricing page
- Extended the HTML template middleware to support page-specific meta descriptions for the public pages and the blog posts - Extended the HTML template middleware to support page-specific meta descriptions for 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
- Fixed the flickering of the navigation items in the header for logged-in users - Fixed the flickering of the navigation items in the header for logged-in users
- Fixed the description of the `ROOT_URL` requirement for the server of the Model Context Protocol (MCP) (experimental)
## 3.97.0 - 2026-11-02 ## 3.97.0 - 2026-11-02

6
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_PORT` | `number` | | The port where _Redis_ is running |
| `REDIS_TLS` | `boolean` (optional) | `false` | Enables TLS/SSL connection to _Redis_ | | `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 | | `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 | | `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) #### OpenID Connect OIDC (experimental)
@ -405,7 +405,7 @@ The _Model Context Protocol_ (MCP) server lets an AI client read your portfolio,
### Prerequisites ### Prerequisites
- Set `ENABLE_FEATURE_MCP` to `true` - 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 - 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. 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_. Point the client to the endpoint below and set the MCP access token as the _Bearer Token_.
``` ```
POST http://localhost:3333/mcp POST <INSERT_ROOT_URL>/mcp
"Authorization": "Bearer <INSERT_MCP_ACCESS_TOKEN>" "Authorization": "Bearer <INSERT_MCP_ACCESS_TOKEN>"
``` ```

2
apps/api/src/main.ts

@ -151,7 +151,7 @@ async function bootstrap() {
const { hostname } = new URL(configurationService.get('ROOT_URL')); const { hostname } = new URL(configurationService.get('ROOT_URL'));
logger.warn( 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.`
); );
} }

33
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) => { const lastDateString = dateStrings.reduce((a, b) => {
return a > b ? a : b; return a > b ? a : b;
}, undefined); }, '');
let previousExchangeRate = let previousExchangeRate =
exchangeRatesByCurrency[`${currency}${targetCurrency}`]?.[ exchangeRatesByCurrency[`${currency}${targetCurrency}`]?.[
@ -214,7 +214,7 @@ export class ExchangeRateDataService {
const resultExtended = result; const resultExtended = result;
for (const symbol of Object.keys(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]); const [date] = Object.keys(result[symbol]);
// Calculate the opposite direction // Calculate the opposite direction
@ -226,7 +226,7 @@ export class ExchangeRateDataService {
} }
for (const symbol of Object.keys(resultExtended)) { 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] = this.exchangeRates[symbol] =
resultExtended[symbol]?.[dateStringOfYesterday]?.marketPrice; resultExtended[symbol]?.[dateStringOfYesterday]?.marketPrice;
@ -302,7 +302,7 @@ export class ExchangeRateDataService {
const derivedCurrencyFactor = const derivedCurrencyFactor =
this.derivedCurrencyFactors[`${aFromCurrency}${aToCurrency}`]; this.derivedCurrencyFactors[`${aFromCurrency}${aToCurrency}`];
let factor: number; let factor: number | undefined;
if (aFromCurrency === aToCurrency) { if (aFromCurrency === aToCurrency) {
factor = 1; factor = 1;
@ -324,8 +324,8 @@ export class ExchangeRateDataService {
} else { } else {
// Calculate indirectly via base currency // Calculate indirectly via base currency
let marketPriceBaseCurrencyFromCurrency: number; let marketPriceBaseCurrencyFromCurrency: number | undefined;
let marketPriceBaseCurrencyToCurrency: number; let marketPriceBaseCurrencyToCurrency: number | undefined;
try { try {
if (aFromCurrency === DEFAULT_CURRENCY) { if (aFromCurrency === DEFAULT_CURRENCY) {
@ -337,7 +337,7 @@ export class ExchangeRateDataService {
date: aDate, date: aDate,
symbol: `${DEFAULT_CURRENCY}${aFromCurrency}` symbol: `${DEFAULT_CURRENCY}${aFromCurrency}`
}) })
)?.marketPrice as number; )?.marketPrice;
} }
} catch {} } catch {}
@ -351,14 +351,19 @@ export class ExchangeRateDataService {
date: aDate, date: aDate,
symbol: `${DEFAULT_CURRENCY}${aToCurrency}` symbol: `${DEFAULT_CURRENCY}${aToCurrency}`
}) })
)?.marketPrice as number; )?.marketPrice;
} }
} catch {} } catch {}
// Calculate the opposite direction if (
factor = isNumber(marketPriceBaseCurrencyFromCurrency) &&
(1 / marketPriceBaseCurrencyFromCurrency) * isNumber(marketPriceBaseCurrencyToCurrency)
marketPriceBaseCurrencyToCurrency; ) {
// Calculate the opposite direction
factor =
(1 / marketPriceBaseCurrencyFromCurrency) *
marketPriceBaseCurrencyToCurrency;
}
} }
} }
@ -530,7 +535,9 @@ export class ExchangeRateDataService {
} }
}) })
).forEach(({ currency }) => { ).forEach(({ currency }) => {
currencies.push(currency); if (currency) {
currencies.push(currency);
}
}); });
( (

14
apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts

@ -121,6 +121,7 @@ function createHolding({
assetSubClass = AssetSubClass.STOCK, assetSubClass = AssetSubClass.STOCK,
dataSource = DataSource.YAHOO, dataSource = DataSource.YAHOO,
isin, isin,
name,
symbol = 'AAPL' symbol = 'AAPL'
}: { }: {
allocationInPercentage?: number; allocationInPercentage?: number;
@ -128,6 +129,7 @@ function createHolding({
assetSubClass?: AssetSubClass; assetSubClass?: AssetSubClass;
dataSource?: DataSource; dataSource?: DataSource;
isin?: string | null; isin?: string | null;
name?: string | null;
symbol?: string; symbol?: string;
} = {}) { } = {}) {
return { return {
@ -140,7 +142,7 @@ function createHolding({
isin, isin,
symbol, symbol,
currency: 'CHF', currency: 'CHF',
name: `Name of ${symbol}` name: name === undefined ? `Name of ${symbol}` : name
}, },
dateOfFirstActivity: new Date('2024-01-01'), dateOfFirstActivity: new Date('2024-01-01'),
grossPerformance: 100, grossPerformance: 100,
@ -631,6 +633,16 @@ describe('PortfolioTableService', () => {
expect(row).toContain('| Name of AAPL | | AAPL |'); 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 () => { it('gives the translation of the asset class and of the asset sub class', async () => {
const result = await getHoldingsTable([createHolding()]); const result = await getHoldingsTable([createHolding()]);

13
apps/api/src/services/portfolio-table/portfolio-table.service.ts

@ -52,7 +52,10 @@ function getDataSourceColumnDefinition<T>(
const dataSource = getDataSource(row); const dataSource = getDataSource(row);
return dataSource return dataSource
? transformDataSourceInResponse({ configurationService, dataSource }) ? (transformDataSourceInResponse({
configurationService,
dataSource
}) ?? '')
: ''; : '';
}, },
name: DATA_SOURCE_COLUMN_NAME name: DATA_SOURCE_COLUMN_NAME
@ -176,7 +179,7 @@ export class PortfolioTableService {
}), }),
{ {
getValue: ({ assetProfile, currency }) => { getValue: ({ assetProfile, currency }) => {
return currency ?? assetProfile.currency; return currency ?? assetProfile.currency ?? '';
}, },
name: 'Currency' name: 'Currency'
}, },
@ -226,7 +229,7 @@ export class PortfolioTableService {
[ [
{ {
getValue: ({ assetProfile }) => { getValue: ({ assetProfile }) => {
return assetProfile.name; return assetProfile.name ?? '';
}, },
name: 'Name' name: 'Name'
}, },
@ -249,7 +252,7 @@ export class PortfolioTableService {
}), }),
{ {
getValue: ({ assetProfile }) => { getValue: ({ assetProfile }) => {
return assetProfile.currency; return assetProfile.currency ?? '';
}, },
name: 'Currency' name: 'Currency'
}, },
@ -696,7 +699,7 @@ export class PortfolioTableService {
const performanceSection = ['## Performance', '']; const performanceSection = ['## Performance', ''];
if (chart?.length > 0) { if (chart && chart.length > 0) {
performanceSection.push( performanceSection.push(
await getMarkdownTable({ await getMarkdownTable({
columnDefinitions: this.getColumnDefinitions({ columnDefinitions: this.getColumnDefinitions({

2
apps/api/src/services/user/user.service.ts

@ -708,6 +708,8 @@ export class UserService {
userId userId
}); });
await this.prismaService.authDevice.deleteMany({ where: { userId } });
await this.prismaService.user.update({ await this.prismaService.user.update({
data: { accessToken: hashedAccessToken }, data: { accessToken: hashedAccessToken },
where: { id: userId } where: { id: userId }

2
apps/client/src/locales/messages.de.xlf

@ -5203,7 +5203,7 @@
</trans-unit> </trans-unit>
<trans-unit id="2086423453010730920" datatype="html"> <trans-unit id="2086423453010730920" datatype="html">
<source>For seasoned investors who manage multiple portfolios.</source> <source>For seasoned investors who manage multiple portfolios.</source>
<target state="new">For seasoned investors who manage multiple portfolios.</target> <target state="translated">Für erfahrene Anleger, die mehrere Portfolios verwalten.</target>
<context-group purpose="location"> <context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/pricing/pricing-page.html</context> <context context-type="sourcefile">apps/client/src/app/pages/pricing/pricing-page.html</context>
<context context-type="linenumber">233</context> <context context-type="linenumber">233</context>

Loading…
Cancel
Save