Added user adding and deleting frontend and moved knockout.js to local server

master
Keith Irwin 2022-11-01 17:49:17 -06:00
parent 64ae072837
commit ba69f775be
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 21 additions and 2 deletions

View File

@ -22,14 +22,32 @@
<div>
<input type="text" data-bind="textInput:newPeerHostname,event:{keypress:addKeyPress}" placeholder="phone"></input>
<select data-bind="options:users,optionsText:'name',value:newPeerUser,optionsCaption:'(user)'"></select>
<span>.mytld</span>
21
<button data-bind="click:addPeer,disable:isAddingPeer,text:addPeerText">Add</button>
</div>
<p>After clicking "Add", the new peer's config will appear below. Copy and paste it into your wireguard client and start the service. <b>This configuration will not be shown again!</b> If you lose the config, you will need to delete the peer and recreate it. </p>
<h2>Add user</h2>
<p>To add a new user, type in the user's first device name and a username and click 'add'. The hostname and username must each be 3-10 lowercase letters and numbers <code>/[a-z0-9]{3,10}/</code>. </p>
<div>
<input type="text" data-bind="textInput:newUserHostname,event:{keypress:addKeyPress}" placeholder="pc1"></input>
<input type="text" data-bind="textInput:newUsername,event:{keypress:addKeyPress}" placeholder="joe"></input>
<button data-bind="click:addUser,disable:isAddingUser,text:addUserText">Add</button>
</div>
<p>After clicking "Add", the new user's first peer config will appear below. Copy and paste it into your wireguard client and start the service. <b>This configuration will not be shown again!</b> If you lose the config, you will need to delete the peer and recreate it. </p>
<h2>Delete User</h2>
<p>To delete a user, select the username from the list below and click 'Delete'. This will delete the user and all their peers. </p>
<div>
<select data-bind="options:users,optionsText:'name',value:userToDelete,optionsCaption:'(user)'"></select>
21
<button data-bind="click:deleteUser,disable:isDeletingUser,text:deleteUserText">Delete</button>
</div>
<hr>
<pre data-bind="text:newConfigText"></pre>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.1/knockout-latest.js" integrity="sha512-2AL/VEauKkZqQU9BHgnv48OhXcJPx9vdzxN1JrKDVc4FPU/MEE/BZ6d9l0mP7VmvLsjtYwqiYQpDskK9dG8KBA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/knockout-latest.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw=="></script>
<script src="/admin.js"></script>
</body>
</html>

1
front/knockout-latest.min.js vendored Normal file

File diff suppressed because one or more lines are too long