Add remote access feature and UI improvements
- Implement `remoteAccess` functionality in `ApiCLI` for Veyon integration. - Create `selectIP.php` view and associated form for remote access inputs. - Add JSON configuration for lab setups (`labList.json`). - Introduce reusable `home-button` web component. - Update project router and controller to support new `/remoteAccess` and `/conn` routes. - Add custom styles and icons to enhance UI.
This commit is contained in:
@@ -3,7 +3,15 @@
|
||||
class Controller {
|
||||
|
||||
public function index(): void {
|
||||
require_once '../views/home.php';
|
||||
require_once BASE_PATH.'/app/views/home.php';
|
||||
}
|
||||
|
||||
public function remoteAccess() {
|
||||
require_once BASE_PATH.'/app/views/selectIP.php';
|
||||
}
|
||||
|
||||
public function cli() {
|
||||
ApiCLI::testConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,5 +6,32 @@
|
||||
*/
|
||||
|
||||
class ApiCLI {
|
||||
|
||||
static $SET_WD = "cd 'C:\\Program Files\\Veyon' 2>&1 &&";
|
||||
|
||||
public static function testConnection() {
|
||||
$cmd = "curl -I 127.0.0.1 && cd";
|
||||
$response = shell_exec($cmd." 2>&1");
|
||||
echo "<pre>"; echo $response; echo "</pre>";
|
||||
}
|
||||
// Veyon Modules
|
||||
// [N] 1. authkeys - Commands for managing authentication keys
|
||||
// [N] 2. config - Commands for managing the configuration of Veyon
|
||||
// [?] 3. ldap - Commands for configuring and testing LDAP/AD integration
|
||||
// [?] 4. networkobjects - Commands for managing the builtin network object directory
|
||||
// [Y] 5. power - Commands for controlling power status of computers
|
||||
// [Y] 6. remoteaccess - Remote view or control a computer
|
||||
// [N] 7. service - Commands for configuring and controlling Veyon Service
|
||||
// [N] 8. shell - Commands for shell functionalities
|
||||
// [Y] 9. functions - Commands for managing functions
|
||||
public static function remoteAccess($ip, $connectionType='view') {
|
||||
global $SET_WD;
|
||||
|
||||
echo "Executing: ".EXE_NAME." remoteaccess ".$connectionType." ".$ip;
|
||||
echo "<br>";
|
||||
|
||||
$response = shell_exec($SET_WD . " ". EXE_NAME ." remoteaccess ".$connectionType." ".$ip." 2>&1");
|
||||
if ($response != "[OK]") {
|
||||
echo "<pre>"; echo $response; echo "</pre>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$name = '';
|
||||
if(isset($_GET['name']) && $_GET['name']) {
|
||||
$name = " " . $_GET['name'];
|
||||
}
|
||||
?>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Project 16 - Dashboard</title>
|
||||
<?php include COMMON_HTML_HEAD; ?>
|
||||
<script src="<?=URL_PATH?>/commons/components/button.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.title-bar {
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
padding: 10px 10px 10px 20px;
|
||||
background-color: var(--kashmir);
|
||||
color: var(--gray);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
& a {
|
||||
border-radius: 1em;
|
||||
padding: 10px;
|
||||
|
||||
& > img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="title-bar">
|
||||
<div><?=PROJECT_NAME?></div>
|
||||
<div>
|
||||
<a href="" class="btn btn-light">
|
||||
<img src="<?=URL_PATH?>/assets/icons/hamburger.svg" alt="">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<home-button main-href="remoteAccess" icon-src="<?=URL_PATH?>/assets/icons/placeholder.svg" text="Accesso Remoto"></home-button>
|
||||
<home-button main-href="a" icon-src="<?=URL_PATH?>/assets/icons/placeholder.svg" text="Features" ></home-button>
|
||||
<home-button main-href="a" icon-src="<?=URL_PATH?>/assets/icons/placeholder.svg" text="Get Token" ></home-button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
66
app/views/selectIP.php
Normal file
66
app/views/selectIP.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2025. Brusegan Samuele, Davanzo Andrea
|
||||
* Questo file fa parte di VeyonCtrl ed è rilasciato
|
||||
* sotto la licenza MIT. Vedere il file LICENSE per i dettagli.
|
||||
*/
|
||||
|
||||
if(isset($_POST['submit'])) {
|
||||
$ip = $_POST['ip'];
|
||||
$type = $_POST['veyon-remoteaccess-type'];
|
||||
ApiCLI::remoteAccess($ip, $type);
|
||||
}
|
||||
|
||||
?>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Project 16</title>
|
||||
<?php include COMMON_HTML_HEAD; ?>
|
||||
</head>
|
||||
<body data-bs-theme="dark">
|
||||
<div>
|
||||
<!-- Lista dei laboratori -->
|
||||
|
||||
<?php
|
||||
/*$labList = json_decode(file_get_contents(URL_PATH.'/configs/labList.json'));
|
||||
foreach ($labList as $lab) {
|
||||
?>
|
||||
<div class="btn btn-primary" data-ip="<?=$lab->netIP?>" data-lab="<?=$lab->name?>" data-mask="<?=$lab->subnetMask?>">
|
||||
<?=$lab->name?>
|
||||
</div>
|
||||
<?php
|
||||
}*/
|
||||
?>
|
||||
|
||||
<!-- Lista dei computer -->
|
||||
<!-- Cerca e usa una utility per trovare tutti i pc in rete -->
|
||||
|
||||
<!-- Lancia connessione a `EXE_NAME` -->
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
<div class="d-flex flex-column align-items-center">
|
||||
<h3 class="pb-5 pt-2">Inserisci le informazioni per la connessione</h3>
|
||||
<form action="<?=URL_PATH?>/remoteAccess" method="post" class="col-3" style="background: #333; border-radius: 10px; padding: 10px;" >
|
||||
<label class="form-label" for="ip">Inserisci l'ip:</label>
|
||||
<input class="form-control" type="text" name="ip" id="ip">
|
||||
<br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="veyon-remoteaccess-type" id="veyon-remoteaccess-view" value="view">
|
||||
<label class="form-check-label" for="veyon-remoteaccess-view">View</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="veyon-remoteaccess-type" id="veyon-remoteaccess-control" value="control">
|
||||
<label class="form-check-label" for="veyon-remoteaccess-control">Control</label>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="submit" value="submit">
|
||||
<hr>
|
||||
<button type="submit" class="w-100 btn btn-primary">Connetti</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user