Skip to content

Commit

Permalink
First Glider version published
Browse files Browse the repository at this point in the history
  • Loading branch information
N7ghtm4r3 committed Jan 22, 2023
1 parent 077e45f commit 436bc85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Binary file modified .gradle/file-system.probe
Binary file not shown.
10 changes: 6 additions & 4 deletions src/main/java/com/tecknobit/glider/helpers/GliderLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ public GliderLauncher(String databasePath, String token, String ivSpec, String s
throw new Exception("No-any sessions found with that token, retry");
socketManager = new SocketManager(false, session.getIvSpec(), session.getSecretKey(), CBC_ALGORITHM);
this.hostPort = session.getHostPort();
refreshPublicKeys();
if(session.isQRCodeLoginEnabled()) {
qrCodeHelper = new QRCodeHelper();
try {
Expand Down Expand Up @@ -317,14 +316,16 @@ public GliderLauncher(String databasePath, String token, String ivSpec, String s
**/
public GliderLauncher(String databasePath, String password, boolean singleUseMode, boolean QRCodeLoginEnabled,
int hostPort, boolean runInLocalhost) throws Exception {
if(!databasePath.endsWith(".db"))
if (databasePath.isBlank() || password.isBlank())
throw new IllegalArgumentException("You must fill the required fields as the database path and the password");
if (!databasePath.endsWith(".db"))
databasePath += ".db";
databaseManager = new DatabaseManager(databasePath);
String ivSpec = createCBCIvParameterSpecString();
String secretKey = createCBCSecretKeyString(k256);
String token = UUID.randomUUID().toString().replaceAll("-", "");
databaseManager.insertNewSession(token, ivSpec, secretKey, password, new SocketManager(false)
.getHost(!runInLocalhost), hostPort, singleUseMode, QRCodeLoginEnabled, runInLocalhost);
.getHost(!runInLocalhost), hostPort, singleUseMode, QRCodeLoginEnabled, runInLocalhost);
throw new SaveData("\n" + new JSONObject().put(SessionKeys.ivSpec.name(), ivSpec)
.put(SessionKeys.secretKey.name(), secretKey)
.put(SessionKeys.token.name(), token)
Expand Down Expand Up @@ -558,6 +559,7 @@ public void startService() throws IOException {
}
System.err.println("This session has been deleted");
});
refreshPublicKeys();
}

/**
Expand All @@ -570,7 +572,7 @@ private void refreshPublicKeys() {
public void run() {
super.run();
boolean createKeys;
while (true) {
while (socketManager.continueListening()) {
try {
if (!session.isSingleUseMode())
createKeys = true;
Expand Down

0 comments on commit 436bc85

Please sign in to comment.