ajout heimdall
This commit is contained in:
63
heimdall/config/www/SupportedApps/LinkAce/LinkAce.php
Executable file
63
heimdall/config/www/SupportedApps/LinkAce/LinkAce.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php namespace App\SupportedApps\LinkAce;
|
||||
|
||||
class LinkAce 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
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest($this->url("api/v1/links"));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = "inactive";
|
||||
|
||||
$res_links = parent::execute(
|
||||
$this->url("api/v1/links"),
|
||||
$this->attrs()
|
||||
);
|
||||
$links = json_decode($res_links->getBody(), true);
|
||||
|
||||
$res_tags = parent::execute($this->url("api/v1/tags"), $this->attrs());
|
||||
$tags = json_decode($res_tags->getBody(), true);
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($links) {
|
||||
$data["links"] = $links["total"] ?? 0;
|
||||
}
|
||||
|
||||
if ($tags) {
|
||||
$data["tags"] = $tags["total"] ?? 0;
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
|
||||
public function attrs()
|
||||
{
|
||||
$apikey = $this->config->apikey;
|
||||
$attrs = [
|
||||
"headers" => [
|
||||
"content-type" => "application/json",
|
||||
"Authorization" => "Bearer " . $apikey,
|
||||
],
|
||||
];
|
||||
return $attrs;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/LinkAce/app.json
Executable file
10
heimdall/config/www/SupportedApps/LinkAce/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "c7eef6a399bb48a066d4e11fc577e896bc142cf3",
|
||||
"name": "LinkAce",
|
||||
"website": "https://www.linkace.org",
|
||||
"license": "GNU General Public License v3.0 only",
|
||||
"description": "LinkAce is a self-hosted archive to collect links of your favorite websites. Save articles to read them later, tools to use them in your next project, or historic content to archive it for the long term. LinkAce comes with a lot of features while keeping a clean and minimal interface.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "linkace.svg"
|
||||
}
|
||||
14
heimdall/config/www/SupportedApps/LinkAce/config.blade.php
Executable file
14
heimdall/config/www/SupportedApps/LinkAce/config.blade.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<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.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/LinkAce/linkace.png
Executable file
BIN
heimdall/config/www/SupportedApps/LinkAce/linkace.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
10
heimdall/config/www/SupportedApps/LinkAce/livestats.blade.php
Executable file
10
heimdall/config/www/SupportedApps/LinkAce/livestats.blade.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Links</span>
|
||||
<strong>{!! $links !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Tags</span>
|
||||
<strong>{!! $tags !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user