23header(
'Content-Type: application/json');
29if ($_SERVER[
'REQUEST_METHOD'] ===
'POST') {
30 $moduleName = isset($_POST[
'moduleName']) ? $_POST[
'moduleName'] :
null;
31 $version = isset($_POST[
'version']) ? $_POST[
'version'] :
null;
33 if ($moduleName && $version) {
37 Util::logDebug(
"Applying config for module: $moduleName, version: $version");
40 $configKey = $moduleName .
'Version';
43 Util::logInfo(
"Successfully updated $moduleName version to $version in bearsampp.conf");
47 'message' =>
"Configuration updated successfully!\n\n✓ Set $moduleName" .
"Version = \"$version\"\n\nNow right-click the Bearsampp tray icon and select 'Reload' to activate the new version."
50 }
catch (Exception $e) {
51 $response = [
'error' =>
'Failed to update configuration: ' . $e->getMessage()];
52 error_log(
'Exception in apply module config: ' . $e->getMessage());
55 $response = [
'error' =>
'Invalid module name or version.'];
58 $response = [
'error' =>
'Invalid request method.'];
static logInfo($data, $file=null)
static logDebug($data, $file=null)