diff --git a/packages/core/src/lib/organization-team-employee/organization-team-employee.service.ts b/packages/core/src/lib/organization-team-employee/organization-team-employee.service.ts index e74f823d193..7ff728a4e1d 100644 --- a/packages/core/src/lib/organization-team-employee/organization-team-employee.service.ts +++ b/packages/core/src/lib/organization-team-employee/organization-team-employee.service.ts @@ -233,7 +233,7 @@ export class OrganizationTeamEmployeeService extends TenantAwareCrudService { + electronService.ipcRenderer.on('setup-data', (_, arg) => { this.desktopFeatures.gauzyPlatform = arg.gauzyWindow; this.desktopFeatures.timeTracking = arg.timeTrackerWindow; this.connectivity.integrated = arg.isLocalServer; @@ -71,7 +72,7 @@ export class SetupComponent implements OnInit { } }); - electronService.ipcRenderer.on('log_state', (event, arg) => { + electronService.ipcRenderer.on('log_state', (_, arg) => { const validMessage = this.defaultMessage.findIndex((item) => arg.msg.indexOf(item) > -1); if (validMessage > -1) { if (validMessage === 0 && arg.msg.indexOf('Found 0 users in DB') < 0) { @@ -253,6 +254,30 @@ export class SetupComponent implements OnInit { }; } + /** + * Sanitizes and constructs the server URL with the provided host and port. + * + * @param host - The host URL (e.g., "http://localhost"). + * @param port - The port to append to the host URL (e.g., "3000"). + * @returns The sanitized server URL as a string (e.g., "http://localhost:3000"). + * @throws Error if the `host` parameter is missing or invalid. + */ + sanitizeServerPort(host: string, port: string): string { + if (!host) { + throw new Error('Host is required'); + } + + try { + const url = new URL(host); + if (port) { + url.port = port; // Set the port if provided + } + return url.origin; // Return the sanitized origin + } catch (error) { + throw new Error('Invalid server URL format'); + } + } + getServerConfig() { if (this.connectivity.integrated) { return { @@ -263,9 +288,10 @@ export class SetupComponent implements OnInit { if (this.connectivity.custom) { const protocol = this.serverConfig.custom.apiHost.indexOf('http') === 0 ? '' : 'https://'; - const port = this.serverConfig.custom.port ? ':' + this.serverConfig.custom.port : ''; + const port = this.serverConfig.custom.port; + const apiHost = `${protocol}${this.serverConfig.custom.apiHost}`; return { - serverUrl: protocol + this.serverConfig.custom.apiHost + port, + serverUrl: this.sanitizeServerPort(apiHost, port), isLocalServer: false }; } @@ -419,14 +445,15 @@ export class SetupComponent implements OnInit { const resp = await this.setupService.pingServer({ host: url.origin }) - this.serverConfig.custom.apiHost = url.origin; + this.serverConfig.custom.apiHost = `${url.protocol}//${url.hostname}`; + this.serverConfig.custom.port = url.port; return resp; } catch (error) { if (!retry) { url.protocol = url.protocol === 'http:' ? 'https' : 'http'; return this.serverProtocolCheck(url.origin, true); } - throw error; + throw new Error(this._translateService.instant('TIMER_TRACKER.SETUP.UNABLE_TO_CONNECT')); } } @@ -437,28 +464,18 @@ export class SetupComponent implements OnInit { if (this.runApp) { await this.saveAndRun(); } else { - this.dialogData = { - title: 'TOASTR.TITLE.SUCCESS', - message: this._translateService.instant('TIMER_TRACKER.SETTINGS.MESSAGES.CONNECTION_SUCCEEDS', { - url: serverHostOptions.serverUrl - }), - status: 'success' - }; - const elBtn: HTMLElement = this.btnDialogOpen.nativeElement; - elBtn.click(); + this._notifier.success(this._translateService.instant('TIMER_TRACKER.SETTINGS.MESSAGES.CONNECTION_SUCCEEDS', { + url: serverHostOptions.serverUrl + })) this.isCheckConnection = false; + this._cdr.detectChanges(); } }) .catch((e) => { - this.dialogData = { - title: 'TOASTR.TITLE.ERROR', - message: e.message, - status: 'danger' - }; - const elBtn: HTMLElement = this.btnDialogOpen.nativeElement; - elBtn.click(); + this._notifier.error(e.message); this.isSaving = false; this.isCheckConnection = false; + this._cdr.detectChanges(); }); } @@ -492,17 +509,9 @@ export class SetupComponent implements OnInit { this.electronService.ipcRenderer.on('database_status', (event, arg) => { // this.open(true); if (arg.status) { - this.dialogData = { - title: 'TOASTR.TITLE.SUCCESS', - message: arg.message, - status: 'success' - }; + this._notifier.success(arg.message); } else { - this.dialogData = { - title: 'TOASTR.TITLE.WARNING', - message: arg.message, - status: 'danger' - }; + this._notifier.warn(arg.message) } if (arg.status && this.runApp) { diff --git a/packages/ui-core/i18n/assets/i18n/ar.json b/packages/ui-core/i18n/assets/i18n/ar.json index 25a52e1b5ca..840a465f085 100644 --- a/packages/ui-core/i18n/assets/i18n/ar.json +++ b/packages/ui-core/i18n/assets/i18n/ar.json @@ -3877,7 +3877,8 @@ "PASSWORD": "كلمة المرور", "UI_HOSTNAME": "اسم المضيف أو عنوان IP واجهة المستخدم (UI)", "TITLE_SERVER_API": "معالج تثبيت خادم API الخاص بـ Ever Gauzy", - "LABEL_SERVER_API": "يوفر تطبيق سطح المكتب Ever Gauzy API Server الوظائف الكاملة لمنصة Gauzy المتوفرة مباشرة على جهاز الكمبيوتر المكتبي أو الكمبيوتر المحمول. بالإضافة إلى ذلك، فهو يسمح بتتبع وقت العمل وتسجيل النشاط والقدرة على تلقي تذكيرات/إشعارات التتبع" + "LABEL_SERVER_API": "يوفر تطبيق سطح المكتب Ever Gauzy API Server الوظائف الكاملة لمنصة Gauzy المتوفرة مباشرة على جهاز الكمبيوتر المكتبي أو الكمبيوتر المحمول. بالإضافة إلى ذلك، فهو يسمح بتتبع وقت العمل وتسجيل النشاط والقدرة على تلقي تذكيرات/إشعارات التتبع", + "UNABLE_TO_CONNECT": "غير قادر على الاتصال بالخادم. يرجى التحقق من مضيف API أو اتصال الإنترنت الخاص بك." }, "SETTINGS": { "SCREEN_CAPTURE": "التقاط الشاشة", diff --git a/packages/ui-core/i18n/assets/i18n/bg.json b/packages/ui-core/i18n/assets/i18n/bg.json index ebd8996b94a..01c62f2b80a 100644 --- a/packages/ui-core/i18n/assets/i18n/bg.json +++ b/packages/ui-core/i18n/assets/i18n/bg.json @@ -3927,7 +3927,8 @@ "PASSWORD": "Парола", "UI_HOSTNAME": "Име на хост на потребителския интерфейс / IP адрес", "TITLE_SERVER_API": "Съветник за инсталиране на Ever Gauzy API сървър", - "LABEL_SERVER_API": "Приложението Ever Gauzy API Server Desktop предоставя пълната функционалност на платформата Gauzy, достъпна директно на вашия настолен компютър или лаптоп. Освен това позволява проследяване на работното време, записване на дейността и възможност за получаване на напомняния/известия за проследяване" + "LABEL_SERVER_API": "Приложението Ever Gauzy API Server Desktop предоставя пълната функционалност на платформата Gauzy, достъпна директно на вашия настолен компютър или лаптоп. Освен това позволява проследяване на работното време, записване на дейността и възможност за получаване на напомняния/известия за проследяване", + "UNABLE_TO_CONNECT": "Не може да се осъществи връзка със сървъра. Моля, проверете вашия API хост или интернет връзка." }, "SETTINGS": { "SCREEN_CAPTURE": "Захващане на екран", diff --git a/packages/ui-core/i18n/assets/i18n/de.json b/packages/ui-core/i18n/assets/i18n/de.json index 4f2f22d5be8..f586d3f0201 100644 --- a/packages/ui-core/i18n/assets/i18n/de.json +++ b/packages/ui-core/i18n/assets/i18n/de.json @@ -3875,7 +3875,8 @@ "PASSWORD": "Passwort", "UI_HOSTNAME": "UI Hostname / IP-Adresse", "TITLE_SERVER_API": "Ever Gauzy API Server Installation Wizard", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App giver den fulde funktionalitet af Gauzy Platform tilgængelig direkte på din stationære computer eller en bærbar computer. Derudover tillader det sporing af arbejdstid, aktivitetsregistrering og mulighed for at modtage sporingspåmindelser/notifikationer." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App giver den fulde funktionalitet af Gauzy Platform tilgængelig direkte på din stationære computer eller en bærbar computer. Derudover tillader det sporing af arbejdstid, aktivitetsregistrering og mulighed for at modtage sporingspåmindelser/notifikationer.", + "UNABLE_TO_CONNECT": "Verbindung zum Server nicht möglich. Bitte überprüfen Sie Ihren API-Host oder Ihre Internetverbindung." }, "SETTINGS": { "SCREEN_CAPTURE": "Bildschirmaufnahme", diff --git a/packages/ui-core/i18n/assets/i18n/en.json b/packages/ui-core/i18n/assets/i18n/en.json index 3159af9d7e7..8bab1dfae24 100644 --- a/packages/ui-core/i18n/assets/i18n/en.json +++ b/packages/ui-core/i18n/assets/i18n/en.json @@ -4008,7 +4008,8 @@ "PASSWORD": "Password", "UI_HOSTNAME": "UI Hostname / IP Address", "TITLE_SERVER_API": "Ever Gauzy API Server Installation Wizard", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App provides the full functionality of the Gauzy Platform available directly on your desktop computer or a laptop. In addition, it allows tracking work time, activity recording, and the ability to receive tracking reminders/notifications." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App provides the full functionality of the Gauzy Platform available directly on your desktop computer or a laptop. In addition, it allows tracking work time, activity recording, and the ability to receive tracking reminders/notifications.", + "UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection." }, "SETTINGS": { "SCREEN_CAPTURE": "Screen Capture", diff --git a/packages/ui-core/i18n/assets/i18n/es.json b/packages/ui-core/i18n/assets/i18n/es.json index a4fccb7e51c..a416e8c82c5 100644 --- a/packages/ui-core/i18n/assets/i18n/es.json +++ b/packages/ui-core/i18n/assets/i18n/es.json @@ -3881,7 +3881,9 @@ "PASSWORD": "Contraseña", "UI_HOSTNAME": "Nombre de host de IU / Dirección IP", "TITLE_SERVER_API": "Asistente de instalación del servidor API de Ever Gauzy", - "LABEL_SERVER_API": "La aplicación de escritorio Ever Gauzy API Server proporciona la funcionalidad completa de la plataforma Gauzy disponible directamente en su computadora de escritorio o portátil. Además, permite realizar un seguimiento del tiempo de trabajo, registrar actividades y recibir recordatorios/notificaciones de seguimiento." + "LABEL_SERVER_API": "La aplicación de escritorio Ever Gauzy API Server proporciona la funcionalidad completa de la plataforma Gauzy disponible directamente en su computadora de escritorio o portátil. Además, permite realizar un seguimiento del tiempo de trabajo, registrar actividades y recibir recordatorios/notificaciones de seguimiento.", + "UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection." + }, "SETTINGS": { "SCREEN_CAPTURE": "Captura de pantalla", diff --git a/packages/ui-core/i18n/assets/i18n/fr.json b/packages/ui-core/i18n/assets/i18n/fr.json index 05c27f53862..a7984153aa7 100644 --- a/packages/ui-core/i18n/assets/i18n/fr.json +++ b/packages/ui-core/i18n/assets/i18n/fr.json @@ -3879,7 +3879,8 @@ "PASSWORD": "Mot de passe", "UI_HOSTNAME": "Nom d'hôte de l'interface utilisateur / Adresse IP", "TITLE_SERVER_API": "Assistant d'installation du serveur API Ever Gauzy", - "LABEL_SERVER_API": "L'application de bureau Ever Gauzy API Server fournit toutes les fonctionnalités de la plateforme Gauzy disponibles directement sur votre ordinateur de bureau ou votre ordinateur portable. De plus, elle permet de suivre le temps de travail, d'enregistrer les activités et de recevoir des rappels/notifications de suivi." + "LABEL_SERVER_API": "L'application de bureau Ever Gauzy API Server fournit toutes les fonctionnalités de la plateforme Gauzy disponibles directement sur votre ordinateur de bureau ou votre ordinateur portable. De plus, elle permet de suivre le temps de travail, d'enregistrer les activités et de recevoir des rappels/notifications de suivi.", + "UNABLE_TO_CONNECT": "Impossible de se connecter au serveur. Veuillez vérifier votre hôte API ou votre connexion Internet." }, "SETTINGS": { "SCREEN_CAPTURE": "Capture d'écran", diff --git a/packages/ui-core/i18n/assets/i18n/he.json b/packages/ui-core/i18n/assets/i18n/he.json index 31de6930072..24107f61ff9 100644 --- a/packages/ui-core/i18n/assets/i18n/he.json +++ b/packages/ui-core/i18n/assets/i18n/he.json @@ -3891,7 +3891,9 @@ "PASSWORD": "סיסמה", "UI_HOSTNAME": "שם מארח יישום ממשק משתמש / כתובת IP", "TITLE_SERVER_API": "אשף התקנת שרת API של Ever Gauzy", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App מספקת את הפונקציונליות המלאה של פלטפורמת Gauzy הזמינה ישירות במחשב השולחני או במחשב הנייד שלך. בנוסף, הוא מאפשר מעקב אחר זמן עבודה, רישום פעילות ויכולת לקבל תזכורות/הודעות מעקב." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App מספקת את הפונקציונליות המלאה של פלטפורמת Gauzy הזמינה ישירות במחשב השולחני או במחשב הנייד שלך. בנוסף, הוא מאפשר מעקב אחר זמן עבודה, רישום פעילות ויכולת לקבל תזכורות/הודעות מעקב.", + "UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection." + }, "SETTINGS": { "SCREEN_CAPTURE": "לכידת מסך", diff --git a/packages/ui-core/i18n/assets/i18n/it.json b/packages/ui-core/i18n/assets/i18n/it.json index 2f47179d205..35ce980145b 100644 --- a/packages/ui-core/i18n/assets/i18n/it.json +++ b/packages/ui-core/i18n/assets/i18n/it.json @@ -3879,7 +3879,8 @@ "PASSWORD": "Password", "UI_HOSTNAME": "Nome host dell'interfaccia utente / indirizzo IP", "TITLE_SERVER_API": "Procedura guidata di installazione del server API Ever Gauzy", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App fornisce la piena funzionalità della piattaforma Gauzy disponibile direttamente sul tuo computer desktop o laptop. Inoltre, consente di tracciare il tempo di lavoro, registrare le attività e ricevere promemoria/notifiche di tracciamento." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App fornisce la piena funzionalità della piattaforma Gauzy disponibile direttamente sul tuo computer desktop o laptop. Inoltre, consente di tracciare il tempo di lavoro, registrare le attività e ricevere promemoria/notifiche di tracciamento.", + "UNABLE_TO_CONNECT": "Impossibile connettersi al server. Controlla il tuo host API o la connessione internet." }, "SETTINGS": { "SCREEN_CAPTURE": "Cattura dello schermo", diff --git a/packages/ui-core/i18n/assets/i18n/nl.json b/packages/ui-core/i18n/assets/i18n/nl.json index 5bd3b04858f..f97833e36f7 100644 --- a/packages/ui-core/i18n/assets/i18n/nl.json +++ b/packages/ui-core/i18n/assets/i18n/nl.json @@ -3879,7 +3879,8 @@ "PASSWORD": "Wachtwoord", "UI_HOSTNAME": "UI Hostnaam / IP-adres", "TITLE_SERVER_API": "Ever Gauzy API Server-installatiewizard", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App biedt de volledige functionaliteit van het Gauzy Platform direct beschikbaar op uw desktopcomputer of laptop. Daarnaast kunt u hiermee werktijd bijhouden, activiteiten registreren en trackingherinneringen/meldingen ontvangen." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App biedt de volledige functionaliteit van het Gauzy Platform direct beschikbaar op uw desktopcomputer of laptop. Daarnaast kunt u hiermee werktijd bijhouden, activiteiten registreren en trackingherinneringen/meldingen ontvangen.", + "UNABLE_TO_CONNECT": "Kan geen verbinding maken met de server. Controleer uw API-host of internetverbinding." }, "SETTINGS": { "SCREEN_CAPTURE": "Schermopname", diff --git a/packages/ui-core/i18n/assets/i18n/pl.json b/packages/ui-core/i18n/assets/i18n/pl.json index 6a4948f4503..aafa03e3ae7 100644 --- a/packages/ui-core/i18n/assets/i18n/pl.json +++ b/packages/ui-core/i18n/assets/i18n/pl.json @@ -3879,7 +3879,8 @@ "PASSWORD": "Hasło", "UI_HOSTNAME": "Nazwa hosta interfejsu użytkownika / Adres IP", "TITLE_SERVER_API": "Kreator instalacji serwera API Ever Gauzy", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App zapewnia pełną funkcjonalność platformy Gauzy dostępną bezpośrednio na komputerze stacjonarnym lub laptopie. Ponadto umożliwia śledzenie czasu pracy, rejestrowanie aktywności i możliwość otrzymywania przypomnień/powiadomień o śledzeniu." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App zapewnia pełną funkcjonalność platformy Gauzy dostępną bezpośrednio na komputerze stacjonarnym lub laptopie. Ponadto umożliwia śledzenie czasu pracy, rejestrowanie aktywności i możliwość otrzymywania przypomnień/powiadomień o śledzeniu.", + "UNABLE_TO_CONNECT": "Impossibile connettersi al server. Controlla il tuo host API o la connessione internet." }, "SETTINGS": { "SCREEN_CAPTURE": "Zrzut ekranu", diff --git a/packages/ui-core/i18n/assets/i18n/pt.json b/packages/ui-core/i18n/assets/i18n/pt.json index 7999cf22c3e..f913de5dc21 100644 --- a/packages/ui-core/i18n/assets/i18n/pt.json +++ b/packages/ui-core/i18n/assets/i18n/pt.json @@ -3879,7 +3879,8 @@ "PASSWORD": "Senha", "UI_HOSTNAME": "Nome do Host da Interface do Usuário / Endereço IP", "TITLE_SERVER_API": "Ever Gauzy API Server Instalation Wizard", - "LABEL_SERVER_API": "A aplicação Gauzy API Server Desktop fornece a funcionalidade completa da plataforma Gauzy disponível diretamente no seu computador de secretária ou portátil. Além disso, permite o tempo de trabalho de rastreio, o registo de atividades e a capacidade de receber lembretes/notificações de rastreio." + "LABEL_SERVER_API": "A aplicação Gauzy API Server Desktop fornece a funcionalidade completa da plataforma Gauzy disponível diretamente no seu computador de secretária ou portátil. Além disso, permite o tempo de trabalho de rastreio, o registo de atividades e a capacidade de receber lembretes/notificações de rastreio.", + "UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection." }, "SETTINGS": { "SCREEN_CAPTURE": "Captura de tela", diff --git a/packages/ui-core/i18n/assets/i18n/ru.json b/packages/ui-core/i18n/assets/i18n/ru.json index 1392572ba33..a1309bc4224 100644 --- a/packages/ui-core/i18n/assets/i18n/ru.json +++ b/packages/ui-core/i18n/assets/i18n/ru.json @@ -3897,7 +3897,8 @@ "PASSWORD": "Пароль", "UI_HOSTNAME": "Имя хоста интерфейса пользователя / IP-адрес", "TITLE_SERVER_API": "Мастер установки сервера API Ever Gauzy", - "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App предоставляет полный функционал Gauzy Platform, доступный непосредственно на вашем настольном компьютере или ноутбуке. Кроме того, он позволяет отслеживать рабочее время, записывать активность и получать напоминания/уведомления об отслеживании." + "LABEL_SERVER_API": "Ever Gauzy API Server Desktop App предоставляет полный функционал Gauzy Platform, доступный непосредственно на вашем настольном компьютере или ноутбуке. Кроме того, он позволяет отслеживать рабочее время, записывать активность и получать напоминания/уведомления об отслеживании.", + "UNABLE_TO_CONNECT": "Не удается подключиться к серверу. Пожалуйста, проверьте ваш API хост или подключение к интернету." }, "SETTINGS": { "SCREEN_CAPTURE": "Захват экрана", diff --git a/packages/ui-core/i18n/assets/i18n/zh.json b/packages/ui-core/i18n/assets/i18n/zh.json index 9d5131eb208..01886616a4d 100644 --- a/packages/ui-core/i18n/assets/i18n/zh.json +++ b/packages/ui-core/i18n/assets/i18n/zh.json @@ -3879,7 +3879,8 @@ "PASSWORD": "密码", "UI_HOSTNAME": "界面主机名/ IP地址", "TITLE_SERVER_API": "Ever Gauzy API 服务器安装向导", - "LABEL_SERVER_API": "Ever Gauzy API Server 桌面应用程序提供 Gauzy 平台的全部功能,可直接在您的台式计算机或笔记本电脑上使用。此外,它还允许跟踪工作时间、活动记录以及接收跟踪提醒/通知的功能。" + "LABEL_SERVER_API": "Ever Gauzy API Server 桌面应用程序提供 Gauzy 平台的全部功能,可直接在您的台式计算机或笔记本电脑上使用。此外,它还允许跟踪工作时间、活动记录以及接收跟踪提醒/通知的功能。", + "UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection." }, "SETTINGS": { "SCREEN_CAPTURE": "屏幕捕获",