Lightweight node app to use in place of plex to self host your video and movie collections. Running on just under 50MB of ram this is ideal for people looking to host videos on minimal hardware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
6.2 KiB

  1. <script>
  2. function editHostForm(id, username)
  3. {
  4. $("#editUserBox").css("display", "block");
  5. $("#useridLabel").val(id);
  6. $("#usernameLabel").val(username);
  7. }
  8. </script>
  9. <div id="editUserBox" class="row" style="display:none">
  10. <!-- Edit User -->
  11. <div class="col-md-6">
  12. <div class="card">
  13. <div class="card-header">
  14. <h3 class="text-center">Edit User</h3>
  15. </div>
  16. <div class="card-body">
  17. <form action="/edituser" method ="post" class="p-2">
  18. <div class="form-group">
  19. <input class="form-control" id="useridLabel" type="text" name="id" required>
  20. <label>User ID</label>
  21. </div>
  22. <div class="form-group">
  23. <input class="form-control" id="usernameLabel" type="text" name="username" required>
  24. <label>User Name</label>
  25. </div>
  26. <div class="form-group">
  27. <input class="form-control" type="password" name="password" required>
  28. <label>Password</label>
  29. </div>
  30. <div class="form-group">
  31. <input class="form-control w-100" type="checkbox" name="admin">
  32. <label>Admin</label>
  33. </div>
  34. <div class="text-center">
  35. <input type="submit" name="add_user" value="Update User"
  36. class="btn btn-lg btn-secondary"/>
  37. </div>
  38. </form>
  39. </div>
  40. </div>
  41. <br>
  42. </div>
  43. </div>
  44. {if admin}
  45. <div class="row">
  46. <!-- Current Users -->
  47. <div class="col-md-8">
  48. <div class='card'>
  49. <div class="card-header">
  50. <h3 class="text-center">Users</h3>
  51. </div>
  52. <div class="card-body">
  53. <table class="table table-striped">
  54. <thead class="thead-dark">
  55. <tr>
  56. <td>User Name</td>
  57. <td>User ID</td>
  58. <td>Admin</td>
  59. <td>Edit</td>
  60. <td>Terminate</td>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. {for user in users}
  65. <tr>
  66. <td>{user.username}</td>
  67. <td>{user.id}</td>
  68. <td>{user.admin}</td>
  69. <td>
  70. <button onclick="editHostForm({user.id}, '{user.username}')" class="btn btn-secondary">Edit User</button>
  71. </td>
  72. <td>
  73. <form action="/removeuser" method ="post" >
  74. <input type="submit" name="submit" value="Delete" class="btn btn-secondary"/>
  75. <input type='hidden' name='id' value='{user.id}' />
  76. </form>
  77. </td>
  78. </tr>
  79. {/for}
  80. </tbody>
  81. </table>
  82. </div>
  83. </div>
  84. </div>
  85. <!-- Add User -->
  86. <div class="col-md-4">
  87. <div class="card">
  88. <div class="card-header">
  89. <h3 class="text-center">Add New User</h3>
  90. </div>
  91. <div class="card-body">
  92. <form action="/addUser" method ="post" class="p-2">
  93. <div class="form-group">
  94. <label> User Name
  95. <input class="form-control w-100" type="text" name="username" required>
  96. </label>
  97. </div>
  98. <div class="form-group">
  99. <label>Password
  100. <input class="form-control w-100" type="password" name="password" required>
  101. </label>
  102. </div>
  103. <div class="form-group">
  104. <label>Admin
  105. <input class="form-control w-100" type="checkbox" name="admin">
  106. </label>
  107. </div>
  108. <div class="text-center">
  109. <input type="submit" name="add_user" value="Create User"
  110. class="btn btn-lg btn-secondary"/>
  111. </div>
  112. </form>
  113. </div>
  114. </div>
  115. <br>
  116. </div>
  117. </div>
  118. {else}
  119. {if loggedIn}
  120. <div class="col-md-6">
  121. <div class="card">
  122. <div class="card-header">
  123. <h3 class="text-center">Update Profile</h3>
  124. </div>
  125. <div class="card-body">
  126. <form action="/updateUser" method ="post" class="p-2">
  127. <div class="form-group">
  128. <input class="form-control" id="usernameLabel" type="text" name="username" value="{username}" required>
  129. <label>User Name</label>
  130. </div>
  131. <div class="form-group">
  132. <input class="form-control" type="password" name="password" required>
  133. <label>Password</label>
  134. </div>
  135. <div class="text-center">
  136. <input type="submit" name="Update Profile" value="Update User"
  137. class="btn btn-lg btn-secondary"/>
  138. </div>
  139. </form>
  140. </div>
  141. </div>
  142. <br>
  143. </div>
  144. {else}
  145. <h1 class="align-content-center">Login Required</h1>
  146. <div class="align-content-center">
  147. <img src="/includes/img/404.jpg" alt="Page not found" width="70%" />
  148. </div>
  149. {/if}
  150. {/if}