vaultfs 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auth/AuthManager.java +9 -19
- package/version.txt +1 -1
package/package.json
CHANGED
|
@@ -105,8 +105,10 @@ public class AuthManager {
|
|
|
105
105
|
URL url = URI.create(AuthConfig.AUTH_SERVER_URL + "/auth/session/new").toURL();
|
|
106
106
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
107
107
|
conn.setRequestMethod("GET");
|
|
108
|
-
conn.setConnectTimeout(
|
|
109
|
-
conn.setReadTimeout(
|
|
108
|
+
conn.setConnectTimeout(10000);
|
|
109
|
+
conn.setReadTimeout(10000);
|
|
110
|
+
int responseCode = conn.getResponseCode();
|
|
111
|
+
if (responseCode != 200) return null;
|
|
110
112
|
String response = readStream(conn.getInputStream());
|
|
111
113
|
return extractJsonValue(response, "sessionId");
|
|
112
114
|
} catch (Exception e) {
|
|
@@ -170,29 +172,17 @@ public class AuthManager {
|
|
|
170
172
|
/** Opens a URL in the default browser using platform-specific commands. */
|
|
171
173
|
private static void openBrowser(String url) {
|
|
172
174
|
String os = System.getProperty("os.name").toLowerCase();
|
|
173
|
-
Runtime rt = Runtime.getRuntime();
|
|
174
175
|
try {
|
|
175
176
|
if (os.contains("win")) {
|
|
176
|
-
|
|
177
|
+
Runtime.getRuntime().exec(new String[]{"cmd", "/c", "start", "", url});
|
|
177
178
|
} else if (os.contains("mac")) {
|
|
178
|
-
|
|
179
|
+
Runtime.getRuntime().exec(new String[]{"open", url});
|
|
179
180
|
} else {
|
|
180
|
-
String[]
|
|
181
|
-
boolean opened = false;
|
|
182
|
-
for (String browser : browsers) {
|
|
183
|
-
try {
|
|
184
|
-
rt.exec(new String[]{browser, url});
|
|
185
|
-
opened = true;
|
|
186
|
-
break;
|
|
187
|
-
} catch (Exception ignored) {}
|
|
188
|
-
}
|
|
189
|
-
if (!opened) {
|
|
190
|
-
System.out.println("Please open this URL manually: " + url);
|
|
191
|
-
}
|
|
181
|
+
Runtime.getRuntime().exec(new String[]{"xdg-open", url});
|
|
192
182
|
}
|
|
193
183
|
} catch (Exception e) {
|
|
194
|
-
System.out.println("Could not open browser
|
|
195
|
-
System.out.println("Please
|
|
184
|
+
System.out.println(" Could not open browser: " + e.getMessage());
|
|
185
|
+
System.out.println(" Please visit manually: " + url);
|
|
196
186
|
}
|
|
197
187
|
}
|
|
198
188
|
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.9
|