Files
OpenSpace/data/assets/util/screenshots_endpoint.asset
T
2021-04-28 19:19:51 +02:00

22 lines
1.1 KiB
Lua

asset.onInitialize(function ()
-- Disable the server, add production gui endpoint, and restart server.
-- The temporary disabling avoids restarting the server on each property change.
-- TODO: Add a trigger property to the module to restart the server "manually"
-- and remove automatic restart on each property change,
-- since frequent restarting seems to be unstable on mac.
local enabled = openspace.getPropertyValue("Modules.WebGui.ServerProcessEnabled")
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", false)
local directories = openspace.getPropertyValue("Modules.WebGui.Directories")
directories[#directories + 1] = "screenshots"
directories[#directories + 1] = "${SCREENSHOTS}"
openspace.setPropertyValueSingle("Modules.WebGui.Directories", directories)
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", enabled)
end)
asset.onDeinitialize(function ()
-- TODO: Remove endpoints. As of 2019-10-29, OpenSpace sometimes
-- crashes when endpoints are removed while the application is closing.
end)