1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-30 13:13:58 +01:00
SKCraft-Launcher/sample-files/upload/packages.php
2015-02-19 13:25:48 -08:00

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);