-
-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Photoprism #496
Comments
You can try using https://user:[email protected] |
Unfortunately that doesn't work :/ |
I'm curious about this as well! I just tried to use the Photoprism tile and haven't been able to figure out how to "authenticate". |
It looks like the v1 API uses |
I figure out how to solve this problem. You need to change two files under Heimdall deploy path config.blade.php <h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
<div class="items">
<div class="input">
<label>{{ strtoupper(__('app.url')) }}</label>
{!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!}
</div>
<div class="input">
<label title="">Session ID (<a href="https://docs.photoprism.app/developer-guide/api/#with-authentication" target="_blank">help?</a>)</label>
{!! Form::text('config[session]', isset($item) ? $item->getconfig()->session : null, ['placeholder' => __('Session ID'), 'data-config' => 'session', 'class' => 'form-control config-item']) !!}
</div>
<div class="input">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div> PhotoPrism.php <?php namespace App\SupportedApps\PhotoPrism;
class PhotoPrism extends \App\SupportedApps implements \App\EnhancedApps
{
public $config;
//protected $login_first = true; // Uncomment if api requests need to be authed first
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
function __construct()
{
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
}
function get_request_attrs()
{
$attrs["headers"] = ["X-Session-ID" => $this->config->session];
return $attrs;
}
public function test()
{
$attrs = $this->get_request_attrs();
$test = parent::appTest($this->url("api/v1/config"), $attrs);
echo $test->status;
}
public function livestats()
{
$status = "inactive";
$attrs = $this->get_request_attrs();
$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;
}
return parent::getLiveStats($status, $data);
}
public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
return $api_url;
}
} |
Thank you @iwinstar your solution worked great. |
@byrongamatos what did you put into the URL and Session ID fields when adding PhotoPrism into Heimdall? |
@EarlJr53 Open a new tab and login to photo prism. Then open the developer tools of your browser, and under local storage for photoprism you will find a session token. I copied and used this token |
Thank you so much! I got it!
|
I changed the files too and had to restart my docker heimdall instance The session_id I took with dev tools (F12 browser - Application tab - Search for Local Storage - Than your URL - than you can find the session_id) I can even enter what I want as session ID |
I think the session_id you provided maybe expired, you can check it with Postman.
|
No |
Hmm OK |
At least the connection is working Why the API just returns 0 for everything must be an error somewhere on the photoprism side... |
Could anyone open a PR to apply the solution from @iwinstar to Heimdall code? It would be great if everyone using Heimdall could get this fix without having to find this issue and manually update those files |
Hi there! Running through the backlog of issues and PRs... A couple of observations / comments:
Let me know if anyone plans to work on this. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
5 similar comments
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
@mvdkleijn photoprism now supports app password. https://docs.photoprism.app/developer-guide/api/auth/ |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
Fixed by #764 |
Hi - I just have an issue with the livestats on the Photoprism tile.
In fact I need an authentification for the api (I tried to access too over the browser) but there is no such option that I could configure.
Isn't that supported yet?
Thanks
The text was updated successfully, but these errors were encountered: