Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http server: fix ticket usage for m3u playlist - use only one for all…
… streams
  • Loading branch information
perexg committed Apr 20, 2016
1 parent ac2d90e commit 4058e89
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/webui/webui.c
Expand Up @@ -477,7 +477,8 @@ static void
http_m3u_playlist_add(htsbuf_queue_t *hq, const char *hostpath,
const char *url_remain, const char *profile,
const char *svcname, const char *logo,
const char *epgid, access_t *access)
const char *epgid, access_t *access,
char **ticket)
{
htsbuf_append_str(hq, "#EXTINF:-1");
if (logo) {
Expand All @@ -488,8 +489,9 @@ http_m3u_playlist_add(htsbuf_queue_t *hq, const char *hostpath,
}
if (epgid)
htsbuf_qprintf(hq, " tvg-id=\"%s\"", epgid);
htsbuf_qprintf(hq, ",%s\n%s%s?ticket=%s", svcname, hostpath, url_remain,
access_ticket_create(url_remain, access));
if (*ticket == NULL)
*ticket = (char *)access_ticket_create(url_remain, access);
htsbuf_qprintf(hq, ",%s\n%s%s?ticket=%s", svcname, hostpath, url_remain, *ticket);
htsbuf_qprintf(hq, "&profile=%s\n", profile);
}

Expand Down Expand Up @@ -551,7 +553,7 @@ http_channel_playlist(http_connection_t *hc, int pltype, channel_t *channel)
{
htsbuf_queue_t *hq;
char buf[255];
char *profile, *hostpath;
char *profile, *hostpath, *ticket = NULL;
const char *name;
char ubuf[UUID_HEX_SIZE];

Expand All @@ -573,7 +575,7 @@ http_channel_playlist(http_connection_t *hc, int pltype, channel_t *channel)
http_m3u_playlist_add(hq, hostpath, buf, profile, name,
channel_get_icon(channel),
channel_get_uuid(channel, ubuf),
hc->hc_access);
hc->hc_access, &ticket);

} else if (pltype == PLAYLIST_E2) {

Expand Down Expand Up @@ -601,7 +603,7 @@ http_tag_playlist(http_connection_t *hc, int pltype, channel_tag_t *tag)
htsbuf_queue_t *hq;
char buf[255], ubuf[UUID_HEX_SIZE];
idnode_list_mapping_t *ilm;
char *profile, *hostpath;
char *profile, *hostpath, *ticket = NULL;
const char *name;
channel_t *ch;
channel_t **chlist;
Expand Down Expand Up @@ -648,7 +650,7 @@ http_tag_playlist(http_connection_t *hc, int pltype, channel_tag_t *tag)
http_m3u_playlist_add(hq, hostpath, buf, profile, name,
channel_get_icon(ch),
channel_get_uuid(ch, ubuf),
hc->hc_access);
hc->hc_access, &ticket);
} else if (pltype == PLAYLIST_E2) {
htsbuf_qprintf(hq, "#NAME %s\n", name);
http_e2_playlist_add(hq, hostpath, buf, profile, name);
Expand Down Expand Up @@ -680,7 +682,7 @@ http_tag_list_playlist(http_connection_t *hc, int pltype)
int labelidx = 0;
int idx = 0, count = 0;
int chidx = 0, chcount = 0;
char *profile, *hostpath;
char *profile, *hostpath, *ticket = NULL;
idnode_list_mapping_t *ilm;

if(hc->hc_access == NULL ||
Expand Down Expand Up @@ -731,7 +733,7 @@ http_tag_list_playlist(http_connection_t *hc, int pltype)
if (pltype == PLAYLIST_M3U) {
snprintf(buf, sizeof(buf), "/playlist/tagid/%d", idnode_get_short_uuid(&ct->ct_id));
http_m3u_playlist_add(hq, hostpath, buf, profile, ct->ct_name,
channel_tag_get_icon(ct), NULL, hc->hc_access);
channel_tag_get_icon(ct), NULL, hc->hc_access, &ticket);
} else if (pltype == PLAYLIST_E2) {
htsbuf_qprintf(hq, "#SERVICE 1:64:%d:0:0:0:0:0:0:0::%s\n", labelidx++, ct->ct_name);
htsbuf_qprintf(hq, "#DESCRIPTION %s\n", ct->ct_name);
Expand Down Expand Up @@ -774,7 +776,7 @@ http_channel_list_playlist(http_connection_t *hc, int pltype)
channel_t *ch;
channel_t **chlist;
int idx = 0, count = 0;
char *profile, *hostpath;
char *profile, *hostpath, *ticket = NULL;
const char *name;

if(hc->hc_access == NULL ||
Expand Down Expand Up @@ -814,7 +816,7 @@ http_channel_list_playlist(http_connection_t *hc, int pltype)
http_m3u_playlist_add(hq, hostpath, buf, profile, name,
channel_get_icon(ch),
channel_get_uuid(ch, ubuf),
hc->hc_access);
hc->hc_access, &ticket);
} else if (pltype == PLAYLIST_E2) {
http_e2_playlist_add(hq, hostpath, buf, profile, name);
} else if (pltype == PLAYLIST_SATIP_M3U) {
Expand Down

0 comments on commit 4058e89

Please sign in to comment.