{
http_path_t *hp = malloc(sizeof(http_path_t));
- hp->hp_len = strlen(path);
- hp->hp_path = strdup(path);
+ if (tvheadend_webroot) {
+ char *tmp; const char *pre = "";
+ size_t len = strlen(tvheadend_webroot) + strlen(path) + 1;
+ if (*tvheadend_webroot != '/') {
+ len++;
+ pre = "/";
+ }
+ hp->hp_path = tmp = malloc(len);
+ sprintf(tmp, "%s%s%s", pre, tvheadend_webroot, path);
+ } else
+ hp->hp_path = strdup(path);
+ hp->hp_len = strlen(hp->hp_path);
hp->hp_opaque = opaque;
hp->hp_callback = callback;
hp->hp_accessmask = accessmask;
int htsp_port;
int htsp_port_extra;
char *tvheadend_cwd;
+const char *tvheadend_webroot;
const char *tvheadend_capabilities[] = {
#if ENABLE_CWC
printf(" -s Log debug to syslog\n");
printf(" -w <portnumber> WebUI access port [default 9981]\n");
printf(" -e <portnumber> HTSP access port [default 9982]\n");
+ printf(" -W <path> WebUI context path [default /]\n");
printf("\n");
printf("Development options\n");
printf("\n");
// make sure the timezone is set
tzset();
- while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:sw:e:E:R:")) != -1) {
+ while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:sw:e:E:R:W:")) != -1) {
switch(c) {
case 'a':
adapter_mask = 0x0;
case 'j':
join_transport = optarg;
break;
+ case 'W':
+ tvheadend_webroot = optarg;
+ break;
default:
usage(argv[0]);
}
extern const char *tvheadend_version;
extern char *tvheadend_cwd;
extern const char *tvheadend_capabilities[];
+extern const char *tvheadend_webroot;
#define PTS_UNSET INT64_C(0x8000000000000000)
* General capabilities
*/
Ext.Ajax.request({
- url: '/capabilities',
+ url: 'capabilities',
success: function(d)
{
if (d && d.responseText)
page_root(http_connection_t *hc, const char *remain, void *opaque)
{
if(is_client_simple(hc)) {
- http_redirect(hc, "/simple.html");
+ http_redirect(hc, "simple.html");
} else {
- http_redirect(hc, "/extjs.html");
+ http_redirect(hc, "extjs.html");
}
return 0;
}
+static int
+page_root2(http_connection_t *hc, const char *remain, void *opaque)
+{
+ if (!tvheadend_webroot) return 1;
+ char *tmp = malloc(strlen(tvheadend_webroot) + 2);
+ sprintf(tmp, "%s/", tvheadend_webroot);
+ http_redirect(hc, tmp);
+ free(tmp);
+ return 0;
+}
+
/**
* Static download of a file from the filesystem
*/
void
webui_init(void)
{
+ http_path_add("", NULL, page_root2, ACCESS_WEB_INTERFACE);
http_path_add("/", NULL, page_root, ACCESS_WEB_INTERFACE);
http_path_add("/dvrfile", NULL, page_dvrfile, ACCESS_WEB_INTERFACE);