Skip to content

Commit

Permalink
Merge pull request #2728 from ever-co/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Jul 15, 2024
2 parents a85315a + d59ec58 commit e2e7900
Show file tree
Hide file tree
Showing 28 changed files with 649 additions and 262 deletions.
28 changes: 24 additions & 4 deletions apps/server-web/src/locales/i18n/bg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"APP_QUIT": "Откажете се",
"GENERAL": "Общ",
"SERVER_STATUS_STOPPED": "Статус: Спряна",
"SERVER_STATUS_STARTED": "Статус: започна"
"SERVER_STATUS_STARTED": "Статус: започна",
"OPEN_WEB": "Отворете уеб в браузъра",
"SERVER_WINDOW": "Прозорец на сървъра"
},
"FORM": {
"FIELDS": {
Expand All @@ -22,7 +24,15 @@
},
"BUTTON": {
"SAVE_SETTING": "Запазване на настройката",
"OK": "Добре"
"OK": "Добре",
"YES": "да",
"NO": "Не",
"DOWNLOAD_NOW": "Свали сега",
"LATER": "По късно",
"CANCEL": "Отказ",
"CLOSE": "Близо",
"START": "Започнете",
"STOP": "Спри се"
},
"LABELS": {
"CHECKING": "Проверка",
Expand All @@ -42,11 +52,21 @@
"AUTO_UPDATE_SUBTITLE": "Активирайте автоматичната проверка на актуализацията, за да стартирате заявка за проверка дали е налична нова версия и да уведомите",
"AUTO_UPDATE_TOGLE": "Автоматична актуализация",
"CHECK_UPDATE_TITLE": "Проверете и актуализирайте версията на приложението си",
"CHECK_UPDATE_SUBTITLE": "Налична е нова актуализация! Моля, щракнете върху бутона Изтегляне сега по-долу."
"CHECK_UPDATE_SUBTITLE": "Налична е нова актуализация! Моля, щракнете върху бутона Изтегляне сега по-долу.",
"LANGUAGES": "Езици"
}
},
"MESSAGE": {
"SUCCESS": "Успех",
"ERROR": "Грешка"
"ERROR": "Грешка",
"WARNING": "Warning",
"INFO": "Информация",
"UPDATE_AVAILABLE": "Налична е нова актуализация! Моля, щракнете върху бутона Изтегляне сега по-долу.",
"EXIT_MESSAGE": "Мрежата на сървъра все още работи, сигурни ли сте, че ще излезете от приложението?",
"UPDATE_SUCCESS": "Актуализирайте успешно"
},
"LANGUAGES": {
"en": "Английски",
"bg": "България"
}
}
19 changes: 15 additions & 4 deletions apps/server-web/src/locales/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"APP_QUIT": "Quit",
"GENERAL": "General",
"SERVER_STATUS_STOPPED": "Status: Stopped",
"SERVER_STATUS_STARTED": "Status: Started"
"SERVER_STATUS_STARTED": "Status: Started",
"OPEN_WEB": "Open Web In Browser",
"SERVER_WINDOW": "Server Window"
},
"FORM": {
"FIELDS": {
Expand All @@ -27,7 +29,10 @@
"NO": "No",
"DOWNLOAD_NOW": "Download Now",
"LATER": "Later",
"CANCEL": "Cancel"
"CANCEL": "Cancel",
"CLOSE": "Close",
"START": "Start",
"STOP": "Stop"
},
"LABELS": {
"CHECKING": "Checking",
Expand All @@ -47,7 +52,8 @@
"AUTO_UPDATE_SUBTITLE": "Enable automatice update check, in order to run a request to check if new version is available and notify",
"AUTO_UPDATE_TOGLE": "Automatic Update",
"CHECK_UPDATE_TITLE": "Check & Update your app version",
"CHECK_UPDATE_SUBTITLE": "New Update is available! Please click button Download Now below."
"CHECK_UPDATE_SUBTITLE": "New Update is available! Please click button Download Now below.",
"LANGUAGES": "Languages"
}
},
"MESSAGE": {
Expand All @@ -56,6 +62,11 @@
"WARNING": "Warning",
"INFO": "Info",
"UPDATE_AVAILABLE": "New Update is available! Please click button Download Now below.",
"EXIT_MESSAGE": "Server web still running, Are you sure to exit the app ?"
"EXIT_MESSAGE": "Server web still running, Are you sure to exit the app ?",
"UPDATE_SUCCESS": "Update Successfully"
},
"LANGUAGES": {
"en": "English",
"bg": "Bulgaria"
}
}
25 changes: 24 additions & 1 deletion apps/server-web/src/main/helpers/constant.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Channels } from './interfaces'
export const EventLists = {
webServerStarted: 'WEB_SERVER_STARTED',
webServerStopped: 'WEB_SERVER_STOPPED',
Expand All @@ -11,7 +12,9 @@ export const EventLists = {
UPDATE_PROGRESS: 'UPDATE_PROGRESS',
UPDATE_DOWNLOADED: 'UPDATE_DOWNLOADED',
UPDATE_CANCELLED: 'UPDATE_CANCELLED',
CHANGE_LANGUAGE: 'CHANGE_LANGUAGE'
CHANGE_LANGUAGE: 'CHANGE_LANGUAGE',
OPEN_WEB: 'OPEN_WEB',
SERVER_WINDOW: 'SERVER_WINDOW'
}

export const SettingPageTypeMessage = {
Expand All @@ -32,3 +35,23 @@ export const SettingPageTypeMessage = {
updateSettingResponse: 'update-setting-response',
updateCancel: 'update-cancel'
}

export const ServerPageTypeMessage = {
SERVER_STATUS: 'server-status',
SERVER_EXEC: 'server-exec'
}

export const LOG_TYPES = {
UPDATE_LOG: 'UPDATE-LOG',
SERVER_LOG: 'SERVER-LOG'
}

export const IPC_TYPES: {
SETTING_PAGE: Channels,
UPDATER_PAGE: Channels,
SERVER_PAGE: Channels
} = {
SETTING_PAGE: 'setting-page',
UPDATER_PAGE: 'updater-page',
SERVER_PAGE: 'server-page'
}
3 changes: 2 additions & 1 deletion apps/server-web/src/main/helpers/desktop-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DesktopServerFactory } from './services/desktop-server-factory';
import EventEmitter from 'events';
import { Observer } from './services/utils';
import NotificationDesktop from '../windows/desktop-notifier';
import { LOG_TYPES } from './constant';
// Define server states
export enum ServerState {
STOPPED = 'stopped',
Expand Down Expand Up @@ -34,7 +35,7 @@ export class DesktopServer {
mainWindow?: BrowserWindow,
signal?: AbortSignal,
): Promise<void> {
console.log('DesktopServer -> start');
console.log(LOG_TYPES.SERVER_LOG, 'DesktopServer -> start');

try {
if (this.state !== ServerState.STOPPED) {
Expand Down
1 change: 1 addition & 0 deletions apps/server-web/src/main/helpers/interfaces/i-constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Channels = 'setting-page' | 'ipc-renderer' | 'language-set' | 'updater-page' | 'server-page';
Empty file.
1 change: 1 addition & 0 deletions apps/server-web/src/main/helpers/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './i-server';
export * from './i-desktop-dialog';
export * from './i-constant';
8 changes: 4 additions & 4 deletions apps/server-web/src/main/helpers/services/libs/server-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChildProcessFactory, Observer } from '../utils';
import { BrowserWindow } from 'electron';
import { ServerConfig } from './server-config';
import EventEmitter from 'events';
import { EventLists } from '../../constant';
import { EventLists, LOG_TYPES } from '../../constant';
// import { Timeout } from '../../decorators';

export abstract class ServerTask {
Expand Down Expand Up @@ -72,7 +72,7 @@ export abstract class ServerTask {

const service = ChildProcessFactory.createProcess(this.processPath, this.args, signal);

console.log('Service created', service.pid);
console.log(LOG_TYPES.SERVER_LOG, 'Service created', service.pid);

service.stdout?.on('data', (data: any) => {
const msg = data.toString();
Expand All @@ -93,12 +93,12 @@ export abstract class ServerTask {
});

service.stderr?.on('data', (data: any) => {
console.log('stderr:', data.toString());
console.log(LOG_TYPES.SERVER_LOG, 'stderr:', data.toString());
this.loggerObserver.notify(data.toString());
});

service.on('disconnect', () => {
console.log('Webserver disconnected');
console.log(LOG_TYPES.SERVER_LOG, 'Webserver disconnected');
if (this.eventEmmitter) {
this.eventEmmitter.emit(EventLists.webServerStopped);
}
Expand Down
Loading

0 comments on commit e2e7900

Please sign in to comment.