remote.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. </style>
  31. </head>
  32. <body>
  33. <br>
  34. <div class="ts container">
  35. <div class="ts white header">
  36. <i class="options icon"></i>RemotePlay Remote
  37. <div class="sub white header">Control your remote player here!</div>
  38. </div>
  39. <p class="white">Target RemotePlay ID</p>
  40. <div class="ts basic mini fluid input">
  41. <select class="ts basic dropdown" id="remoteID" style="background: black;color: white;width: 100%">
  42. <option>Scanning...</option>
  43. </select>
  44. </div>
  45. <p class="white">Volume Control (Min <--> Max)</p>
  46. <div class="ts slider">
  47. <input id="vol" type="range" min="0" max="1" step="0.05" value="0">
  48. </div>
  49. <br>
  50. <div class="ts separated mini buttons">
  51. <button class="ts basic white button" onClick="play();"><i class="play icon"></i>Play</button>
  52. <button class="ts basic white button" onClick="pause();"><i class="pause icon"></i>Pause</button>
  53. <button class="ts basic white button" onClick="bwd();"><i class="backward icon"></i>Backward</button>
  54. <button class="ts basic white button" onClick="fwd();"><i class="forward icon"></i>Forward</button>
  55. <button class="ts basic white button" onClick="fbwd();"><i class="fast backward icon"></i>Fast backward</button>
  56. <button class="ts basic white button" onClick="ffwd();"><i class="fast forward icon"></i>Fast forward</button>
  57. <button class="ts basic white button" onClick="stop();"><i class="stop icon"></i>Stop</button>
  58. <button class="ts basic white button" onClick="mute();"><i class="volume off icon"></i>Mute</button>
  59. <button class="ts basic white button" onClick="reset();"><i class="stop icon"></i>Reset</button>
  60. </div>
  61. </div>
  62. <script>
  63. var rid = "";
  64. ao_module_setWindowSize(1000,340);
  65. $("#vol").on("change",function(){
  66. sendCommand("setVol",$(this).val());
  67. });
  68. $("#remoteID").on("change",function(){
  69. ao_module_saveStorage("remoteplay","remoteID",$(this).val());
  70. rid = $(this).val();
  71. });
  72. function play(){
  73. sendCommand("play","");
  74. }
  75. function pause(){
  76. sendCommand("pause","");
  77. }
  78. function fwd(){
  79. sendCommand("fwd","");
  80. }
  81. var ffwding = false;
  82. function ffwd(){
  83. if(ffwding){
  84. clearInterval(timer_1);
  85. ffwding = false;
  86. $("button").removeAttr("disabled");
  87. $("#vol").removeAttr("disabled");
  88. }else{
  89. timer_1 = setInterval(fwd, 1000);
  90. ffwding = true;
  91. $("#vol").attr("disabled","disabled");
  92. $("button").attr("disabled","disabled");
  93. $(".fast.forward.icon").parent().removeAttr("disabled");
  94. }
  95. }
  96. function bwd(){
  97. sendCommand("bwd","");
  98. }
  99. var fbwding = false;
  100. function fbwd(){
  101. if(fbwding){
  102. clearInterval(timer_1);
  103. fbwding = false;
  104. $("button").removeAttr("disabled");
  105. $("#vol").removeAttr("disabled");
  106. }else{
  107. timer_1 = setInterval(bwd, 1000);
  108. fbwding = true;
  109. $("#vol").attr("disabled","disabled");
  110. $("button").attr("disabled","disabled");
  111. $(".fast.backward.icon").parent().removeAttr("disabled");
  112. }
  113. }
  114. function stop(){
  115. sendCommand("stop","");
  116. }
  117. function mute(){
  118. sendCommand("setVol","0");
  119. $("#vol").val(0);
  120. }
  121. function reset(){
  122. sendCommand("reset","");
  123. }
  124. function sendCommand(comm,value){
  125. var fullcomm = comm + "," + value;
  126. $.get("remote.php?comm=" + fullcomm + "&rid=" + rid,function(data){
  127. if (data.includes("ERROR")){
  128. }
  129. });
  130. }
  131. $(document).ready(function(){
  132. var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
  133. $.get("opr.php?opr=scanalive",function(data){
  134. var obj = JSON.parse(data);
  135. $("#remoteID").html("");
  136. $("#remoteID").append($("<option></option>").attr("value", "").text("Not selected"));
  137. $.each( obj, function( key, value ) {
  138. $("#remoteID").append($("<option></option>").attr("value", value).text(value));
  139. });
  140. $("#remoteID").val("");
  141. if (previousRemoteID !== undefined && $("#remoteID option[value='" + previousRemoteID + "']").length > 0){
  142. $("#remoteID").val(previousRemoteID);
  143. rid = previousRemoteID;
  144. }
  145. });
  146. });
  147. </script>
  148. </body>
  149. </html>