Fix display names for key generation
This commit is contained in:
parent
8e7e0aade7
commit
2fe896abb0
11
index.js
11
index.js
@ -19,6 +19,16 @@ const SwalConfig = {
|
|||||||
buttonsStyling: false,
|
buttonsStyling: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const invalidChars = ['/', '\\', '>', '<', ':', '*', '|', '"', '\'', '?', '\0'];
|
||||||
|
|
||||||
|
const replaceInvalid = (str) => {
|
||||||
|
var cache = str;
|
||||||
|
invalidChars.forEach(ch => {
|
||||||
|
cache = cache.replace(ch, "#");
|
||||||
|
});
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
const isOverflown = ({ clientHeight, scrollHeight }) => scrollHeight > clientHeight
|
const isOverflown = ({ clientHeight, scrollHeight }) => scrollHeight > clientHeight
|
||||||
|
|
||||||
const setCookie = (cname, cvalue, exdays) => {
|
const setCookie = (cname, cvalue, exdays) => {
|
||||||
@ -134,6 +144,7 @@ const generateSSH = async (name, id, token) => {
|
|||||||
generateKeyPair("RSASSA-PKCS1-v1_5", 4096, "namehere")
|
generateKeyPair("RSASSA-PKCS1-v1_5", 4096, "namehere")
|
||||||
.then((keys) => {
|
.then((keys) => {
|
||||||
var KeyExport = new JSZip();
|
var KeyExport = new JSZip();
|
||||||
|
name = replaceInvalid(name);
|
||||||
KeyExport.file("HackersTownTTY-"+name, keys[0]);
|
KeyExport.file("HackersTownTTY-"+name, keys[0]);
|
||||||
KeyExport.file("HackersTownTTY-"+name+".pub", keys[1]);
|
KeyExport.file("HackersTownTTY-"+name+".pub", keys[1]);
|
||||||
KeyExport.generateAsync({type:"blob"})
|
KeyExport.generateAsync({type:"blob"})
|
||||||
|
Loading…
Reference in New Issue
Block a user