It's not secure by any means. Don't be fooled- this is "inconvenienceware", not "security software". 7 out of 10 hackers here could get around it in 5 minutes. But hey, it's a start, and will get improved. I had a more... serious... version running, but certain things got changed in 0.78 that broke it. I'll worry about it later.
Code: Select all
function widget:GetInfo()
return {
name="Widget White List",
desc="Widgets that do not match current options are not allowed.",
author="Argh",
date="January 9th, 2009",
license="Public Domain, or the least-restrictive rights in your country of residence",
layer=0,
enabled=true,
handler=true,
}
end
local WhiteList = {
--WORLDBUILDER STUFF
["Dynamic Blob Shadows"] = 0,
["Streetlamps"] = 0,
--P.U.R.E. STUFF
["Black Box"] = 0,
["Brief O' Matic"] = 0,
["Credits"] = 0,
["Help O' Matic"] = 0,
["Mine Widget"] = 0,
["P.U.R.E. Unit Status Display"] = 0,
["P.U.R.E. Team Display (ALL)"] = 0,
["P.U.R.E. Team Display (SELECTED)"] = 0,
["UI Support"] = 0,
["Select at Start"] = 0,
["Theme"] = 0,
["Tooltip Fixes"] = 0,
["Widget White List"] = 0,
--SPRING NATIVE
["ImmobileBuilder"] = 0,
--ESSENTIAL, DO NOT REMOVE THESE
["Widgets"] = 0,
["WidgetSelector"] = 0,
["Selector"] = 0,
}
local Player = Spring.GetLocalPlayerID()
function widget:GameFrame(f)
if f == 1 then
for name,data in pairs(widgetHandler.widgets) do
if WhiteList[data.whInfo.name] == nil then
Spring.SendCommands({"luaui disablewidget "..data.whInfo.name})
Spring.Echo("Removed Widget from Player "..Player..". Widget Disabled: "..data.whInfo.name)
end
end
Spring.SendCommands({
"unbindkeyset f11",
"unbindkeyset ctrl+f11",
"bind f11 luaui unitstatus",
})
end
end
function widget:Shutdown()
Spring.SendCommands({"bind f11 luaui WidgetSelector"})
end