2019-06-28 17:50:02 +00:00
|
|
|
local Ansi = require('opus.ansi')
|
|
|
|
local Config = require('opus.config')
|
|
|
|
local UI = require('opus.ui')
|
2019-03-22 05:40:29 +00:00
|
|
|
|
|
|
|
local colors = _G.colors
|
|
|
|
|
2019-03-26 13:08:39 +00:00
|
|
|
-- -t80x30
|
|
|
|
|
2019-03-23 16:20:48 +00:00
|
|
|
if _G.http.websocket then
|
2019-06-18 19:19:24 +00:00
|
|
|
local config = Config.load('cloud')
|
2019-03-22 05:40:29 +00:00
|
|
|
|
2019-06-18 19:19:24 +00:00
|
|
|
local tab = UI.Tab {
|
|
|
|
tabTitle = 'Cloud',
|
2019-11-08 05:50:11 +00:00
|
|
|
description = 'Cloud Catcher options',
|
2019-06-18 19:19:24 +00:00
|
|
|
key = UI.TextEntry {
|
|
|
|
x = 3, ex = -3, y = 2,
|
|
|
|
limit = 32,
|
|
|
|
value = config.key,
|
|
|
|
shadowText = 'Cloud key',
|
|
|
|
accelerators = {
|
|
|
|
enter = 'update_key',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
button = UI.Button {
|
|
|
|
x = 3, y = 4,
|
|
|
|
text = 'Update',
|
|
|
|
event = 'update_key',
|
|
|
|
},
|
|
|
|
labelText = UI.TextArea {
|
|
|
|
x = 3, ex = -3, y = 6,
|
|
|
|
textColor = colors.yellow,
|
|
|
|
marginLeft = 0, marginRight = 0,
|
|
|
|
value = string.format(
|
2019-03-28 11:29:01 +00:00
|
|
|
[[Use a non-changing cloud key. Note that only a single computer can use this session at one time.
|
|
|
|
To obtain a key, visit:
|
|
|
|
%shttps://cloud-catcher.squiddev.cc%s then bookmark:
|
|
|
|
%shttps://cloud-catcher.squiddev.cc/?id=KEY
|
2019-06-18 19:19:24 +00:00
|
|
|
]],
|
|
|
|
Ansi.white, Ansi.reset, Ansi.white),
|
|
|
|
},
|
|
|
|
}
|
2019-03-22 05:40:29 +00:00
|
|
|
|
2019-06-18 19:19:24 +00:00
|
|
|
function tab:eventHandler(event)
|
|
|
|
if event.type == 'update_key' then
|
|
|
|
if #self.key.value > 0 then
|
|
|
|
config.key = self.key.value
|
|
|
|
else
|
|
|
|
config.key = nil
|
|
|
|
end
|
|
|
|
Config.update('cloud', config)
|
|
|
|
self:emit({ type = 'success_message', message = 'Updated' })
|
|
|
|
end
|
|
|
|
end
|
2019-03-22 05:40:29 +00:00
|
|
|
|
2019-06-18 19:19:24 +00:00
|
|
|
return tab
|
2019-03-23 16:20:48 +00:00
|
|
|
end
|
2019-03-22 05:40:29 +00:00
|
|
|
|