diff --git a/core/api_views.py b/core/api_views.py index eab5f44e..a2cbab94 100644 --- a/core/api_views.py +++ b/core/api_views.py @@ -42,6 +42,9 @@ class CoreSettingsViewSet(viewsets.ModelViewSet): @api_view(['GET']) @permission_classes([IsAuthenticated]) def environment(request): + # Import version information + from version import __version__, __build__ + public_ip = None local_ip = None country_code = None @@ -83,4 +86,6 @@ def environment(request): 'country_code': country_code, 'country_name': country_name, 'env_mode': "dev" if os.getenv('DISPATCHARR_ENV') == "dev" else "prod", + 'version': __version__, + 'build': __build__, }) diff --git a/frontend/src/api.js b/frontend/src/api.js index cd106eeb..b1db3f42 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -155,8 +155,8 @@ export default class API { ...(channel.logo_file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body: body, }); @@ -220,8 +220,8 @@ export default class API { ...(values.logo_file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body: body, }); @@ -518,8 +518,8 @@ export default class API { ...(values.file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body, }); @@ -602,8 +602,8 @@ export default class API { ...(values.file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body, }); @@ -663,8 +663,8 @@ export default class API { ...(values.epg_file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body, }); @@ -704,8 +704,8 @@ export default class API { ...(values.epg_file ? {} : { - 'Content-Type': 'application/json', - }), + 'Content-Type': 'application/json', + }), }, body, }); diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx index 00fb4045..322c8635 100644 --- a/frontend/src/components/Sidebar.jsx +++ b/frontend/src/components/Sidebar.jsx @@ -1,4 +1,4 @@ -import React, { useRef } from 'react'; +import React, { useRef, useEffect, useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { ListOrdered, @@ -26,6 +26,7 @@ import logo from '../images/logo.png'; import useChannelsStore from '../store/channels'; import './sidebar.css'; import useSettingsStore from '../store/settings'; +import API from '../api'; const NavLink = ({ item, isActive, collapsed }) => { return ( @@ -64,6 +65,24 @@ const Sidebar = ({ collapsed, toggleDrawer, drawerWidth, miniDrawerWidth }) => { const { channels } = useChannelsStore(); const { environment } = useSettingsStore(); const publicIPRef = useRef(null); + const [appVersion, setAppVersion] = useState({ version: '', build: '' }); + + // Fetch environment settings including version on component mount + useEffect(() => { + const fetchEnvironment = async () => { + try { + const envData = await API.getEnvironmentSettings(); + setAppVersion({ + version: envData.version || '', + build: envData.build || '' + }); + } catch (error) { + console.error('Failed to fetch environment settings:', error); + } + }; + + fetchEnvironment(); + }, []); // Navigation Items const navItems = [ @@ -224,6 +243,11 @@ const Sidebar = ({ collapsed, toggleDrawer, drawerWidth, miniDrawerWidth }) => { )} + {!collapsed && ( + + v{appVersion.version}{appVersion.build !== '0' ? `-${appVersion.build}` : ''} + + )} ); };