Skip to content
Merged

Dev #21

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
7e5be60
docker: init: 02-postgres.sh: allow DB user to create new DB (for tests)
maluueu Jun 8, 2025
192edda
apps: output: change body detection logic and add tests
maluueu Jun 8, 2025
424a450
DVR Features and bug fixes
OkinawaBoss Sep 18, 2025
02ac0d8
Merge pull request #430 from Dispatcharr/dev
OkinawaBoss Sep 19, 2025
eee4ab0
Update for recurring rules
OkinawaBoss Sep 19, 2025
6536f35
FIxed bug
OkinawaBoss Sep 20, 2025
fd90384
Allow for batch editing channel logos
EmeraldPi Sep 21, 2025
ec19381
Enhancement: Update logo options to include the default logo
SergeantPanda Sep 26, 2025
68c8d4d
Change logo upload to link to Logo.jsx form
EmeraldPi Sep 27, 2025
d0e31e8
Rebuilt FFmpeg base container
SergeantPanda Oct 3, 2025
ff894ac
Fix: Need onSuccess in file upload to update Channel.jsx logo
EmeraldPi Oct 4, 2025
3128c11
Merge pull request #458 from csmith1210/set-logo-url-v1
SergeantPanda Oct 4, 2025
e4a6d19
Revert "Add option to add a logo by a URL in Channel editor/creator"
SergeantPanda Oct 4, 2025
9947f36
Merge pull request #511 from Dispatcharr/revert-458-set-logo-url-v1
SergeantPanda Oct 4, 2025
23be065
Revert "Revert "Add option to add a logo by a URL in Channel editor/c…
SergeantPanda Oct 4, 2025
d316173
Merge pull request #512 from Dispatcharr/revert-511-revert-458-set-lo…
SergeantPanda Oct 4, 2025
a502d30
Update installed packages, node and create missing folders
Blarm1959 Oct 4, 2025
23209e7
[Enhancement] Set logo name from url
EmeraldPi Oct 3, 2025
d1ac5b1
Add EPG TVG-ID setting functionality
SergeantPanda Oct 4, 2025
94f966e
Reverted to old method for parsing xml. Still will not break if Cloud…
SergeantPanda Oct 4, 2025
29ee837
Add recover=True to iterparse for parse_programs_for_tvg_id as well t…
SergeantPanda Oct 4, 2025
9173f0b
Merge pull request #517 from Dispatcharr/dev
SergeantPanda Oct 4, 2025
882be5c
Release v0.10.3
actions-user Oct 4, 2025
25d6322
Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into…
SergeantPanda Oct 4, 2025
18dc73c
Merge pull request #518 from Dispatcharr/Assign-tvg-id-from-epg
SergeantPanda Oct 4, 2025
67a6ad1
Enhancement: Add clear EPG button to ChannelBatchForm for resetting E…
SergeantPanda Oct 4, 2025
d773525
Enhancement: Add confirmation dialogs for setting names, logos, TVG-I…
SergeantPanda Oct 4, 2025
e6a9672
Merge branch 'dev' into pr/csmith1210/457
SergeantPanda Oct 5, 2025
cedd0d6
Finish merge
SergeantPanda Oct 5, 2025
cfd235b
Merge pull request #457 from EmeraldPi/logo-batch-edit
SergeantPanda Oct 5, 2025
0406c86
Merge pull request #515 from EmeraldPi/set-name-logo
SergeantPanda Oct 5, 2025
ad4143d
Merge pull request #514 from Blarm1959/dev
SergeantPanda Oct 5, 2025
a31feee
Bug fix: Ensure distinct channel results in generate_m3u, generate_ep…
SergeantPanda Oct 6, 2025
dea6411
Time Zones
OkinawaBoss Oct 6, 2025
8db9689
Merge branch 'DVR-Update' into dev
OkinawaBoss Oct 6, 2025
a4a677a
Bug fix: Streamers with ALL assigned will now get all channels they h…
SergeantPanda Oct 6, 2025
22493c2
Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into…
SergeantPanda Oct 6, 2025
e01338f
Enhancement: Properly track channel creation time and channel update …
SergeantPanda Oct 6, 2025
144a861
Bug fix: When using direct urls in m3u output, use the correct stream…
SergeantPanda Oct 6, 2025
bc574c2
Bug fix: convert commas to decimals and verify float before saving vo…
SergeantPanda Oct 7, 2025
13874d6
Bug fix: If no streams are found during an XC account refresh we were…
SergeantPanda Oct 7, 2025
3326b9f
Bug fix: Add logo URL validation to prevent PostgreSQL btree index er…
SergeantPanda Oct 7, 2025
d1aa9fe
Bug fix: Add logo URL validation to prevent PostgreSQL btree index er…
SergeantPanda Oct 7, 2025
a959ba1
Fix: Add IPv6 CIDR validation in Settings. Add ::0/0 as a default as …
jordandalley Oct 7, 2025
99ad0ec
Bug fix: Fixes bug where adding multiple M3U accounts in a row would …
SergeantPanda Oct 7, 2025
171bb00
Set XC as default for new M3U accounts
SergeantPanda Oct 7, 2025
da245c4
Bug fix: Backend now notifies frontend when a new playlist is creatin…
SergeantPanda Oct 7, 2025
8794156
Enhancement: Only fetch playlists and channel profiles after successf…
SergeantPanda Oct 7, 2025
0722010
Merge pull request #534 from Dispatcharr/dev
SergeantPanda Oct 8, 2025
fe58594
Release v0.10.4
actions-user Oct 8, 2025
951af5f
Enhancement: Add auto-enable settings for new groups and categories i…
SergeantPanda Oct 9, 2025
85fdfed
Merge pull request #543 from Dispatcharr/Auto-disable-new-categories
SergeantPanda Oct 9, 2025
9dc54fd
Fix: Ensure channel_id and channel.uuid are converted to strings befo…
SergeantPanda Oct 10, 2025
fefab4c
Enhancement: Improve resource cleanup in ProxyServer and StreamManage…
SergeantPanda Oct 10, 2025
f58bc81
Enhancement: Optimize EPG program fetching by implementing chunked re…
SergeantPanda Oct 10, 2025
d5f9ba7
Sort EPG output by channel number.
SergeantPanda Oct 10, 2025
d32abec
Enhancement: Add confirmation dialog to stream delete functions.
SergeantPanda Oct 11, 2025
6acb0da
Bug fix/Enhancement: Selecting many streams will no longer cause the …
SergeantPanda Oct 11, 2025
fbd83e6
Enhancement: Added tooltips to stream table fields. Also removed unne…
SergeantPanda Oct 11, 2025
fa08216
Enhancement: Add chunk timeout configuration in ConfigHelper. Improve…
SergeantPanda Oct 11, 2025
74280ba
Changed read timeout for http connection for the proxy server to 10 s…
SergeantPanda Oct 12, 2025
404d2f8
Switch HTTP streamer to a thread and pipe its output to a local pipe …
SergeantPanda Oct 12, 2025
071561c
Merge pull request #553 from Dispatcharr:Proxy-changes
SergeantPanda Oct 12, 2025
87d2131
Bug fix: Fixes saving settings returning error.
SergeantPanda Oct 13, 2025
90d065d
Enhancement: Show "Saved Successfully" message when changing stream s…
SergeantPanda Oct 13, 2025
ed065f7
Enhancement: Implement caching for proxy settings to improve performa…
SergeantPanda Oct 14, 2025
4df2f79
Bug fix: Fixes bug where if there were no channel profiles other than…
SergeantPanda Oct 14, 2025
ae8b85a
feat: added support for rtsp
ragchuck Oct 15, 2025
9b2ebf1
Better database connection cleanup.
SergeantPanda Oct 16, 2025
b9a0aaa
Re-allign tables and buttons after adjusting button layout.
SergeantPanda Oct 16, 2025
0031d55
Bug Fix: Resizing columns in the channel table may cause the page to …
SergeantPanda Oct 16, 2025
ec21e83
Enhancement: Increase time for a client to search for an available co…
SergeantPanda Oct 16, 2025
7744d72
Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into…
SergeantPanda Oct 16, 2025
d3d7f3c
Merge pull request #531 from jordandalley/fix-ipv6-validation
SergeantPanda Oct 16, 2025
ca8e9d0
Enhancement: Add custom logo support for channel groups in Auto Sync …
SergeantPanda Oct 17, 2025
22fb0b3
Enhancement: Add Custom Dummy EPG with Dynamic Pattern Matching and N…
SergeantPanda Oct 18, 2025
ba695eb
Merge pull request #568 from Dispatcharr/dummy-epgs
SergeantPanda Oct 18, 2025
0a4c7ca
Bug fix: Fix bug where channel logo would revert back to provider log…
SergeantPanda Oct 18, 2025
91eaa64
Enhancement: Force a specific EPG for auto channel sync channels.
SergeantPanda Oct 18, 2025
fa2a90f
Bug fix: Remove bottom horizontal scroll bar from TV Guide, it was no…
SergeantPanda Oct 18, 2025
1a541bd
Bug fix: Unable to preview custom streams.
SergeantPanda Oct 18, 2025
81276bf
Bug fix: Current settings for Stream Profile and Group were not displ…
SergeantPanda Oct 18, 2025
0d987aa
Enhancement: If a stream profile is set for a custom stream, when pre…
SergeantPanda Oct 18, 2025
8494f61
Bug fix: Use correct name if stream name is supposed to be used to bu…
SergeantPanda Oct 18, 2025
7cbdb61
Enhancement: Ensure root's .bashrc sources Dispatcharr profile script…
SergeantPanda Oct 19, 2025
9b07f01
Refactor directory creation and ownership management in init script f…
SergeantPanda Oct 19, 2025
d456051
Verify /app also has the correct permissions.
SergeantPanda Oct 19, 2025
c21ea5e
Bug Fix: Use event timezone for date calculation in custom dummy chan…
SergeantPanda Oct 19, 2025
dee6722
Bug fix: Fixes bug where if minute was not specified matching would f…
SergeantPanda Oct 19, 2025
fe54004
Enhancement: Add a {time} and {time24} output for better output forma…
SergeantPanda Oct 19, 2025
603c9f9
Enhancement: Added ability to specify output timezone for custom epg …
SergeantPanda Oct 19, 2025
163b1dd
Move buttons to the right side and correctly load in output timezone …
SergeantPanda Oct 19, 2025
75215cf
Enhancement: Convert <time> and <time24> in the frontend.
SergeantPanda Oct 19, 2025
937c20c
Enhancement: Add upcoming and ended previews for custom dummy epg.
SergeantPanda Oct 19, 2025
6e0e646
Enhancement: EPG Dummy - Convert time based on timezone for preview.
SergeantPanda Oct 19, 2025
6a85475
Enhancement: Adds ability to specify categories (comma separted) as w…
SergeantPanda Oct 19, 2025
4b74673
Bug fix: Use search instead of match for checking if the title matche…
SergeantPanda Oct 19, 2025
97c24db
Bug Fix: Fix inconsistency with how 24 hour time is displayed between…
SergeantPanda Oct 19, 2025
92d499a
Enhancement: Switch regex compilation from re to regex module
SergeantPanda Oct 20, 2025
119b222
Enhancement: Allow setting both Celery and UWSGI nice levels. Default…
SergeantPanda Oct 21, 2025
d5de69c
Merge pull request #574 from Dispatcharr/dev
SergeantPanda Oct 22, 2025
dd5f0d0
Release v0.11.0
actions-user Oct 22, 2025
645c1ec
Testing redis potential fix. Launch redis in entrypoint before uWSGI
SergeantPanda Oct 22, 2025
73bb1ec
Trying a different approach to fix LXC issues.
SergeantPanda Oct 22, 2025
0a6f9eb
Bug fix: Fixes uWSGI not getting environmental variables passed to it…
SergeantPanda Oct 22, 2025
2de5acf
Merge pull request #580 from Dispatcharr/dev
SergeantPanda Oct 22, 2025
29c46ee
Release v0.11.1
actions-user Oct 22, 2025
57b99e3
Enhancement: Change sub_title field in ProgramData model from CharFie…
SergeantPanda Oct 22, 2025
a1834d9
Merge branch 'main' of https://github.com/Dispatcharr/Dispatcharr int…
SergeantPanda Oct 22, 2025
0fd464c
Enhancement: Adds ability to set a custom poster and channel logo wit…
SergeantPanda Oct 24, 2025
2042274
Enhancement: Bulk assign custom dummy epgs.
SergeantPanda Oct 25, 2025
423c56f
Enhancement: Sort groups during xc_get_live_categories in the order t…
SergeantPanda Oct 25, 2025
3e2e704
Enhancement: Add 'Include New Tag' option to mark programs as new in …
SergeantPanda Oct 25, 2025
5c27bd2
Enhancement: Increase maximum URL length for Stream model to 4096 cha…
SergeantPanda Oct 28, 2025
1fde8e4
Fixes the issue where channel titles are truncated early after an apo…
Oct 29, 2025
28c211c
Enhancement: Add {endtime} as an available output for custom dummy ep…
SergeantPanda Oct 29, 2025
c9d7e66
Enhancement: Add {starttime_long} and {endtime_long} to custom dummy …
SergeantPanda Oct 29, 2025
4284955
Enhancement: Adds the ability to use an exisitng custom dummy epg as …
SergeantPanda Oct 29, 2025
0741e45
Enhancement: Add custom fallback templates for dummy EPG generation t…
SergeantPanda Oct 30, 2025
9d4fd63
Enhancement: Add date placeholders for custom dummy EPG based on outp…
SergeantPanda Oct 30, 2025
400c77f
Update views.py
lasharor Oct 30, 2025
16c44ea
Merge pull request #600 from lasharor/patch-2
SergeantPanda Oct 30, 2025
1b282f1
Merge pull request #594 from 0x53c65c0a8bd30fff/truncated-channel-tit…
SergeantPanda Oct 30, 2025
6715bc7
Enhancement: Update TTL settings for client records and implement per…
SergeantPanda Oct 31, 2025
c7e955b
Merge pull request #604 from Dispatcharr:proxy-client-ttl
SergeantPanda Oct 31, 2025
60f77c8
Enhancement: Support month strings for date parsing.
SergeantPanda Oct 31, 2025
12aae44
Enhancement: For custom dummy epg's, use correct date for placeholder…
SergeantPanda Nov 1, 2025
d15d8f6
Bug Fix: Fix bug for the frontend custom dummy epg examples where DST…
SergeantPanda Nov 1, 2025
93f0742
Bug fix/enhancement: Check if we're the owner of /data and set owners…
SergeantPanda Nov 4, 2025
81639c0
Merge pull request #615 from Dispatcharr/dev
SergeantPanda Nov 4, 2025
d0ebfb5
Release v0.11.2
actions-user Nov 4, 2025
e6146e5
Bug fix: Reduce websocket message size when processing epgs. Also rem…
SergeantPanda Nov 5, 2025
77e9850
Enhancement: Refactor get_host_and_port for smarter port selection wh…
SergeantPanda Nov 5, 2025
871f9f9
Another attempt for the get_host_and_port function to better handle p…
SergeantPanda Nov 5, 2025
ed86eb2
Ensures that in the groups section of M3U playlist management, the EP…
Nov 6, 2025
da62870
Separate VOD and channel logos into distinct tables with dedicated ma…
SergeantPanda Nov 7, 2025
c3153f6
Merge pull request #628 from Dispatcharr:vod-logos
SergeantPanda Nov 7, 2025
4701456
Enhancement: Force fetch all logos after logo cleanup.
SergeantPanda Nov 7, 2025
860c671
Fix delete button not activating for vod logo table.
SergeantPanda Nov 7, 2025
6037c15
Fix header checkbox not clearing on bulk delete in logo tables.
SergeantPanda Nov 7, 2025
9a5e04a
Better confirmation dialog messages for vod logo table.
SergeantPanda Nov 7, 2025
dc22dff
Bug Fix: Refactor parse_extinf_line to improve attribute extraction a…
SergeantPanda Nov 11, 2025
21723e2
Update URL validation to support FQDNs for rtsp/rtp protocols and imp…
SergeantPanda Nov 11, 2025
b608af1
Auto detect RTSP streams when proxy profile is selected and force FFm…
SergeantPanda Nov 11, 2025
a7f449f
Merge pull request #565 from ragchuck:enable-rtsp
SergeantPanda Nov 11, 2025
b9e819e
Enhancement: Adds support for UDP streams. Closes #617
SergeantPanda Nov 12, 2025
431ea6d
Merge pull request #640 from Dispatcharr:udp-stream-support
SergeantPanda Nov 12, 2025
a3c16d4
Skip HTTP validation for non-HTTP protocols (UDP/RTP/RTSP) in stream …
SergeantPanda Nov 12, 2025
79895a1
Enhancement: Update URL validation to support authentication for non-…
SergeantPanda Nov 12, 2025
4720e04
Implement manual redirect for non-HTTP protocols (RTSP/RTP/UDP) in st…
SergeantPanda Nov 12, 2025
6e79b37
When stream_type is UDP do not add user_agent to FFmpeg command.
SergeantPanda Nov 13, 2025
4b5d304
Enhancement: Add wheel scrolling support for TV guide and synchronize…
SergeantPanda Nov 14, 2025
cc7cd32
Improved syncronization of timeline and guide for mobile touch (inclu…
SergeantPanda Nov 14, 2025
0360292
Refactor LoginForm: Restore navigation effect and streamline login ha…
SergeantPanda Nov 14, 2025
325c836
Merge pull request #625 from 0x53c65c0a8bd30fff/force-epg-menu-alphab…
SergeantPanda Nov 14, 2025
575b764
Refactor LoginForm: Enhance UI with logo, updated title, and improved…
SergeantPanda Nov 14, 2025
b2a041c
Enhancement: Add forgot password link to login form with instructions…
SergeantPanda Nov 14, 2025
6dab5e3
Enhancement: Add "Remember Me" checkbox to login for that will save t…
SergeantPanda Nov 14, 2025
761ee42
Enhancement: Add version to login form.
SergeantPanda Nov 14, 2025
7321a6d
Enhancement: Allow saving password to local storage.
SergeantPanda Nov 14, 2025
4f29f7f
Enhancement: Conditionally render Sidebar based on authentication status
SergeantPanda Nov 14, 2025
a3be679
Enhancement: Add loading state to login button for better user feedback
SergeantPanda Nov 14, 2025
ed7e164
Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into…
SergeantPanda Nov 14, 2025
acbcc46
Revert "docker: init: 02-postgres.sh: allow DB user to create new DB …
SergeantPanda Nov 14, 2025
5160ead
Merge pull request #166 from maluueu/dev
SergeantPanda Nov 14, 2025
23e2814
Enhancement: Add loading state and dynamic text to submit buttons in …
SergeantPanda Nov 14, 2025
827501c
Better spacing for version text.
SergeantPanda Nov 15, 2025
2514528
Enhancement: Update channel state handling in ProxyServer and views t…
SergeantPanda Nov 15, 2025
0700cf2
Enhancement: Add copy link functionality to SeriesModal and VODModal,…
SergeantPanda Nov 15, 2025
6bd5958
Enhancement: Improve channel shutdown logic in ProxyServer to handle …
SergeantPanda Nov 15, 2025
bbe1f63
Fix: Preserve stream order in ChannelSerializer PATCH/PUT responses
FiveBoroughs Nov 16, 2025
1560afa
Enhancement: Optimize bulk channel editing in ChannelViewSet by valid…
SergeantPanda Nov 17, 2025
1b16df4
Enhancement: Improve batch EPG association in ChannelViewSet by addin…
SergeantPanda Nov 17, 2025
d8df848
Enhancement: Add success notification for channel updates in API, imp…
SergeantPanda Nov 17, 2025
afedce5
Enhancement: Implement background profile refresh task with rate limi…
SergeantPanda Nov 18, 2025
dc2a408
Merge pull request #666 from Dispatcharr:XC-Profile-rate-limit
SergeantPanda Nov 18, 2025
b6c3234
Enhancement: Improve zombie channel handling in ProxyServer by checki…
SergeantPanda Nov 18, 2025
968a8f1
Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into…
SergeantPanda Nov 18, 2025
3e77259
Merge pull request #670 from Dispatcharr/dev
SergeantPanda Nov 19, 2025
fea7c99
Release v0.12.0
actions-user Nov 19, 2025
204a5a0
Merge pull request #659 from FiveBoroughs/fix/channel-stream-order-se…
SergeantPanda Nov 19, 2025
1f0fe00
UI now reflects date and time formats chosen by user
Biologisten Nov 20, 2025
89a2316
Enhancement: Add system event logging and viewer with M3U/EPG endpoin…
SergeantPanda Nov 20, 2025
db276f6
Merge pull request #679 from Dispatcharr/event-viewer
SergeantPanda Nov 20, 2025
05f98e9
Bug fix: Fixes DVR cards not respecting users preference for date and…
SergeantPanda Nov 21, 2025
d94d615
Fix: Handle missing channel profiles in m3u and EPG generation with a…
SergeantPanda Nov 21, 2025
cb1953b
Enhancement: Implement comprehensive logging for user authentication …
SergeantPanda Nov 21, 2025
c5f6d8c
Enhancement: Update xc_player_api to return server_info for unknown a…
SergeantPanda Nov 21, 2025
aa9fa09
Fix: Improve date parsing logic in generate_custom_dummy_programs to …
SergeantPanda Nov 21, 2025
e7700b6
Enhancement: Add validation for EPG objects and payloads in updateEPG…
SergeantPanda Nov 21, 2025
aae7b1b
Enhancement: Refactor xc_player_api to streamline action handling and…
SergeantPanda Nov 21, 2025
7673cd0
fix: Convert float channel numbers to integers for XC client compatib…
SergeantPanda Nov 22, 2025
962d5e9
Enhancement: Hide drop-downs for the system event viewer when in the …
SergeantPanda Nov 25, 2025
0997cd7
Enhancement: Improved minimum horizontal size in the stats page for i…
SergeantPanda Nov 25, 2025
13ad62d
Bug Fix: Fix bug where previewing a stream would always select the de…
SergeantPanda Nov 25, 2025
8754839
Enhancement: Add search icon to name headers for the channels and str…
SergeantPanda Nov 25, 2025
fb084d0
Bug Fix: Filter out non-existent channel groups in M3UGroupFilter com…
SergeantPanda Nov 25, 2025
2b58d7d
Enhancement: Ensure "Uncategorized" categories and relations exist fo…
SergeantPanda Nov 25, 2025
1d23ed3
Enhancement: Allow scrolling when edit m3u account modal is open on m…
SergeantPanda Nov 28, 2025
b791190
Enhancement: Add scrollable modal support for M3UFilters and M3UProfi…
SergeantPanda Nov 28, 2025
bd37094
Bug fix: Use UUID instead of ID for episode URL. This fixes links not…
SergeantPanda Dec 1, 2025
be0409b
Add referrorpolicy to Youtube iframe's for series and VOD modals.
SergeantPanda Dec 2, 2025
85b5b18
Add CHANGELOG.md to document project updates and notable changes
SergeantPanda Dec 2, 2025
2c5fbaf
Update changelog with current unreleased changes.
SergeantPanda Dec 2, 2025
3cb6952
Docs: Added issue references to changelog.
SergeantPanda Dec 2, 2025
0bf3499
Add update_changelog script and integrate it into release workflow
SergeantPanda Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
NEW_VERSION=$(python -c "import version; print(f'{version.__version__}')")
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT

- name: Update Changelog
run: |
python scripts/update_changelog.py ${{ steps.update_version.outputs.new_version }}

- name: Set repository metadata
id: meta
run: |
Expand All @@ -54,7 +58,7 @@ jobs:

- name: Commit and Tag
run: |
git add version.py
git add version.py CHANGELOG.md
git commit -m "Release v${{ steps.update_version.outputs.new_version }}"
git tag -a "v${{ steps.update_version.outputs.new_version }}" -m "Release v${{ steps.update_version.outputs.new_version }}"
git push origin main --tags
Expand Down
837 changes: 837 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

128 changes: 115 additions & 13 deletions apps/accounts/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,88 @@ class TokenObtainPairView(TokenObtainPairView):
def post(self, request, *args, **kwargs):
# Custom logic here
if not network_access_allowed(request, "UI"):
# Log blocked login attempt due to network restrictions
from core.utils import log_system_event
username = request.data.get("username", 'unknown')
client_ip = request.META.get('REMOTE_ADDR', 'unknown')
user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')
log_system_event(
event_type='login_failed',
user=username,
client_ip=client_ip,
user_agent=user_agent,
reason='Network access denied',
)
return Response({"error": "Forbidden"}, status=status.HTTP_403_FORBIDDEN)

# Get the response from the parent class first
response = super().post(request, *args, **kwargs)
username = request.data.get("username")

# Log login attempt
from core.utils import log_system_event
client_ip = request.META.get('REMOTE_ADDR', 'unknown')
user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')

try:
response = super().post(request, *args, **kwargs)

# If login was successful, update last_login and log success
if response.status_code == 200:
if username:
from django.utils import timezone
try:
user = User.objects.get(username=username)
user.last_login = timezone.now()
user.save(update_fields=['last_login'])

# Log successful login
log_system_event(
event_type='login_success',
user=username,
client_ip=client_ip,
user_agent=user_agent,
)
except User.DoesNotExist:
pass # User doesn't exist, but login somehow succeeded
else:
# Log failed login attempt
log_system_event(
event_type='login_failed',
user=username or 'unknown',
client_ip=client_ip,
user_agent=user_agent,
reason='Invalid credentials',
)

# If login was successful, update last_login
if response.status_code == 200:
username = request.data.get("username")
if username:
from django.utils import timezone
try:
user = User.objects.get(username=username)
user.last_login = timezone.now()
user.save(update_fields=['last_login'])
except User.DoesNotExist:
pass # User doesn't exist, but login somehow succeeded
return response

return response
except Exception as e:
# If parent class raises an exception (e.g., validation error), log failed attempt
log_system_event(
event_type='login_failed',
user=username or 'unknown',
client_ip=client_ip,
user_agent=user_agent,
reason=f'Authentication error: {str(e)[:100]}',
)
raise # Re-raise the exception to maintain normal error flow


class TokenRefreshView(TokenRefreshView):
def post(self, request, *args, **kwargs):
# Custom logic here
if not network_access_allowed(request, "UI"):
# Log blocked token refresh attempt due to network restrictions
from core.utils import log_system_event
client_ip = request.META.get('REMOTE_ADDR', 'unknown')
user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')
log_system_event(
event_type='login_failed',
user='token_refresh',
client_ip=client_ip,
user_agent=user_agent,
reason='Network access denied (token refresh)',
)
return Response({"error": "Unauthorized"}, status=status.HTTP_403_FORBIDDEN)

return super().post(request, *args, **kwargs)
Expand Down Expand Up @@ -80,6 +138,15 @@ def initialize_superuser(request):
class AuthViewSet(viewsets.ViewSet):
"""Handles user login and logout"""

def get_permissions(self):
"""
Login doesn't require auth, but logout does
"""
if self.action == 'logout':
from rest_framework.permissions import IsAuthenticated
return [IsAuthenticated()]
return []

@swagger_auto_schema(
operation_description="Authenticate and log in a user",
request_body=openapi.Schema(
Expand All @@ -100,13 +167,26 @@ def login(self, request):
password = request.data.get("password")
user = authenticate(request, username=username, password=password)

# Get client info for logging
from core.utils import log_system_event
client_ip = request.META.get('REMOTE_ADDR', 'unknown')
user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')

if user:
login(request, user)
# Update last_login timestamp
from django.utils import timezone
user.last_login = timezone.now()
user.save(update_fields=['last_login'])

# Log successful login
log_system_event(
event_type='login_success',
user=username,
client_ip=client_ip,
user_agent=user_agent,
)

return Response(
{
"message": "Login successful",
Expand All @@ -118,6 +198,15 @@ def login(self, request):
},
}
)

# Log failed login attempt
log_system_event(
event_type='login_failed',
user=username or 'unknown',
client_ip=client_ip,
user_agent=user_agent,
reason='Invalid credentials',
)
return Response({"error": "Invalid credentials"}, status=400)

@swagger_auto_schema(
Expand All @@ -126,6 +215,19 @@ def login(self, request):
)
def logout(self, request):
"""Logs out the authenticated user"""
# Log logout event before actually logging out
from core.utils import log_system_event
username = request.user.username if request.user and request.user.is_authenticated else 'unknown'
client_ip = request.META.get('REMOTE_ADDR', 'unknown')
user_agent = request.META.get('HTTP_USER_AGENT', 'unknown')

log_system_event(
event_type='logout',
user=username,
client_ip=client_ip,
user_agent=user_agent,
)

logout(request)
return Response({"message": "Logout successful"})

Expand Down
4 changes: 4 additions & 0 deletions apps/channels/api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
UpdateChannelMembershipAPIView,
BulkUpdateChannelMembershipAPIView,
RecordingViewSet,
RecurringRecordingRuleViewSet,
GetChannelStreamsAPIView,
SeriesRulesAPIView,
DeleteSeriesRuleAPIView,
EvaluateSeriesRulesAPIView,
BulkRemoveSeriesRecordingsAPIView,
BulkDeleteUpcomingRecordingsAPIView,
ComskipConfigAPIView,
)

app_name = 'channels' # for DRF routing
Expand All @@ -30,6 +32,7 @@
router.register(r'logos', LogoViewSet, basename='logo')
router.register(r'profiles', ChannelProfileViewSet, basename='profile')
router.register(r'recordings', RecordingViewSet, basename='recording')
router.register(r'recurring-rules', RecurringRecordingRuleViewSet, basename='recurring-rule')

urlpatterns = [
# Bulk delete is a single APIView, not a ViewSet
Expand All @@ -46,6 +49,7 @@
path('series-rules/bulk-remove/', BulkRemoveSeriesRecordingsAPIView.as_view(), name='bulk_remove_series_recordings'),
path('series-rules/<str:tvg_id>/', DeleteSeriesRuleAPIView.as_view(), name='delete_series_rule'),
path('recordings/bulk-delete-upcoming/', BulkDeleteUpcomingRecordingsAPIView.as_view(), name='bulk_delete_upcoming_recordings'),
path('dvr/comskip-config/', ComskipConfigAPIView.as_view(), name='comskip_config'),
]

urlpatterns += router.urls
Loading