mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
98_JsonMod.pm: modify file uri behaviour (Forum #133765
git-svn-id: https://svn.fhem.de/fhem/trunk@27660 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5a0c055792
commit
f9346ea0e5
@ -594,12 +594,15 @@ sub JsonMod_ApiRequest {
|
||||
|
||||
my $source = $hash->{'CONFIG'}->{'SOURCE'};
|
||||
|
||||
# file: correct file:/.. but also accepted file://..
|
||||
if ($source =~ m/^file:[\/]{1,2}(.+)/) {
|
||||
# abs: file:/// or file:/
|
||||
# rel: file:
|
||||
# non-comform file:// -> rel file:
|
||||
if ($source =~ m/^file:[\/]{2}(.+)|^file:(.+)/) {
|
||||
$hash->{'CONFIG'}->{'IN_REQUEST'} = 0;
|
||||
$hash->{'API_LAST_RES'} = Time::HiRes::time();
|
||||
|
||||
my $filename = $1;
|
||||
|
||||
my $filename = $1//$2;
|
||||
# say "filename: $filename";
|
||||
if (-e $filename) {
|
||||
my $data;
|
||||
open(my $fh, '<', $filename) or do {
|
||||
@ -1889,7 +1892,16 @@ sub listDates {
|
||||
<ul>
|
||||
<code>define <name> JsonMod <http[s]:example.com:/somepath/somefile.json></code>
|
||||
<br><br>
|
||||
defines the device and set the source (file:/|http://|https://).
|
||||
defines the device and set the source (file:|http:|https:|system://).<br>
|
||||
<br>files example:
|
||||
<ul>
|
||||
<li>file:[//]/path/file (absolute)</li>
|
||||
<li>file:[//]path/file (realtive)</li>
|
||||
</ul>
|
||||
<br>system example:
|
||||
<ul>
|
||||
<li>system://curl -X POST "https://httpbin.org/anything" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"login":"my_login","password":"my_password"}'</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user