* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-15 19:59 Liam McLoughlin
2011-08-12 23:17 ` [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
0 siblings, 1 reply; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-15 19:59 UTC (permalink / raw
To: gentoo-commits
commit: d8ab9fad2e88341c8c6cc7c2913ea74625fbe9d2
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Fri Jul 15 19:58:22 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Fri Jul 15 19:58:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=d8ab9fad
Handle \r\n when building the configuration file
---
web/process.php | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/web/process.php b/web/process.php
index 149c1b7..1b68d03 100644
--- a/web/process.php
+++ b/web/process.php
@@ -11,10 +11,10 @@
$root_password = escapeshellarg($_POST["rootpassword"]);
$packages_list = escapeshellarg($_POST["packages"]);
$output_format = escapeshellarg($_POST["format"]);
-
-
+
+ $packages_list = str_replace("\r\n", " ", $packages_list);
$packages_list = str_replace("\n", " ", $packages_list);
-
+
$ini_string = "[vmconfig]
BUILD_ID='$build_id'
@@ -36,11 +36,11 @@ OUTPUT_FORMAT=$output_format";
$client = new GearmanClient();
$client->addServer();
$handle = $client->doBackground("invoke_image_build", $ini_string);
-
+
$db = mysql_connect("localhost","gentoaster","");
if(!$db) die("Could not connect to database ".mysql_error());
mysql_select_db("gentoaster");
mysql_query("INSERT INTO builds (id, handle) VALUES('".$build_id."','".$handle."')");
header("Location: finished.php?uuid=".$build_id);
-?>
\ No newline at end of file
+?>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
@ 2011-07-24 2:43 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-24 2:43 UTC (permalink / raw
To: gentoo-commits
commit: 3dd50e713424c76cdfc709bb4f6b96be9bced1b0
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Jul 21 22:12:21 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Jul 21 22:12:21 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=3dd50e71
Added zonetab loading for timezone lists
---
web/index.php | 147 +++++++++++++--------------------------------------------
1 files changed, 33 insertions(+), 114 deletions(-)
diff --git a/web/index.php b/web/index.php
index 86b608c..181d07b 100644
--- a/web/index.php
+++ b/web/index.php
@@ -1,3 +1,25 @@
+<?php
+ define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
+
+ $timezones = array();
+ $zonetab = file(ZONETAB);
+ foreach ($zonetab as $buf)
+ {
+ if (substr($buf,0,1)=='#') continue;
+ $rec = preg_split('/\s+/',$buf);
+ $key = $rec[2];
+ $val = $rec[2];
+ $c = count($rec);
+ for ($i=3;$i<$c;$i++) $val.= ' '.$rec[$i];
+ $timezones[$key] = $val;
+ ksort($timezones);
+ }
+ $timezoneOption = "";
+ foreach ($timezones as $timezone => $description)
+ {
+ $timezoneOption .= "<option>".$timezone."</option>\n";
+ }
+?>
<html>
<head>
<title>Gentoaster</title>
@@ -23,7 +45,7 @@
</div>
<div id="locale" class="step">
<h1>Locale</h1>
-
+
<label for="locale_language">Language</label><br />
<select id="locale_language" class="required" name="language">
<option>English (UK)</option>
@@ -38,36 +60,36 @@
<label for="locale_timezone">Timezone</label><br />
<select id="locale_timezone" class="required" name="timezone">
- <option>Europe/London</option>
+ <?php echo $timezoneOption; ?>
</select>
<br>
</div>
<div id="user" class="step">
<h1>User details</h1>
-
+
<label for="user_username">Username</label><br />
<input id="user_username" class="required" type="text" name="username"><br>
<label for="user_password">Password</label><br />
<input id="user_password" class="required" type="password" name="password">
<input id="user_confirmpassword" class="required" type="password" name="confirmpassword"><br>
-
+
<label for="user_rootpassword">Root Password</label><br />
<input id="user_rootpassword" class="required" type="password" name="rootpassword">
<input id="user_confirmrootpassword" class="required" type="password" name="confirmrootpassword"><br>
</div>
<div id="network" class="step">
<h1>Network</h1>
-
+
<label for="network_hostname">Hostname</label><br />
<input id="network_hostname" class="required" type="text" name="hostname"><br>
</div>
<div id="partitioning" class="step">
<h1>Partitioning</h1>
-
+
<label for="partitioning_size">Disk size</label><br />
<input id="partitioning_size" class="required" type="text" name="size" value="4096"><br>
-
+
<label for="">Split</label><br /><br />
<div id="partitioning_split" name="split"></div><br /><br />
<div id="partitioning_display">Not yet updated</div><br />
@@ -77,14 +99,14 @@
</div>
<div id="packages" class="step">
<h1>Packages</h1>
-
+
<label for="packages_packages">Packages list</label><br /><br />
<textarea id="packages_packages" name="packages" style="width: 680px; height: 330px;">dhcpcd</textarea>
<br>
</div>
<div id="format" class="step submit_step">
<h1>Image format</h1>
-
+
<label for="format_format">Output format</label><br />
<select id="format_format" class="required" name="format">
<option value="raw">Raw</option>
@@ -106,109 +128,6 @@
</div>
</form>
</div>
- <script type="text/javascript">
- $(function(){
- $("#wizard").formwizard({
- validationEnabled: true,
- focusFirstInput: true,
- disableUIStyles: true,
- //historyEnabled: true,
- validationOptions: {
- rules: {
- username: {
- minlength: 2
- },
- password: {
- minlength: 5
- },
- confirmpassword: {
- minlength: 5,
- equalTo: "#user_password"
- },
- boot_size: {
- min: 32
- },
- swap_size: {
- min: 16
- },
- root_size: {
- min: 3072
- },
- size: {
- min: 4020
- }
- },
- messages: {
- username: {
- minlength: "Your username must consist of at least 2 characters"
- },
- password: {
- minlength: "Your password must be at least 5 characters long"
- },
- confirmpassword: {
- minlength: "Your password must be at least 5 characters long",
- equalTo: "Please enter the same password in both boxes"
- },
- boot_size: {
- min: "Your boot partition must be at least 32MB"
- },
- swap_size: {
- min: "Your swap partition must be at least 128MB"
- },
- root_size: {
- min: "Your root partition must be at least 3072MB"
- },
- size: {
- min: "Your disk image must be at least 4020MB"
- }
- }
- }
- });
-
- function partitioning_update(event, ui) {
- if(!ui.values) {
- ui.values = ui;
- }
- $('.partitionrange').css('width', $('.ui-slider-range').css('left'));
- var boot_size = ui.values[0];
- var swap_size = ui.values[1]-ui.values[0];
- var root_size = $("#partitioning_split").slider( "option", "max" )-ui.values[1];
- var image_size = boot_size+swap_size+root_size;
- $("#partitioning_display").html("Disk image size: "+image_size+"MB<br>Boot partition size: "+boot_size+"MB<br>Swap partition size: "+swap_size+"MB<br>Root partition size: "+root_size+"MB");
- $("#partitioning_boot").attr("value", boot_size);
- $("#partitioning_swap").attr("value", swap_size);
- $("#partitioning_root").attr("value", root_size);
-
- //since it doesn't seem to redraw by itself, hacky fix!
- $("#partitioning_split").slider("option", "values", $("#partitioning_split").slider("option", "values"));
- }
-
- $("#partitioning_split").slider({
- range: true,
- min: 0,
- max: 4096,
- values: [128, 640],
- slide: partitioning_update,
- change: partitioning_update,
- create: function(event, ui) {
- var slider = $(event.target);
- var range = slider.find('.ui-slider-range');
- var newrange = $('<div />');
- newrange.appendTo(slider).addClass('ui-slider-range partitionrange').css('width', range.css('left'));
- }
- });
-
- function update_slider() {
- var new_size = $("#partitioning_size").val();
- $("#partitioning_split").slider("option", "max", new_size);
- partitioning_update(null, $("#partitioning_split").slider("option", "values"));
- }
-
-
- $("#partitioning_size").change(update_slider);
-
- partitioning_update(null, $("#partitioning_split").slider("option", "values"));
- });
- </script>
+ <script type="text/javascript" src=" /js/gentoaster.js"></script>
</body>
-</html>
\ No newline at end of file
+</html>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
@ 2011-07-27 20:04 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 20:04 UTC (permalink / raw
To: gentoo-commits
commit: e27028f91f5fb2149054adbb89d14177f0e6f3db
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 20:04:32 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 20:04:32 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=e27028f9
Added simultaneous build settings
---
web/config.php | 3 +++
web/index.php | 23 +++++++++++++++++++++++
web/process.php | 2 +-
web/status.php | 9 +++++++++
web/testdrive.php | 2 +-
5 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/web/config.php b/web/config.php
index 30d6aa4..c31e60b 100644
--- a/web/config.php
+++ b/web/config.php
@@ -6,6 +6,9 @@
// Path to the zonetab file
define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
+ // Should we allow multiple simultaneous builds for a user?
+ define("SIMULTANEOUS_BUILDS", false);
+
// What should we limit the virtual machine disk size to?
define("MAX_DISK_SIZE", 16384);
diff --git a/web/index.php b/web/index.php
index 6b6abec..a68a219 100644
--- a/web/index.php
+++ b/web/index.php
@@ -5,6 +5,29 @@
require_once "recaptcha.php";
}
+ if(!SIMULTANEOUS_BUILDS) {
+ $db = new mysqli(MYSQL_HOSTNAME, MYSQL_USERNAME,
+ MYSQL_PASSWORD, MYSQL_DATABASE);
+ if (mysqli_connect_errno()) {
+ die("Could not connect to database ".mysqli_connect_error());
+ }
+
+ $ipaddress = filter_input(INPUT_SERVER, "REMOTE_ADDR",
+ FILTER_VALIDATE_IP);
+
+ $stmt = $db->prepare("SELECT id FROM builds WHERE ipaddress = ?");
+ $stmt->bind_param("s", $ipaddress);
+ $stmt->execute();
+ $stmt->store_result();
+
+ if ($stmt->num_rows == 1) {
+ $stmt->bind_result($buildID);
+ $stmt->fetch();
+ header("Location: status.php?uuid=".$buildID."&simultaneous=true");
+ }
+ $stmt->close();
+ }
+
$timezones = array();
$zonetab = file(ZONETAB);
foreach ($zonetab as $buf) {
diff --git a/web/process.php b/web/process.php
index 238e843..9ba055b 100644
--- a/web/process.php
+++ b/web/process.php
@@ -9,7 +9,7 @@
require_once "recaptcha.php";
$remoteAddress = filter_input(INPUT_SERVER,
- "remote_addr",
+ "REMOTE_ADDR",
FILTER_VALIDATE_IP);
$challenge = filter_input(INPUT_POST,
"recaptcha_challenge_field",
diff --git a/web/status.php b/web/status.php
index 719afe6..d2e8715 100644
--- a/web/status.php
+++ b/web/status.php
@@ -6,9 +6,16 @@
require_once "config.php";
$buildID = filter_input(INPUT_GET, "uuid", FILTER_UNSAFE_RAW);
+ $simultaneous = filter_input(INPUT_GET, "simultaneous", FILTER_VALIDATE_BOOLEAN);
$buildresult = "Unknown!";
$inprogress = false;
$builddone = false;
+ $simultaneousString = "";
+
+ if($simultaneous && !SIMULTANEOUS_BUILDS) {
+ $simultaneousString = "You were redirected to this page because you already have a ".
+ "build in progress. Simultaneous builds are disabled on this server.<br/><br/>";
+ }
$db = new mysqli(MYSQL_HOSTNAME, MYSQL_USERNAME,
MYSQL_PASSWORD, MYSQL_DATABASE);
@@ -19,6 +26,7 @@
$stmt = $db->prepare("SELECT handle FROM builds WHERE id = ?");
$stmt->bind_param("s", $buildID);
$stmt->execute();
+ $stmt->store_result();
if ($stmt->num_rows == 1) {
$stmt->bind_result($handle);
$stmt->fetch();
@@ -103,6 +111,7 @@
<div id="status" class="step">
<h1><?php echo $titleString; ?></h1>
<p>
+ <?php echo $simultaneousString; ?>
<?php echo $buildresult; ?>
<div id="progressbar"></div>
</p>
diff --git a/web/testdrive.php b/web/testdrive.php
index 8f3c718..3847b69 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -18,7 +18,7 @@
$stmt = $db->prepare("SELECT handle FROM builds WHERE id = ?");
$stmt->bind_param("s", $buildID);
$stmt->execute();
-
+ $stmt->store_result();
if ($stmt->num_rows == 1) {
$stmt->bind_result($handle);
$stmt->fetch();
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 20:11 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 20:11 UTC (permalink / raw
To: gentoo-commits
commit: aebdf3ef47a283793013a9da18c25c73458f400a
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 20:10:52 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 20:10:52 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=aebdf3ef
Add missing IP address parameter when creating job entry
---
web/process.php | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/web/process.php b/web/process.php
index 9ba055b..1daaa86 100644
--- a/web/process.php
+++ b/web/process.php
@@ -5,12 +5,12 @@
require_once "config.php";
+ $ipaddress = filter_input(INPUT_SERVER, "REMOTE_ADDR",
+ FILTER_VALIDATE_IP);
+
if (RECAPTCHA_ENABLED) {
require_once "recaptcha.php";
-
- $remoteAddress = filter_input(INPUT_SERVER,
- "REMOTE_ADDR",
- FILTER_VALIDATE_IP);
+
$challenge = filter_input(INPUT_POST,
"recaptcha_challenge_field",
FILTER_UNSAFE_RAW);
@@ -19,7 +19,7 @@
FILTER_UNSAFE_RAW);
$resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
- $remoteAddress,
+ $ipaddress,
$challenge,
$response);
@@ -76,8 +76,8 @@ OUTPUT_FORMAT=$outputFormat";
die("Could not connect to database ".mysqli_connect_error());
}
- $stmt = $db->prepare("INSERT INTO builds (id, handle) VALUES(?, ?)");
- $stmt->bind_param("ss", $buildID, $handle);
+ $stmt = $db->prepare("INSERT INTO builds (id, handle, ipaddress) VALUES(?, ?, ?)");
+ $stmt->bind_param("sss", $buildID, $handle, $ipaddress);
$stmt->execute();
$stmt->close();
$db->close();
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 20:25 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 20:25 UTC (permalink / raw
To: gentoo-commits
commit: a9970aa2d0f32e2dd2de8fd837b369e3cf92ee37
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 20:25:15 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 20:25:15 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=a9970aa2
Fix broken shell filter
---
web/process.php | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/web/process.php b/web/process.php
index 1daaa86..cadbf98 100644
--- a/web/process.php
+++ b/web/process.php
@@ -31,19 +31,19 @@
function sanitize_shellarg($arg) {
return escapeshellarg($arg);
}
- define("FILTER_SANITIZE_SHELL", array("options" => "sanitize_shellarg"));
+ $shellfilter = array("options" => "sanitize_shellarg");
$buildID = uniqid();
$bootMegabytes = filter_input(INPUT_POST, "boot_size", FILTER_VALIDATE_INT);
$swapMegabytes = filter_input(INPUT_POST, "swap_size", FILTER_VALIDATE_INT);
$rootMegabytes = filter_input(INPUT_POST, "root_size", FILTER_VALIDATE_INT);
- $timezone = filter_input(INPUT_POST, "timezone", FILTER_SANITIZE_SHELL);
- $hostname = filter_input(INPUT_POST, "hostname", FILTER_SANITIZE_SHELL);
- $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_SHELL);
- $password = filter_input(INPUT_POST, "password", FILTER_SANITIZE_SHELL);
- $rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_SANITIZE_SHELL);
- $packagesList = filter_input(INPUT_POST, "packages", FILTER_SANITIZE_SHELL);
- $outputFormat = filter_input(INPUT_POST, "format", FILTER_SANITIZE_SHELL);
+ $timezone = filter_input(INPUT_POST, "timezone", FILTER_CALLBACK, $shellfilter);
+ $hostname = filter_input(INPUT_POST, "hostname", FILTER_CALLBACK, $shellfilter);
+ $username = filter_input(INPUT_POST, "username", FILTER_CALLBACK, $shellfilter);
+ $password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $shellfilter);
+ $rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_CALLBACK, $shellfilter);
+ $packagesList = filter_input(INPUT_POST, "packages", FILTER_CALLBACK, $shellfilter);
+ $outputFormat = filter_input(INPUT_POST, "format", FILTER_CALLBACK, $shellfilter);
$packagesList = str_replace("\r\n", " ", $packagesList);
$packagesList = str_replace("\n", " ", $packagesList);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 22:02 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 22:02 UTC (permalink / raw
To: gentoo-commits
commit: 74298756df4a3427d7fd3645f0a7068d82597357
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 22:02:24 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 22:02:24 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=74298756
Fix broken VNC client JS
---
web/testdrive.php | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/web/testdrive.php b/web/testdrive.php
index 7610811..268d425 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -180,10 +180,11 @@
'local_cursor': gqv('cursor',true),
'shared': gqv('shared',true),
'updateState': updateState,
+ };
+
rfb.connect(host, port, password);
- };
- setTimeout("connect()", 2000);
+ setTimeout("connect()", 2000);
</script>
</div>
</div>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 22:04 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 22:04 UTC (permalink / raw
To: gentoo-commits
commit: 320825a5371e0301bfa8b3f79002d865d920c9af
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 22:02:24 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 22:03:46 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=320825a5
Fix broken VNC client JS
---
web/testdrive.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/testdrive.php b/web/testdrive.php
index 7610811..cbdfb50 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -179,8 +179,8 @@
'true_color': gqv('true_color',true),
'local_cursor': gqv('cursor',true),
'shared': gqv('shared',true),
- 'updateState': updateState,
- rfb.connect(host, port, password);
+ 'updateState': updateState});
+
};
setTimeout("connect()", 2000);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 22:11 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 22:11 UTC (permalink / raw
To: gentoo-commits
commit: 665387ad048a2726d52c82b2bab108dfe70ec6b3
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 22:02:24 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 22:10:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=665387ad
Fix broken VNC client JS
---
web/testdrive.php | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/web/testdrive.php b/web/testdrive.php
index 7610811..d4708c9 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -172,15 +172,17 @@
port = <?php echo $server[1]; ?>;
password = "";
- gqv = WebUtil.getQueryVar;
+ function gqv(a,b) {
+ return WebUtil.getQueryVar(a,b);
+ }
rfb = new RFB({'target':$D('VNC_canvas'),
'encrypt': gqv('encrypt',false),
'true_color': gqv('true_color',true),
'local_cursor': gqv('cursor',true),
'shared': gqv('shared',true),
- 'updateState': updateState,
- rfb.connect(host, port, password);
+ 'updateState': updateState});
+
};
setTimeout("connect()", 2000);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-27 22:11 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 22:11 UTC (permalink / raw
To: gentoo-commits
commit: 9a58ea8981c092477428d130301ca9dd5ee0082b
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 22:02:24 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 22:11:52 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=9a58ea89
Fix broken VNC client JS
---
web/testdrive.php | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/web/testdrive.php b/web/testdrive.php
index 7610811..6d087a9 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -125,7 +125,7 @@
return false;
}
function updateState(rfb, state, oldstate, msg) {
- var s, sb, cad, level;
+ var s, sb, cad, level, attr;
s = $D('VNC_status');
sb = $D('VNC_status_bar');
cad = $D('sendCtrlAltDelButton');
@@ -172,15 +172,17 @@
port = <?php echo $server[1]; ?>;
password = "";
- gqv = WebUtil.getQueryVar;
+ function gqv(a,b) {
+ return WebUtil.getQueryVar(a,b);
+ }
rfb = new RFB({'target':$D('VNC_canvas'),
'encrypt': gqv('encrypt',false),
'true_color': gqv('true_color',true),
'local_cursor': gqv('cursor',true),
'shared': gqv('shared',true),
- 'updateState': updateState,
- rfb.connect(host, port, password);
+ 'updateState': updateState});
+
};
setTimeout("connect()", 2000);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
@ 2011-07-27 22:13 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-27 22:13 UTC (permalink / raw
To: gentoo-commits
commit: 0f5558d334f95339b621d5357a2b01d1cde97897
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Wed Jul 27 22:02:24 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Wed Jul 27 22:12:57 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=0f5558d3
Fix broken VNC client JS
---
web/testdrive.php | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/web/testdrive.php b/web/testdrive.php
index 7610811..a141af5 100644
--- a/web/testdrive.php
+++ b/web/testdrive.php
@@ -125,7 +125,7 @@
return false;
}
function updateState(rfb, state, oldstate, msg) {
- var s, sb, cad, level;
+ var s, sb, cad, level, attr;
s = $D('VNC_status');
sb = $D('VNC_status_bar');
cad = $D('sendCtrlAltDelButton');
@@ -172,15 +172,19 @@
port = <?php echo $server[1]; ?>;
password = "";
- gqv = WebUtil.getQueryVar;
+ function gqv(a,b) {
+ return WebUtil.getQueryVar(a,b);
+ }
rfb = new RFB({'target':$D('VNC_canvas'),
'encrypt': gqv('encrypt',false),
'true_color': gqv('true_color',true),
'local_cursor': gqv('cursor',true),
'shared': gqv('shared',true),
- 'updateState': updateState,
+ 'updateState': updateState});
+
rfb.connect(host, port, password);
+
};
setTimeout("connect()", 2000);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-28 0:56 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-28 0:56 UTC (permalink / raw
To: gentoo-commits
commit: 4253d57e036689208f8f2f8a683a1f938a8058fd
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Jul 28 00:56:34 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Jul 28 00:56:34 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=4253d57e
Adding USE, package USE, FEATURES and keywords to WebUI
---
web/config.php | 12 ++++++++++++
web/index.php | 32 ++++++++++++++++++++++++++++++++
web/process.php | 17 ++++++++++-------
3 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/web/config.php b/web/config.php
index 1d1cb2e..210d1db 100644
--- a/web/config.php
+++ b/web/config.php
@@ -11,6 +11,18 @@
// What should we set as the default list of packages?
define("DEFAULT_PACKAGES", "dhcpd");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_PACKAGE_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_FEATURES", "parallel-fetch userfetch userpriv getbinpkg");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_KEYWORDS", "");
// What should we limit the virtual machine disk size to?
define("MAX_DISK_SIZE", 16384);
diff --git a/web/index.php b/web/index.php
index 99b9cf0..d6cfd9d 100644
--- a/web/index.php
+++ b/web/index.php
@@ -190,6 +190,38 @@
?></textarea>
<br>
</div>
+ <div id="expert" class="step">
+ <h1>Expert</h1>
+
+ <label for="expert_use">USE flags</label>
+ <br /><br />
+ <textarea id="expert_use" name="use"
+ style="width: 680px; height: 110px;"><?php
+ echo DEFAULT_USE;
+ ?></textarea>
+ <br>
+ <label for="expert_puse">Package USE</label>
+ <br /><br />
+ <textarea id="expert_puse" name="puse"
+ style="width: 680px; height: 110px;"><?php
+ echo DEFAULT_PACKAGE_USE;
+ ?></textarea>
+ <br>
+ <label for="expert_features">Features</label>
+ <br /><br />
+ <textarea id="expert_features" name="features"
+ style="width: 680px; height: 110px;"><?php
+ echo DEFAULT_FEATURES;
+ ?></textarea>
+ <br>
+ <label for="expert_keywords">Accept Keywords</label>
+ <br /><br />
+ <textarea id="expert_keywords" name="keywords"
+ style="width: 680px; height: 110px;"><?php
+ echo DEFAULT_KEYWORDS;
+ ?></textarea>
+ <br>
+ </div>
<div id="format" class="step submit_step">
<h1>Image format</h1>
diff --git a/web/process.php b/web/process.php
index a005319..e0bf38a 100644
--- a/web/process.php
+++ b/web/process.php
@@ -40,6 +40,8 @@
function sanitize_shellarg($arg)
{
+ $arg = str_replace("\r\n", " ", $arg);
+ $arg = str_replace("\n", " ", $arg);
return escapeshellarg($arg);
}
$sfi = array("options" => "sanitize_shellarg");
@@ -54,11 +56,12 @@
$password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
$rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_CALLBACK, $sfi);
$packagesList = filter_input(INPUT_POST, "packages", FILTER_CALLBACK, $sfi);
+ $use = filter_input(INPUT_POST, "use", FILTER_CALLBACK, $sfi);
+ $puse = filter_input(INPUT_POST, "puse", FILTER_CALLBACK, $sfi);
+ $features = filter_input(INPUT_POST, "features", FILTER_CALLBACK, $sfi);
+ $keywords = filter_input(INPUT_POST, "keywords", FILTER_CALLBACK, $sfi);
$outputFormat = filter_input(INPUT_POST, "format", FILTER_CALLBACK, $sfi);
- $packagesList = str_replace("\r\n", " ", $packagesList);
- $packagesList = str_replace("\n", " ", $packagesList);
-
$iniString = "[vmconfig]
BUILD_ID='$buildID'
@@ -70,10 +73,10 @@ HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username
DEFAULT_PASSWORD=$password
-USE_FLAGS=''
-PACKAGE_USE=''
-FEATURES='parallel-fetch userfetch userpriv getbinpkg'
-PACKAGE_ACCEPT_KEYWORDS=''
+USE_FLAGS='$use'
+PACKAGE_USE='$puse'
+FEATURES='$features'
+PACKAGE_ACCEPT_KEYWORDS='$keywords'
PACKAGES_LIST=$packagesList
OUTPUT_FORMAT=$outputFormat";
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-28 1:02 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-28 1:02 UTC (permalink / raw
To: gentoo-commits
commit: 6f16b6f20007012cc8e63056f9a7629310d67412
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Jul 28 00:56:34 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Jul 28 01:02:10 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=6f16b6f2
Adding USE, package USE, FEATURES and keywords to WebUI
---
web/config.php | 12 ++++++++++++
web/index.php | 32 ++++++++++++++++++++++++++++++++
web/process.php | 17 ++++++++++-------
3 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/web/config.php b/web/config.php
index 1d1cb2e..210d1db 100644
--- a/web/config.php
+++ b/web/config.php
@@ -11,6 +11,18 @@
// What should we set as the default list of packages?
define("DEFAULT_PACKAGES", "dhcpd");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_PACKAGE_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_FEATURES", "parallel-fetch userfetch userpriv getbinpkg");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_KEYWORDS", "");
// What should we limit the virtual machine disk size to?
define("MAX_DISK_SIZE", 16384);
diff --git a/web/index.php b/web/index.php
index 99b9cf0..e16bc42 100644
--- a/web/index.php
+++ b/web/index.php
@@ -190,6 +190,38 @@
?></textarea>
<br>
</div>
+ <div id="expert" class="step">
+ <h1>Expert</h1>
+
+ <label for="expert_use">USE flags</label>
+ <br /><br />
+ <textarea id="expert_use" name="use"
+ style="width: 680px; height: 85px;"><?php
+ echo DEFAULT_USE;
+ ?></textarea>
+ <br>
+ <label for="expert_puse">Package USE</label>
+ <br /><br />
+ <textarea id="expert_puse" name="puse"
+ style="width: 680px; height: 85px;"><?php
+ echo DEFAULT_PACKAGE_USE;
+ ?></textarea>
+ <br>
+ <label for="expert_features">Features</label>
+ <br /><br />
+ <textarea id="expert_features" name="features"
+ style="width: 680px; height: 85px;"><?php
+ echo DEFAULT_FEATURES;
+ ?></textarea>
+ <br>
+ <label for="expert_keywords">Accept Keywords</label>
+ <br /><br />
+ <textarea id="expert_keywords" name="keywords"
+ style="width: 680px; height: 85px;"><?php
+ echo DEFAULT_KEYWORDS;
+ ?></textarea>
+ <br>
+ </div>
<div id="format" class="step submit_step">
<h1>Image format</h1>
diff --git a/web/process.php b/web/process.php
index a005319..e0bf38a 100644
--- a/web/process.php
+++ b/web/process.php
@@ -40,6 +40,8 @@
function sanitize_shellarg($arg)
{
+ $arg = str_replace("\r\n", " ", $arg);
+ $arg = str_replace("\n", " ", $arg);
return escapeshellarg($arg);
}
$sfi = array("options" => "sanitize_shellarg");
@@ -54,11 +56,12 @@
$password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
$rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_CALLBACK, $sfi);
$packagesList = filter_input(INPUT_POST, "packages", FILTER_CALLBACK, $sfi);
+ $use = filter_input(INPUT_POST, "use", FILTER_CALLBACK, $sfi);
+ $puse = filter_input(INPUT_POST, "puse", FILTER_CALLBACK, $sfi);
+ $features = filter_input(INPUT_POST, "features", FILTER_CALLBACK, $sfi);
+ $keywords = filter_input(INPUT_POST, "keywords", FILTER_CALLBACK, $sfi);
$outputFormat = filter_input(INPUT_POST, "format", FILTER_CALLBACK, $sfi);
- $packagesList = str_replace("\r\n", " ", $packagesList);
- $packagesList = str_replace("\n", " ", $packagesList);
-
$iniString = "[vmconfig]
BUILD_ID='$buildID'
@@ -70,10 +73,10 @@ HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username
DEFAULT_PASSWORD=$password
-USE_FLAGS=''
-PACKAGE_USE=''
-FEATURES='parallel-fetch userfetch userpriv getbinpkg'
-PACKAGE_ACCEPT_KEYWORDS=''
+USE_FLAGS='$use'
+PACKAGE_USE='$puse'
+FEATURES='$features'
+PACKAGE_ACCEPT_KEYWORDS='$keywords'
PACKAGES_LIST=$packagesList
OUTPUT_FORMAT=$outputFormat";
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
@ 2011-07-28 1:08 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-28 1:08 UTC (permalink / raw
To: gentoo-commits
commit: 5bcf585222474363c28c9ad34360877968efcbce
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Jul 28 00:56:34 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Jul 28 01:07:59 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=5bcf5852
Adding USE, package USE, FEATURES and keywords to WebUI
---
web/config.php | 12 ++++++++++++
web/index.php | 32 ++++++++++++++++++++++++++++++++
web/process.php | 17 ++++++++++-------
3 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/web/config.php b/web/config.php
index 1d1cb2e..210d1db 100644
--- a/web/config.php
+++ b/web/config.php
@@ -11,6 +11,18 @@
// What should we set as the default list of packages?
define("DEFAULT_PACKAGES", "dhcpd");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_PACKAGE_USE", "");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_FEATURES", "parallel-fetch userfetch userpriv getbinpkg");
+
+ // What should we set as the default list of packages?
+ define("DEFAULT_KEYWORDS", "");
// What should we limit the virtual machine disk size to?
define("MAX_DISK_SIZE", 16384);
diff --git a/web/index.php b/web/index.php
index 99b9cf0..55484d0 100644
--- a/web/index.php
+++ b/web/index.php
@@ -190,6 +190,38 @@
?></textarea>
<br>
</div>
+ <div id="expert" class="step">
+ <h1>Expert</h1>
+
+ <label for="expert_use">USE flags</label>
+ <br />
+ <textarea id="expert_use" name="use"
+ style="width: 680px; height: 60px;"><?php
+ echo DEFAULT_USE;
+ ?></textarea>
+ <br><br />
+ <label for="expert_puse">Package USE</label>
+ <br />
+ <textarea id="expert_puse" name="puse"
+ style="width: 680px; height: 60px;"><?php
+ echo DEFAULT_PACKAGE_USE;
+ ?></textarea>
+ <br><br />
+ <label for="expert_features">Features</label>
+ <br />
+ <textarea id="expert_features" name="features"
+ style="width: 680px; height: 60px;"><?php
+ echo DEFAULT_FEATURES;
+ ?></textarea>
+ <br><br />
+ <label for="expert_keywords">Accept Keywords</label>
+ <br />
+ <textarea id="expert_keywords" name="keywords"
+ style="width: 680px; height: 60px;"><?php
+ echo DEFAULT_KEYWORDS;
+ ?></textarea>
+ <br>
+ </div>
<div id="format" class="step submit_step">
<h1>Image format</h1>
diff --git a/web/process.php b/web/process.php
index a005319..e0bf38a 100644
--- a/web/process.php
+++ b/web/process.php
@@ -40,6 +40,8 @@
function sanitize_shellarg($arg)
{
+ $arg = str_replace("\r\n", " ", $arg);
+ $arg = str_replace("\n", " ", $arg);
return escapeshellarg($arg);
}
$sfi = array("options" => "sanitize_shellarg");
@@ -54,11 +56,12 @@
$password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
$rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_CALLBACK, $sfi);
$packagesList = filter_input(INPUT_POST, "packages", FILTER_CALLBACK, $sfi);
+ $use = filter_input(INPUT_POST, "use", FILTER_CALLBACK, $sfi);
+ $puse = filter_input(INPUT_POST, "puse", FILTER_CALLBACK, $sfi);
+ $features = filter_input(INPUT_POST, "features", FILTER_CALLBACK, $sfi);
+ $keywords = filter_input(INPUT_POST, "keywords", FILTER_CALLBACK, $sfi);
$outputFormat = filter_input(INPUT_POST, "format", FILTER_CALLBACK, $sfi);
- $packagesList = str_replace("\r\n", " ", $packagesList);
- $packagesList = str_replace("\n", " ", $packagesList);
-
$iniString = "[vmconfig]
BUILD_ID='$buildID'
@@ -70,10 +73,10 @@ HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username
DEFAULT_PASSWORD=$password
-USE_FLAGS=''
-PACKAGE_USE=''
-FEATURES='parallel-fetch userfetch userpriv getbinpkg'
-PACKAGE_ACCEPT_KEYWORDS=''
+USE_FLAGS='$use'
+PACKAGE_USE='$puse'
+FEATURES='$features'
+PACKAGE_ACCEPT_KEYWORDS='$keywords'
PACKAGES_LIST=$packagesList
OUTPUT_FORMAT=$outputFormat";
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-07-28 1:12 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-07-28 1:12 UTC (permalink / raw
To: gentoo-commits
commit: cb5bbb72d305e53fded087f8df6f35be5d37188e
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Jul 28 01:12:40 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Jul 28 01:12:40 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=cb5bbb72
Fix config generation double quoting
---
web/process.php | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/web/process.php b/web/process.php
index e0bf38a..b16f272 100644
--- a/web/process.php
+++ b/web/process.php
@@ -73,10 +73,10 @@ HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username
DEFAULT_PASSWORD=$password
-USE_FLAGS='$use'
-PACKAGE_USE='$puse'
-FEATURES='$features'
-PACKAGE_ACCEPT_KEYWORDS='$keywords'
+USE_FLAGS=$use
+PACKAGE_USE=$puse
+FEATURES=$features
+PACKAGE_ACCEPT_KEYWORDS=$keywords
PACKAGES_LIST=$packagesList
OUTPUT_FORMAT=$outputFormat";
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
@ 2011-08-02 17:22 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-08-02 17:22 UTC (permalink / raw
To: gentoo-commits
commit: c626a0b84da7ec05c04543c12594869988b4e886
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Tue Aug 2 17:21:43 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Tue Aug 2 17:21:43 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=c626a0b8
Fix a simultaneous builds bug where failed builds were counted as still being in progress, add keyboard layout support to WebUI.
---
web/config.php | 3 +++
web/index.php | 20 ++++++++++++++++----
web/process.php | 2 ++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/web/config.php b/web/config.php
index 210d1db..39f505f 100644
--- a/web/config.php
+++ b/web/config.php
@@ -3,6 +3,9 @@
// Gentoaster web interface settings
// Licensed under GPL v3, see COPYING file
+ // Path to the Gentoaster binaries/resources
+ define("GENTOASTER_PATH", "/usr/share/gentoaster");
+
// Path to the zonetab file
define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
diff --git a/web/index.php b/web/index.php
index 55484d0..b6cb119 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,12 +23,14 @@
FILTER_VALIDATE_IP
);
- $stmt = $db->prepare("SELECT id FROM builds WHERE ipaddress = ?");
- $stmt->bind_param("s", $ipaddress);
+ $query = "SELECT id, returncode ".
+ "FROM builds WHERE ipaddress = ?";
+ $stmt = $db->prepare($query);
+ $stmt->bind_param("sd", $ipaddress, $returncode);
$stmt->execute();
$stmt->store_result();
- if ($stmt->num_rows == 1) {
+ if ($stmt->num_rows == 1 && $returncode === null) {
$stmt->bind_result($buildID);
$stmt->fetch();
$url = "status.php?uuid=".$buildID."&simultaneous=true";
@@ -57,6 +59,16 @@
foreach ($timezones as $timezone => $description) {
$timezoneOption .= "<option>".$timezone."</option>\n";
}
+ $layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
+ $keyboardOption = "";
+
+ foreach($layoutLines as $layout) {
+ $layoutdata = explode("\t", $layout);
+ $keyboardOption .= "<option value=\"".$layoutdata[0]."\">";
+ $keyboardOption .= trim($layoutdata[1])."</option>\n";
+ }
+
+ asort($layouts);
?>
<html>
<head>
@@ -117,7 +129,7 @@
<br />
<select id="locale_keyboard" class="required"
name="keyboard">
- <option>United Kingdom</option>
+ <?php echo $keyboardOption; ?>
</select>
<br>
diff --git a/web/process.php b/web/process.php
index b16f272..c590bee 100644
--- a/web/process.php
+++ b/web/process.php
@@ -51,6 +51,7 @@
$swapMegabytes = filter_input(INPUT_POST, "swap_size", FILTER_VALIDATE_INT);
$rootMegabytes = filter_input(INPUT_POST, "root_size", FILTER_VALIDATE_INT);
$timezone = filter_input(INPUT_POST, "timezone", FILTER_CALLBACK, $sfi);
+ $keyboard = filter_input(INPUT_POST, "keyboard", FILTER_CALLBACK, $sfi);
$hostname = filter_input(INPUT_POST, "hostname", FILTER_CALLBACK, $sfi);
$username = filter_input(INPUT_POST, "username", FILTER_CALLBACK, $sfi);
$password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
@@ -69,6 +70,7 @@ BOOT_MEGABYTES='$bootMegabytes'
SWAP_MEGABYTES='$swapMegabytes'
ROOT_MEGABYTES='$rootMegabytes'
TIMEZONE=$timezone
+KEYBOARD=$keyboard
HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-08-02 17:31 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-08-02 17:31 UTC (permalink / raw
To: gentoo-commits
commit: a0a786dbc48cf83aab4954058c28b4ff8dfa19f5
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Tue Aug 2 17:31:27 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Tue Aug 2 17:31:27 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=a0a786db
Add options for configuring default keyboard layout and timezone
---
web/config.php | 6 ++++++
web/index.php | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/web/config.php b/web/config.php
index 39f505f..38076e8 100644
--- a/web/config.php
+++ b/web/config.php
@@ -11,6 +11,12 @@
// Should we allow multiple simultaneous builds for a user?
define("SIMULTANEOUS_BUILDS", false);
+
+ // What should we set as the default keyboard layout?
+ define("DEFAULT_KEYBOARD", "gb");
+
+ // What should we set as the default timezone?
+ define("DEFAULT_TIMEZONE", "Europe/London");
// What should we set as the default list of packages?
define("DEFAULT_PACKAGES", "dhcpd");
diff --git a/web/index.php b/web/index.php
index b6cb119..4903bbb 100644
--- a/web/index.php
+++ b/web/index.php
@@ -57,15 +57,22 @@
}
$timezoneOption = "";
foreach ($timezones as $timezone => $description) {
- $timezoneOption .= "<option>".$timezone."</option>\n";
+ $timezoneOption .= "<option";
+ if ($timezone == DEFAULT_TIMEZONE) {
+ $timezoneOption .= " selected";
+ }
+ $timezoneOption .= ">".$timezone."</option>\n";
}
$layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
$keyboardOption = "";
foreach($layoutLines as $layout) {
$layoutdata = explode("\t", $layout);
- $keyboardOption .= "<option value=\"".$layoutdata[0]."\">";
- $keyboardOption .= trim($layoutdata[1])."</option>\n";
+ $keyboardOption .= "<option value=\"".$layoutdata[0]."\"";
+ if ($layoutdata[0] == DEFAULT_KEYBOARD) {
+ $keyboardOption .= " selected";
+ }
+ $keyboardOption .= ">".trim($layoutdata[1])."</option>\n";
}
asort($layouts);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-08-04 21:04 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-08-04 21:04 UTC (permalink / raw
To: gentoo-commits
commit: 0b2091cc10ccb748adc89c58a19b367308f047c7
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Thu Aug 4 21:04:00 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Thu Aug 4 21:04:00 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=0b2091cc
Fix simultaneous build detection, fix sorting on keyboard layouts
---
web/index.php | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/web/index.php b/web/index.php
index 4903bbb..dcaae6b 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,18 +23,23 @@
FILTER_VALIDATE_IP
);
- $query = "SELECT id, returncode ".
+ $query = "SELECT id, handle ".
"FROM builds WHERE ipaddress = ?";
$stmt = $db->prepare($query);
- $stmt->bind_param("sd", $ipaddress, $returncode);
+ $stmt->bind_param("s", $ipaddress);
$stmt->execute();
$stmt->store_result();
- if ($stmt->num_rows == 1 && $returncode === null) {
- $stmt->bind_result($buildID);
+ if ($stmt->num_rows == 1) {
+ $stmt->bind_result($buildID, $handle);
$stmt->fetch();
- $url = "status.php?uuid=".$buildID."&simultaneous=true";
- header("Location: ".$url);
+ $client = new GearmanClient();
+ $client->addServer();
+ $status = $client->jobStatus($handle);
+ if ($status[0]) {
+ $url = "status.php?uuid=".$buildID."&simultaneous=true";
+ header("Location: ".$url);
+ }
}
$stmt->close();
}
@@ -65,17 +70,21 @@
}
$layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
$keyboardOption = "";
+ $layouts = array();
foreach($layoutLines as $layout) {
$layoutdata = explode("\t", $layout);
- $keyboardOption .= "<option value=\"".$layoutdata[0]."\"";
- if ($layoutdata[0] == DEFAULT_KEYBOARD) {
+ $layouts[$layoutdata[0]] = $layoutdata[1];
+ }
+ asort($layouts);
+
+ foreach($layouts as $layoutCode => $layoutName) {
+ $keyboardOption .= "<option value=\"".$layoutCode."\"";
+ if ($layoutCode == DEFAULT_KEYBOARD) {
$keyboardOption .= " selected";
}
- $keyboardOption .= ">".trim($layoutdata[1])."</option>\n";
+ $keyboardOption .= ">".trim($layoutName)."</option>\n";
}
-
- asort($layouts);
?>
<html>
<head>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:webui commit in: web/
@ 2011-08-06 0:14 Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-08-06 0:14 UTC (permalink / raw
To: gentoo-commits
commit: d1be7277d54b8d01eba1cfa30bf844b2536c93fc
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Sat Aug 6 00:13:08 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Sat Aug 6 00:13:50 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=d1be7277
Progress bar is now AJAXified!
---
web/ajax.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
web/status.php | 36 ++++++++++++++++++++-------
2 files changed, 98 insertions(+), 10 deletions(-)
diff --git a/web/ajax.php b/web/ajax.php
new file mode 100644
index 0000000..105c893
--- /dev/null
+++ b/web/ajax.php
@@ -0,0 +1,72 @@
+<?php
+
+ // Gentoaster web interface AJAX remote
+ // Licensed under GPL v3, see COPYING file
+
+ require_once "config.php";
+
+ $buildID = filter_input(INPUT_GET, "uuid", FILTER_UNSAFE_RAW);
+
+
+ $db = new mysqli(
+ MYSQL_HOSTNAME,
+ MYSQL_USERNAME,
+ MYSQL_PASSWORD,
+ MYSQL_DATABASE
+ );
+
+ if (mysqli_connect_errno()) {
+ die("Could not connect to database ".mysqli_connect_error());
+ }
+
+ $stmt = $db->prepare("SELECT handle FROM builds WHERE id = ?");
+ $stmt->bind_param("s", $buildID);
+ $stmt->execute();
+ $stmt->store_result();
+ if ($stmt->num_rows == 1) {
+ $stmt->bind_result($handle);
+ $stmt->fetch();
+ $stmt->close();
+ $client = new GearmanClient();
+ $client->addServer();
+
+ $status = $client->jobStatus($handle);
+ if ($status[0]) {
+ if ($status[3] != 0) {
+ // in progress
+ $ret = array("status" => 1, "num" => $status[2], "den" => $status[3]);
+ } else {
+ // not yet processed
+ $ret = array("status" => 2);
+ }
+ } else {
+ $query = "SELECT returncode, result ".
+ "FROM builds WHERE id = ?";
+ $stmt = $db->prepare($query);
+ $stmt->bind_param("s", $buildID);
+ $stmt->execute();
+ $stmt->bind_result($returncode, $result);
+ $stmt->fetch();
+ $stmt->close();
+ if ($returncode !== null) {
+ if ($returncode == 0) {
+ // finished
+ $ret = array("status" => 0);
+ } else {
+ // returned with non-zero status code
+ $ret = array("status" => 3);
+ }
+ } else {
+ // failed
+ $ret = array("status" => 4);
+ }
+ }
+ } else {
+ // job not found
+ $ret = array("status" => -1);
+ }
+
+ $db->close();
+
+ echo json_encode($ret);
+?>
\ No newline at end of file
diff --git a/web/status.php b/web/status.php
index ab57a1e..69e8afc 100644
--- a/web/status.php
+++ b/web/status.php
@@ -49,7 +49,7 @@
if ($status[3] != 0) {
$percentage = ceil($status[2]/$status[3]*100);
$bres = "Your build is currently running".
- " and is ".$percentage."% complete";
+ " and is <span id=\"percent\">".$percentage."</span>% complete";
$inprogress = true;
} else {
$bres = "Task has not yet been processed";
@@ -113,15 +113,31 @@
href="css/ui-lightness/jquery-ui-1.8.14.custom.css">
<script type="text/javascript" src="/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.14.js"></script>
- <?php
- if ($inprogress) {
- echo '<script>
- $(document).ready(function() {
- $("#progressbar").progressbar({ value: '.$percentage.' });
- });
- </script>';
- }
- ?>
+ <?php if ($inprogress) { ?>
+ <script>
+ var UUID = "<?php echo $buildID; ?>";
+
+ $(document).ready(function() {
+ $("#progressbar").progressbar({ value: <?php echo $percentage; ?> });
+ });
+
+ function bar_update() {
+ $.getJSON('ajax.php?uuid='+UUID, function(data) {
+ if(data.status == 1) {
+ percent = Math.floor((data.num/data.den)*100);
+ $("#progressbar").progressbar({ value: percent });
+ $("#percent").html(percent);
+ } else {
+ window.location.reload();
+ }
+ });
+ setTimeout("bar_update();", 3000);
+ }
+
+ bar_update();
+ </script>
+ <?php } ?>
+
</head>
<body>
<div id="container">
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoaster:master commit in: web/
2011-07-15 19:59 [gentoo-commits] proj/gentoaster:webui commit in: web/ Liam McLoughlin
@ 2011-08-12 23:17 ` Liam McLoughlin
0 siblings, 0 replies; 19+ messages in thread
From: Liam McLoughlin @ 2011-08-12 23:17 UTC (permalink / raw
To: gentoo-commits
commit: d8ab9fad2e88341c8c6cc7c2913ea74625fbe9d2
Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
AuthorDate: Fri Jul 15 19:58:22 2011 +0000
Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
CommitDate: Fri Jul 15 19:58:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=d8ab9fad
Handle \r\n when building the configuration file
---
web/process.php | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/web/process.php b/web/process.php
index 149c1b7..1b68d03 100644
--- a/web/process.php
+++ b/web/process.php
@@ -11,10 +11,10 @@
$root_password = escapeshellarg($_POST["rootpassword"]);
$packages_list = escapeshellarg($_POST["packages"]);
$output_format = escapeshellarg($_POST["format"]);
-
-
+
+ $packages_list = str_replace("\r\n", " ", $packages_list);
$packages_list = str_replace("\n", " ", $packages_list);
-
+
$ini_string = "[vmconfig]
BUILD_ID='$build_id'
@@ -36,11 +36,11 @@ OUTPUT_FORMAT=$output_format";
$client = new GearmanClient();
$client->addServer();
$handle = $client->doBackground("invoke_image_build", $ini_string);
-
+
$db = mysql_connect("localhost","gentoaster","");
if(!$db) die("Could not connect to database ".mysql_error());
mysql_select_db("gentoaster");
mysql_query("INSERT INTO builds (id, handle) VALUES('".$build_id."','".$handle."')");
header("Location: finished.php?uuid=".$build_id);
-?>
\ No newline at end of file
+?>
^ permalink raw reply related [flat|nested] 19+ messages in thread
end of thread, other threads:[~2011-08-12 23:18 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 19:59 [gentoo-commits] proj/gentoaster:webui commit in: web/ Liam McLoughlin
2011-08-12 23:17 ` [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
-- strict thread matches above, loose matches on Subject: below --
2011-07-27 20:11 [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
2011-07-27 20:25 Liam McLoughlin
2011-07-27 22:02 Liam McLoughlin
2011-07-27 22:04 Liam McLoughlin
2011-07-27 22:11 Liam McLoughlin
2011-07-27 22:11 Liam McLoughlin
2011-07-28 0:56 Liam McLoughlin
2011-07-28 1:02 Liam McLoughlin
2011-07-28 1:12 Liam McLoughlin
2011-08-02 17:31 Liam McLoughlin
2011-08-04 21:04 Liam McLoughlin
2011-08-06 0:14 Liam McLoughlin
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
2011-07-24 2:43 ` [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
2011-07-27 20:04 ` [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
2011-07-27 22:13 ` [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
2011-07-28 1:08 ` [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
2011-08-12 23:17 [gentoo-commits] proj/gentoaster:master " Liam McLoughlin
2011-08-02 17:22 ` [gentoo-commits] proj/gentoaster:webui " Liam McLoughlin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox