2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

02_HTTPSRV: require trailing slash in infix to foster integration of TabletUI

git-svn-id: https://svn.fhem.de/fhem/trunk@8700 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2015-06-06 06:54:05 +00:00
parent 2cc926f50a
commit 60f7388cb4
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 02_HTTPSRV: require trailing slash in infix to foster
integration of TabletUI
- feature: 59_Weather: polish translations (Lukasz) - feature: 59_Weather: polish translations (Lukasz)
- changed: 57_CALVIEW.pm: code cleanup - changed: 57_CALVIEW.pm: code cleanup
- bugfix: 30_pilight_*: restore (StateFn), trigger changes twice - bugfix: 30_pilight_*: restore (StateFn), trigger changes twice

View File

@ -63,6 +63,9 @@ HTTPSRV_Define($$) {
return "Usage: define <name> HTTPSRV <infix> <directory> <friendlyname>" if(int(@a) != 5); return "Usage: define <name> HTTPSRV <infix> <directory> <friendlyname>" if(int(@a) != 5);
my $name= $a[0]; my $name= $a[0];
my $infix= $a[2]; my $infix= $a[2];
if($infix !~ m-/$-) {
$infix = "$infix/";
}
my $directory= $a[3]; my $directory= $a[3];
my $friendlyname= $a[4]; my $friendlyname= $a[4];
@ -114,7 +117,7 @@ sub HTTPSRV_CGI() {
my ($request) = @_; # /$infix/filename my ($request) = @_; # /$infix/filename
if($request =~ m,^(/[^/]+)(/(.*)?)?$,) { if($request =~ m,^(/[^/]+/)((.*)?)?$,) {
my $link= $1; my $link= $1;
my $filename= $3; my $filename= $3;
my $name; my $name;
@ -180,7 +183,7 @@ sub HTTPSRV_CGI() {
<h3>HTTPSRV</h3> <h3>HTTPSRV</h3>
<ul> <ul>
Provides a mini HTTP server plugin for FHEMWEB. It serves files from a given directory. Provides a mini HTTP server plugin for FHEMWEB. It serves files from a given directory.
It optionally accepts a query string to set readings of this device if an attribute allows the given reading<p> It optionally accepts a query string to set readings of this device if an attribute allows the given reading.<p>
HTTPSRV is an extension to <a href="HTTPSRV">FHEMWEB</a>. You must install FHEMWEB to use HTTPSRV.</p> HTTPSRV is an extension to <a href="HTTPSRV">FHEMWEB</a>. You must install FHEMWEB to use HTTPSRV.</p>
@ -191,14 +194,16 @@ sub HTTPSRV_CGI() {
Defines the HTTP server. <code>&lt;infix&gt;</code> is the portion behind the FHEMWEB base URL (usually Defines the HTTP server. <code>&lt;infix&gt;</code> is the portion behind the FHEMWEB base URL (usually
<code>http://hostname:8083/fhem</code>), <code>&lt;directory&gt;</code> is the absolute path the <code>http://hostname:8083/fhem</code>), <code>&lt;directory&gt;</code> is the absolute path the
files are served from, and <code>&lt;friendlyname&gt;</code> is the name displayed in the side menu of FHEMWEB.<p><p> files are served from, and <code>&lt;friendlyname&gt;</code> is the name displayed in the side menu of
FHEMWEB. <code>&lt;infix&gt;</code> should contain a trailing slash, which is automatically added to
the definition if it is missing in the define statement.<p><p>
Example: Example:
<ul> <ul>
<code>define myJSFrontend HTTPSRV jsf /usr/share/jsfrontend My little frontend</code><br> <code>define myJSFrontend HTTPSRV jsf /usr/share/jsfrontend/ My little frontend</code><br>
or <br> or <br>
<code> <code>
define kindleweb HTTPSRV kindle /opt/fhem/kindle Kindle Web<br> define kindleweb HTTPSRV kindle /opt/fhem/kindle/ Kindle Web<br>
attr kindleweb readings KindleBatt attr kindleweb readings KindleBatt
</code><br> </code><br>
</ul> </ul>