mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-01-05 20:23:52 +01:00
Copy PreauthKey to keyboard. Added initial formatting
This commit is contained in:
@@ -466,7 +466,7 @@ def build_preauth_key_table(user_name):
|
||||
<thead>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td>Key</td>
|
||||
<td class='tooltipped' data-tooltip='Click an Auth Key Prefix to copy it to the clipboard'>Key Prefix</td>
|
||||
<td><center>Reusable</center></td>
|
||||
<td><center>Used</center></td>
|
||||
<td><center>Ephemeral</center></td>
|
||||
@@ -505,7 +505,7 @@ def build_preauth_key_table(user_name):
|
||||
# TR ID will look like "1-albert-tr"
|
||||
preauth_keys_collection = preauth_keys_collection+"""
|
||||
<tr id='"""+key["id"]+"""-"""+user_name+"""-tr' class='"""+hide_expired+"""'>
|
||||
<td>"""+str(key["id"])+"""</td>
|
||||
<td>"""+str(key["id"])[0:10]+""" onclick=copy_preauth_key(""""+str(key["id"])+"""")</td>
|
||||
<td class='tooltipped' data-tooltip='"""+tooltip_data+"""'>"""+str(key["key"])+"""</td>
|
||||
<td><center>"""+btn_reusable+"""</center></td>
|
||||
<td><center>"""+btn_used+"""</center></td>
|
||||
|
||||
@@ -968,3 +968,10 @@ function toggle_expired() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy a PreAuth Key to the clipboard. Show only the Prefix by default
|
||||
function copy_preauth_key(key) {
|
||||
key.select();
|
||||
navigator.clipboard.writeText(key);
|
||||
M.toast({html: 'PreAuth key copied to clipboard.'})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user