Skip to content

Commit aeba429

Browse files
authored
Add RomM as an enhanced app (#819)
* Add RomM as an enhanced app * fix linting
1 parent 137fc0a commit aeba429

6 files changed

Lines changed: 85 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Vaultwarden/Thumbs.db
55
BrotherPrinter/Thumbs.db
66
Rustdesk/Thumbs.db
77
.idea
8+
.DS_Store

RomM/RomM.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace App\SupportedApps\RomM;
4+
5+
class RomM extends \App\SupportedApps implements \App\EnhancedApps
6+
{
7+
public $config;
8+
9+
public function __construct()
10+
{
11+
}
12+
13+
public function test()
14+
{
15+
$test = parent::appTest($this->url('api/stats'));
16+
echo $test->status;
17+
}
18+
19+
public function livestats()
20+
{
21+
$status = "inactive";
22+
$res = parent::execute($this->url('api/stats'));
23+
$result = json_decode($res->getBody());
24+
$details = ["visiblestats" => []];
25+
foreach ($this->config->availablestats as $stat) {
26+
$newstat = new \stdClass();
27+
$newstat->title = self::getAvailableStats()[$stat];
28+
$newstat->value = $result->{$stat};
29+
$details["visiblestats"][] = $newstat;
30+
}
31+
return parent::getLiveStats($status, $details);
32+
}
33+
34+
public function url($endpoint)
35+
{
36+
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
37+
return $api_url;
38+
}
39+
40+
public static function getAvailableStats()
41+
{
42+
return [
43+
"PLATFORMS" => "Platforms",
44+
"ROMS" => "Total ROMs",
45+
"SAVES" => "Saves",
46+
"STATES" => "States",
47+
"SCREENSHOTS" => "Screenshots",
48+
"FILESIZE" => "Total Filesize",
49+
];
50+
}
51+
}

RomM/app.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"appid": "2a3931f4ca016a139bcf5a97c85ee0a67825fe43",
3+
"name": "RomM",
4+
"website": "https://romm.app",
5+
"license": "Affero General Public License v3.0",
6+
"description": "RomM is your beautiful, powerful, self-hosted rom manager. Scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators.",
7+
"enhanced": true,
8+
"tile_background": "dark",
9+
"icon": "romm.png"
10+
}

RomM/config.blade.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
2+
<div class="items">
3+
<div class="input">
4+
<label>{{ strtoupper(__('app.url')) }}</label>
5+
{!! Form::text('config[override_url]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
6+
</div>
7+
<div class="input">
8+
<label>Stats to show</label>
9+
{!! Form::select('config[availablestats][]', App\SupportedApps\RomM\RomM::getAvailableStats(), isset($item) ? $item->getConfig()->availablestats ?? null : null, ['multiple' => 'multiple']) !!}
10+
</div>
11+
<div class="input">
12+
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
13+
</div>
14+
</div>
15+

RomM/livestats.blade.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ul class="livestats">
2+
@foreach ($visiblestats as $stat)
3+
<li>
4+
<span class="title">{!! $stat->title !!}</span>
5+
<strong>{!! $stat->value !!}</strong>
6+
</li>
7+
@endforeach
8+
</ul>

RomM/romm.png

31.4 KB
Loading

0 commit comments

Comments
 (0)