Skip to content
This repository was archived by the owner on Apr 4, 2026. It is now read-only.

Commit 6019eba

Browse files
committed
Added Settings Page
1 parent 92f396a commit 6019eba

4 files changed

Lines changed: 40 additions & 26 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Icon="cubes"
2+
Author="dcflachs"
3+
Title="Compose"
4+
Type="xmenu"
5+
Menu="Utilities"
6+
---
7+
<?php
8+
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
9+
$cfg = parse_plugin_cfg($sName);
10+
?>
11+
12+
<form markdown="1" name="compose_manager_settings" method="POST" action="/update.php" target="progressFrame">
13+
<input type="hidden" name="#file" value="<?=$sName?>/<?=$sName?>.cfg">
14+
15+
_(Compose Command Progress Display)_:
16+
: <select name="OUTPUTSTYLE">
17+
<?=mk_option($cfg['OUTPUTSTYLE'], "basic", _("Basic"))?>
18+
<?=mk_option($cfg['OUTPUTSTYLE'], "ttyd", _("Experimental"))?>
19+
</select>
20+
21+
<input type="submit" name="#default" value="_(Default)_">
22+
: <input type="submit" name="#apply" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
23+
</form>

source/compose.manager/default.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OUTPUTSTYLE="basic"

source/compose.manager/php/compose_util.php

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
4+
require_once("/usr/local/emhttp/plugins/dynamix/include/Wrappers.php");
45

56
function logger($string) {
67
$string = escapeshellarg($string);
@@ -26,29 +27,10 @@ function execComposeCommandInTTY($cmd)
2627
}
2728

2829
function echoComposeCommand($action)
29-
// {
30-
// global $plugin_root;
31-
// $path = isset($_POST['path']) ? urldecode(($_POST['path'])) : "";
32-
// $unRaidVars = parse_ini_file("/var/local/emhttp/var.ini");
33-
// if ($unRaidVars['mdState'] != "STARTED" ) {
34-
// echo $plugin_root."/scripts/arrayNotStarted.sh";
35-
// logger("Array not Started!");
36-
// }
37-
// else
38-
// {
39-
// $projectName = basename($path);
40-
// if ( is_file("$path/name") ) {
41-
// $projectName = trim(file_get_contents("$path/name"));
42-
// }
43-
// $projectName = sanitizeStr($projectName);
44-
// $path .= "/compose.yml";
45-
// // exec("chmod +x ".escapeshellarg($plugin_root."/scripts/compose.sh"));
46-
// $composeCommand = $plugin_root."/scripts/compose.sh"."&arg1=".$action."&arg2=".$path."&arg3=".$projectName;
47-
// echo $composeCommand;
48-
// }
49-
// }
5030
{
5131
global $plugin_root;
32+
global $sName;
33+
$cfg = parse_plugin_cfg($sName);
5234
$path = isset($_POST['path']) ? urldecode(($_POST['path'])) : "";
5335
$unRaidVars = parse_ini_file("/var/local/emhttp/var.ini");
5436
if ($unRaidVars['mdState'] != "STARTED" ) {
@@ -63,12 +45,19 @@ function echoComposeCommand($action)
6345
}
6446
$projectName = sanitizeStr($projectName);
6547
$path .= "/compose.yml";
66-
$compose_command = join(" ", array(escapeshellarg($plugin_root."scripts/compose.sh"),escapeshellarg($action),escapeshellarg($path),escapeshellarg($projectName)));
67-
logger($compose_command);
48+
49+
if ($cfg['OUTPUTSTYLE'] == "ttyd") {
50+
$composeCommand = join(" ", array(escapeshellarg($plugin_root."scripts/compose.sh"),escapeshellarg($action),escapeshellarg($path),escapeshellarg($projectName)));
51+
execComposeCommandInTTY($composeCommand);
52+
logger($composeCommand);
53+
$composeCommand = "/plugins/compose.manager/php/show_ttyd.php";
54+
}
55+
else {
56+
$composeCommand = $plugin_root."/scripts/compose.sh"."&arg1=".$action."&arg2=".$path."&arg3=".$projectName;
57+
}
6858

69-
execComposeCommandInTTY($compose_command);
70-
echo "/plugins/compose.manager/php/show_ttyd.php";
71-
logger("/plugins/compose.manager/php/show_ttyd.php");
59+
echo $composeCommand;
60+
logger($composeCommand);
7261
}
7362
}
7463

source/compose.manager/php/defines.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
$compose_root = "/boot/config/plugins/compose.manager/projects";
33
$plugin_root = "/usr/local/emhttp/plugins/compose.manager/";
44
$socket_name = "compose_manager_action";
5+
$sName = "compose.manager";
56
?>

0 commit comments

Comments
 (0)