Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MS] Fixed opening urls #8895

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions client/src/services/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,37 @@ function getTrialServers(): Array<string> {
const CLEAN_APP_VERSION = `${APP_VERSION.slice(0, APP_VERSION.indexOf('+') === -1 ? undefined : APP_VERSION.indexOf('+'))}`;
const APP_VERSION_PREFIX = `v${CLEAN_APP_VERSION}`;

async function openUrl(url: string): Promise<void> {
window.electronAPI.log('debug', `Opening ${url}`);
window.open(url, '_blank');
}

async function openDocumentationLink(): Promise<void> {
window.open(I18n.translate({ key: 'MenuPage.documentationLink', data: { version: APP_VERSION_PREFIX } }), '_blank');
await openUrl(I18n.translate({ key: 'MenuPage.documentationLink', data: { version: APP_VERSION_PREFIX } }));
}

async function openContactLink(): Promise<void> {
window.open(I18n.translate({ key: 'MenuPage.contactLink', data: { signUrl: getSignUrl() } }), '_blank');
await openUrl(I18n.translate({ key: 'MenuPage.contactLink', data: { signUrl: getSignUrl() } }));
}

async function openLicenseLink(): Promise<void> {
window.open(I18n.translate({ key: 'app.licenseLink', data: { version: APP_VERSION_PREFIX } }), '_blank');
await openUrl(I18n.translate({ key: 'app.licenseLink', data: { version: APP_VERSION_PREFIX } }));
}

async function openChangelogLink(version?: string): Promise<void> {
window.open(I18n.translate({ key: 'app.history', data: { version: version ?? APP_VERSION_PREFIX } }), '_blank');
await openUrl(I18n.translate({ key: 'app.history', data: { version: version ?? APP_VERSION_PREFIX } }));
}

async function openSourcesLink(): Promise<void> {
window.open(I18n.translate('app.projectSources'), '_blank');
await openUrl(I18n.translate('app.projectSources'));
}

async function openDeveloperLink(): Promise<void> {
window.open(I18n.translate('app.developerLink'), '_blank');
await openUrl(I18n.translate('app.developerLink'));
}

async function openTOS(tosLink: string): Promise<void> {
window.open(tosLink, '_blank');
await openUrl(tosLink);
}

export const Env = {
Expand Down
8 changes: 4 additions & 4 deletions client/src/views/about/AboutView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ion-text class="app-info-value"> v{{ APP_VERSION }} </ion-text>
<ion-button
class="changelog-btn button-outline"
@click="Env.Links.openChangelogLink"
@click="Env.Links.openChangelogLink()"
>
{{ $msTranslate('AboutPage.update.showChangelog') }}
</ion-button>
Expand All @@ -47,7 +47,7 @@
</ion-label>
<ion-text class="app-info-value">
<span
@click="Env.Links.openDeveloperLink"
@click="Env.Links.openDeveloperLink()"
class="link"
>
{{ $msTranslate('app.developer') }}
Expand All @@ -62,7 +62,7 @@
</ion-label>
<ion-text class="app-info-value">
<span
@click="Env.Links.openLicenseLink"
@click="Env.Links.openLicenseLink()"
class="link"
>
{{ $msTranslate('app.license') }}
Expand All @@ -77,7 +77,7 @@
</ion-label>
<ion-text class="app-info-value">
<span
@click="Env.Links.openSourcesLink"
@click="Env.Links.openSourcesLink()"
target="_blank"
:href="$msTranslate('app.projectSources')"
class="link"
Expand Down