Skip to content

Commit

Permalink
Merge pull request #3085 from ever-co/stage
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Sep 29, 2024
2 parents 704f95d + a510930 commit ce5e77b
Show file tree
Hide file tree
Showing 48 changed files with 1,045 additions and 130 deletions.
15 changes: 14 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,17 @@
"asar",
"icns",
"nsis",
"WARNING️"
"WARNING️",
"Periode",
"maximizable",
"mainconfig",
"electronmon",
"languagedetector",
"teamsupercell",
"pmmmwh",
"compat",
"webm",
"webp"
],
"useGitignore": true,
"ignorePaths": [
Expand Down Expand Up @@ -424,5 +434,8 @@
"apps/desktop/i18n/**",
"apps/**/*.{svg,css,scss}",
".scripts/icon-utils/icons/**",
"apps/server-web/src/locales/**/*.json",
"apps/server-web/src/resources/*",
"apps/server-web/assets/*"
]
}
3 changes: 1 addition & 2 deletions .github/workflows/desktop-server-api.apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ jobs:
PROCESSOR_REVISION: ''
PSModuleAnalysisCachePath: ''
PSModulePath: ''
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps'
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\Amazon\AWSCLIV2\'
DOTNET_MULTILEVEL_LOOKUP: ''
DOTNET_NOLOGO: ''
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: ''
Expand Down Expand Up @@ -405,4 +405,3 @@ jobs:
# APPDATA: ''
# COMMONPROGRAMFILES: ''
# CommonProgramFiles(x86)
# CommonProgramW6432
3 changes: 1 addition & 2 deletions .github/workflows/desktop-server-web.apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ jobs:
PROCESSOR_REVISION: ''
PSModuleAnalysisCachePath: ''
PSModulePath: ''
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps'
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\Amazon\AWSCLIV2\'
DOTNET_MULTILEVEL_LOOKUP: ''
DOTNET_NOLOGO: ''
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: ''
Expand Down Expand Up @@ -396,4 +396,3 @@ jobs:
# APPDATA: ''
# COMMONPROGRAMFILES: ''
# CommonProgramFiles(x86)
# CommonProgramW6432
3 changes: 1 addition & 2 deletions .github/workflows/desktop.apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ jobs:
PROCESSOR_REVISION: ''
PSModuleAnalysisCachePath: ''
PSModulePath: ''
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps'
Path: 'C:\hostedtoolcache\windows\node\20.11.1\x64;C:\Program Files\Git\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\Program Files\OpenSSL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\Amazon\AWSCLIV2\'
DOTNET_MULTILEVEL_LOOKUP: ''
DOTNET_NOLOGO: ''
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: ''
Expand Down Expand Up @@ -405,4 +405,3 @@ jobs:
# APPDATA: ''
# COMMONPROGRAMFILES: ''
# CommonProgramFiles(x86)
# CommonProgramW6432
6 changes: 3 additions & 3 deletions apps/extensions/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4633,9 +4633,9 @@ reusify@^1.0.4:
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==

rollup@^3.2.5:
version "3.5.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.5.0.tgz#dfe5cba22c2c074691b4c25b9b8e9cfd90ac712b"
integrity sha512-TYu2L+TGhmNsXCtByont89u+ATQLcDy6A+++PwLXYunRtOm7XnaD+65s1pvewaOxMYR0eOkMXn9/i0saBxxpnQ==
version "3.29.5"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54"
integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==
optionalDependencies:
fsevents "~2.3.2"

Expand Down
9 changes: 8 additions & 1 deletion apps/server-web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const path = require('path');

module.exports = {
plugins: [require('tailwindcss'), require('autoprefixer')],
plugins: {
tailwindcss: {
config: path.join(__dirname, 'tailwind.config.js')
},
autoprefixer: {}
}
};
2 changes: 1 addition & 1 deletion apps/server-web/src/locales/i18n/bg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"AUTO_UPDATE_TITLE": "Автоматична проверка на актуализацията",
"AUTO_UPDATE_SUBTITLE": "Активирайте автоматичната проверка на актуализацията, за да стартирате заявка за проверка дали е налична нова версия и да уведомите",
"AUTO_UPDATE_TOGLE": "Автоматична актуализация",
"AUTO_UPDATE_TOGGLE": "Автоматична актуализация",
"CHECK_UPDATE_TITLE": "Проверете и актуализирайте версията на приложението си",
"CHECK_UPDATE_SUBTITLE": "Налична е нова актуализация! Моля, щракнете върху бутона Изтегляне сега по-долу.",
"LANGUAGES": "Езици"
Expand Down
2 changes: 1 addition & 1 deletion apps/server-web/src/locales/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"AUTO_UPDATE_TITLE": "Automatic Update Check",
"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",
"AUTO_UPDATE_TOGGLE": "Automatic Update",
"CHECK_UPDATE_TITLE": "Check & Update your app version",
"CHECK_UPDATE_SUBTITLE": "New Update is available! Please click button Download Now below.",
"LANGUAGES": "Languages"
Expand Down
6 changes: 4 additions & 2 deletions apps/server-web/src/main/helpers/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const EventLists = {
CHANGE_LANGUAGE: 'CHANGE_LANGUAGE',
OPEN_WEB: 'OPEN_WEB',
SERVER_WINDOW: 'SERVER_WINDOW',
RESTART_SERVER: 'RESTART_SERVER'
RESTART_SERVER: 'RESTART_SERVER',
CHANGE_THEME: 'CHANGE_THEME',
}

export const SettingPageTypeMessage = {
Expand All @@ -35,7 +36,8 @@ export const SettingPageTypeMessage = {
updateSetting: 'update-setting',
updateSettingResponse: 'update-setting-response',
updateCancel: 'update-cancel',
restartServer: 'restart-server'
restartServer: 'restart-server',
themeChange: 'theme-change'
}

export const ServerPageTypeMessage = {
Expand Down
2 changes: 1 addition & 1 deletion apps/server-web/src/main/helpers/interfaces/i-constant.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type Channels = 'setting-page' | 'ipc-renderer' | 'language-set' | 'updater-page' | 'server-page';
export type Channels = 'setting-page' | 'ipc-renderer' | 'language-set' | 'updater-page' | 'server-page' | 'theme-change' | 'current-theme';
1 change: 1 addition & 0 deletions apps/server-web/src/main/helpers/interfaces/i-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ interface GeneralConfig {
lang?: string
autoUpdate?: boolean
updateCheckPeriode?: string
theme?: string
[key: string]: any
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const LocalStore = {
const config: WebServer = {
server: {
PORT: 3002,
GAUZY_API_SERVER_URL: 'htpp://localhost:3000',
GAUZY_API_SERVER_URL: 'http://localhost:3000',
NEXT_PUBLIC_GAUZY_API_SERVER_URL: 'http://localhost:3000'
},
general: {
Expand Down
14 changes: 7 additions & 7 deletions apps/server-web/src/main/helpers/services/libs/server-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export abstract class ServerTask {
protected isRunning: boolean;
protected signal: AbortSignal;
private criticalMessageError = ['[CRITICAL::ERROR]', 'EADDRINUSE'];
public eventEmmitter: EventEmitter;
public eventEmitter: EventEmitter;

protected constructor(
processPath: string,
Expand All @@ -28,7 +28,7 @@ export abstract class ServerTask {
successMessage: string,
errorMessage: string,
signal: AbortSignal,
eventEmmitter: EventEmitter
eventEmitter: EventEmitter
) {
this.processPath = processPath;
this.args = args;
Expand All @@ -39,7 +39,7 @@ export abstract class ServerTask {
this.pid = `${this.args.serviceName}Pid`;
this.signal = signal;
this.isRunning = false;
this.eventEmmitter = eventEmmitter;
this.eventEmitter = eventEmitter;

this.loggerObserver = new Observer((msg: string) => {
console.log('Sending log_state:', msg);
Expand Down Expand Up @@ -99,17 +99,17 @@ export abstract class ServerTask {

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

service.on('error', (err) => {
console.log('child process error', err);
})

if (this.eventEmmitter) {
this.eventEmmitter.emit(EventLists.webServerStarted);
if (this.eventEmitter) {
this.eventEmitter.emit(EventLists.webServerStarted);
}
this.config.setting = { server: { ...this.config.setting.server, [this.pid]: service.pid } };
} catch (error) {
Expand Down
22 changes: 20 additions & 2 deletions apps/server-web/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,16 @@ const onInitApplication = () => {
})
})

eventEmitter.on(EventLists.CHANGE_THEME, (data) => {
LocalStore.updateConfigSetting({
general: {
theme: data
}
})
logWindow?.webContents.send('themeSignal', { type: SettingPageTypeMessage.themeChange, data });
settingWindow?.webContents.send('themeSignal', { type: SettingPageTypeMessage.themeChange, data });
})

eventEmitter.on(EventLists.gotoAbout, async () => {
if (!settingWindow) {
await createWindow('SETTING_WINDOW');
Expand Down Expand Up @@ -467,6 +477,9 @@ ipcMain.on(IPC_TYPES.SETTING_PAGE, async (event, arg) => {
case SettingPageTypeMessage.restartServer:
eventEmitter.emit(EventLists.RESTART_SERVER)
break;
case SettingPageTypeMessage.themeChange:
eventEmitter.emit(EventLists.CHANGE_THEME, arg.data)
break;
default:
break;
}
Expand Down Expand Up @@ -505,6 +518,11 @@ ipcMain.on(IPC_TYPES.SERVER_PAGE, (_, arg) => {
}
})

ipcMain.handle('current-theme', async () => {
const setting: WebServer = LocalStore.getStore('config');
return setting.general?.theme;;
})

const createIntervalAutoUpdate = () => {
if (intervalUpdate) {
clearInterval(intervalUpdate)
Expand All @@ -513,10 +531,10 @@ const createIntervalAutoUpdate = () => {
if (setting.general?.autoUpdate && setting.general.updateCheckPeriode) {
const checkIntervalSecond = parseInt(setting.general.updateCheckPeriode);
if (!Number.isNaN(checkIntervalSecond)) {
const intevalMS = checkIntervalSecond * 60 * 1000;
const intervalMS = checkIntervalSecond * 60 * 1000;
intervalUpdate = setInterval(() => {
updater.checkUpdateNotify();
}, intevalMS)
}, intervalMS)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/server-web/src/main/main_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ const createWindow = async () => {
menuBuilder.buildMenu();

// Open urls in the user's browser
mainWindow.webContents.setWindowOpenHandler((edata) => {
shell.openExternal(edata.url);
mainWindow.webContents.setWindowOpenHandler((eData) => {
shell.openExternal(eData.url);
return { action: 'deny' };
});

Expand Down
9 changes: 9 additions & 0 deletions apps/server-web/src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const electronHandler = {
once(channel: Channels, func: (...args: unknown[]) => void) {
ipcRenderer.once(channel, (_event, ...args) => func(...args));
},
invoke(channel: Channels, ...args: unknown[]) {
return ipcRenderer.invoke(channel, ...args);
},
removeEventListener(channel: Channels) {
ipcRenderer.removeAllListeners(channel)
}
Expand All @@ -33,8 +36,14 @@ contextBridge.exposeInMainWorld('electron', electronHandler);
contextBridge.exposeInMainWorld('languageChange', {
language: (callback: any) => ipcRenderer.on('languageSignal', (_event, value) => callback(value))
})
contextBridge.exposeInMainWorld('themeChange', {
theme: (callback: any) => ipcRenderer.on('themeSignal', (_event, value) => callback(value))
})

export type ElectronHandler = typeof electronHandler;
export type languageChange = {
language: (callback: any) => void
}
export type themeChange = {
theme: (callback: any) => void
}
Loading

0 comments on commit ce5e77b

Please sign in to comment.