Ver Fonte

Add files via upload

yeungalan há 6 anos atrás
pai
commit
2b41980a13

+ 9 - 0
RemotePlay/check.php

@@ -1,6 +1,15 @@
 <?php
 include_once("../auth.php");
 if (isset($_GET['rid'])){
+	touch("data/" . $_GET['rid'] . ".alive");
+	$alives = scandir("data/");
+	foreach($alives as $file){
+       $time = filectime("data/".$file);
+        if($time + 30 <= time() && $file !== ".." && $file !== "."){
+                unlink("data/".$file);
+        }
+    }
+	
 	if (file_exists("data/" . $_GET['rid'] . ".inf")){
 		$data = file_get_contents("data/" . $_GET['rid'] . ".inf");
 		$data = explode(",",$data);

+ 17 - 5
RemotePlay/embedded.php

@@ -63,6 +63,7 @@ if(!$valid){
 	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 	<script src="../script/jquery.min.js"></script>
 	<script src="../script/ao_module.js"></script>
+	<link rel="manifest" href="manifest.json">
 	<style>
 		body{
 			background-color:#0c0c0c;
@@ -87,7 +88,9 @@ if(!$valid){
 	<hr>
 	<p class="white">Target RemotePlay ID</p>
 	<div class="ts basic mini fluid input">
-		<input id="remoteID" class="white" type="text">
+		<select class="ts basic dropdown" id="remoteID" style="background: black;color: white;width: 100%">
+			<option>Scanning...</option>
+		</select>
 	</div>
 	<br><p class="white">Filename</p>
 	<div class="ts basic mini fluid input">
@@ -104,10 +107,19 @@ if(!$valid){
 </div>
 	<script>
 	$(document).ready(function(){
-		var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
-		if (previousRemoteID !== undefined){
-			$("#remoteID").val(previousRemoteID);
-		}
+		$.get("opr.php?opr=scanalive",function(data){
+				var obj = JSON.parse(data);
+				$("#remoteID").html("");
+				$("#remoteID").append($("<option></option>").attr("value", "").text("Not selected"));
+				$.each( obj, function( key, value ) {
+					$("#remoteID").append($("<option></option>").attr("value", value).text(value));
+				});
+				$("#remoteID").val("");
+				var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
+				if (previousRemoteID !== undefined && $("#remoteID option[value='" + previousRemoteID + "']").length > 0){
+					$("#remoteID").val(previousRemoteID);
+				}
+			});
 	});
 	var rid = $("#rid").text().trim();
 	ao_module_setWindowSize(385,420);

BIN
RemotePlay/img/android-chrome-192x192.png


BIN
RemotePlay/img/android-chrome-512x512.png


BIN
RemotePlay/img/apple-touch-icon.png


BIN
RemotePlay/img/launch-1125x2436.png


BIN
RemotePlay/img/launch-1242x2148.png


BIN
RemotePlay/img/launch-1536x2048.png


BIN
RemotePlay/img/launch-1668x2224.png


BIN
RemotePlay/img/launch-2048x2732.png


BIN
RemotePlay/img/launch-640x1136.png


BIN
RemotePlay/img/launch-750x1294.png


+ 71 - 59
RemotePlay/index.php

@@ -11,6 +11,9 @@ if (isset($_GET['filepath'])){
 	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 	<script src="../script/jquery.min.js"></script>
 	<script src="../script/ao_module.js"></script>
+	<link rel="manifest" href="manifest.json">
+
+	
 	<style>
 	body{
 		background-color:#0c0c0c;
@@ -48,7 +51,7 @@ var audio = new Audio("");
 
 loadScreen();
 var rid = $("#rid").text().trim();
-ao_module_setWindowSize(385,520);
+ao_module_setWindowSize(395,520);
 ao_module_setWindowTitle("RemotePlay");
 ao_module_setWindowIcon("feed");
 if (ao_module_virtualDesktop){
@@ -69,66 +72,69 @@ function check(){
 				console.log(fileinfo[1]);
 
 						if (fileinfo[0] == "fopen"){
-							audio.pause();
-							audio.currentTime = 0;
-        					//open the given filepath
-							if(fileinfo[1].indexOf(".jpg") > 0){
-								
-								$("body").html('<img src="' + fileinfo[1] + '" style="height: 100%;display: block;margin-left: auto;margin-right: auto;"></img');
-								currDisplay = "image";
-								
-							}else if(fileinfo[1].indexOf(".mp4") > 0){
-								
-								$("body").html('<video autoplay loop id="video" style="height: 100%;display: block;margin-left: auto;margin-right: auto;"><source src="' + fileinfo[1] + '" type="video/mp4"></video><div class="ts snackbar"><div class="content"></div></div>');
-								video = document.querySelector('video');
-								var promise = video.play();
-
-								if (promise !== undefined) {
-								  promise.then(_ => {
-								  }).catch(error => {
-									video.muted = true;
-									video.play();
-									ts('.snackbar').snackbar({
-										content: 'Due to browser restricton, this video has been muted.',
-										action: '',
-										actionEmphasis: 'negative',
-									});
-									
-								  });
-								}
-
-								currDisplay = "video";
-								video = document.getElementById("video");
-								
-							}else{
-								
-								loadScreen();
-								audio.volume = localStorage.getItem("global_volume");
-								audio.loop = true;
+							$.get("opr.php?opr=mime&file=" + fileinfo[1],function(filetype){
 								audio.pause();
 								audio.currentTime = 0;
-								audio.src = fileinfo[1];
-								audio.play();
-								
-								var promise = audio.play();
-								if (promise !== undefined) {
-								  promise.then(_ => {
-								  }).catch(error => {
-									audio.muted = true;
-									audio.play();
-									ts('.snackbar').snackbar({
-										content: 'Due to browser restricton, audio can\'t stream to this device',
-										action: '',
-										actionEmphasis: 'negative',
-									});
-									//alert("Error");
-								  });
-								}
-								
-								currDisplay = "audio";
-							}
-        				    ao_module_setWindowSize(800,800);
-        				    
+								//open the given filepath
+								if(filetype == "image"){
+									
+									$("body").html('<img src="' + fileinfo[1] + '" style="height: 100%;display: block;margin-left: auto;margin-right: auto;"></img');
+									currDisplay = "image";
+									ao_module_setWindowSize(800,800);
+									
+								}else if(filetype == "video"){
+									
+									$("body").html('<video autoplay loop id="video" style="height: 100%;display: block;margin-left: auto;margin-right: auto;width: 100%;"><source src="' + fileinfo[1] + '" type="video/mp4"></video><div class="ts snackbar"><div class="content"></div></div>');
+									video = document.querySelector('video');
+									var promise = video.play();
+
+									if (promise !== undefined) {
+									  promise.then(_ => {
+									  }).catch(error => {
+										video.muted = true;
+										video.play();
+										ts('.snackbar').snackbar({
+											content: 'Due to browser restricton, this video has been muted.',
+											action: '',
+											actionEmphasis: 'negative',
+										});
+										
+									  });
+									}
+
+									currDisplay = "video";
+									ao_module_setWindowSize(800,800);
+									video = document.getElementById("video");
+									
+								}else if(filetype == "audio"){
+									
+									loadScreen();
+									audio.volume = localStorage.getItem("global_volume");
+									audio.loop = true;
+									audio.pause();
+									audio.currentTime = 0;
+									audio.src = fileinfo[1];
+									//audio.play();
+									
+									var promise = audio.play();
+									if (promise !== undefined) {
+									  promise.then(_ => {
+									  }).catch(error => {
+										audio.muted = true;
+										audio.play();
+										ts('.snackbar').snackbar({
+											content: 'Due to browser restricton, audio can\'t stream to this device',
+											action: '',
+											actionEmphasis: 'negative',
+										});
+										//alert("Error");
+									  });
+									}
+									
+									currDisplay = "audio";
+									ao_module_setWindowSize(395,520);
+								}	
+        				    });
         				}else if (fileinfo[0] == "setVol"){
 							localStorage.setItem("global_volume",fileinfo[1]);
 							if(currDisplay == "audio"){
@@ -139,15 +145,19 @@ function check(){
         					
         				}else if (fileinfo[0] == "volup"){
 							if(currDisplay == "audio"){
+								localStorage.setItem("global_volume",audio.volume + 0.1);
 								audio.volume = audio.volume + 0.1
 							}else if(currDisplay == "video"){
+								localStorage.setItem("global_volume",video.volume + 0.1);
 								video.volume = video.volume + 0.1
 							}
         					
         				}else if (fileinfo[0] == "voldown"){
 							if(currDisplay == "audio"){
+								localStorage.setItem("global_volume",audio.volume - 0.1);
 								audio.volume = audio.volume - 0.1
 							}else if(currDisplay == "video"){
+								localStorage.setItem("global_volume",video.volume - 0.1);
 								video.volume = video.volume - 0.1
 							}
 								  
@@ -229,6 +239,8 @@ function loadScreen(){
 </div>
 <div class="white bottom" align="right">
 	<div class="ts breadcrumb">
+		<a class="white section" href="mobileremote.php">Toggle P-Remote</a>
+		<div class="divider"> / </div>
 		<a class="white section" href="remote.php">Toggle Remote</a>
 		<div class="divider"> / </div>
 		<a class="white section" href="">Refresh</a>

+ 23 - 0
RemotePlay/manifest.json

@@ -0,0 +1,23 @@
+{
+  "name": "Remoteplay",
+  "short_name": "Remoteplay",
+  "description": "Remoteplay",
+  "scope": ".",
+  "start_url": "/AOB/RemotePlay/",
+  "display": "standalone",
+  "orientation": "portrait",
+  "theme_color": "#ffffff",
+  "background_color": "#ffffff",
+  "icons": [
+    {
+      "src": "img/android-chrome-192x192.png",
+      "sizes": "192x192",
+      "type": "image/png"
+    },
+    {
+      "src": "img/android-chrome-512x512.png",
+      "sizes": "512x512",
+      "type": "image/png"
+    }
+  ]
+}

+ 18 - 9
RemotePlay/mobileremote.php

@@ -18,6 +18,7 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 	<meta name="viewport" content="width=device-width, initial-scale=0.9, shrink-to-fit=no">
 	<script src="../script/jquery.min.js"></script>
 	<script src="../script/ao_module.js"></script>
+	<link rel="manifest" href="manifest.json">
 	<style>
 	body{
 		background-color:#0c0c0c;
@@ -44,7 +45,9 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
         <div class="sixteen wide column">
 			<p class="white">Target RemotePlay ID</p>
 			<div class="ts basic mini fluid input">
-				<input id="remoteID" class="white" type="text">
+				<select class="ts basic dropdown" id="remoteID" style="background: black;color: white;width: 100%">
+					<option>Scanning...</option>
+				</select>
 			</div>
 		</div>
     </div>
@@ -116,11 +119,8 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 
 /* end */
 
-
-
-
 var rid = "";
-ao_module_setWindowSize(500,320);
+ao_module_setWindowSize(347,560);
 $("#vol").on("change",function(){
 	sendCommand("setVol",$(this).val());
 });
@@ -210,10 +210,19 @@ function sendCommand(comm,value){
 
 $(document).ready(function(){
 	var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
-	if (previousRemoteID !== undefined){
-		$("#remoteID").val(previousRemoteID);
-		rid = previousRemoteID;
-	}
+	$.get("opr.php?opr=scanalive",function(data){
+		var obj = JSON.parse(data);
+		$("#remoteID").html("");
+		$("#remoteID").append($("<option></option>").attr("value", "").text("Not selected"));
+		$.each( obj, function( key, value ) {
+			$("#remoteID").append($("<option></option>").attr("value", value).text(value));
+		});
+		$("#remoteID").val("");
+		if (previousRemoteID !== undefined && $("#remoteID option[value='" + previousRemoteID + "']").length > 0){
+			$("#remoteID").val(previousRemoteID);
+			rid = previousRemoteID;
+		}
+	});
 });
 </script>
 </body>

+ 23 - 0
RemotePlay/opr.php

@@ -0,0 +1,23 @@
+<?php
+if (isset($_GET['opr'])){
+	if($_GET["opr"] == "scanalive"){
+		$output = [];
+		$file = glob('data/*.alive');
+		foreach($file as $alive){
+			array_push($output,basename($alive,".alive"));
+		}
+		echo json_encode($output);
+		
+	}else if($_GET["opr"] == "mime"){
+		
+		echo explode("/",mime_content_type($_GET["file"]))[0];
+		
+	}else{
+		
+		echo "[]";
+		
+	}
+	
+}else{
+	echo "[]";
+}

+ 48 - 14
RemotePlay/remote.php

@@ -18,6 +18,7 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 	<script src="../script/jquery.min.js"></script>
 	<script src="../script/ao_module.js"></script>
+	<link rel="manifest" href="manifest.json">
 	<style>
 	body{
 		background-color:#0c0c0c;
@@ -37,7 +38,9 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 </div>
 	<p class="white">Target RemotePlay ID</p>
 	<div class="ts basic mini fluid input">
-		<input id="remoteID" class="white" type="text">
+		<select class="ts basic dropdown" id="remoteID" style="background: black;color: white;width: 100%">
+			<option>Scanning...</option>
+		</select>
 	</div>
 	<p class="white">Volume Control (Min <--> Max)</p>
 	<div class="ts slider">
@@ -47,9 +50,10 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 	<div class="ts separated mini buttons">
 		<button class="ts basic white button" onClick="play();"><i class="play icon"></i>Play</button>
 		<button class="ts basic white button" onClick="pause();"><i class="pause icon"></i>Pause</button>
-		<button class="ts basic white button" onClick="bwd();"><i class="play icon"></i>Back forward</button>
-		<button class="ts basic white button" onClick="fwd();"><i class="play icon"></i>Fast forward</button>
-		<button class="ts basic white button" onClick="speedincrease();"><i class="play icon"></i>Speed increase</button>
+		<button class="ts basic white button" onClick="bwd();"><i class="backward icon"></i>Backward</button>
+		<button class="ts basic white button" onClick="fwd();"><i class="forward icon"></i>Forward</button>
+		<button class="ts basic white button" onClick="fbwd();"><i class="fast backward icon"></i>Fast backward</button>
+		<button class="ts basic white button" onClick="ffwd();"><i class="fast forward icon"></i>Fast forward</button>
 		<button class="ts basic white button" onClick="stop();"><i class="stop icon"></i>Stop</button>
 		<button class="ts basic white button" onClick="mute();"><i class="volume off icon"></i>Mute</button>
 		<button class="ts basic white button" onClick="reset();"><i class="stop icon"></i>Reset</button>
@@ -57,7 +61,7 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
 </div>
 <script>
 var rid = "";
-ao_module_setWindowSize(500,320);
+ao_module_setWindowSize(1000,340);
 $("#vol").on("change",function(){
 	sendCommand("setVol",$(this).val());
 });
@@ -79,14 +83,19 @@ function fwd(){
 	sendCommand("fwd","");
 }
 
-var speedincreaseing = false;
-function speedincrease(){
-	if(speedincreaseing){
+var ffwding = false;
+function ffwd(){
+	if(ffwding){
 		clearInterval(timer_1);
-		speedincreaseing = false;
+		ffwding = false;
+		$("button").removeAttr("disabled");
+		$("#vol").removeAttr("disabled");
 	}else{
 	  timer_1 = setInterval(fwd, 1000);
-	  speedincreaseing = true;
+	  ffwding = true;
+	  $("#vol").attr("disabled","disabled");
+	  $("button").attr("disabled","disabled");
+	  $(".fast.forward.icon").parent().removeAttr("disabled");
 	}
 }
 
@@ -94,6 +103,22 @@ function bwd(){
 	sendCommand("bwd","");
 }
 
+var fbwding = false;
+function fbwd(){
+	if(fbwding){
+		clearInterval(timer_1);
+		fbwding = false;
+		$("button").removeAttr("disabled");
+		$("#vol").removeAttr("disabled");
+	}else{
+	  timer_1 = setInterval(bwd, 1000);
+	  fbwding = true;
+	  $("#vol").attr("disabled","disabled");
+	  $("button").attr("disabled","disabled");
+	  $(".fast.backward.icon").parent().removeAttr("disabled");
+	}
+}
+
 function stop(){
 	sendCommand("stop","");
 }
@@ -118,10 +143,19 @@ function sendCommand(comm,value){
 
 $(document).ready(function(){
 	var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
-	if (previousRemoteID !== undefined){
-		$("#remoteID").val(previousRemoteID);
-		rid = previousRemoteID;
-	}
+	$.get("opr.php?opr=scanalive",function(data){
+		var obj = JSON.parse(data);
+		$("#remoteID").html("");
+		$("#remoteID").append($("<option></option>").attr("value", "").text("Not selected"));
+		$.each( obj, function( key, value ) {
+			$("#remoteID").append($("<option></option>").attr("value", value).text(value));
+		});
+		$("#remoteID").val("");
+		if (previousRemoteID !== undefined && $("#remoteID option[value='" + previousRemoteID + "']").length > 0){
+			$("#remoteID").val(previousRemoteID);
+			rid = previousRemoteID;
+		}
+	});
 });
 </script>
 </body>