mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-18 22:02:42 +09:00
Initial start of replacing apps list to use github generated list
This commit is contained in:
@@ -39,23 +39,49 @@ class Application extends Model
|
|||||||
public function class()
|
public function class()
|
||||||
{
|
{
|
||||||
$name = $this->name;
|
$name = $this->name;
|
||||||
$name = preg_replace('/\PL/u', '', $name);
|
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
|
||||||
|
|
||||||
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
|
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
|
||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function apps()
|
||||||
|
{
|
||||||
|
$json = json_decode(file_get_contents(storage_path('app/supportedapps.json'))) ?? [];
|
||||||
|
$apps = collect($json->apps);
|
||||||
|
$sorted = $apps->sortBy('name', SORT_NATURAL|SORT_FLAG_CASE);
|
||||||
|
return $sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function autocomplete()
|
||||||
|
{
|
||||||
|
$apps = self::apps();
|
||||||
|
$list = [];
|
||||||
|
foreach($apps as $app) {
|
||||||
|
$list[] = (object)[
|
||||||
|
'label' => $app->name,
|
||||||
|
'value' => $app->appid
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function single($appid)
|
||||||
|
{
|
||||||
|
$apps = self::apps();
|
||||||
|
$app = $apps->where('appid', $appid)->first();
|
||||||
|
$classname = preg_replace('/[^\p{L}\p{N}]/u', '', $app->name);
|
||||||
|
$app->class = '\App\SupportedApps\\'.$classname.'\\'.$classname;
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
|
||||||
public static function applist()
|
public static function applist()
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
$all = self::orderBy('name')->get()->sortBy('name', SORT_NATURAL|SORT_FLAG_CASE);
|
|
||||||
$list['null'] = 'None';
|
$list['null'] = 'None';
|
||||||
foreach($all as $app) {
|
$apps = self::apps();
|
||||||
$name = $app->name;
|
foreach($apps as $app) {
|
||||||
// $name = preg_replace('/\PL/u', '', $name);
|
$list[$app->appid] = $app->name;
|
||||||
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
|
|
||||||
|
|
||||||
$list['\App\SupportedApps\\'.$name.'\\'.$name] = $app->name;
|
|
||||||
}
|
}
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ function getLinkTargetAttribute()
|
|||||||
|
|
||||||
function className($name)
|
function className($name)
|
||||||
{
|
{
|
||||||
$name = preg_replace('/\PL/u', '', $name);
|
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ class ItemController extends Controller
|
|||||||
public function appload(Request $request)
|
public function appload(Request $request)
|
||||||
{
|
{
|
||||||
$output = [];
|
$output = [];
|
||||||
$appname = $request->input('app');
|
$appid = $request->input('app');
|
||||||
|
/*$appname = $request->input('app');
|
||||||
//die($appname);
|
//die($appname);
|
||||||
|
|
||||||
$app_details = Application::where('name', $appname)->firstOrFail();
|
$app_details = Application::where('name', $appname)->firstOrFail();
|
||||||
@@ -338,7 +339,15 @@ class ItemController extends Controller
|
|||||||
$output['config'] = className($app_details->name).'.config';
|
$output['config'] = className($app_details->name).'.config';
|
||||||
} else {
|
} else {
|
||||||
$output['config'] = null;
|
$output['config'] = null;
|
||||||
}
|
}*/
|
||||||
|
$app = Application::single($appid);
|
||||||
|
$output = (array)$app;
|
||||||
|
$output['config'] = null;
|
||||||
|
$output['colour'] = ($app->tile_background == 'light') ? '#fafbfc' : '#161b1f';
|
||||||
|
$output['iconview'] = 'https://raw.githubusercontent.com/linuxserver/Heimdall-Apps/master/' . preg_replace('/[^\p{L}\p{N}]/u', '', $app->name) . '/' . $app->icon;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
return json_encode($output);
|
return json_encode($output);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Application;
|
use App\Application;
|
||||||
use App\SupportedApps;
|
use App\SupportedApps;
|
||||||
|
|
||||||
@@ -32,8 +33,11 @@ class ProcessApps implements ShouldQueue
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$localapps = Application::all();
|
$localapps = Application::all();
|
||||||
$list = json_decode(SupportedApps::getList()->getBody());
|
$json = SupportedApps::getList()->getBody();
|
||||||
$validapps = [];
|
|
||||||
|
Storage::disk('local')->put('supportedapps.json', $json);
|
||||||
|
|
||||||
|
/* $validapps = [];
|
||||||
|
|
||||||
foreach($list->apps as $app) {
|
foreach($list->apps as $app) {
|
||||||
$validapps[] = $app->appid;
|
$validapps[] = $app->appid;
|
||||||
@@ -58,7 +62,7 @@ class ProcessApps implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
//$delete = Application::whereNotIn('appid', $validapps)->delete(); // delete any apps not in list
|
//$delete = Application::whereNotIn('appid', $validapps)->delete(); // delete any apps not in list
|
||||||
// removed the delete so local apps can be added
|
// removed the delete so local apps can be added
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ abstract class SupportedApps
|
|||||||
|
|
||||||
public static function getList()
|
public static function getList()
|
||||||
{
|
{
|
||||||
$list_url = 'https://apps.heimdall.site/list';
|
// $list_url = 'https://apps.heimdall.site/list';
|
||||||
|
$list_url = 'https://appslist.heimdall.site/list.json';
|
||||||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]);
|
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]);
|
||||||
return $client->request('GET', $list_url);
|
return $client->request('GET', $list_url);
|
||||||
}
|
}
|
||||||
|
|||||||
18
public/css/app.css
vendored
18
public/css/app.css
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
|
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
|
||||||
html {
|
html {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
@@ -420,6 +421,23 @@ body {
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.item-container .tooltip {
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background: #00000038;
|
||||||
|
color: white;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 120px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 13px;
|
||||||
|
-webkit-backdrop-filter: blur(8px);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.item-container:hover .tooltip {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.black {
|
.black {
|
||||||
color: #000 !important;
|
color: #000 !important;
|
||||||
|
|||||||
4
public/mix-manifest.json
generated
4
public/mix-manifest.json
generated
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"/css/app.css": "/css/app.css?id=bafda2139c75830558d2",
|
"/css/app.css": "/css/app.css?id=7de7134287f332b33a25",
|
||||||
"/js/app.js": "/js/app.js?id=0ff185efa8c02e94999e"
|
"/js/app.js": "/js/app.js?id=d04c0e0d819506e10194"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,6 +201,24 @@ body {
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.tooltip {
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background: #00000038;
|
||||||
|
color: white;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 120px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 13px;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
.tooltip {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.black {
|
.black {
|
||||||
color: #000!important;
|
color: #000!important;
|
||||||
|
|||||||
@@ -14,5 +14,5 @@
|
|||||||
<a rel="noopener noreferrer" title="{{ App\Item::getApplicationDescription($app->class) }}" class="link{{ title_color($app->colour) }}"{!! $app->link_target !!} href="{{ $app->link }}"><i class="fas {{ $app->link_icon }}"></i></a>
|
<a rel="noopener noreferrer" title="{{ App\Item::getApplicationDescription($app->class) }}" class="link{{ title_color($app->colour) }}"{!! $app->link_target !!} href="{{ $app->link }}"><i class="fas {{ $app->link_icon }}"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<a class="item-edit" href="{{ route($app->link_type.'.edit', [ $app->id ]) }}"><i class="fas fa-pencil"></i></a>
|
<a class="item-edit" href="{{ route($app->link_type.'.edit', [ $app->id ]) }}"><i class="fas fa-pencil"></i></a>
|
||||||
|
@if(App\Item::getApplicationDescription($app->class) !== '')<div class="tooltip">{{ App\Item::getApplicationDescription($app->class) }}</div>@endif
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -19,13 +19,15 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
var availableTags = @json(App\Application::all()->pluck('name'));
|
var availableTags = @json(App\Application::autocomplete());
|
||||||
|
console.log(availableTags)
|
||||||
$( "#appname" ).autocomplete({
|
$( "#appname" ).autocomplete({
|
||||||
source: availableTags,
|
source: availableTags,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
var appvalue = ui.item.value;
|
event.preventDefault();
|
||||||
appload(appvalue);
|
// appload(ui.item.value);
|
||||||
|
$( "#appname" ).val(ui.item.label)
|
||||||
|
$('#apptype').val(ui.item.value).change()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// initial load
|
// initial load
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
$('#tile-preview .title').html($(this).val());
|
$('#tile-preview .title').html($(this).val());
|
||||||
})
|
})
|
||||||
$('#apptype').on('change', function(e) {
|
$('#apptype').on('change', function(e) {
|
||||||
appload($(this).find('option:selected').text());
|
appload($(this).find('option:selected').val());
|
||||||
});
|
});
|
||||||
$('#appcolour').on('change', function(e) {
|
$('#appcolour').on('change', function(e) {
|
||||||
$('#tile-preview .item').css('backgroundColor', $(this).val());
|
$('#tile-preview .item').css('backgroundColor', $(this).val());
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
// Main details
|
// Main details
|
||||||
$('#appimage').html("<img src='"+data.iconview+"' /><input type='hidden' name='icon' value='"+data.icon+"' />");
|
$('#appimage').html("<img src='"+data.iconview+"' /><input type='hidden' name='icon' value='"+data.icon+"' />");
|
||||||
$('input[name=colour]').val(data.colour);
|
$('input[name=colour]').val(data.colour);
|
||||||
$('select[name=class]').val(data.class);
|
$('select[name=class]').val(data.appid);
|
||||||
hueb.setColor( data.colour );
|
hueb.setColor( data.colour );
|
||||||
$('input[name=pinned]').prop('checked', true);
|
$('input[name=pinned]').prop('checked', true);
|
||||||
// Preview details
|
// Preview details
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ Route::get('/autologin/{uuid}', 'Auth\LoginController@autologin')->name('user.au
|
|||||||
|
|
||||||
Route::get('/', 'ItemController@dash')->name('dash');
|
Route::get('/', 'ItemController@dash')->name('dash');
|
||||||
Route::get('check_app_list', 'ItemController@checkAppList')->name('applist');
|
Route::get('check_app_list', 'ItemController@checkAppList')->name('applist');
|
||||||
|
Route::get('single/{appid}', function($appid) {
|
||||||
|
return json_encode(\App\Application::single($appid));
|
||||||
|
})->name('single');
|
||||||
|
|
||||||
Route::resources([
|
Route::resources([
|
||||||
'items' => 'ItemController',
|
'items' => 'ItemController',
|
||||||
|
|||||||
1
storage/app/supportedapps.json
Normal file
1
storage/app/supportedapps.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user