diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2012-12-26 19:49:43 +0100 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2012-12-26 19:49:43 +0100 |
commit | 6c10da93f171ec7fbff5fe7f9597b6be4f1501c5 (patch) | |
tree | 9522e849628fba0c89d5cb8919e273fe3494d7a7 /tntconfig.cpp | |
parent | 320a053f329f39bd416cba3b7508e6ed570853a2 (diff) | |
download | vdr-plugin-live-6c10da93f171ec7fbff5fe7f9597b6be4f1501c5.tar.gz vdr-plugin-live-6c10da93f171ec7fbff5fe7f9597b6be4f1501c5.tar.bz2 |
Adds support for the newly introduced ResourceDirectory.
This is taken from a patch provided in ticket #1064.
Diffstat (limited to 'tntconfig.cpp')
-rw-r--r-- | tntconfig.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tntconfig.cpp b/tntconfig.cpp index 5293540..3a1fd14 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -31,6 +31,9 @@ namespace vdrlive { WriteProperties(); string const configDir(Plugin::GetConfigDirectory()); +#if APIVERSNUM > 10729 + string const resourceDir(Plugin::GetResourceDirectory()); +#endif ostringstream builder; builder << configDir << "/httpd.config"; @@ -72,7 +75,11 @@ namespace vdrlive { // the following selects the theme specific 'theme.css' file // inserted by 'tadi' -- verified with above, but not counterchecked yet! +#if APIVERSNUM > 10729 + file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << resourceDir << "/themes/$1/css/$2 text/css" << endl; +#else file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << configDir << "/themes/$1/css/$2 text/css" << endl; +#endif // the following rules provide a search scheme for images. The first // rule where a image is found, terminates the search. @@ -80,8 +87,13 @@ namespace vdrlive { // 2. /img/<imgname>.<ext> // deprecated: 3. <imgname>.<ext> (builtin images) // inserted by 'tadi' -- verified with above, but not counterchecked yet! +#if APIVERSNUM > 10729 + file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/themes/$1/img/$2.$3 image/$3" << endl; + file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/img/$2.$3 image/$3" << endl; +#else file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/themes/$1/img/$2.$3 image/$3" << endl; file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/img/$2.$3 image/$3" << endl; +#endif // deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl; // Epg images @@ -98,18 +110,34 @@ namespace vdrlive { // WARNING: no path components with '.' in the name are allowed. Only // the basename may contain dots and must end with '.js' // inserted by 'tadi' -- verified with above, but not counterchecked yet! +#if APIVERSNUM > 10729 + file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << resourceDir << "/js$1$2 text/javascript" << endl; +#else file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << configDir << "/js$1$2 text/javascript" << endl; +#endif // map to 'css/basename(uri)' // inserted by 'tadi' -- verified with above, but not counterchecked yet! +#if APIVERSNUM > 10729 + file << "MapUrl ^/css.*/(.+) content@ " << resourceDir << "/css/$1 text/css" << endl; +#else file << "MapUrl ^/css.*/(.+) content@ " << configDir << "/css/$1 text/css" << endl; +#endif // map to 'img/basename(uri)' // inserted by 'tadi' -- verified with above, but not counterchecked yet! +#if APIVERSNUM > 10729 + file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << resourceDir << "/img/$1.$2 image/$2" << endl; +#else file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << configDir << "/img/$1.$2 image/$2" << endl; +#endif // Map favicon.ico into img directory +#if APIVERSNUM > 10729 + file << "MapUrl ^/favicon.ico$ content@ " << resourceDir << "/img/favicon.ico image/x-icon" << endl; +#else file << "MapUrl ^/favicon.ico$ content@ " << configDir << "/img/favicon.ico image/x-icon" << endl; +#endif // insecure by default: DO NOT UNKOMMENT!!! // file << "MapUrl /([^/]+/.+) content@ $1" << endl; @@ -156,6 +184,9 @@ namespace vdrlive { void TntConfig::Configure(tnt::Tntnet& app) const { string const configDir(Plugin::GetConfigDirectory()); +#if APIVERSNUM > 10729 + string const resourceDir(Plugin::GetResourceDirectory()); +#endif std::istringstream logConf( "rootLogger=" + LiveSetup().GetTntnetLogLevel() + "\n" @@ -199,7 +230,11 @@ namespace vdrlive { // the following selects the theme specific 'theme.css' file // inserted by 'tadi' -- verified with above, but not counterchecked yet! app.mapUrl("^/themes/([^/]*)/css.*/(.+\\.css)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/themes/$1/css/$2") +#else .setPathInfo(configDir + "/themes/$1/css/$2") +#endif .pushArg("text/css"); // the following rules provide a search scheme for images. The first @@ -209,10 +244,18 @@ namespace vdrlive { // deprecated: 3. <imgname>.<ext> (builtin images) // inserted by 'tadi' -- verified with above, but not counterchecked yet! app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/themes/$1/img/$2.$3") +#else .setPathInfo(configDir + "/themes/$1/img/$2.$3") +#endif .pushArg("image/$3"); app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/img/$2.$3") +#else .setPathInfo(configDir + "/img/$2.$3") +#endif .pushArg("image/$3"); // deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl; @@ -230,24 +273,40 @@ namespace vdrlive { // the basename may contain dots and must end with '.js' // inserted by 'tadi' -- verified with above, but not counterchecked yet! app.mapUrl("^/js(/[^.]*)([^/]*\\.js)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/js$1$2") +#else .setPathInfo(configDir + "/js$1$2") +#endif .pushArg("text/javascript"); // map to 'css/basename(uri)' // inserted by 'tadi' -- verified with above, but not counterchecked yet! app.mapUrl("^/css.*/(.+)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/css/$1") +#else .setPathInfo(configDir + "/css/$1") +#endif .pushArg("text/css"); // map to 'img/basename(uri)' // inserted by 'tadi' -- verified with above, but not counterchecked yet! app.mapUrl("^/img.*/(.+)\\.([^.]+)", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/img/$1.$2") +#else .setPathInfo(configDir + "/img/$1.$2") +#endif .pushArg("image/$2"); // Map favicon.ico into img directory app.mapUrl("^/favicon.ico$", "content") +#if APIVERSNUM > 10729 + .setPathInfo(resourceDir + "/img/favicon.ico") +#else .setPathInfo(configDir + "/img/favicon.ico") +#endif .pushArg("image/x-icon"); // takes first path components without 'extension' when it does not |