diff --git a/apps/channels/models.py b/apps/channels/models.py index 60c35923..deb66ae1 100644 --- a/apps/channels/models.py +++ b/apps/channels/models.py @@ -147,7 +147,7 @@ class Stream(models.Model): profile_id = redis_client.get(f"stream_profile:{self.id}") if profile_id: profile_id = int(profile_id) - return self.id, profile_id + return self.id, profile_id, None # Retrieve the M3U account associated with the stream. m3u_account = self.m3u_account @@ -174,10 +174,10 @@ class Stream(models.Model): if profile.max_streams > 0: redis_client.incr(profile_connections_key) - return self.id, profile.id # Return newly assigned stream and matched profile + return self.id, profile.id, None # Return newly assigned stream and matched profile # 4. No available streams - return None, None + return None, None, None def release_stream(self): """ diff --git a/apps/proxy/ts_proxy/url_utils.py b/apps/proxy/ts_proxy/url_utils.py index f80aae75..f68b9b6b 100644 --- a/apps/proxy/ts_proxy/url_utils.py +++ b/apps/proxy/ts_proxy/url_utils.py @@ -58,7 +58,7 @@ def generate_stream_url(channel_id: str) -> Tuple[str, str, bool, Optional[int]] # Get the appropriate user agent m3u_account = M3UAccount.objects.get(id=m3u_profile.m3u_account.id) - stream_user_agent = UserAgent.objects.get(id=m3u_account.user_agent.id).user_agent + stream_user_agent = m3u_account.get_user_agent().user_agent if stream_user_agent is None: stream_user_agent = UserAgent.objects.get(id=CoreSettings.get_default_user_agent_id()) @@ -163,9 +163,7 @@ def get_stream_info_for_switch(channel_id: str, target_stream_id: Optional[int] # Get the user agent from the M3U account m3u_account = M3UAccount.objects.get(id=profile.m3u_account.id) - user_agent = UserAgent.objects.get(id=m3u_account.user_agent.id).user_agent - if not user_agent: - user_agent = UserAgent.objects.get(id=CoreSettings.get_default_user_agent_id()).user_agent + user_agent = m3u_account.get_user_agent().user_agent # Generate URL using the transform function directly stream_url = transform_url(stream.url, profile.search_pattern, profile.replace_pattern) diff --git a/apps/proxy/ts_proxy/views.py b/apps/proxy/ts_proxy/views.py index 32d552da..232b3d28 100644 --- a/apps/proxy/ts_proxy/views.py +++ b/apps/proxy/ts_proxy/views.py @@ -44,7 +44,7 @@ def stream_ts(request, channel_id): # Extract client user agent early for header in ['HTTP_USER_AGENT', 'User-Agent', 'user-agent']: - if header in request.META: + if (header in request.META): client_user_agent = request.META[header] logger.debug(f"[{client_id}] Client connected with user agent: {client_user_agent}") break diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index a57cd1b0..5aa5df23 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -85,65 +85,66 @@ const App = () => { withGlobalStyles withNormalizeCSS > - - - + + + + - - - - - {isAuthenticated ? ( - <> - } /> - } /> - } /> - } /> - } /> - } /> - - ) : ( - } /> - )} - - } - /> - + + + + + {isAuthenticated ? ( + <> + } /> + } /> + } /> + } /> + } /> + } /> + + ) : ( + } /> + )} + + } + /> + + - - - - - - - + + + + + + diff --git a/frontend/src/WebSocket.jsx b/frontend/src/WebSocket.jsx index 72533910..1d33565f 100644 --- a/frontend/src/WebSocket.jsx +++ b/frontend/src/WebSocket.jsx @@ -14,19 +14,17 @@ import useEPGsStore from './store/epgs'; import { Box, Button, Stack } from '@mantine/core'; import API from './api'; -export const WebsocketContext = createContext(false, null, () => {}); +export const WebsocketContext = createContext([false, () => {}, null]); export const WebsocketProvider = ({ children }) => { const [isReady, setIsReady] = useState(false); const [val, setVal] = useState(null); - const { fetchStreams } = useStreamsStore(); const { fetchChannels, setChannelStats, fetchChannelGroups } = useChannelsStore(); const { fetchPlaylists, setRefreshProgress, setProfilePreview } = usePlaylistsStore(); const { fetchEPGData, fetchEPGs } = useEPGsStore(); - const { playlists } = usePlaylistsStore(); const ws = useRef(null); diff --git a/version.py b/version.py index b4b893b7..03f5bc1f 100644 --- a/version.py +++ b/version.py @@ -2,4 +2,4 @@ Dispatcharr version information. """ __version__ = '0.2.0' # Follow semantic versioning (MAJOR.MINOR.PATCH) -__build__ = '0' # Auto-incremented on builds +__build__ = '4' # Auto-incremented on builds