";
+?>
diff --git a/UI/includes/config.php b/UI/includes/config.php
index b7533b1..7acfcff 100644
--- a/UI/includes/config.php
+++ b/UI/includes/config.php
@@ -149,16 +149,24 @@ function executeCommand($command, &$output = null, &$returnCode = null) {
* Get the correct asset path based on current directory structure
*/
function getAssetPath($asset) {
- // Determine if we're in the public directory or main directory
- $currentDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $publicDir = realpath(__DIR__ . '/../public');
+ // Clean the asset path
+ $asset = ltrim($asset, '/');
- if ($currentDir === $publicDir) {
- // We're in the public directory, use relative paths
- return '../assets/' . ltrim($asset, '/');
+ // Get the current script's directory and the request URI
+ $scriptDir = dirname($_SERVER['SCRIPT_FILENAME']);
+ $requestUri = $_SERVER['REQUEST_URI'];
+ $scriptName = $_SERVER['SCRIPT_NAME'];
+
+ // Check if we're accessing files from the public directory
+ // but the document root is set to the main UI directory
+ if (strpos($scriptName, '/public/') !== false ||
+ strpos($requestUri, '/public/') !== false ||
+ basename($scriptDir) === 'public') {
+ // We're in the public directory context, use relative paths
+ return '../assets/' . $asset;
} else {
- // We're in the main directory, use direct paths
- return 'assets/' . ltrim($asset, '/');
+ // We're in the main directory context, use direct paths
+ return 'assets/' . $asset;
}
}
diff --git a/UI/index.php b/UI/index.php
new file mode 100644
index 0000000..b1c780e
--- /dev/null
+++ b/UI/index.php
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+ - Login
+
+
+
+
+
+
+
+
+
Router Enrollment Management Interface
+
Version
+
+
+
+
+
+
+
+
+
+
+
+
+ Default credentials: admin / admin123
+
+
+ Please change the default password in production
+
+
+
+
+
+
+
+
diff --git a/UI/install.sh b/UI/install.sh
index 8d79a7a..7ef2811 100644
--- a/UI/install.sh
+++ b/UI/install.sh
@@ -184,6 +184,15 @@ deploy_ui() {
# Copy main UI files
cp -r public includes assets "$WEB_DIR/" || error_exit "Failed to copy UI files"
+ # Copy root-level PHP files for direct access (when document root is main directory)
+ if [[ -f "index.php" ]]; then
+ cp index.php "$WEB_DIR/" || log "WARNING" "Failed to copy root index.php"
+ fi
+
+ if [[ -f "dashboard.php" ]]; then
+ cp dashboard.php "$WEB_DIR/" || log "WARNING" "Failed to copy root dashboard.php"
+ fi
+
# Copy optional files if they exist
if [[ -f "README.md" ]]; then
cp README.md "$WEB_DIR/" || log "WARNING" "Failed to copy README.md"