mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-19 18:49:38 +00:00
Update bytebin/bytesocks custom config settings
This commit is contained in:
4 files changed
+18
-18
No files matched your search
@@ -768,17 +768,12 @@ public final class ConfigKeys {
|
||||
/**
|
||||
* The URL of the bytebin instance used to upload data
|
||||
*/
|
||||
public static final ConfigKey<String> BYTEBIN_URL = stringKey("bytebin-url", "https://usercontent.luckperms.net/");
|
||||
public static final ConfigKey<String> BYTEBIN_URL = notReloadable(stringKey("bytebin-url", "https://usercontent.luckperms.net/"));
|
||||
|
||||
/**
|
||||
* The host of the bytesocks instance used to communicate with
|
||||
* The URL of the bytesocks instance used to communicate with
|
||||
*/
|
||||
public static final ConfigKey<String> BYTESOCKS_HOST = stringKey("bytesocks-host", "usersockets.luckperms.net");
|
||||
|
||||
/**
|
||||
* If TLS (https/wss) should be used when connecting to bytesocks
|
||||
*/
|
||||
public static final ConfigKey<Boolean> BYTESOCKS_USE_TLS = booleanKey("bytesocks-use-tls", true);
|
||||
public static final ConfigKey<String> BYTESOCKS_URL = notReloadable(stringKey("bytesocks-url", "https://usersockets.luckperms.net/"));
|
||||
|
||||
/**
|
||||
* The URL of the web editor
|
||||
|
||||
@@ -46,14 +46,21 @@ public class BytesocksClient extends AbstractHttpClient {
|
||||
/**
|
||||
* Creates a new bytesocks instance
|
||||
*
|
||||
* @param host the bytesocks host
|
||||
* @param url the bytesocks url
|
||||
* @param userAgent the client user agent string
|
||||
*/
|
||||
public BytesocksClient(OkHttpClient okHttpClient, String host, boolean tls, String userAgent) {
|
||||
public BytesocksClient(OkHttpClient okHttpClient, String url, String userAgent) {
|
||||
super(okHttpClient);
|
||||
|
||||
this.httpUrl = (tls ? "https://" : "http://") + host + "/";
|
||||
this.wsUrl = (tls ? "wss://" : "ws://") + host + "/";
|
||||
this.httpUrl = url;
|
||||
if (this.httpUrl.startsWith("http://")) {
|
||||
this.wsUrl = "ws://" + this.httpUrl.substring(7);
|
||||
} else if (this.httpUrl.startsWith("https://")) {
|
||||
this.wsUrl = "wss://" + this.httpUrl.substring(8);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid URL: " + url);
|
||||
}
|
||||
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,8 +172,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
);
|
||||
this.bytesocks = new BytesocksClient(
|
||||
this.httpClient,
|
||||
getConfiguration().get(ConfigKeys.BYTESOCKS_HOST),
|
||||
getConfiguration().get(ConfigKeys.BYTESOCKS_USE_TLS),
|
||||
getConfiguration().get(ConfigKeys.BYTESOCKS_URL),
|
||||
"luckperms/editor"
|
||||
);
|
||||
this.webEditorStore = new WebEditorStore(this);
|
||||
|
||||
+3
-4
@@ -86,12 +86,11 @@ public class WebEditorIntegrationTest {
|
||||
assertTrue(this.bytesocks.isRunning());
|
||||
|
||||
String bytebinUrl = "http://" + this.bytebin.getHost() + ":" + this.bytebin.getFirstMappedPort() + "/";
|
||||
String bytesocksHost = this.bytesocks.getHost() + ":" + this.bytesocks.getFirstMappedPort();
|
||||
String bytesocksUrl = "http://" + this.bytesocks.getHost() + ":" + this.bytesocks.getFirstMappedPort() + "/";
|
||||
|
||||
Map<String, String> config = ImmutableMap.<String, String>builder()
|
||||
.put("bytebin-url", bytebinUrl)
|
||||
.put("bytesocks-host", bytesocksHost)
|
||||
.put("bytesocks-use-tls", "false")
|
||||
.put("bytesocks-url", bytesocksUrl)
|
||||
.build();
|
||||
|
||||
TestPluginProvider.use(tempDir, config, (app, bootstrap, plugin) -> {
|
||||
@@ -141,7 +140,7 @@ public class WebEditorIntegrationTest {
|
||||
|
||||
httpClient.newWebSocket(
|
||||
new Request.Builder()
|
||||
.url("ws://" + bytesocksHost + "/" + bytesocksKey)
|
||||
.url(bytesocksUrl + bytesocksKey)
|
||||
.build(),
|
||||
new WebSocketListener() {
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user