mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-30 01:22:24 +00:00
Move RunVNC out of ClonOS
This commit is contained in:
@@ -109,7 +109,6 @@ class ClonOS {
|
||||
// $clonos->json_name=$file_path.'a.json.php';
|
||||
|
||||
$this->_db_tasks=new Db('base','cbsdtaskd');
|
||||
$this->_db_local=new Db('base','local');
|
||||
|
||||
if(isset($this->_vars['mode'])) $this->mode=$this->_vars['mode'];
|
||||
if(isset($this->_vars['form_data'])) $this->form=$this->_vars['form_data'];
|
||||
@@ -2030,25 +2029,6 @@ class ClonOS {
|
||||
}
|
||||
}
|
||||
|
||||
function runVNC($jname){
|
||||
$query="SELECT vnc_password FROM bhyve WHERE jname=?";
|
||||
$res=$this->_db_local->selectOne($query, array([$jname]));
|
||||
|
||||
$pass='cbsd';
|
||||
if($res!==false) $pass=$res['vnc_password'];
|
||||
|
||||
$resCBSD::run("vm_vncwss jname=%s permit=%s", array($jname, $this->_client_ip));
|
||||
//$res=$this->_db_local->selectOne("SELECT nodeip FROM local", array());
|
||||
//$nodeip=$res['nodeip'];
|
||||
// need for IPv4/IPv6 regex here, instead of strlen
|
||||
//if(strlen($nodeip)<7) $nodeip='127.0.0.1';
|
||||
//if(strlen($nodeip)<7) $nodeip=$this->server_name;
|
||||
$nodeip=$this->server_name;
|
||||
|
||||
header('Location: http://'.$nodeip.':6081/vnc_auto.html?host='.$nodeip.'&port=6081?password='.$pass);
|
||||
exit;
|
||||
}
|
||||
|
||||
//function getFreeJname($in_helper=false,$type='jail'){
|
||||
function ccmd_getFreeJname($in_helper=false,$type='jail'){
|
||||
$arr=array();
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
<?php
|
||||
if(!isset($_GET['jname']))
|
||||
{
|
||||
if(!isset($_GET['jname'])){
|
||||
echo 'You forgot to specify a name of jail!';
|
||||
exit;
|
||||
}
|
||||
|
||||
function runVNC($jname)
|
||||
{
|
||||
$db=new Db('base','local');
|
||||
$res=db->selectOne("SELECT vnc_password FROM bhyve WHERE jname=?", array([$jname]));
|
||||
|
||||
$pass='cbsd';
|
||||
if($res!==false) $pass=$res['vnc_password'];
|
||||
|
||||
CBSD::run("vm_vncwss jname=%s permit=%s", $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if(isset($_SERVER['SERVER_NAME']) && !empty(trim($_SERVER['SERVER_NAME']))){
|
||||
$nodeip=$_SERVER['SERVER_NAME'];
|
||||
} else {
|
||||
$nodeip=$_SERVER['SERVER_ADDR'];
|
||||
}
|
||||
|
||||
# TODO: This will send the pass in clear text
|
||||
header('Location: http://'.$nodeip.':6081/vnc_auto.html?host='.$nodeip.'&port=6081?password='.$pass);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rp=realpath('../');
|
||||
include($rp.'/php/clonos.php');
|
||||
$clonos=new ClonOS($rp);
|
||||
$clonos->runVNC($_GET['jname']);
|
||||
require_once($rp.'/php/db.php');
|
||||
require_once($rp.'/php/cbsd.php');
|
||||
|
||||
runVNC($_GET['jname']);
|
||||
|
||||
Reference in New Issue
Block a user