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,10 @@
{
"appid": "fbf13ee99afeadddc4f73e1183fd1b52774b3474",
"name": "ruTorrent",
"website": "https://github.com/Novik/ruTorrent",
"license": "GNU General Public License v3.0 or later",
"description": "ruTorrent is a front-end for the popular Bittorrent client rtorrent.",
"enhanced": true,
"tile_background": "dark",
"icon": "rutorrent.png"
}

View 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) && isset($item->getconfig()->override_url) ? $item->getconfig()->override_url : null), array('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) && isset($item->getconfig()->username) ? $item->getconfig()->username : null), array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!}
</div>
<div class="input">
<label>{{ __('app.apps.password') }}</label>
{!! Form::input('password', 'config[password]', (isset($item) && isset($item->getconfig()->password) ? $item->getconfig()->password : null), array('placeholder' => __('app.apps.password'), 'data-config' => 'password', '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,14 @@
<ul class="livestats">
@if($down_rate != "0 B/s")
<li style="width:50%;">
<span class="title">DOWN </span>
<strong>{!! $down_rate !!}</strong>
</li>
@endif
@if($up_rate != "0 B/s")
<li>
<span class="title">UP </span>
<strong>{!! $up_rate !!}</strong>
</li>
@endif
</ul>

View File

@@ -0,0 +1,88 @@
<?php namespace App\SupportedApps\ruTorrent;
use GuzzleHttp\Exception\RequestException;
class ruTorrent extends \App\SupportedApps implements \App\EnhancedApps {
public $config;
function __construct()
{
}
public function test()
{
$data = $this->getXMLRPCData('throttle.global_down.rate');
if( !isset($data) || $data == 'Err' || $data == null || !is_object($data))
{
echo 'There is an issue connecting to "' . $this->url('RPC2') . '". Please respect URL format "http(s)://IP:PORT". ' . $data;
}
else
{
echo 'Connection successful!';
}
}
public function livestats()
{
$status = 'inactive';
$data = [];
$data['down_rate'] = $this->formatBytes((float)$this->getXMLRPCData('throttle.global_down.rate')->params->param->value->i8, 1);
$data['up_rate'] = $this->formatBytes((float)$this->getXMLRPCData('throttle.global_up.rate')->params->param->value->i8, 1);
return parent::getLiveStats($status, $data);
}
public function url($endpoint)
{
return parent::normaliseurl($this->config->url).$endpoint;
}
public function getXMLRPCData($method)
{
$value='';
$body = '<methodCall><methodName>'.$method.'</methodName></methodCall>';
$this->vars = ['http_errors' => false, 'timeout' => 5, 'body' => $body];
$this->attrs = [];
$this->attrs['headers'] = ['Content-Type' => 'text/xml'];
if( isset($this->config->username) && isset($this->config->password) ) {
$this->attrs['headers']['Authorization'] = 'Basic ' . base64_encode($this->config->username . ":" . $this->config->password);
}
try{
$res = parent::execute($this->url('RPC2'), $this->attrs, $this->vars);
} catch(\GuzzleHttp\Exception\RequestException $e){
return ''; // Connection failed, display default response
}
if (function_exists('simplexml_load_string')) {
try {
$value = simplexml_load_string($res->getBody()->getContents());
} catch(\ErrorException $e) {
$value = 'Unexpected response. Are credentials correct?';
}
} else {
$value = 'simplexml_load_string doesn\'t exist.';
}
return $value;
}
public function formatBytes($bytes, $precision = 2)
{
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
return round($bytes, $precision) . ' ' . $units[$pow] . '/s';
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB