opus/sys/autorun/welcome.lua

47 lines
1.1 KiB
Lua
Raw Normal View History

local Config = require('opus.config')
local Util = require('opus.util')
2019-01-20 03:05:05 +00:00
local fs = _G.fs
2019-06-28 10:33:47 +00:00
local os = _G.os
local shell = _ENV.shell
2019-01-20 03:05:05 +00:00
local config = Config.load('os')
2019-03-27 19:21:31 +00:00
if not config.welcomed and shell.openForegroundTab then
2019-06-18 19:19:24 +00:00
config.welcomed = true
config.securityUpdate = true
config.readNotes = 1
2019-06-18 19:19:24 +00:00
Config.update('os', config)
2019-01-20 03:05:05 +00:00
2019-06-18 19:19:24 +00:00
shell.openForegroundTab('Welcome')
2019-01-20 03:05:05 +00:00
end
if not config.securityUpdate then
config.securityUpdate = true
config.secretKey = nil
config.password = nil
config.readNotes = 1
Config.update('os', config)
fs.delete('usr/.known_hosts')
Util.writeFile('sys/notes_1.txt', [[
An important security update has been applied.
Unfortunately, this update has reset the
password on the system. You can set a new
password in System->System->Password.
All computers that you connect to will also
need to be updated as well.
Thanks for your patience. And... thanks to
Anavrins for the much improved security.
]])
end
if fs.exists('sys/notes_1.txt') and shell.openForegroundTab then
shell.openForegroundTab('edit sys/notes_1.txt')
os.sleep(2)
fs.delete('sys/notes_1.txt')
end