mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 04:51:47 +00:00
Only allow reading specific settings
This commit is contained in:
parent
6c47a0051b
commit
171e33fc03
1 changed files with 13 additions and 0 deletions
|
|
@ -415,8 +415,21 @@ function API.new(app)
|
||||||
Type = "Method",
|
Type = "Method",
|
||||||
Description = "Gets a Rojo setting",
|
Description = "Gets a Rojo setting",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- We only allow reading the sync-related behaviors
|
||||||
|
-- to allow plugins to adapt/match their behavior
|
||||||
|
local allowedSettings = {
|
||||||
|
twoWaySync = true,
|
||||||
|
autoReconnect = true,
|
||||||
|
enableSyncFallback = true,
|
||||||
|
autoConnectPlaytestServer = true,
|
||||||
|
playSounds = true,
|
||||||
|
logLevel = true,
|
||||||
|
}
|
||||||
|
|
||||||
function Rojo:GetSetting(setting: string): any
|
function Rojo:GetSetting(setting: string): any
|
||||||
assert(type(setting) == "string", "Setting must be type `string`")
|
assert(type(setting) == "string", "Setting must be type `string`")
|
||||||
|
assert(allowedSettings[setting], `Setting '{setting}' is not allowed to be read by third-party plugins`)
|
||||||
|
|
||||||
return Settings:get(setting)
|
return Settings:get(setting)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue