ajout heimdall
This commit is contained in:
39
heimdall/config/www/SupportedApps/Miniflux/Miniflux.php
Executable file
39
heimdall/config/www/SupportedApps/Miniflux/Miniflux.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php namespace App\SupportedApps\Miniflux;
|
||||
|
||||
class Miniflux extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
private const ENDPOINT = 'v1/entries?status=unread';
|
||||
|
||||
public $config;
|
||||
public $attrs = [];
|
||||
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
private function setClientOptions() {
|
||||
if ($this->config->username != '' || $this->config->password != '') {
|
||||
$this->attrs = ['auth'=> [$this->config->username, $this->config->password]];
|
||||
}
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$this->setClientOptions();
|
||||
$test = parent::appTest($this->url(self::ENDPOINT), $this->attrs);
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$this->setClientOptions();
|
||||
$res = parent::execute($this->url(self::ENDPOINT), $this->attrs);
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data['count_unread'] = $details->total;
|
||||
return parent::getLiveStats('inactive', $data);
|
||||
}
|
||||
|
||||
public function url($endpoint)
|
||||
{
|
||||
return parent::normaliseurl($this->config->url).$endpoint;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user