UUID is mostly ready for prod line, it can generate and retry if an existing UUID is made.
This commit is contained in:
parent
c705a5615a
commit
5d95990a0e
@ -1024,8 +1024,19 @@ public class delegationServices {
|
||||
int max = 999999999;
|
||||
double tokenGEN = Math.random() * (max - min + 1) + min;
|
||||
int tokenSTGEN = (int) tokenGEN;
|
||||
//Above makes token, it will be remade if it already exists
|
||||
String source = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
int length = 40;
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = random.nextInt(source.length());
|
||||
char randomChar = source.charAt(index);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
String UUID = sb.toString();
|
||||
//Above makes UUID, will be remade if it already exists.
|
||||
|
||||
//verify open cert
|
||||
try {
|
||||
Document DupeUser = accountS.find(eq("User", User)).first();
|
||||
String DUPE = (String) DupeUser.get("User");
|
||||
@ -1062,9 +1073,40 @@ public class delegationServices {
|
||||
System.out.println("Token Free (While EXP)");
|
||||
}
|
||||
}
|
||||
} catch (Exception exrs) {
|
||||
UUID uid = UUID.randomUUID();
|
||||
System.out.println("Token Free (Main)");
|
||||
} catch (Exception token) {
|
||||
try {
|
||||
Document DupeUUID = accountS.find(eq("UUID", UUID)).first();
|
||||
String DupeUUIDS = (String) DupeUUID.get("UUID");
|
||||
|
||||
Boolean UUIDOPEN = false;
|
||||
while (UUIDOPEN == false) {
|
||||
length = 40;
|
||||
sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = random.nextInt(source.length());
|
||||
char randomChar = source.charAt(index);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
String UUIDGEN = sb.toString();
|
||||
try {
|
||||
DupeUUID = accountS.find(eq("UUID", UUID)).first();
|
||||
DupeUUIDS = (String) DupeUUID.get("UUID");
|
||||
System.out.println("UUID Is Reserved, Try Again.");
|
||||
length = 40;
|
||||
sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = random.nextInt(source.length());
|
||||
char randomChar = source.charAt(index);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
UUIDGEN = sb.toString();
|
||||
UUID = UUIDGEN;
|
||||
} catch (Exception exDr) {
|
||||
UUIDOPEN = true;
|
||||
System.out.println("UUID Free (While EXP)" + exDr);
|
||||
}
|
||||
}
|
||||
System.out.println("Token & UUID Free (Main)");
|
||||
System.out.println("Creating.");
|
||||
Document createForm = new Document();
|
||||
Document FnetInit = new Document();
|
||||
@ -1078,6 +1120,7 @@ public class delegationServices {
|
||||
createForm.append("Path", "C:\\ObsidianCoreStudios\\Application\\");
|
||||
createForm.append("Freinds", " ");
|
||||
createForm.append("Token", tokenSTGEN);
|
||||
createForm.append("UUID", UUID);
|
||||
createForm.append("Control", 1);
|
||||
createForm.append("Upgrade", 0);
|
||||
createForm.append("Version","2");
|
||||
@ -1087,8 +1130,9 @@ public class delegationServices {
|
||||
accountS.insertOne(createForm);
|
||||
FnetInit.append("User", User);
|
||||
FnetInit.append("Status", true);
|
||||
FnetInit.append("Freinds", " ");
|
||||
FnetInit.append("Friends", " ");
|
||||
FnetInit.append("Token", tokenSTGEN);
|
||||
FnetInit.append("UUID", UUID);
|
||||
FnetInit.append("Control", 1);
|
||||
FNETDOC.insertOne(FnetInit);
|
||||
BasicDBObject searchQuery = new BasicDBObject();
|
||||
@ -1104,6 +1148,9 @@ public class delegationServices {
|
||||
dCollection.updateOne(searchQuery, updateQuery1);
|
||||
System.out.println("Update Request With Finished Status");
|
||||
delegationTimer.DeleteTargetRequest(ClientID);
|
||||
} catch (Exception uuid) {
|
||||
System.out.println("Something went wrong...");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user