mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
firmware: changelogs are pulled from check scripts
Like with text output earlier the update feature is not used from the GUI and brings little to the table. Separate API endpoint is better for these types of actions if the need should ever arise.
This commit is contained in:
parent
b25727a11b
commit
2d382bf870
@ -315,29 +315,28 @@ class FirmwareController extends ApiControllerBase
|
||||
*/
|
||||
public function changelogAction($version)
|
||||
{
|
||||
$this->sessionClose(); // long running action, close session
|
||||
$backend = new Backend();
|
||||
$response = array();
|
||||
$response = ['status' => 'failure'];
|
||||
|
||||
if (!$this->request->isPost()) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->sessionClose(); // long running action, close session
|
||||
|
||||
$filter = new \Phalcon\Filter();
|
||||
$filter->add('version', function ($value) {
|
||||
return preg_replace('/[^0-9a-zA-Z\.]/', '', $value);
|
||||
});
|
||||
$version = $filter->sanitize($version, 'version');
|
||||
|
||||
if ($version == 'update') {
|
||||
$backend->configdRun('firmware changelog fetch');
|
||||
} else {
|
||||
$html = trim($backend->configdRun(sprintf('firmware changelog html %s', $version)));
|
||||
if (!empty($html)) {
|
||||
$response['html'] = $html;
|
||||
}
|
||||
$backend = new Backend();
|
||||
$html = trim($backend->configdRun(sprintf('firmware changelog html %s', $version)));
|
||||
if (!empty($html)) {
|
||||
$response['status'] = 'ok';
|
||||
$response['html'] = $html;
|
||||
}
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user