Auxtools is now a config opt-in (#74501)

See https://github.com/tgstation/tgstation/pull/74497

Causes auxtools to not be a default part of the server environment and
requires server operators to manually enable it.

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
Zephyr
2023-04-05 15:36:26 -07:00
committed by GitHub
co-authored by Mothblocks
parent 74ef643482
commit 7fd64dcf3d
8 changed files with 51 additions and 6 deletions
+2 -2
View File
@@ -6,9 +6,9 @@
//flags
/// can't edit
#define CONFIG_ENTRY_LOCKED 1
#define CONFIG_ENTRY_LOCKED (1<<0)
/// can't see value
#define CONFIG_ENTRY_HIDDEN 2
#define CONFIG_ENTRY_HIDDEN (1<<1)
/// Force the config directory to be something other than "config"
#define OVERRIDE_CONFIG_DIRECTORY_PARAMETER "config-directory"
+4
View File
@@ -2,8 +2,12 @@
#define AUXTOOLS_PARTIAL_INIT 1
GLOBAL_LIST_EMPTY(auxtools_initialized)
GLOBAL_PROTECT(auxtools_initialized)
#define AUXTOOLS_CHECK(LIB)\
if (!CONFIG_GET(flag/auxtools_enabled)) {\
CRASH("Auxtools is not enabled in config!");\
}\
if (GLOB.auxtools_initialized[LIB] != AUXTOOLS_FULL_INIT) {\
if (fexists(LIB)) {\
var/string = LIBCALL(LIB,"auxtools_init")();\
@@ -1,2 +1,5 @@
/datum/config_entry/str_list/lua_path
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN
/datum/config_entry/flag/auxtools_enabled
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN
+5 -3
View File
@@ -40,10 +40,15 @@
/datum/lua_editor/ui_static_data(mob/user)
var/list/data = list()
data["documentation"] = file2text('code/modules/admin/verbs/lua/README.md')
data["auxtools_enabled"] = CONFIG_GET(flag/auxtools_enabled)
data["ss_lua_init"] = SSlua.initialized
return data
/datum/lua_editor/ui_data(mob/user)
var/list/data = list()
if(!CONFIG_GET(flag/auxtools_enabled) || !SSlua.initialized)
return data
data["noStateYet"] = !current_state
data["showGlobalTable"] = show_global_table
if(current_state)
@@ -227,8 +232,5 @@
set category = "Debug"
if(!check_rights_for(src, R_DEBUG))
return
if(SSlua.initialized != TRUE)
to_chat(usr, span_warning("SSlua is not initialized!"))
return
var/datum/lua_editor/editor = new()
editor.ui_interact(usr)
+6
View File
@@ -0,0 +1,6 @@
##
## Master config flag for enabling/disabling auxtools.
## Currently, this will disable Lua scripting.
##
#AUXTOOLS_ENABLED
+1
View File
@@ -6,6 +6,7 @@ $include comms.txt
$include resources.txt
$include interviews.txt
$include lua.txt
$include auxtools.txt
# You can use the @ character at the beginning of a config option to lock it from being edited in-game
# Example usage:
@@ -1,5 +1,5 @@
import { useBackend, useLocalState } from '../../backend';
import { Box, Button, Flex, Section, Tabs, TextArea, Modal, Stack, ProgressBar } from '../../components';
import { Box, Button, Flex, Section, Tabs, TextArea, Modal, Stack, ProgressBar, NoticeBox } from '../../components';
import { Window } from '../../layouts';
import { CallModal } from './CallModal';
import { ChunkViewModal } from './ChunkViewModal';
@@ -72,7 +72,35 @@ export class LuaEditor extends Component {
showGlobalTable,
page,
pageCount,
auxtools_enabled,
ss_lua_init,
} = data;
if (!auxtools_enabled) {
return (
<Window>
<Window.Content>
<NoticeBox danger>
Auxtools is not enabled. Please ask your server administrator to
enable it in the server configuration.
</NoticeBox>
</Window.Content>
</Window>
);
}
if (!ss_lua_init) {
return (
<Window>
<Window.Content>
<NoticeBox danger>
The Lua subsystem is not initialized. Consult your server logs.
</NoticeBox>
</Window.Content>
</Window>
);
}
const [modal, setModal] = useLocalState(
this.context,
'modal',
+1
View File
@@ -7,3 +7,4 @@ FEEDBACK_LOGIN root
FEEDBACK_PASSWORD
LAVALAND_BUDGET 0
SPACE_BUDGET 0
AUXTOOLS_ENABLED