1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Server: Fixed certain URLs

This commit is contained in:
Laurent Cozic 2021-07-24 18:34:42 +01:00
parent 19b45de298
commit 282f782d50
3 changed files with 12 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import { pathExists } from 'fs-extra';
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
import { AppContext, RouteType } from '../utils/types'; import { AppContext, RouteType } from '../utils/types';
import { localFileFromUrl } from '../utils/joplinUtils'; import { localFileFromUrl } from '../utils/joplinUtils';
import { homeUrl, loginUrl } from '../utils/urlUtils';
const { mime } = require('@joplin/lib/mime-utils.js'); const { mime } = require('@joplin/lib/mime-utils.js');
const publicDir = `${dirname(dirname(__dirname))}/public`; const publicDir = `${dirname(dirname(__dirname))}/public`;
@ -58,9 +59,9 @@ router.get('', async (path: SubPath, ctx: AppContext) => {
// Redirect to either /login or /home when trying to access the root // Redirect to either /login or /home when trying to access the root
if (!path.id && !path.link) { if (!path.id && !path.link) {
if (ctx.joplin.owner) { if (ctx.joplin.owner) {
return redirect(ctx, 'home'); return redirect(ctx, homeUrl());
} else { } else {
return redirect(ctx, 'login'); return redirect(ctx, loginUrl());
} }
} }

View File

@ -34,3 +34,11 @@ export function confirmUrl(userId: Uuid, validationToken: string): string {
export function stripePortalUrl(): string { export function stripePortalUrl(): string {
return `${config().baseUrl}/stripe/portal`; return `${config().baseUrl}/stripe/portal`;
} }
export function homeUrl(): string {
return `${config().baseUrl}/home`;
}
export function loginUrl(): string {
return `${config().baseUrl}/login`;
}

View File

@ -26,6 +26,6 @@
{{#showUpgradeProButton}} {{#showUpgradeProButton}}
<p class="block"> <p class="block">
<a href="{{baseUrl}}/upgrade" class="upgrade-button">Upgrade to a Pro account</a> to benefit from collaborate on notebooks, to increase the max note size, or the max total size. <a href="{{{global.baseUrl}}}/upgrade" class="upgrade-button">Upgrade to a Pro account</a> to collaborate on notebooks with other people, to increase the max note size, or the max total size.
</p> </p>
{{/showUpgradeProButton}} {{/showUpgradeProButton}}