1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-16 10:09:55 +00:00

Make http domain configuration a little clearer

This commit is contained in:
SquidDev 2019-12-23 18:59:36 +00:00
parent da41c65128
commit ae928c4397
9 changed files with 29 additions and 27 deletions

View File

@ -54,8 +54,8 @@ public final class Config
private static Property httpEnable;
private static Property httpWebsocketEnable;
private static Property httpWhitelist;
private static Property httpBlacklist;
private static Property httpAllowedDomains;
private static Property httpBlockedDomains;
private static Property httpTimeout;
private static Property httpMaxRequests;
@ -163,8 +163,10 @@ public static void load( File configFile )
{ // HTTP
renameProperty( CATEGORY_GENERAL, "http_enable", CATEGORY_HTTP, "enabled" );
renameProperty( CATEGORY_GENERAL, "http_websocket_enable", CATEGORY_HTTP, "websocket_enabled" );
renameProperty( CATEGORY_GENERAL, "http_whitelist", CATEGORY_HTTP, "whitelist" );
renameProperty( CATEGORY_GENERAL, "http_blacklist", CATEGORY_HTTP, "blacklist" );
renameProperty( CATEGORY_GENERAL, "http_whitelist", CATEGORY_HTTP, "allowed_domains" );
renameProperty( CATEGORY_GENERAL, "http_blacklist", CATEGORY_HTTP, "blocked_domains" );
renameProperty( CATEGORY_HTTP, "whitelist", CATEGORY_HTTP, "allowed_domains" );
renameProperty( CATEGORY_HTTP, "blacklist", CATEGORY_HTTP, "blocked_domains" );
config.getCategory( CATEGORY_HTTP )
.setComment( "Controls the HTTP API" );
@ -176,15 +178,15 @@ public static void load( File configFile )
httpWebsocketEnable = config.get( CATEGORY_HTTP, "websocket_enabled", ComputerCraft.http_websocket_enable );
httpWebsocketEnable.setComment( "Enable use of http websockets. This requires the \"http_enable\" option to also be true." );
httpWhitelist = config.get( CATEGORY_HTTP, "whitelist", DEFAULT_HTTP_WHITELIST );
httpWhitelist.setComment( "A list of wildcards for domains or IP ranges that can be accessed through the " +
httpAllowedDomains = config.get( CATEGORY_HTTP, "allowed_domains", DEFAULT_HTTP_WHITELIST );
httpAllowedDomains.setComment( "A list of wildcards for domains or IP ranges that can be accessed through the " +
"\"http\" API on Computers.\n" +
"Set this to \"*\" to access to the entire internet. Example: \"*.pastebin.com\" will restrict access to " +
"just subdomains of pastebin.com.\n" +
"You can use domain names (\"pastebin.com\"), wilcards (\"*.pastebin.com\") or CIDR notation (\"127.0.0.0/8\")." );
httpBlacklist = config.get( CATEGORY_HTTP, "blacklist", DEFAULT_HTTP_BLACKLIST );
httpBlacklist.setComment( "A list of wildcards for domains or IP ranges that cannot be accessed through the " +
httpBlockedDomains = config.get( CATEGORY_HTTP, "blocked_domains", DEFAULT_HTTP_BLACKLIST );
httpBlockedDomains.setComment( "A list of wildcards for domains or IP ranges that cannot be accessed through the " +
"\"http\" API on Computers.\n" +
"If this is empty then all whitelisted domains will be accessible. Example: \"*.github.com\" will block " +
"access to all subdomains of github.com.\n" +
@ -220,7 +222,7 @@ public static void load( File configFile )
setOrder(
CATEGORY_HTTP,
httpEnable, httpWebsocketEnable, httpWhitelist, httpBlacklist,
httpEnable, httpWebsocketEnable, httpAllowedDomains, httpBlockedDomains,
httpTimeout, httpMaxRequests, httpMaxDownload, httpMaxUpload, httpMaxWebsockets, httpMaxWebsocketMessage
);
}
@ -441,8 +443,8 @@ public static void sync()
// HTTP
ComputerCraft.http_enable = httpEnable.getBoolean();
ComputerCraft.http_websocket_enable = httpWebsocketEnable.getBoolean();
ComputerCraft.http_whitelist = new AddressPredicate( httpWhitelist.getStringList() );
ComputerCraft.http_blacklist = new AddressPredicate( httpBlacklist.getStringList() );
ComputerCraft.http_whitelist = new AddressPredicate( httpAllowedDomains.getStringList() );
ComputerCraft.http_blacklist = new AddressPredicate( httpBlockedDomains.getStringList() );
ComputerCraft.httpTimeout = Math.max( 0, httpTimeout.getInt() );
ComputerCraft.httpMaxRequests = Math.max( 1, httpMaxRequests.getInt() );

View File

@ -168,8 +168,8 @@ gui.computercraft:config.execution.max_main_computer_time=Computer Servertick Ze
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=HTTP-API aktivieren
gui.computercraft:config.http.websocket_enabled=Websockets aktivieren
gui.computercraft:config.http.whitelist=HTTP-Whitelist
gui.computercraft:config.http.blacklist=HTTP-Blacklist
gui.computercraft:config.http.allowed_domains=HTTP-Whitelist
gui.computercraft:config.http.blocked_domains=HTTP-Blacklist
gui.computercraft:config.http.timeout=Zeitüberschreitung
gui.computercraft:config.http.max_requests=Maximale Anzahl gleichzeitiger Anfragen

View File

@ -168,8 +168,8 @@ gui.computercraft:config.execution.max_main_computer_time=Server tick computer t
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=Enable the HTTP API
gui.computercraft:config.http.websocket_enabled=Enable websockets
gui.computercraft:config.http.whitelist=HTTP whitelist
gui.computercraft:config.http.blacklist=HTTP blacklist
gui.computercraft:config.http.allowed_domains=Allowed domains
gui.computercraft:config.http.blocked_domains=Blocked domains
gui.computercraft:config.http.timeout=Timeout
gui.computercraft:config.http.max_requests=Maximum concurrent requests

View File

@ -57,8 +57,8 @@ gui.computercraft:config.default_computer_settings=Configuración de Ordenador p
gui.computercraft:config.log_computer_errors=Grabar errores periféricos
gui.computercraft:config.http.enabled=Habilitar API de HTTP
gui.computercraft:config.http.whitelist=Lista blanca de HTTP
gui.computercraft:config.http.blacklist=Lista negra de HTTP
gui.computercraft:config.http.allowed_domains=Lista blanca de HTTP
gui.computercraft:config.http.blocked_domains=Lista negra de HTTP
gui.computercraft:config.peripheral.command_block_enabled=Habilitar bloque de comandos periférico
gui.computercraft:config.peripheral.modem_range=Rango del módem (Por defecto)

View File

@ -57,8 +57,8 @@ gui.computercraft:config.default_computer_settings=Configuration d'Ordinateur pa
gui.computercraft:config.log_computer_errors=Journal d'erreur périphériques
gui.computercraft:config.http.enabled=Permettre l'API HTTP
gui.computercraft:config.http.whitelist=HTTP liste blanche
gui.computercraft:config.http.blacklist=HTTP liste noire
gui.computercraft:config.http.allowed_domains=HTTP liste blanche
gui.computercraft:config.http.blocked_domains=HTTP liste noire
gui.computercraft:config.peripheral.command_block_enabled=Permettre l'accès d'un Bloc de Commande par périphérique
gui.computercraft:config.peripheral.modem_range=Portée d'un Modem (par défaut)

View File

@ -63,8 +63,8 @@ gui.computercraft:config.execution.computer_threads=Threads computer
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=Attiva l'API HTTP
gui.computercraft:config.http.websocket_enabled=Attiva websocket
gui.computercraft:config.http.whitelist=Lista bianca HTTP
gui.computercraft:config.http.blacklist=Lista nera HTTP
gui.computercraft:config.http.allowed_domains=Lista bianca HTTP
gui.computercraft:config.http.blocked_domains=Lista nera HTTP
gui.computercraft:config.http.timeout=Tempo di scadenza
gui.computercraft:config.http.max_requests=Richieste correnti massime

View File

@ -63,8 +63,8 @@ gui.computercraft:config.execution.computer_threads=Threads por computador
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=Habilitar a biblioteca de HTTP
gui.computercraft:config.http.websocket_enabled=Habilitar websockets
gui.computercraft:config.http.whitelist=Lista de endereços autorizados
gui.computercraft:config.http.blacklist=Lista de endereços proíbidos
gui.computercraft:config.http.allowed_domains=Lista de endereços autorizados
gui.computercraft:config.http.blocked_domains=Lista de endereços proíbidos
gui.computercraft:config.http.timeout=Tempo limite para conexões
gui.computercraft:config.http.max_requests=Limite de conexões paralelas

View File

@ -63,8 +63,8 @@ gui.computercraft:config.execution.computer_threads=Dator trådar
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=Aktivera HTTP API
gui.computercraft:config.http.websocket_enabled=Aktivera websockets
gui.computercraft:config.http.whitelist=HTTP vitlista
gui.computercraft:config.http.blacklist=HTTP svartlista
gui.computercraft:config.http.allowed_domains=HTTP vitlista
gui.computercraft:config.http.blocked_domains=HTTP svartlista
gui.computercraft:config.http.timeout=Timeout
gui.computercraft:config.http.max_requests=Maximalt antal samgående förfrågningar

View File

@ -168,8 +168,8 @@ gui.computercraft:config.execution.max_main_computer_time=服务器计算机tick
gui.computercraft:config.http=HTTP
gui.computercraft:config.http.enabled=启用HTTP API
gui.computercraft:config.http.websocket_enabled=启用websockets
gui.computercraft:config.http.whitelist=HTTP白名单
gui.computercraft:config.http.blacklist=HTTP黑名单
gui.computercraft:config.http.allowed_domains=HTTP白名单
gui.computercraft:config.http.blocked_domains=HTTP黑名单
gui.computercraft:config.http.timeout=Timeout
gui.computercraft:config.http.max_requests=最大并发请求数