浏览代码

added fsconv binaries

tobychui 6 年之前
父节点
当前提交
f26c9e08fa

+ 4 - 3
src/Desktop/desktopFileLoader.php

@@ -1,10 +1,10 @@
 <?php
 //This php loads all the desktop content from a given username
-include '../auth.php';
+include_once('../auth.php');
 if (session_status() == PHP_SESSION_NONE) {
     session_start();
 }
-header('Content-Type: text/html; charset=utf-8');
+//header('Content-Type: text/html; charset=utf-8');
 function getDecodeFileName($filename){
 	if (strpos($filename,"inith") !== false){
 		$ext = pathinfo($filename, PATHINFO_EXTENSION);
@@ -51,11 +51,12 @@ if (isset($_GET['username']) && $_GET['username'] != ""){
 		}else{
 			$filePositions = "";
 		}
+		
 		//For all items on the desktop
 		foreach ($files as $file){
 			$decodedFilename = "";
 			if (is_file($file) || is_dir($file)){
-				array_push($validfile,basename($file));
+				array_push($validfile,urlencode(basename($file)));
 				$fileDesktopPosition = getLineContain($filePositions,basename($file).",");
 				$decodedFilename = getDecodeFileName(basename($file));
 				//The filename has to be encoded into base64 first before sending to the Desktop as some UTF issue is happening here

+ 3 - 1
src/Desktop/myHost.php

@@ -16,16 +16,18 @@ include_once '../auth.php';
 	    .fixedsize{
             min-width:280px;
 			border: 1px solid transparent;
+			cursor:pointer;
 	    }
 		.fixedsize:hover{
 			background-color:#ecf3fd;
 			border: 1px solid #b8d6fb;
-			 border-radius: 3px;
+			border-radius: 3px;
 		}
 		.clickedFixedSize{
 			background-image: linear-gradient(#daeafc,#c1dcfc);
 			border: 1px solid #7da2ce !important;
 			border-radius: 3px;
+			cursor:pointer !important;
 		}
 		.selectable{
 		    border: 1px solid transparent;

+ 40 - 0
src/SystemAOB/functions/file_system/binarySelector.php

@@ -0,0 +1,40 @@
+<?php
+/*
+ArOZ Online File System Binary Selector
+--------------------------------------------------
+This is a simple function to select the suitable binary for your operating system.
+Call with binarySelectExecution("{binary_filename}","{command following the binary}");
+
+*/
+function binarySelectExecution ($binaryName, $command){
+	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+        //Use windows binary
+        $commandString = "start " . $binaryName . ".exe " . $command;
+		pclose(popen($commandString, 'r'));		
+    } else {
+        //Use linux binary
+    	$cpuMode = exec("uname -m 2>&1",$output, $return_var);
+    	switch(trim($cpuMode)){
+    	    case "armv7l": //raspberry pi 3B+
+    	    case "armv6l": //Raspberry pi zero w
+    	            $commandString = "sudo ./" . $binaryName . "_armv6l.elf " . $command; 
+    	        break;
+    	   case "aarch64": //Armbian with ARMv8 / arm64
+    	            $commandString = "sudo ./" . $binaryName . "_arm64.elf " . $command;
+				break;
+    	   case "i686": //x86 32bit CPU
+    	   case "i386": //x86 32bit CPU
+				$commandString = "sudo ./" . $binaryName . "_i386.elf " . $command;
+				break;
+    	   case "x86_64": //x86-64 64bit CPU
+    	            $commandString = "sudo ./" . $binaryName . "_amd64.elf " . $command;
+				break;
+    	   default:
+    	       //No idea why uname -m not working. In that case, x86 32bit binary is used.
+    	            $commandString = "sudo ./" . $binaryName . "_i386.elf " . $command;
+				break;
+		}
+	    pclose(popen($commandString . " > null.txt 2>&1 &", 'r'));
+    }
+}
+?>

+ 3 - 1
src/SystemAOB/functions/file_system/fileoprProgress.php

@@ -44,7 +44,8 @@ if (isset($_GET['download'])){
     //Download the given file after the operation finished
     $download = $_GET['download'];
     //Check if the download target is inside AOR. If not, add handling script in front of the filepath
-    if (strpos(realpath($download),realpath("../../../")) !== 0){
+    //if (strpos(realpath($download),realpath("../../../")) !== 0){
+	if (strpos(realpath($download),"/media/") === 0){
         //This file might be in external storage. Try to give it extDiskAccess
         $download = "../extDiskAccess.php?file=" . $download;
     }
@@ -52,6 +53,7 @@ if (isset($_GET['download'])){
     $download = "false";
 }
 
+//var_dump([realpath($download),realpath("../../../")]);
 ?>
 <!DOCTYPE html>
 <meta name="apple-mobile-web-app-capable" content="yes" />

二进制
src/SystemAOB/functions/file_system/fsconv.exe


二进制
src/SystemAOB/functions/file_system/fsconv_amd64.elf


二进制
src/SystemAOB/functions/file_system/fsconv_arm64.elf


二进制
src/SystemAOB/functions/file_system/fsconv_armv6l.elf


二进制
src/SystemAOB/functions/file_system/fsconv_i386.elf


+ 1 - 0
src/SystemAOB/functions/system_statistic/WIN32_USBlist.txt

@@ -0,0 +1 @@
+Generic USB Hub,Standard Enhanced PCI to USB Host Controller,Realtek RTL8192CU Wireless LAN 802.11n USB 2.0 Network Adapter,Generic USB Hub,Standard Enhanced PCI to USB Host Controller,Intel(R) USB 3.0 可延伸主機控制器,USB Composite Device,USB Root Hub,USB Root Hub,Intel(R) USB 3.0 根集線器,

+ 92 - 5
src/SystemAOB/functions/usbMount.php

@@ -18,6 +18,11 @@ include '../../auth.php';
     <link rel="stylesheet" href="../../script/tocas/tocas.css">
 	<script type='text/javascript' src="../../script/tocas/tocas.js"></script>
 	<title>ArOZ Onlineβ</title>
+	<style>
+	    a{
+	        cursor:pointer;
+	    }
+	</style>
 </head>
 <body>
 <?php
@@ -46,14 +51,66 @@ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
 	
 	?>
 	<!-- External Storage Mounting options-->
+	<!--
 	<div class="ts horizontal divider">External Storage Device Mount Options</div>
 	This mounting options is for the external USB storage device.
 	<div class="ts fluid small buttons">
 	<button class="ts fluid positive button" onClick="MountExtUSB();">Mount sdc1 to /dev/pi</button>
 	<button class="ts fluid negative button" onClick="UmountExtUSB();">Umount /dev/pi</button>
 	</div>
+	-->
 	<!-- Internal Storage Mounting options-->
-	<div class="ts horizontal divider">Internal Device Mounting Options (Developer only)</div>
+	<div class="ts horizontal divider">External Storage Mount Options</div>
+	<table class="ts table">
+        <thead>
+            <tr>
+                <th>Devices</th>
+                <th>Mounted Location</th>
+                <th>Toggle</th>
+            </tr>
+        </thead>
+        <tbody>
+            <?php
+            if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
+                $storageDev = glob("/dev/sd*1");
+                $emmcChk = shell_exec("cat /proc/self/mounts | grep mmcblk0");
+                $eMMCMode = false;
+                $counter = 1;
+                if (trim($emmcChk) != ""){
+                    //Raspberry Pi or similar SBCs that use eMMC to boot. Include sda as external storage
+                    $eMMCMode = true;
+                } 
+                foreach ($storageDev as $dev){
+                    $result = shell_exec("cat /proc/self/mounts | grep " . $dev);
+                    if (trim($result) != ""){
+                        $tmp = explode(' ',$result);
+                        if (!$emmcChk && trim($tmp[0]) == "/dev/sda1"){
+                            //Echo nothing as sda1 is boot parition if eMMC is not found
+                            //To be implemented
+                        }else{
+                             echo '<tr>
+                                <td>' . $tmp[0] . '</td>
+                                <td>'. $tmp[1] .'</td>
+                                <td><a mptID=' . $counter . ' mountPt="' . $tmp[1] . '" onClick="umountThis(this);">Umount</a></td>
+                            </tr>';
+                        }
+                       
+                    }else{
+                        //This parition exists but not mounted
+                        echo '<tr>
+                                <td>' . $dev . '</td>
+                                <td>Not mounted</td>
+                                <td><a mptID=' . $counter . ' devDir="' . $dev . '" onClick="mountThis(this);">Mount</a></td>
+                            </tr>';
+                    }
+                    $counter++;
+                }
+                
+            }
+            ?>
+        </tbody>
+    </table>
+    <!-- 
 	<div class="ts inverted vertically fitted segment">
 	<details class="ts inverted accordion">
 		<summary>
@@ -73,7 +130,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
 		</div>
 	</details>
 	</div>
-	
+	-->
 	<?php
 		if ($isWindows) {echo '</div></details>';}
 	?>
@@ -84,7 +141,9 @@ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
 ArOZ Online BETA SystemAOB Storage Devices Mounting Tool
 <br>
 </div>
-
+<div id="dummyLoader" class="ts active dimmer" style="display:none;">
+    <div class="ts text loader">Waiting File System Reponse</div>
+</div>
 
 <script>
 var isWindows = <?php echo $isWindows ? "true" : "false";?>;
@@ -121,7 +180,7 @@ function UpdateUSBList(){
 				}else{
 					var etc = "";
 				}
-				$('#deviceList').append('<div class="item"><i class="usb icon"></i>&nbsp'+ devices[i].substring(0, 50) + etc + '</div>');
+				$('#deviceList').append('<div class="item"><i class="usb icon"></i> '+ devices[i].substring(0, 50) + etc + '</div>');
 			}
 		}
 	});
@@ -140,13 +199,40 @@ function UpdateStorageDeviceList(){
 					}else{
 						var etc = "";
 					}
-					$('#mountList').append('<div class="item"><i class="disk outline icon"></i>&nbsp'+ data[i].substring(0, 50) + etc + '</div>');
+					$('#mountList').append('<div class="item"><i class="disk outline icon"></i> '+ data[i].substring(0, 50) + etc + '</div>');
 				}
 			}
 		}
 	});
 }
 
+function umountThis(object){
+    var mountPt = $(object).attr('mountPt');
+    umountLocation(mountPt);
+}
+
+function mountThis(object){
+    var mountPt = "/media/storage" + $(object).attr('mptID');
+    var devDir = $(object).attr('devDir');
+    mountDev(devDir,mountPt);
+}
+
+function umountLocation(mountPt){
+    $("#dummyLoader").show();
+    $.get("ntfs-3g.php?mpo=" + mountPt, function(data) {
+		window.location.reload();
+		$("#dummyLoader").hide();
+	});
+}
+
+function mountDev(dev,mountPt){
+    $("#dummyLoader").show();
+    $.get("ntfs-3g.php?md=" + dev + "&mpn=" + mountPt, function(data) {
+		window.location.reload();
+		$("#dummyLoader").hide();
+	});
+}
+
 function MountExtUSB(){
 	//Mount sdc1 to /media/pi 
 	$.get("ntfs-3g.php?md=/dev/sdc1&mpn=/media/pi", function(data) {
@@ -162,6 +248,7 @@ function UmountExtUSB(){
 	});
 }
 
+
 function debug_umso(){
 	$.get("ntfs-3g.php?mpo=/media/storage1", function(data) {
 		window.location.reload();

+ 1 - 1
src/SystemAOB/system/jwt/index.php

@@ -49,7 +49,7 @@ if (isset($_GET['remove']) && $_GET['remove'] != ""){
 			</div>
 			<div class="ts segment">
 			<p>New Token<br>
-			Please enter an expire time (in seconds) for the token. Leave empty for 3600 seconds or 0 for never expire.</p>
+			Please enter an expire time (in seconds) for the token. Leave empty or set to 0 for 3600 seconds / -1 for never expire.</p>
 				<div class="ts labeled fluid action input">
 					<input id="expireTime" type="number" min="0" >
 					<div class="ts basic label">@ <?php echo $_SESSION['login'];?></div>

+ 1 - 0
src/SystemAOB/system/jwt/shadow.php

@@ -422,6 +422,7 @@ else {
 }
 
 if (key_exists("error",$returnArray)){
+    header("HTTP/1.1 401 Unauthorized");
 	die("ERROR. Shadow Runner failed to initiate. " . $returnArray["error"]);
 }
 

+ 6 - 2
src/function_bar.php

@@ -104,6 +104,10 @@ body{
 	background-color:<?php echo $theme["actBtnColor"][3];?>;
 }
 
+.themeColorShader{
+	box-shadow: -1px -1px 3px 1px <?php echo $theme["defBtnColor"][3];?>;
+}
+
 .menuButton{
 	background-color:<?php echo $theme["defBtnColor"][3];?>;
 	width:60px;
@@ -245,8 +249,8 @@ foreach ($folders as $module){
 	
 	</div>
 	<!-- USB Reminder Interface -->
-	<div id="USBList" style="border: 2px #333 solid;overflow: hidden;position: fixed;right: 0;width: 450px;bottom:32px;height:500px;display:none;z-index:118;background-color:white;">
-		<div style="width:100%; position: relative; background-color:#333;color:white;left:0;top:0;height:20px;z-index:8;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;cursor: context-menu;"><i class="usb icon"></i>USB Device List</div>
+	<div id="USBList" class="themeColorShader" style="overflow: hidden;position: fixed;right: 0;width: 450px;bottom:34px;height:500px;display:none;z-index:118;background-color:white;">
+		<div class="fwPanelColor" style="width:100%; position: relative;color:white;left:0;top:0;height:20px;z-index:8;overflow:hidden;text-overflow: ellipsis;white-space: nowrap;cursor: context-menu;padding-left:5px;"><i class="usb icon"></i>USB Device List</div>
 		<iframe id="USBListDisplay" style="width:100%;height:100%;position:absolute;top:20px;" src="SystemAOB/functions/usbMount.php"></iframe>
 		</div>
 	</div>

二进制
src/script/tocas/fonts/1YwB1sO8YE1Lyjf12WNiUA.woff2