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,77 @@
<?php namespace App\SupportedApps\Spotweb;
class Spotweb extends \App\SupportedApps implements \App\EnhancedApps {
public $config;
function __construct() {
$this->jar = new \GuzzleHttp\Cookie\CookieJar;
}
public function login()
{
$username = $this->config->username;
$password = $this->config->password;
if (!isset($username) || empty($username) || !isset($password) || empty($password))
return;
$attrs = [
'cookies' => $this->jar
];
$res = parent::execute($this->url('?page=login'), $attrs);
$content = (string) $res->getBody(true);
preg_match("/name=\"loginform\[xsrfid\]\" value=\"([^\"]+)/", $content, $matches);
$xsrfid = $matches[1];
$attrs = [
'form_params' => [
'loginform' => [
'username' => $username,
'password' => $password,
'xsrfid' => $xsrfid,
'submitlogin' => 'Login',
]
],
'cookies' => $this->jar,
'headers' => ['content-type' => 'application/x-www-form-urlencoded']
];
$res = parent::execute($this->url('?page=login'), $attrs, false, 'POST');
}
public function test()
{
$this->login();
$attrs = [
'cookies' => $this->jar
];
$test = parent::appTest($this->url('?page=statistics'), $attrs);
echo $test->status;
}
public function livestats()
{
$this->login();
$status = 'inactive';
$attrs = [
'cookies' => $this->jar
];
$res = parent::execute($this->url('?page=statistics'), $attrs);
$content = (string) $res->getBody(true);
$data = [];
if (preg_match("/Last update: ([^\<]+)/", $content, $matches) && count($matches) > 1) {
$status = 'active';
$data['last_update'] = trim($matches[1]);
}
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": "8d40ec161e2793d4ad3526e66d1723b2043780b6",
"name": "Spotweb",
"website": "https://github.com/spotweb/spotweb",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"description": "Spotweb is a decentralized usenet community based on the Spotnet protocol.",
"enhanced": true,
"tile_background": "dark",
"icon": "spotweb.png"
}

View File

@@ -0,0 +1,19 @@
<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::text('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,6 @@
<ul class="livestats">
<li>
<span class="title">Last update</span>
<span><strong>{!! $last_update !!}</strong></span>
</li>
</ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB