mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
29 lines
689 B
PHP
29 lines
689 B
PHP
|
<?php
|
||
|
// This file automatically generates packages.json
|
||
|
|
||
|
$files = glob("*.json");
|
||
|
|
||
|
if ($files === false) {
|
||
|
$files = [];
|
||
|
}
|
||
|
|
||
|
$document = [
|
||
|
'minimumVersion' => 1,
|
||
|
'packages' => [],
|
||
|
];
|
||
|
|
||
|
foreach ($files as $file) {
|
||
|
$data = json_decode(file_get_contents($file));
|
||
|
if (isset($data->name) && isset($data->version)) {
|
||
|
$document['packages'][] = [
|
||
|
'name' => $data->name,
|
||
|
'title' => isset($data->title) ? $data->title : $data->name,
|
||
|
'version' => $data->version,
|
||
|
'location' => basename($file),
|
||
|
'priority' => 1,
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
header("Content-Type: text/plain");
|
||
|
echo json_encode($document, JSON_PRETTY_PRINT);
|