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,81 @@
<?php namespace App\SupportedApps\FoldingHome;
class FoldingHome 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()
{
$this->setSID();
$test = parent::appTest($this->url($this->updateURI()));
echo $test->status;
}
public function livestats()
{
$status = 'inactive';
$this->setSID();
$res = parent::execute($this->url($this->updateURI()));
$details = json_decode($res->getBody(), true);
$status = $details[1][1][0]["status"];
$progress = isset($details[1][1][0]["percentdone"]) ? $details[1][1][0]["percentdone"] : "N/A";
$eta = isset($details[1][1][0]["eta"]) ? $details[1][1][0]["eta"] : "N/A";
$data = [
"status" => $status,
"progress" => $progress,
"eta" => $eta
];
return parent::getLiveStats($status, $data);
}
public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url).$endpoint;
return $api_url;
}
public function setSID()
{
if (empty($this->sid)) {
$rand = mt_rand() / mt_getrandmax();
$res = parent::execute($this->url('api/session?_='.$rand), [], [], 'PUT');
$this->sid = (string) $res->getBody();
$query_data = [
'sid' => $this->sid,
'update_id' => 0,
'update_rate' => 1,
'update_path' => '/api/basic',
'_' => time()
];
$res2 = parent::execute($this->url('api/updates/set'), ['query' => $query_data]);
$query_data2 = [
'sid' => $this->sid,
'update_id' => 1,
'update_rate' => 1,
'update_path' => '/api/slots',
'_' => time()
];
$res3 = parent::execute($this->url('api/updates/set'), ['query' => $query_data2]);
$query_data3 = [
'sid' => $this->sid,
'_' => time()
];
$res4 = parent::execute($this->url('api/configured'), ['query' => $query_data3]);
}
}
public function updateURI()
{
$query_url = 'api/updates?sid=';
$query_url .= $this->sid;
$query_url .= '&_=';
$query_url .= time();
return $query_url;
}
}

View File

@@ -0,0 +1,10 @@
{
"appid": "d4f480701f176a366bb9175ce282f80d18da5122",
"name": "Folding@Home",
"website": "https://foldingathome.org/",
"license": "Proprietary",
"description": "Folding@home is a project focused on disease research. The problems were solving require so many computer calcul­ations and we need your help to find the cures!\r\nAccess the your F@H webUI directly from Heimdall.",
"enhanced": true,
"tile_background": "dark",
"icon": "foldingathome.png"
}

View File

@@ -0,0 +1,11 @@
<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">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -0,0 +1,10 @@
<ul class="livestats">
<li>
<span class="title">{{ $status }}</span>
<strong>{!! $progress !!}</strong>
</li>
<li>
<span class="title">ETA</span>
<strong>{!! $eta !!}</strong>
</li>
</ul>