ajout heimdall
This commit is contained in:
58
heimdall/config/www/SupportedApps/Navidrome/Navidrome.php
Executable file
58
heimdall/config/www/SupportedApps/Navidrome/Navidrome.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php namespace App\SupportedApps\Navidrome;
|
||||
|
||||
class Navidrome 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('rest/ping'), $this->getAttributes());
|
||||
if ($test->code === 200) {
|
||||
$result = json_decode($test->response);
|
||||
if ($result->{'subsonic-response'}->status != 'ok') {
|
||||
$test->status = $result->{'subsonic-response'}->error->message;
|
||||
}
|
||||
}
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('rest/getNowPlaying'), $this->getAttributes());
|
||||
$result = json_decode($res->getBody(), true);
|
||||
|
||||
$data['now_playing'] = !$result['subsonic-response']['nowPlaying'] ? 0 : count($result['subsonic-response']['nowPlaying']);
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
|
||||
private function getAttributes()
|
||||
{
|
||||
$salt = 'omHQfVJ';
|
||||
$authToken = md5($this->config->password . $salt);
|
||||
return [
|
||||
'query' => [
|
||||
'u' => $this->config->username, // username
|
||||
't' => $authToken, // token
|
||||
's' => $salt, // salt
|
||||
'v' => '1.16.1', // subsonic API version
|
||||
'c' => 'heimdall', // client name
|
||||
'f' => 'json', // request data format
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function url($endpoint)
|
||||
{
|
||||
$apiUrl = parent::normaliseurl($this->config->url) . $endpoint;
|
||||
return $apiUrl;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/Navidrome/app.json
Executable file
10
heimdall/config/www/SupportedApps/Navidrome/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "31e028553b33bf830e42d88a888ee1093e3dd591",
|
||||
"name": "Navidrome",
|
||||
"website": "https://www.navidrome.org",
|
||||
"license": "GNU General Public License v3.0 only",
|
||||
"description": "Navidrome is a self-hosted, open source music server and streamer. It gives you freedom to listen to your music collection from any browser or mobile device.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "navidrome.png"
|
||||
}
|
||||
19
heimdall/config/www/SupportedApps/Navidrome/config.blade.php
Executable file
19
heimdall/config/www/SupportedApps/Navidrome/config.blade.php
Executable 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) ? $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) ? $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) ? $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>
|
||||
|
||||
6
heimdall/config/www/SupportedApps/Navidrome/livestats.blade.php
Executable file
6
heimdall/config/www/SupportedApps/Navidrome/livestats.blade.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Now Playing</span>
|
||||
<strong>{!! $now_playing !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/Navidrome/navidrome.png
Executable file
BIN
heimdall/config/www/SupportedApps/Navidrome/navidrome.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user