remote.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <?php
  2. include_once '../auth.php';
  3. if(!file_exists("data")){
  4. mkdir("data",0777,true);
  5. }
  6. if (isset($_GET['comm']) && isset($_GET['rid'])){
  7. $rid = $_GET['rid'];
  8. $rid = explode(",",$rid)[0];
  9. file_put_contents("data/" . $rid . ".inf",$_GET['comm']);
  10. echo "DONE";
  11. exit(0);
  12. }
  13. ?>
  14. <html>
  15. <head>
  16. <link rel="stylesheet" href="../script/tocas/tocas.css">
  17. <script src="../script/tocas/tocas.js"></script>
  18. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  19. <script src="../script/jquery.min.js"></script>
  20. <script src="../script/ao_module.js"></script>
  21. <link rel="manifest" href="manifest.json">
  22. <style>
  23. body{
  24. background-color:#0c0c0c;
  25. color:white;
  26. }
  27. .white{
  28. color:white !important;
  29. }
  30. ::placeholder{
  31. color: white !important;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <br>
  37. <div class="ts container">
  38. <div class="ts white header">
  39. <i class="options icon"></i>RemotePlay Remote
  40. <div class="sub white header">Control your remote player here!</div>
  41. </div>
  42. <p class="white">Target RemotePlay ID</p>
  43. <div class="ts dropdown" width="100%">
  44. <div class="text">
  45. <div class="ts fluid input">
  46. <input type="text" style="border-top-right-radius: 0px;border-bottom-right-radius: 0px;background-color: black;color: white!important;border-color: white!important" placeholder="RemotePlay ID" id="remoteID_tb">
  47. </div>
  48. </div>
  49. <i class="caret down icon" style="border: 1px solid white;padding: .78571em 1em;border-radius: .28571rem;background-size: .8em;background-repeat: no-repeat;padding-right: calc(1em + .8em * 1.2);line-height: 1.4385em;border-left: 0px;height: 39.97px;right: 3.2%;border-top-left-radius: 0px;border-bottom-left-radius: 0px;top: 0.4vh;"></i>
  50. <div class="menu" style="background-color: black !important;" id="n_remoteID">
  51. </div>
  52. </div>
  53. <!--
  54. <div class="ts basic mini fluid input">
  55. <select class="ts basic dropdown" id="remoteID" style="background: black;color: white;width: 100%">
  56. <option>Scanning...</option>
  57. </select>
  58. </div>
  59. -->
  60. <p class="white">Volume Control (Min <--> Max)</p>
  61. <div class="ts slider">
  62. <input id="vol" type="range" min="0" max="1" step="0.05" value="0">
  63. </div>
  64. <br>
  65. <div class="ts separated mini buttons">
  66. <button class="ts basic white button" onClick="play();"><i class="play icon"></i>Play</button>
  67. <button class="ts basic white button" onClick="pause();"><i class="pause icon"></i>Pause</button>
  68. <button class="ts basic white button" onClick="bwd();"><i class="backward icon"></i>Backward</button>
  69. <button class="ts basic white button" onClick="fwd();"><i class="forward icon"></i>Forward</button>
  70. <button class="ts basic white button" onClick="fbwd();"><i class="fast backward icon"></i>Fast backward</button>
  71. <button class="ts basic white button" onClick="ffwd();"><i class="fast forward icon"></i>Fast forward</button>
  72. <button class="ts basic white button" onClick="stop();"><i class="stop icon"></i>Stop</button>
  73. <button class="ts basic white button" onClick="mute();"><i class="volume off icon"></i>Mute</button>
  74. <button class="ts basic white button" onClick="reset();"><i class="stop icon"></i>Reset</button>
  75. </div>
  76. </div>
  77. <script>
  78. var rid = "";
  79. $(document).ready(function(){
  80. ao_module_setWindowSize(1000,340);
  81. ts('.ts.dropdown:not(.basic)').dropdown();
  82. $(".ts.fluid.input").click(function(e) {
  83. e.stopPropagation();
  84. });
  85. var h = $(".ts.fluid.input").height();
  86. $(".caret.down.icon").attr("style",$(".caret.down.icon").attr("style").replace("39.97",h));
  87. var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
  88. $.get("opr.php?opr=scanalive",function(data){
  89. var obj = JSON.parse(data);
  90. $("#n_remoteID").html("");
  91. $("#n_remoteID").append($('<div class="item" style="color: white!important;"></div>').attr("value", "").text("Not selected"));
  92. $.each( obj, function( key, value ) {
  93. $("#n_remoteID").append($('<div class="item" style="color: white!important;"></div>').attr("value", value).text(value));
  94. });
  95. $("#n_remoteID").val("");
  96. /*
  97. if (previousRemoteID !== undefined && $(".item[value='" + previousRemoteID + "']").length > 0){
  98. $("#remoteID_tb").val(previousRemoteID);
  99. rid = previousRemoteID;
  100. }
  101. */
  102. $("#remoteID_tb").val(previousRemoteID);
  103. $("#n_remoteID .item").on("click",function(){
  104. //console.log($(this).attr("value"));
  105. $("#remoteID_tb").val($(this).attr("value"));
  106. ao_module_saveStorage("remoteplay","remoteID",$(this).attr("value"));
  107. rid = $(this).attr("value");
  108. });
  109. $("#remoteID_tb").on("change",function(){
  110. ao_module_saveStorage("remoteplay","remoteID",$(this).val());
  111. rid = $(this).val();
  112. });
  113. });
  114. });
  115. $("#vol").on("change",function(){
  116. sendCommand("setVol",$(this).val());
  117. });
  118. function play(){
  119. sendCommand("play","");
  120. }
  121. function pause(){
  122. sendCommand("pause","");
  123. }
  124. function fwd(){
  125. sendCommand("fwd","");
  126. }
  127. var ffwding = false;
  128. function ffwd(){
  129. if(ffwding){
  130. clearInterval(timer_1);
  131. ffwding = false;
  132. $("button").removeAttr("disabled");
  133. $("#vol").removeAttr("disabled");
  134. }else{
  135. timer_1 = setInterval(fwd, 1000);
  136. ffwding = true;
  137. $("#vol").attr("disabled","disabled");
  138. $("button").attr("disabled","disabled");
  139. $(".fast.forward.icon").parent().removeAttr("disabled");
  140. }
  141. }
  142. function bwd(){
  143. sendCommand("bwd","");
  144. }
  145. var fbwding = false;
  146. function fbwd(){
  147. if(fbwding){
  148. clearInterval(timer_1);
  149. fbwding = false;
  150. $("button").removeAttr("disabled");
  151. $("#vol").removeAttr("disabled");
  152. }else{
  153. timer_1 = setInterval(bwd, 1000);
  154. fbwding = true;
  155. $("#vol").attr("disabled","disabled");
  156. $("button").attr("disabled","disabled");
  157. $(".fast.backward.icon").parent().removeAttr("disabled");
  158. }
  159. }
  160. function stop(){
  161. sendCommand("stop","");
  162. }
  163. function mute(){
  164. sendCommand("setVol","0");
  165. $("#vol").val(0);
  166. }
  167. function reset(){
  168. sendCommand("reset","");
  169. }
  170. function sendCommand(comm,value){
  171. var fullcomm = comm + "," + value;
  172. $.get("remote.php?comm=" + fullcomm + "&rid=" + rid,function(data){
  173. if (data.includes("ERROR")){
  174. }
  175. });
  176. }
  177. /*
  178. $(document).ready(function(){
  179. var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
  180. $.get("opr.php?opr=scanalive",function(data){
  181. var obj = JSON.parse(data);
  182. $("#remoteID").html("");
  183. $("#remoteID").append($("<option></option>").attr("value", "").text("Not selected"));
  184. $.each( obj, function( key, value ) {
  185. $("#remoteID").append($("<option></option>").attr("value", value).text(value));
  186. });
  187. $("#remoteID").val("");
  188. if (previousRemoteID !== undefined && $("#remoteID option[value='" + previousRemoteID + "']").length > 0){
  189. $("#remoteID").val(previousRemoteID);
  190. rid = previousRemoteID;
  191. }
  192. });
  193. });
  194. */
  195. </script>
  196. </body>
  197. </html>