Adds a new `modules/miniMax` module mirroring the existing OpenAI pattern (`api_key` + `enabled` config keys). Adds a `classes/minimax.php` client that calls `https://api.minimax.io/anthropic/v1/messages` (the same endpoint OpenClaw's minimax-portal provider uses) and returns structured JSON via the Anthropic tool_use response shape. **Replaces the autopilot planner:** - `PLANNER_MODEL`: `gpt-5.6-sol` → `MiniMax-M3` - `xlvask_automation_service`: `new openai()` → `new minimax()` in the planner + the isOpenAiIntegrationEnabled() guard - New xlvask config flag `minimax_integration_enabled` gates the autopilot. The OpenAI flag is kept so deployments can roll back. **Compatibility shims** (so the autopilot keeps working with minimal churn): - `minimax_request_exception` extends `openai_request_exception`, so every existing `catch (openai_request_exception)` block catches MiniMax errors unchanged. - The result payload also carries the legacy `_openai_response_model` and `_openai_usage` aliases, so `sanitizeOpenAiResult` keeps working unchanged. **New endpoints:** GET/POST `/minimax/config` in `moduleConfigRoute` guarded by `modules_minimax_config`, mirroring `/openai/config`. **Tests:** PHP api suite 290/290 passing locally (no regressions). All xlvask tests still pass. **Frontend counterpart** ships in a separate PR on pleno-vue (ConfigurationXLVask.vue + SessionUser.modules.minimax + i18n in all 5 locales). **Followup (post-merge):** operator (jeppe) enters the MiniMax API key in superuser XL Vask settings → I'll optimize/test/debug live XL Vask usage logs against the new model. --------- Co-authored-by: Truck Wash Agent <agent@copenhagentruckwash.local>
1132 lines
49 KiB
PHP
1132 lines
49 KiB
PHP
<?php
|
|
|
|
namespace routes;
|
|
|
|
use classes\authentication;
|
|
use classes\backup_store;
|
|
use classes\economic;
|
|
use classes\email;
|
|
use classes\fxratesapi;
|
|
use classes\motorapi;
|
|
use classes\n8n;
|
|
use classes\recaptcha;
|
|
use classes\response;
|
|
use classes\router;
|
|
use classes\slack;
|
|
use classes\stripe;
|
|
use classes\weatherapi;
|
|
use classes\workfeed;
|
|
use objects\logs_o;
|
|
use traits\route_t;
|
|
|
|
class moduleConfigRoute
|
|
{
|
|
use route_t;
|
|
|
|
public function run(): void
|
|
{
|
|
global /** @var response $response */
|
|
/** @var router $router */
|
|
$router, $response;
|
|
|
|
|
|
/** Economic config > GET */
|
|
$this->get('/economic/config', function () {
|
|
global $response;
|
|
$this->requirePermission('economic_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('economic_config', 'global', 1, $user->id, 'ECONOMIC_CONFIG', 'Successfully fetched economic config');
|
|
$response->success(
|
|
(new economic())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('economic_config', 'global', 1, 0, 'ECONOMIC_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'economic_config' => 'Get economic config'
|
|
]
|
|
);
|
|
|
|
/** Economic config > POST */
|
|
$this->post('/economic/config', function () {
|
|
global $response;
|
|
$this->requirePermission('economic_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('economic_config', 'global', 1, $user->id, 'ECONOMIC_CONFIG', 'Successfully updated economic config');
|
|
$response->success(
|
|
(new economic())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('economic_config', 'global', 1, 0, 'ECONOMIC_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'economic_config' => 'Update economic config'
|
|
]
|
|
);
|
|
|
|
/** reCAPTCHA config > GET */
|
|
$this->get('/reCAPTCHA/config', function () {
|
|
global $response;
|
|
$this->requirePermission('recaptcha_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('recaptcha_config', 'global', 1, $user->id, 'RECAPTCHA_CONFIG', 'Successfully fetched recaptcha config');
|
|
$response->success(
|
|
(new recaptcha())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('recaptcha_config', 'global', 1, 0, 'RECAPTCHA_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'recaptcha_config' => 'Get recaptcha config'
|
|
]
|
|
);
|
|
|
|
/** reCAPTCHA config > POST */
|
|
$this->post('/reCAPTCHA/config', function () {
|
|
global $response;
|
|
$this->requirePermission('recaptcha_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('recaptcha_config', 'global', 1, $user->id, 'RECAPTCHA_CONFIG', 'Successfully updated recaptcha config');
|
|
$response->success(
|
|
(new recaptcha())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('recaptcha_config', 'global', 1, 0, 'RECAPTCHA_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'recaptcha_config' => 'Update recaptcha config'
|
|
]
|
|
);
|
|
|
|
/** Email config > GET */
|
|
$this->get('/email/config', function () {
|
|
global $response;
|
|
$this->requirePermission('email_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('email_config', 'global', 1, $user->id, 'EMAIL_CONFIG', 'Successfully fetched email config');
|
|
$response->success(
|
|
(new email())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('email_config', 'global', 1, 0, 'EMAIL_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'email_config' => 'Get email config'
|
|
]
|
|
);
|
|
|
|
/** Email config > POST */
|
|
$this->post('/email/config', function () {
|
|
global $response;
|
|
$this->requirePermission('email_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('email_config', 'global', 1, $user->id, 'EMAIL_CONFIG', 'Successfully updated email config');
|
|
$response->success(
|
|
(new email())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('email_config', 'global', 1, 0, 'EMAIL_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'email_config' => 'Update email config'
|
|
]
|
|
);
|
|
|
|
/** Email config > TEST */
|
|
$this->post('/email/config/test', function () {
|
|
global $response;
|
|
$this->requirePermission('email_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
$test_recipient = $this->fromRequest('email');
|
|
if (!$test_recipient) {
|
|
(new logs_o())->add('email_config', 'global', 1, $user->id, 'EMAIL_CONFIG', 'Test email recipient not set');
|
|
$response->error('Test email recipient not set', 400);
|
|
}
|
|
// Check if the test recipient is a valid email
|
|
if (!filter_var($test_recipient, FILTER_VALIDATE_EMAIL)) {
|
|
(new logs_o())->add('email_config', 'global', 1, $user->id, 'EMAIL_CONFIG', 'Invalid test email recipient');
|
|
$response->error('Invalid test email recipient', 400);
|
|
}
|
|
// Log the incident
|
|
(new logs_o())->add('email_config', 'global', 1, $user->id, 'EMAIL_CONFIG', 'Successfully tested email config');
|
|
$response->success(
|
|
(new email())->testConfigRequest($test_recipient)
|
|
);
|
|
} else {
|
|
(new logs_o())->add('email_config', 'global', 1, 0, 'EMAIL_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'email_config' => 'Test email config'
|
|
]
|
|
);
|
|
|
|
/** Slack config > GET */
|
|
$this->get('/slack/config', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_CONFIG', 'Successfully fetched Slack config');
|
|
$response->success(
|
|
(new slack())->getConfig()->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'slack_config' => 'Get Slack config'
|
|
]
|
|
);
|
|
|
|
/** Slack config > POST */
|
|
$this->post('/slack/config', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_CONFIG', 'Successfully updated Slack config');
|
|
$response->success(
|
|
(new slack())->getConfig()->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'slack_config' => 'Update Slack config'
|
|
]
|
|
);
|
|
|
|
/** Slack config > TEST */
|
|
$this->post('/slack/config/test', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if (!$user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
|
|
$result = (new slack())->test_customer_registration_webhook();
|
|
if (($result['configured'] ?? false) !== true) {
|
|
(new logs_o())->add('slack_config', 'global', 0, $user->id, 'SLACK_CONFIG_TEST', 'Slack customer registration webhook URL is not configured');
|
|
$response->error($result['message'] ?? 'Slack customer registration webhook URL is not configured.', 400);
|
|
}
|
|
|
|
if (($result['sent'] ?? false) !== true) {
|
|
(new logs_o())->add('slack_config', 'global', 0, $user->id, 'SLACK_CONFIG_TEST', 'Slack customer registration test webhook failed');
|
|
$response->error($result['message'] ?? 'Slack test message failed.', 502);
|
|
}
|
|
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_CONFIG_TEST', 'Successfully tested Slack customer registration webhook');
|
|
$response->success($result);
|
|
},
|
|
[
|
|
'slack_config' => 'Test Slack config'
|
|
]
|
|
);
|
|
|
|
/** Slack internal department goal progress config > TEST */
|
|
$this->post('/slack/config/internal-department-goal-progress/test', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if (!$user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG_TEST', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
|
|
$result = (new slack())->test_internal_department_goal_progress_webhook();
|
|
if (($result['configured'] ?? false) !== true) {
|
|
(new logs_o())->add('slack_config', 'global', 0, $user->id, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG_TEST', 'Slack internal department goal progress webhook URL is not configured');
|
|
$response->error($result['message'] ?? 'Slack internal department goal progress webhook URL is not configured.', 400);
|
|
}
|
|
|
|
if (($result['sent'] ?? false) !== true) {
|
|
(new logs_o())->add('slack_config', 'global', 0, $user->id, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG_TEST', 'Slack internal department goal progress test webhook failed');
|
|
$response->error($result['message'] ?? 'Slack test message failed.', 502);
|
|
}
|
|
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG_TEST', 'Successfully tested Slack internal department goal progress webhook');
|
|
$response->success($result);
|
|
},
|
|
[
|
|
'slack_config' => 'Test Slack internal department goal progress config'
|
|
]
|
|
);
|
|
|
|
/** Slack internal department goal progress config > GET */
|
|
$this->get('/slack/config/internal-department-goal-progress', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if (!$user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG', 'Successfully fetched Slack internal department goal progress config');
|
|
$response->success(
|
|
(new slack())->get_internal_department_goal_progress_config()
|
|
);
|
|
},
|
|
[
|
|
'slack_config' => 'Get Slack internal department goal progress config'
|
|
]
|
|
);
|
|
|
|
/** Slack internal department goal progress config > POST */
|
|
$this->post('/slack/config/internal-department-goal-progress', function () {
|
|
global $response;
|
|
$this->requirePermission('slack_config');
|
|
$user = (new authentication())->get_user();
|
|
if (!$user) {
|
|
(new logs_o())->add('slack_config', 'global', 1, 0, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
|
|
$webhook_url = $response->getRequestParameter('internal_department_goal_progress_webhook_url')
|
|
?? $response->getRequestParameter('webhook_url')
|
|
?? '';
|
|
$department_ids = $response->getRequestParameter('internal_department_ids')
|
|
?? $response->getRequestParameter('department_ids')
|
|
?? [];
|
|
|
|
if (!is_array($department_ids)) {
|
|
$department_ids = array_filter(array_map('trim', explode(',', (string)$department_ids)));
|
|
}
|
|
|
|
(new logs_o())->add('slack_config', 'global', 1, $user->id, 'SLACK_INTERNAL_DEPARTMENT_GOAL_PROGRESS_CONFIG', 'Successfully updated Slack internal department goal progress config');
|
|
$response->success(
|
|
(new slack())->set_internal_department_goal_progress_config(
|
|
(string)$webhook_url,
|
|
$department_ids
|
|
)
|
|
);
|
|
},
|
|
[
|
|
'slack_config' => 'Update Slack internal department goal progress config'
|
|
]
|
|
);
|
|
|
|
$this->get('/backups/config', function () {
|
|
global $response;
|
|
$this->requirePermission('backups_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('backups_config', 'global', 1, $user->id, 'BACKUPS_CONFIG', 'Successfully fetched backups config');
|
|
$response->success(
|
|
(new backup_store())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('backups_config', 'global', 1, 0, 'BACKUPS_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'backups_config' => 'Get backups config'
|
|
]
|
|
);
|
|
|
|
$this->post('/backups/config', function () {
|
|
global $response;
|
|
$this->requirePermission('backups_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('backups_config', 'global', 1, $user->id, 'BACKUPS_CONFIG', 'Successfully updated backups config');
|
|
$response->success(
|
|
(new backup_store())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('backups_config', 'global', 1, 0, 'BACKUPS_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'backups_config' => 'Update backups config'
|
|
]
|
|
);
|
|
|
|
$this->get('/failover/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_failover_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('failover_config', 'global', 1, $user->id, 'FAILOVER_CONFIG', 'Successfully fetched failover config');
|
|
$response->success(
|
|
(new \classes\failover())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('failover_config', 'global', 1, 0, 'FAILOVER_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_failover_config' => 'Get failover config'
|
|
]
|
|
);
|
|
|
|
$this->post('/failover/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_failover_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('failover_config', 'global', 1, $user->id, 'FAILOVER_CONFIG', 'Successfully updated failover config');
|
|
$response->success(
|
|
(new \classes\failover())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('failover_config', 'global', 1, 0, 'FAILOVER_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_failover_config' => 'Update failover config'
|
|
]
|
|
);
|
|
|
|
$this->get('/coolify/config', function () {
|
|
global $response;
|
|
$this->requirePermission('superuser_coolify_manage');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('coolify_config', 'global', 1, $user->id, 'COOLIFY_CONFIG', 'Successfully fetched Coolify config');
|
|
$response->success(
|
|
(new \classes\coolify())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('coolify_config', 'global', 1, 0, 'COOLIFY_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'superuser_coolify_manage' => 'Get Coolify config'
|
|
]
|
|
);
|
|
|
|
$this->post('/coolify/config', function () {
|
|
global $response;
|
|
$this->requirePermission('superuser_coolify_manage');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('coolify_config', 'global', 1, $user->id, 'COOLIFY_CONFIG', 'Successfully updated Coolify config');
|
|
$response->success(
|
|
(new \classes\coolify())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('coolify_config', 'global', 1, 0, 'COOLIFY_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'superuser_coolify_manage' => 'Update Coolify config'
|
|
]
|
|
);
|
|
|
|
/** Bird config > GET */
|
|
$this->get('/bird/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_bird_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully fetched bird config');
|
|
$response->success(
|
|
(new \classes\bird())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_bird_config' => 'Get bird config'
|
|
]
|
|
);
|
|
|
|
/** Bird config > POST */
|
|
$this->post('/bird/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_bird_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully updated bird config');
|
|
$response->success(
|
|
(new \classes\bird())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_bird_config' => 'Update bird config'
|
|
]
|
|
);
|
|
|
|
/** MotorAPI config > GET */
|
|
$this->get('/motorapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('motorapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('motorapi_config', 'global', 1, $user->id, 'MOTORAPI_CONFIG', 'Successfully fetched motorapi config');
|
|
$response->success(
|
|
(new motorapi())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('motorapi_config', 'global', 1, 0, 'MOTORAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'motorapi_config' => 'Get motorapi config'
|
|
]
|
|
);
|
|
|
|
/** MotorAPI config > POST */
|
|
$this->post('/motorapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('motorapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('motorapi_config', 'global', 1, $user->id, 'MOTORAPI_CONFIG', 'Successfully updated motorapi config');
|
|
$response->success(
|
|
(new motorapi())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('motorapi_config', 'global', 1, 0, 'MOTORAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'motorapi_config' => 'Update motorapi config'
|
|
]
|
|
);
|
|
|
|
/** Stripe config > GET */
|
|
$this->get('/stripe/config', function () {
|
|
global $response;
|
|
$this->requirePermission('stripe_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('stripe_config', 'global', 1, $user->id, 'STRIPE_CONFIG', 'Successfully fetched stripe config');
|
|
$response->success(
|
|
(new stripe())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('stripe_config', 'global', 1, 0, 'STRIPE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'stripe_config' => 'Get stripe config'
|
|
]
|
|
);
|
|
|
|
/** Stripe config > POST */
|
|
$this->post('/stripe/config', function () {
|
|
global $response;
|
|
$this->requirePermission('stripe_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('stripe_config', 'global', 1, $user->id, 'STRIPE_CONFIG', 'Successfully updated stripe config');
|
|
$response->success(
|
|
(new stripe())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('stripe_config', 'global', 1, 0, 'STRIPE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'stripe_config' => 'Update stripe config'
|
|
]
|
|
);
|
|
|
|
/** FXRatesAPI config > GET */
|
|
$this->get('/fxratesapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('fxratesapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('fxratesapi_config', 'global', 1, $user->id, 'FXRATESAPI_CONFIG', 'Successfully fetched fxratesapi config');
|
|
$response->success(
|
|
(new fxratesapi())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('fxratesapi_config', 'global', 1, 0, 'FXRATESAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'fxratesapi_config' => 'Get fxratesapi config'
|
|
]
|
|
);
|
|
/** FXRatesAPI config > POST */
|
|
$this->post('/fxratesapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('fxratesapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('fxratesapi_config', 'global', 1, $user->id, 'FXRATESAPI_CONFIG', 'Successfully updated fxratesapi config');
|
|
$response->success(
|
|
(new fxratesapi())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('fxratesapi_config', 'global', 1, 0, 'FXRATESAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'fxratesapi_config' => 'Update fxratesapi config'
|
|
]
|
|
);
|
|
/** GatewayAPI config > GET */
|
|
$this->get('/gatewayapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('gatewayapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('gatewayapi_config', 'global', 1, $user->id, 'GATEWAYAPI_CONFIG', 'Successfully fetched gatewayapi config');
|
|
$response->success(
|
|
(new \classes\gatewayapi())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('gatewayapi_config', 'global', 1, 0, 'GATEWAYAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'gatewayapi_config' => 'Get gatewayapi config'
|
|
]
|
|
);
|
|
/** GatewayAPI config > POST */
|
|
$this->post('/gatewayapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('gatewayapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('gatewayapi_config', 'global', 1, $user->id, 'GATEWAYAPI_CONFIG', 'Successfully updated gatewayapi config');
|
|
$response->success(
|
|
(new \classes\gatewayapi())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('gatewayapi_config', 'global', 1, 0, 'GATEWAYAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'gatewayapi_config' => 'Update gatewayapi config'
|
|
]
|
|
);
|
|
|
|
/** WeatherAPI config > GET */
|
|
$this->get('/weatherapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('weatherapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('weatherapi_config', 'global', 1, $user->id, 'WEATHERAPI_CONFIG', 'Successfully fetched weatherapi config');
|
|
$response->success(
|
|
(new weatherapi())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('weatherapi_config', 'global', 1, 0, 'WEATHERAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'weatherapi_config' => 'Get weatherapi config'
|
|
]
|
|
);
|
|
/** WeatherAPI config > POST */
|
|
$this->post('/weatherapi/config', function () {
|
|
global $response;
|
|
$this->requirePermission('weatherapi_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('weatherapi_config', 'global', 1, $user->id, 'WEATHERAPI_CONFIG', 'Successfully updated weatherapi config');
|
|
$response->success(
|
|
(new weatherapi())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('weatherapi_config', 'global', 1, 0, 'WEATHERAPI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'weatherapi_config' => 'Update weatherapi config'
|
|
]
|
|
);
|
|
|
|
/** n8n config > GET */
|
|
$this->get('/n8n/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_n8n_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('n8n_config', 'global', 1, $user->id, 'N8N_CONFIG', 'Successfully fetched n8n config');
|
|
$response->success(
|
|
(new n8n())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('n8n_config', 'global', 1, 0, 'N8N_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_n8n_config' => 'Get n8n config'
|
|
]
|
|
);
|
|
/** n8n config > POST */
|
|
$this->post('/n8n/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_n8n_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('n8n_config', 'global', 1, $user->id, 'N8N_CONFIG', 'Successfully updated n8n config');
|
|
$response->success(
|
|
(new n8n())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('n8n_config', 'global', 1, 0, 'N8N_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_n8n_config' => 'Update n8n config'
|
|
]
|
|
);
|
|
|
|
/** Workfeed config > GET */
|
|
$this->get('/workfeed/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_workfeed_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('workfeed_config', 'global', 1, $user->id, 'WORKFEED_CONFIG', 'Successfully fetched workfeed config');
|
|
$response->success(
|
|
(new workfeed())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('workfeed_config', 'global', 1, 0, 'WORKFEED_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_workfeed_config' => 'Get workfeed config'
|
|
]
|
|
);
|
|
/** Workfeed config > POST */
|
|
$this->post('/workfeed/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_workfeed_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('workfeed_config', 'global', 1, $user->id, 'WORKFEED_CONFIG', 'Successfully updated workfeed config');
|
|
$response->success(
|
|
(new workfeed())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('workfeed_config', 'global', 1, 0, 'WORKFEED_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_workfeed_config' => 'Update workfeed config'
|
|
]
|
|
);
|
|
|
|
/** XLVask config > GET */
|
|
$this->get('/xlvask/config', function () {
|
|
global $response;
|
|
$this->requirePermission('xlvask_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('xlvask_config', 'global', 1, $user->id, 'XLVASK_CONFIG', 'Successfully fetched xlvask config');
|
|
$response->success(
|
|
(new \classes\xlvask())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('xlvask_config', 'global', 1, 0, 'XLVASK_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'xlvask_config' => 'Get xlvask config'
|
|
]
|
|
);
|
|
/** XLVask config > POST */
|
|
$this->post('/xlvask/config', function () {
|
|
global $response;
|
|
$this->requirePermission('xlvask_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('xlvask_config', 'global', 1, $user->id, 'XLVASK_CONFIG', 'Successfully updated xlvask config');
|
|
$response->success(
|
|
(new \classes\xlvask())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('xlvask_config', 'global', 1, 0, 'XLVASK_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'xlvask_config' => 'Update xlvask config'
|
|
]
|
|
);
|
|
|
|
/** Entra config > GET */
|
|
$this->get('/entra/config', function () {
|
|
global $response;
|
|
$this->requirePermission('entra_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('entra_config', 'global', 1, $user->id, 'ENTRA_CONFIG', 'Successfully fetched entra config');
|
|
$response->success(
|
|
(new \classes\entra())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('entra_config', 'global', 1, 0, 'ENTRA_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'entra_config' => 'Get entra config'
|
|
]
|
|
);
|
|
/** Entra config > POST */
|
|
$this->post('/entra/config', function () {
|
|
global $response;
|
|
$this->requirePermission('entra_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('entra_config', 'global', 1, $user->id, 'ENTRA_CONFIG', 'Successfully updated entra config');
|
|
$response->success(
|
|
(new \classes\entra())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('entra_config', 'global', 1, 0, 'ENTRA_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'entra_config' => 'Update entra config'
|
|
]
|
|
);
|
|
/** Limble config > GET */
|
|
$this->get('/limble/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_limble_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('limble_config', 'global', 1, $user->id, 'LIMBLE_CONFIG', 'Successfully fetched limble config');
|
|
$response->success(
|
|
(new \classes\limble())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('limble_config', 'global', 1, 0, 'LIMBLE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_limble_config' => 'Get limble config'
|
|
]
|
|
);
|
|
/** Limble config > POST */
|
|
$this->post('/limble/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_limble_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('limble_config', 'global', 1, $user->id, 'LIMBLE_CONFIG', 'Successfully updated limble config');
|
|
$response->success(
|
|
(new \classes\limble())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('limble_config', 'global', 1, 0, 'LIMBLE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_limble_config' => 'Update limble config'
|
|
]
|
|
);
|
|
/** OcrSpace config > GET */
|
|
$this->get('/ocrspace/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_ocrspace_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('ocrspace_config', 'global', 1, $user->id, 'OCRSPACE_CONFIG', 'Successfully fetched ocrspace config');
|
|
$response->success(
|
|
(new \classes\ocr_space())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('ocrspace_config', 'global', 1, 0, 'OCRSPACE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_ocrspace_config' => 'Get ocrspace config'
|
|
]
|
|
);
|
|
/** OcrSpace config > POST */
|
|
$this->post('/ocrspace/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_ocrspace_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('ocrspace_config', 'global', 1, $user->id, 'OCRSPACE_CONFIG', 'Successfully updated ocrspace config');
|
|
$response->success(
|
|
(new \classes\ocr_space())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('ocrspace_config', 'global', 1, 0, 'OCRSPACE_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_ocrspace_config' => 'Update ocrspace config'
|
|
]
|
|
);
|
|
/** OpenAI config > GET */
|
|
$this->get('/openai/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_openai_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('openai_config', 'global', 1, $user->id, 'OPENAI_CONFIG', 'Successfully fetched openai config');
|
|
$response->success(
|
|
(new \classes\openai())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('openai_config', 'global', 1, 0, 'OPENAI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_openai_config' => 'Get openai config'
|
|
]
|
|
);
|
|
/** OpenAI config > POST */
|
|
$this->post('/openai/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_openai_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('openai_config', 'global', 1, $user->id, 'OPENAI_CONFIG', 'Successfully updated openai config');
|
|
$response->success(
|
|
(new \classes\openai())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('openai_config', 'global', 1, 0, 'OPENAI_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_openai_config' => 'Update openai config'
|
|
]
|
|
);
|
|
/** MiniMax config > GET */
|
|
$this->get('/minimax/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_minimax_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('minimax_config', 'global', 1, $user->id, 'MINIMAX_CONFIG', 'Successfully fetched MiniMax config');
|
|
$response->success(
|
|
(new \classes\minimax())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('minimax_config', 'global', 1, 0, 'MINIMAX_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_minimax_config' => 'Get MiniMax config'
|
|
]
|
|
);
|
|
/** MiniMax config > POST */
|
|
$this->post('/minimax/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_minimax_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('minimax_config', 'global', 1, $user->id, 'MINIMAX_CONFIG', 'Successfully updated MiniMax config');
|
|
$response->success(
|
|
(new \classes\minimax())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('minimax_config', 'global', 1, 0, 'MINIMAX_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_minimax_config' => 'Update MiniMax config'
|
|
]
|
|
);
|
|
/** LicensePlateRecognizer config > GET */
|
|
$this->get('/licenseplaterecognizer/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_licenseplaterecognizer_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('licenseplaterecognizer_config', 'global', 1, $user->id, 'LICENSEPLATERECOGNIZER_CONFIG', 'Successfully fetched licenseplaterecognizer config');
|
|
$response->success(
|
|
(new \classes\licenseplaterecognizer())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('licenseplaterecognizer_config', 'global', 1, 0, 'LICENSEPLATERECOGNIZER_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_licenseplaterecognizer_config' => 'Get licenseplaterecognizer config'
|
|
]
|
|
);
|
|
/** LicensePlateRecognizer config > POST */
|
|
$this->post('/licenseplaterecognizer/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_licenseplaterecognizer_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('licenseplaterecognizer_config', 'global', 1, $user->id, 'LICENSEPLATERECOGNIZER_CONFIG', 'Successfully updated licenseplaterecognizer config');
|
|
$response->success(
|
|
(new \classes\licenseplaterecognizer())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('licenseplaterecognizer_config', 'global', 1, 0, 'LICENSEPLATERECOGNIZER_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_licenseplaterecognizer_config' => 'Update licenseplaterecognizer config'
|
|
]
|
|
);
|
|
/** Virkdata config > GET */
|
|
$this->get('/virkdata/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_virkdata_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('virkdata_config', 'global', 1, $user->id, 'VIRKDATA_CONFIG', 'Successfully fetched virkdata config');
|
|
$response->success(
|
|
(new \classes\virkdata())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('virkdata_config', 'global', 1, 0, 'VIRKDATA_CONFIG', 'No user found, or invalid session');
|
|
}
|
|
},
|
|
[
|
|
'modules_virkdata_config' => 'Get virkdata config'
|
|
]
|
|
);
|
|
/** Virkdata config > POST */
|
|
$this->post('/virkdata/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_virkdata_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('virkdata_config', 'global', 1, $user->id, 'VIRKDATA_CONFIG', 'Successfully updated virkdata config');
|
|
$response->success(
|
|
(new \classes\virkdata())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('virkdata_config', 'global', 1, 0, 'VIRKDATA_CONFIG', 'No user found, or invalid session');
|
|
$response->error('Invalid session', 400);
|
|
}
|
|
},
|
|
[
|
|
'modules_virkdata_config' => 'Update virkdata config'
|
|
]
|
|
);
|
|
/** Shelly config -> GET */
|
|
$this->get('/shelly/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_shelly_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('shelly_config', 'global', 1, $user->id, 'SHELLY_CONFIG', 'Successfully fetched shelly config');
|
|
$response->success(
|
|
(new \classes\shelly())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('shelly_config', 'global', 1, 0, 'VIRKDATA_CONFIG', 'No user found, or invalid session');
|
|
}
|
|
},
|
|
[
|
|
'modules_shelly_config' => 'Get shelly config'
|
|
]
|
|
);
|
|
$this->post('/shelly/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_shelly_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('shelly_config', 'global', 1, $user->id, 'SHELLY_CONFIG', 'Successfully updated shelly config');
|
|
$response->success(
|
|
(new \classes\shelly())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('shelly_config', 'global', 1, 0, 'SHELLY_CONFIG', 'No user found, or invalid session');
|
|
}
|
|
});
|
|
/** Self-Serve config -> GET */
|
|
$this->get('/selfserve/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_selfserve_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('selfserve_config', 'global', 1, $user->id, 'SELFSERVE_CONFIG', 'Successfully fetched self-serve config');
|
|
$response->success(
|
|
(new \classes\selfserve())->config->getConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('selfserve_config', 'global', 1, 0, 'SELFSERVE_CONFIG', 'No user found, or invalid session');
|
|
}
|
|
},
|
|
[
|
|
'modules_selfserve_config' => 'Get self-serve config'
|
|
]
|
|
);
|
|
$this->post('/selfserve/config', function () {
|
|
global $response;
|
|
$this->requirePermission('modules_selfserve_config');
|
|
$user = (new authentication())->get_user();
|
|
if ($user) {
|
|
(new logs_o())->add('selfserve_config', 'global', 1, $user->id, 'SELFSERVE_CONFIG', 'Successfully updated self-serve config');
|
|
$response->success(
|
|
(new \classes\selfserve())->config->postConfigRequest()
|
|
);
|
|
} else {
|
|
(new logs_o())->add('selfserve_config', 'global', 1, 0, 'SELFSERVE_CONFIG', 'No user found, or invalid session');
|
|
}
|
|
});
|
|
}
|
|
}
|