mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-21 01:05:30 +00:00
Fix XC URL sub-path handling in profile refresh and EPG creation
- Fix credential extraction in get_transformed_credentials() using negative indices anchored to the known tail structure instead of hardcoded indices that break when server URLs contain sub-paths - Fix EPG URL construction in M3U form to normalize server URL to origin before appending xmltv.php endpoint XC accounts with sub-paths in their server URL (e.g., http://server.com/portal/a/) caused two failures: profile refresh extracted wrong credentials from the URL path due to hardcoded array indices, and EPG auto-creation appended xmltv.php under the sub-path instead of at the domain root. Both fixes normalize away the sub-path using the same approach the backend's XCClient already uses for API calls.
This commit is contained in:
parent
b8e1785d0e
commit
8de23eec35
2 changed files with 7 additions and 5 deletions
|
|
@ -2305,10 +2305,12 @@ def get_transformed_credentials(account, profile=None):
|
|||
parsed_url = urllib.parse.urlparse(transformed_complete_url)
|
||||
path_parts = [part for part in parsed_url.path.split('/') if part]
|
||||
|
||||
if len(path_parts) >= 2:
|
||||
# Extract username and password from path
|
||||
transformed_username = path_parts[1]
|
||||
transformed_password = path_parts[2]
|
||||
if len(path_parts) >= 4 and path_parts[-1] == '1234.ts':
|
||||
# Extract username and password from the known structure:
|
||||
# .../{live}/{username}/{password}/1234.ts
|
||||
# Using negative indices so sub-paths in the server URL don't shift extraction
|
||||
transformed_username = path_parts[-3]
|
||||
transformed_password = path_parts[-2]
|
||||
|
||||
# Rebuild server URL without the username/password path
|
||||
transformed_url = f"{parsed_url.scheme}://{parsed_url.netloc}"
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ const M3U = ({
|
|||
API.addEPG({
|
||||
name: values.name,
|
||||
source_type: 'xmltv',
|
||||
url: `${values.server_url}/xmltv.php?username=${values.username}&password=${values.password}`,
|
||||
url: `${new URL(values.server_url).origin}/xmltv.php?username=${values.username}&password=${values.password}`,
|
||||
api_key: '',
|
||||
is_active: true,
|
||||
refresh_interval: 24,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue