Skip to content

Commit

Permalink
Add Maintainerr Enhanced App
Browse files Browse the repository at this point in the history
  • Loading branch information
albinmedoc committed Jun 2, 2024
1 parent e80ddb5 commit e12ba48
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Maintainerr/Maintainerr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\SupportedApps\Maintainerr;

class Maintainerr 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

public function __construct()
{
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
}

public function test()
{
$test = parent::appTest($this->url(""));
echo $test->status;
}

public function livestats()
{
$status = "inactive";
$data = [];

$rules = json_decode(parent::execute($this->url("api/rules"))->getBody());
$activeRules = $filteredObjects = array_filter($rules, function ($rule) {
return isset($rule->isActive) && $rule->isActive;
});

$data["rules"] = count($activeRules);

return parent::getLiveStats($status, $data);
}

public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
return $api_url;
}
}
10 changes: 10 additions & 0 deletions Maintainerr/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appid": "34048cd0432f63fda7286fc2d843f0d68b4d28c5",
"name": "Maintainerr",
"website": "https://maintainerr.info",
"license": "MIT license",
"description": "Maintainerr makes managing your media easy. It’s a one-stop-shop for handling those outlying shows and movies that take up precious space",
"enhanced": true,
"tile_background": "dark",
"icon": "maintainerr.svg"
}
10 changes: 10 additions & 0 deletions Maintainerr/config.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<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, ['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>
6 changes: 6 additions & 0 deletions Maintainerr/livestats.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ul class="livestats">
<li>
<span class="title">Rules</span>
<strong>{!! $rules !!}</strong>
</li>
</ul>
41 changes: 41 additions & 0 deletions Maintainerr/maintainerr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e12ba48

Please sign in to comment.