<?php
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

require_once('../settings.php');

$action = filter_input(INPUT_GET, 'do', FILTER_SANITIZE_STRING);

if ($action === 'get_apps') {
    $apps = new \CAI\CAICP\Applications(CP_ROOT_REL);
    echo $apps->get_avail_json();
} elseif ($action === 'get_enabled_apps') {
    $apps = new \CAI\CAICP\Applications(CP_ROOT_REL);
    echo $apps->get_enabled_json();
}
