Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit d05461f

Browse files
ExplvExplv
authored andcommitted
Fix OSBot accounts with special chars in password / spaces in name
Fix scripts with special chars / spaces in parameters Fix update message shown when running manager outside of .jar
1 parent d988297 commit d05461f

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.explv.explv_osbot_manager</groupId>
88
<artifactId>explv_osbot_manager</artifactId>
9-
<version>v2.0.1</version>
9+
<version>v2.0.3</version>
1010
<repositories>
1111
<repository>
1212
<id>local-repo</id>

src/main/java/bot_parameters/account/OSBotAccount.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public static OSBotAccount getInstance() {
1616

1717
@Override
1818
public final String[] toParameter() {
19-
return new String[]{ "-login", String.format("%s:%s", getUsername(), getPassword()) };
19+
return new String[]{ "-login", String.format("\"%s\":\"%s\"", getUsername(), getPassword()) };
2020
}
2121
}

src/main/java/bot_parameters/script/Script.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ public final void setParameters(final String parameters) {
4747

4848
@Override
4949
public final String[] toParameter() {
50-
return new String[] { "-script", String.format("%s:%s", scriptIdentifier.get(), parameters.get()) };
50+
if (isLocal()) {
51+
return new String[]{"-script", String.format("\\\"%s\\\":\\\"%s\\\"", scriptIdentifier.get(), parameters.get())};
52+
} else {
53+
return new String[]{"-script", String.format("%s:\\\"%s\\\"", scriptIdentifier.get(), parameters.get())};
54+
}
5155
}
5256

5357
private void writeObject(ObjectOutputStream stream) throws IOException {

src/main/java/main/ExplvOSBotManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ public static void main(final String[] args) {
1111
launch(args);
1212
}
1313

14+
public static final String getVersion() {
15+
String version = ExplvOSBotManager.class.getPackage().getImplementationVersion();
16+
return version != null ? version : "";
17+
}
18+
1419
@Override
1520
public final void start(final Stage primaryStage) {
1621
if (Updater.isUpdateRequired()) {
1722
Updater.update();
1823
}
1924

20-
primaryStage.setTitle("Explv's OSBot Manager");
25+
primaryStage.setTitle("Explv's OSBot Manager " + getVersion());
2126
Scene scene = new Scene(new ManagerPane(), 600, 400);
2227
scene.getStylesheets().add("css/manager_pane.css");
2328
primaryStage.setScene(scene);

src/main/java/main/Updater.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,26 @@ private static Optional<JSONObject> getLatestReleaseJSON() {
5252
}
5353

5454
public static boolean isUpdateRequired() {
55-
String currentVersion = Updater.class.getPackage().getImplementationVersion();
56-
return !currentVersion.equals(latestReleaseJSON.get("tag_name"));
55+
String currentVersion = ExplvOSBotManager.getVersion();
56+
57+
if (currentVersion.isEmpty()) {
58+
return false;
59+
}
60+
61+
return currentVersion.compareTo((String) latestReleaseJSON.get("tag_name")) < 0;
5762
}
5863

5964
public static void update() {
6065
Dialog updateDialog = new Dialog();
61-
updateDialog.setTitle("Explv's OSBot Manager");
66+
updateDialog.setTitle("Explv's OSBot Manager " + ExplvOSBotManager.getVersion());
6267
updateDialog.setHeaderText("Updating");
6368
updateDialog.show();
6469

6570
if (!downloadAndRunLatestRelease()) {
6671
updateDialog.close();
6772

6873
Dialog errorDialog = new Dialog();
69-
errorDialog.setTitle("Explv's OSBot Manager");
74+
errorDialog.setTitle("Explv's OSBot Manager " + ExplvOSBotManager.getVersion());
7075
errorDialog.setHeaderText("Error!");
7176
errorDialog.setContentText("Failed to download latest version");
7277
errorDialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);

version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)