ajout heimdall
This commit is contained in:
89
heimdall/config/www/SupportedApps/FreshRSS/FreshRSS.php
Executable file
89
heimdall/config/www/SupportedApps/FreshRSS/FreshRSS.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php namespace App\SupportedApps\FreshRSS;
|
||||
|
||||
class FreshRSS extends \App\SupportedApps implements \App\EnhancedApps
|
||||
{
|
||||
public $config;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
private $clientVars = [
|
||||
"http_errors" => false,
|
||||
"timeout" => 15,
|
||||
"connect_timeout" => 15,
|
||||
"verify" => false,
|
||||
];
|
||||
|
||||
public function test()
|
||||
{
|
||||
$attrs = [
|
||||
"body" => "api_key=" . $this->getApiKey(),
|
||||
"headers" => [
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
];
|
||||
|
||||
$res = parent::execute(
|
||||
$this->url("api/fever.php?api"),
|
||||
$attrs,
|
||||
$this->clientVars,
|
||||
"POST"
|
||||
);
|
||||
|
||||
if ($res->getStatusCode() == 200) {
|
||||
$data = json_decode($res->getBody());
|
||||
if ($data != null && $data->auth === 1) {
|
||||
echo "Welcome " .
|
||||
$this->config->username .
|
||||
", you are connected to API v" .
|
||||
$data->api_version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = "inactive";
|
||||
$data = [];
|
||||
|
||||
$attrs = [
|
||||
"body" => "api_key=" . $this->getApiKey(),
|
||||
"headers" => [
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
];
|
||||
|
||||
$res = parent::execute(
|
||||
$this->url("api/fever.php?api&unread_item_ids"),
|
||||
$attrs,
|
||||
$this->clientVars,
|
||||
"POST"
|
||||
);
|
||||
if ($res->getStatusCode() == 200) {
|
||||
$body = json_decode($res->getBody());
|
||||
if ($body->auth === 1) {
|
||||
if ($body->unread_item_ids != "") {
|
||||
$data["unread"] = count(
|
||||
explode(",", $body->unread_item_ids)
|
||||
);
|
||||
} else {
|
||||
$data["unread"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
|
||||
public function getApiKey()
|
||||
{
|
||||
return md5($this->config->username . ":" . $this->config->apikey);
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/FreshRSS/app.json
Executable file
10
heimdall/config/www/SupportedApps/FreshRSS/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "5c68de7acdaff4da4f680545bb51a847840c81da",
|
||||
"name": "FreshRSS",
|
||||
"website": "https://freshrss.org",
|
||||
"license": "GNU Affero General Public License v3.0",
|
||||
"description": "FreshRSS is a self-hosted RSS feed aggregator. It is lightweight, easy to work with, powerful and customizable.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "freshrss.svg"
|
||||
}
|
||||
18
heimdall/config/www/SupportedApps/FreshRSS/config.blade.php
Executable file
18
heimdall/config/www/SupportedApps/FreshRSS/config.blade.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<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>{{ __('app.apps.username') }}</label>
|
||||
{!! Form::text('config[username]', isset($item) ? $item->getconfig()->username : null, ['placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.apikey') }}</label>
|
||||
{!! Form::text('config[apikey]', isset($item) ? $item->getconfig()->apikey : null, ['placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
BIN
heimdall/config/www/SupportedApps/FreshRSS/freshrss.png
Executable file
BIN
heimdall/config/www/SupportedApps/FreshRSS/freshrss.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
7
heimdall/config/www/SupportedApps/FreshRSS/livestats.blade.php
Executable file
7
heimdall/config/www/SupportedApps/FreshRSS/livestats.blade.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<ul class="livestats">
|
||||
@if ($unread > 0)
|
||||
<li>
|
||||
<span class="title" style="color:orange;">{!! $unread !!} Unread</span>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
Reference in New Issue
Block a user