|
|
@@ -611,13 +611,14 @@ http_dvr_list_playlist(http_connection_t *hc) |
|
|
char buf[255];
|
|
|
dvr_entry_t *de;
|
|
|
const char *uuid;
|
|
|
- char *hostpath = http_get_hostpath(hc);
|
|
|
+ char *hostpath;
|
|
|
off_t fsize;
|
|
|
time_t durration;
|
|
|
struct tm tm;
|
|
|
int bandwidth;
|
|
|
|
|
|
hq = &hc->hc_reply;
|
|
|
+ hostpath = http_get_hostpath(hc);
|
|
|
|
|
|
htsbuf_qprintf(hq, "#EXTM3U\n");
|
|
|
LIST_FOREACH(de, &dvrentries, de_global_link) {
|
|
|
@@ -788,7 +789,8 @@ http_stream_service(http_connection_t *hc, service_t *service, int weight) |
|
|
|
|
|
if(!(pro = profile_find_by_list(hc->hc_access->aa_profiles,
|
|
|
http_arg_get(&hc->hc_req_args, "profile"),
|
|
|
- "service")))
|
|
|
+ "service",
|
|
|
+ SUBSCRIPTION_PACKET | SUBSCRIPTION_MPEGTS)))
|
|
|
return HTTP_STATUS_NOT_ALLOWED;
|
|
|
|
|
|
if((tcp_id = http_stream_preop(hc)) == NULL)
|
|
|
@@ -925,7 +927,8 @@ http_stream_channel(http_connection_t *hc, channel_t *ch, int weight) |
|
|
|
|
|
if(!(pro = profile_find_by_list(hc->hc_access->aa_profiles,
|
|
|
http_arg_get(&hc->hc_req_args, "profile"),
|
|
|
- "channel")))
|
|
|
+ "channel",
|
|
|
+ SUBSCRIPTION_PACKET | SUBSCRIPTION_MPEGTS)))
|
|
|
return HTTP_STATUS_NOT_ALLOWED;
|
|
|
|
|
|
if((tcp_id = http_stream_preop(hc)) == NULL)
|
|
|
@@ -1037,28 +1040,37 @@ page_xspf(http_connection_t *hc, const char *remain, void *opaque) |
|
|
{
|
|
|
size_t maxlen;
|
|
|
char *buf, *hostpath = http_get_hostpath(hc);
|
|
|
- const char *title, *profile, *image;
|
|
|
+ const char *title, *profile, *ticket, *image;
|
|
|
size_t len;
|
|
|
|
|
|
if ((title = http_arg_get(&hc->hc_req_args, "title")) == NULL)
|
|
|
title = "TVHeadend Stream";
|
|
|
profile = http_arg_get(&hc->hc_req_args, "profile");
|
|
|
+ ticket = http_arg_get(&hc->hc_req_args, "ticket");
|
|
|
image = http_arg_get(&hc->hc_req_args, "image");
|
|
|
|
|
|
maxlen = strlen(remain) + strlen(title) + 512;
|
|
|
buf = alloca(maxlen);
|
|
|
|
|
|
+ pthread_mutex_lock(&global_lock);
|
|
|
+ if (ticket == NULL) {
|
|
|
+ snprintf(buf, maxlen, "/%s", remain);
|
|
|
+ ticket = access_ticket_create(buf, hc->hc_access);
|
|
|
+ }
|
|
|
snprintf(buf, maxlen, "\
|
|
|
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\
|
|
|
<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\r\n\
|
|
|
<trackList>\r\n\
|
|
|
<track>\r\n\
|
|
|
<title>%s</title>\r\n\
|
|
|
- <location>%s/%s%s%s</location>\r\n%s%s%s\
|
|
|
+ <location>%s/%s%s%s%s%s</location>\r\n%s%s%s\
|
|
|
</track>\r\n\
|
|
|
</trackList>\r\n\
|
|
|
-</playlist>\r\n", title, hostpath, remain, profile ? "?profile=" : "", profile ?: "",
|
|
|
- image ? " <image>" : "", image ?: "", image ? "</image>\r\n" : "");
|
|
|
+</playlist>\r\n", title, hostpath, remain,
|
|
|
+ profile ? "?profile=" : "", profile ?: "",
|
|
|
+ profile ? "&ticket=" : "?ticket=", ticket,
|
|
|
+ image ? " <image>" : "", image ?: "", image ? "</image>\r\n" : "");
|
|
|
+ pthread_mutex_unlock(&global_lock);
|
|
|
|
|
|
len = strlen(buf);
|
|
|
http_send_header(hc, 200, "application/xspf+xml", len, 0, NULL, 10, 0, NULL, NULL);
|
|
|
@@ -1077,20 +1089,29 @@ page_m3u(http_connection_t *hc, const char *remain, void *opaque) |
|
|
{
|
|
|
size_t maxlen;
|
|
|
char *buf, *hostpath = http_get_hostpath(hc);
|
|
|
- const char *title, *profile;
|
|
|
+ const char *title, *profile, *ticket;
|
|
|
size_t len;
|
|
|
|
|
|
if ((title = http_arg_get(&hc->hc_req_args, "title")) == NULL)
|
|
|
title = "TVHeadend Stream";
|
|
|
profile = http_arg_get(&hc->hc_req_args, "profile");
|
|
|
+ ticket = http_arg_get(&hc->hc_req_args, "ticket");
|
|
|
|
|
|
maxlen = strlen(remain) + strlen(title) + 256;
|
|
|
buf = alloca(maxlen);
|
|
|
|
|
|
+ pthread_mutex_lock(&global_lock);
|
|
|
+ if (ticket == NULL) {
|
|
|
+ snprintf(buf, maxlen, "/%s", remain);
|
|
|
+ ticket = access_ticket_create(buf, hc->hc_access);
|
|
|
+ }
|
|
|
snprintf(buf, maxlen, "\
|
|
|
#EXTM3U\r\n\
|
|
|
#EXTINF:-1,%s\r\n\
|
|
|
-%s/%s%s%s\r\n", title, hostpath, remain, profile ? "?profile=" : "", profile ?: "");
|
|
|
+%s/%s%s%s%s%s\r\n", title, hostpath, remain,
|
|
|
+ profile ? "?profile=" : "", profile ?: "",
|
|
|
+ profile ? "&ticket=" : "?ticket=", ticket);
|
|
|
+ pthread_mutex_unlock(&global_lock);
|
|
|
|
|
|
len = strlen(buf);
|
|
|
http_send_header(hc, 200, "audio/x-mpegurl", len, 0, NULL, 10, 0, NULL, NULL);
|
|
|
@@ -1436,7 +1457,7 @@ webui_init(int xspf) |
|
|
|
|
|
http_path_add("/state", NULL, page_statedump, ACCESS_ADMIN);
|
|
|
|
|
|
- http_path_add("/stream", NULL, http_stream, ACCESS_STREAMING);
|
|
|
+ http_path_add("/stream", NULL, http_stream, ACCESS_ANONYMOUS);
|
|
|
|
|
|
http_path_add("/imagecache", NULL, page_imagecache, ACCESS_ANONYMOUS);
|
|
|
|
|
|
|