diff --git a/core/src/api/index.ts b/core/src/api/index.ts index 58b94f38b..be1b06777 100644 --- a/core/src/api/index.ts +++ b/core/src/api/index.ts @@ -4,7 +4,6 @@ */ export enum AppRoute { appDataPath = 'appDataPath', - appVersion = 'appVersion', openExternalUrl = 'openExternalUrl', openAppDirectory = 'openAppDirectory', openFileExplore = 'openFileExplorer', diff --git a/core/src/node/extension/manager.ts b/core/src/node/extension/manager.ts index 618a5ed9f..3e52ac02d 100644 --- a/core/src/node/extension/manager.ts +++ b/core/src/node/extension/manager.ts @@ -47,7 +47,7 @@ export class ExtensionManager { const extensionsJson = join(extDir, "extensions.json"); if (!existsSync(extensionsJson)) - writeFileSync(extensionsJson, "{}", "utf-8"); + writeFileSync(extensionsJson, "{}"); this.extensionsPath = extDir; } catch (error) { diff --git a/core/src/node/extension/store.ts b/core/src/node/extension/store.ts index 2225479ca..84b1f9caf 100644 --- a/core/src/node/extension/store.ts +++ b/core/src/node/extension/store.ts @@ -84,7 +84,6 @@ export function persistExtensions() { writeFileSync( ExtensionManager.instance.getExtensionsFile(), JSON.stringify(persistData), - "utf-8" ); } diff --git a/electron/handlers/app.ts b/electron/handlers/app.ts index 2cbc13848..d0d9dae72 100644 --- a/electron/handlers/app.ts +++ b/electron/handlers/app.ts @@ -7,15 +7,6 @@ import { ExtensionManager, ModuleManager } from '@janhq/core/node' import { startServer, stopServer } from '@janhq/server' export function handleAppIPCs() { - /** - * Returns the version of the app. - * @param _event - The IPC event object. - * @returns The version of the app. - */ - ipcMain.handle(AppRoute.appVersion, async (_event) => { - return app.getVersion() - }) - /** * Handles the "openAppDirectory" IPC message by opening the app's user data directory. * The `shell.openPath` method is used to open the directory in the user's default file explorer. diff --git a/web/containers/Layout/BottomBar/index.tsx b/web/containers/Layout/BottomBar/index.tsx index 6fbac8bec..655ca2300 100644 --- a/web/containers/Layout/BottomBar/index.tsx +++ b/web/containers/Layout/BottomBar/index.tsx @@ -15,7 +15,6 @@ import { MainViewState } from '@/constants/screens' import { useActiveModel } from '@/hooks/useActiveModel' import { useDownloadState } from '@/hooks/useDownloadState' -import { useGetAppVersion } from '@/hooks/useGetAppVersion' import { useGetDownloadedModels } from '@/hooks/useGetDownloadedModels' import useGetSystemResources from '@/hooks/useGetSystemResources' import { useMainViewState } from '@/hooks/useMainViewState' @@ -24,7 +23,6 @@ const BottomBar = () => { const { activeModel, stateModel } = useActiveModel() const { ram, cpu } = useGetSystemResources() const progress = useAtomValue(appDownloadProgress) - const appVersion = useGetAppVersion() const { downloadedModels } = useGetDownloadedModels() const { setMainViewState } = useMainViewState() const { downloadStates } = useDownloadState() @@ -74,9 +72,8 @@ const BottomBar = () => {
- - Jan v{appVersion?.version ?? ''} - + {/* VERSION is defined by webpack, please see next.config.js */} + Jan v{VERSION ?? ''}
) diff --git a/web/hooks/useGetAppVersion.ts b/web/hooks/useGetAppVersion.ts deleted file mode 100644 index ef82add45..000000000 --- a/web/hooks/useGetAppVersion.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useEffect, useState } from 'react' - -export function useGetAppVersion() { - const [version, setVersion] = useState('') - - useEffect(() => { - getAppVersion() - }, []) - - const getAppVersion = () => { - window.core?.api?.appVersion().then((version: string | undefined) => { - setVersion(version ?? '') - }) - } - - return { version } -} diff --git a/web/screens/Settings/CoreExtensions/ExtensionsCatalog/index.tsx b/web/screens/Settings/CoreExtensions/ExtensionsCatalog/index.tsx index e2a6f3e13..650ed318c 100644 --- a/web/screens/Settings/CoreExtensions/ExtensionsCatalog/index.tsx +++ b/web/screens/Settings/CoreExtensions/ExtensionsCatalog/index.tsx @@ -7,8 +7,6 @@ import { Button } from '@janhq/uikit' import { FeatureToggleContext } from '@/context/FeatureToggle' -import { useGetAppVersion } from '@/hooks/useGetAppVersion' - import { formatExtensionsName } from '@/utils/converter' import { extensionManager } from '@/extension' @@ -17,7 +15,6 @@ const ExtensionCatalog = () => { const [activeExtensions, setActiveExtensions] = useState([]) const [extensionCatalog, setExtensionCatalog] = useState([]) const fileInputRef = useRef(null) - const { version } = useGetAppVersion() const { experimentalFeatureEnabed } = useContext(FeatureToggleContext) /** * Loads the extension catalog module from a CDN and sets it as the extension catalog state. @@ -26,7 +23,6 @@ const ExtensionCatalog = () => { if (!window.electronAPI) { return } - if (!version) return // Get extension manifest import(/* webpackIgnore: true */ PLUGIN_CATALOG + `?t=${Date.now()}`).then( @@ -35,7 +31,7 @@ const ExtensionCatalog = () => { setExtensionCatalog(data.default) } ) - }, [experimentalFeatureEnabed, version]) + }, [experimentalFeatureEnabed]) /** * Fetches the active extensions and their preferences from the `extensions` and `preferences` modules. diff --git a/web/services/restService.ts b/web/services/restService.ts index 6fd7ad069..25488ae15 100644 --- a/web/services/restService.ts +++ b/web/services/restService.ts @@ -13,11 +13,6 @@ export function openExternalUrl(url: string) { window?.open(url, '_blank') } -// Async function to get the application version -export async function appVersion() { - return Promise.resolve(VERSION) -} - // Define API routes based on different route types export const APIRoutes = [ ...Object.values(AppRoute).map((r) => ({ path: 'app', route: r })), @@ -55,5 +50,4 @@ export const restAPI = { } }, {}), openExternalUrl, - appVersion, }