ajout heimdall

This commit is contained in:
2025-01-01 11:24:01 +01:00
parent f8be42e486
commit c52f60fca9
1477 changed files with 15692 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<?php namespace App\SupportedApps\Syncthing;
class Syncthing 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-API-Key" => $this->config->apikey];
return $attrs;
}
public function test()
{
$attrs = $this->get_request_attrs();
$test = parent::appTest($this->url('/rest/system/version'), $attrs);
echo $test->status;
}
public function livestats()
{
$data = [];
$needed_files = 0;
$needed_bytes = 0;
$status = 'inactive';
$attrs = $this->get_request_attrs();
# first get a list of folders
$res = parent::execute($this->url('/rest/stats/folder'), $attrs);
$details = json_decode($res->getBody());
foreach ($details as $folder => $folder_status) {
$folder_db_res = parent::execute($this->url('/rest/db/status?folder=${folder}'), $attrs);
$folder_db = json_decode($folder_db_res->getBody());
if ($folder_db) {
$needed_files += $folder_db["needFiles"];
$needed_bytes += $folder_db["needBytes"];
}
}
if ($needed_files || $needed_bytes) {
$status = 'active';
}
$data['needed_files'] = $needed_files;
$data['needed_bytes'] = $needed_bytes;
return parent::getLiveStats($status, $data);
}
public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url).$endpoint;
return $api_url;
}
}

View File

@@ -0,0 +1,10 @@
{
"appid": "7775c3bbf580fbaf57818e68ce7b1b48b8f93b95",
"name": "Syncthing",
"website": "https://syncthing.net/",
"license": "Mozilla Public License 2.0",
"description": "Syncthing is a free, open-source peer-to-peer file synchronization application. It can sync files between devices on a local network, or between remote devices over the Internet.",
"enhanced": true,
"tile_background": "dark",
"icon": "syncthing.png"
}

View File

@@ -0,0 +1,15 @@
<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]', null, array('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) && property_exists($item->getconfig(), "apikey") ? $item->getconfig()->apikey : null), array('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>

View File

@@ -0,0 +1,10 @@
<ul class="livestats">
<li>
<span class="title">Needed Files</span>
<strong>{!! $needed_files !!}</strong>
</li>
<li>
<span class="title">Needed Bytes</span>
<strong>{!! $needed_bytes !!}</strong>
</li>
</ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB