diff --git a/PhotoPrism/PhotoPrism.php b/PhotoPrism/PhotoPrism.php index 69645451bc..9144f0f6cb 100644 --- a/PhotoPrism/PhotoPrism.php +++ b/PhotoPrism/PhotoPrism.php @@ -14,21 +14,29 @@ public function __construct() //$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set } + public function getRequestAttrs() + { + $attrs["headers"] = ["X-Session-ID" => $this->config->session]; + return $attrs; + } + public function test() { - $test = parent::appTest($this->url("api/v1/config")); + $attrs = $this->getRequestAttrs(); + $test = parent::appTest($this->url("api/v1/config"), $attrs); echo $test->status; } public function livestats() { $status = "inactive"; - $res = parent::execute($this->url("api/v1/config")); + $attrs = $this->getRequestAttrs(); + $res = parent::execute($this->url("api/v1/config"), $attrs); $details = json_decode($res->getBody(), true); - $data = []; if ($details) { + $status = "active"; $data["photos"] = number_format($details["count"]["photos"]) ?? 0; $data["videos"] = number_format($details["count"]["videos"]) ?? 0; } diff --git a/PhotoPrism/config.blade.php b/PhotoPrism/config.blade.php index ce273e941c..1a8424d693 100644 --- a/PhotoPrism/config.blade.php +++ b/PhotoPrism/config.blade.php @@ -3,6 +3,10 @@
{!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!} +
+
+ + {!! Form::text('config[session]', isset($item) ? $item->getconfig()->session : null, ['placeholder' => __('Session ID'), 'data-config' => 'session', 'class' => 'form-control config-item']) !!}