typo + lock screen
This commit is contained in:
@@ -6,5 +6,5 @@
|
|||||||
title = 'Schematic Builder',
|
title = 'Schematic Builder',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/builder',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/builder',
|
||||||
description = [[Build structures from schematic files using a turtle or command computer. ]],
|
description = [[Build structures from schematic files using a turtle or command computer. ]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
description = [[Peripheral management for CCEmuX
|
description = [[Peripheral management for CCEmuX
|
||||||
|
|
||||||
Adds a tab in the System application for configuring peripherals.]],
|
Adds a tab in the System application for configuring peripherals.]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,5 @@
|
|||||||
* Screen recorder
|
* Screen recorder
|
||||||
* and more...
|
* and more...
|
||||||
]],
|
]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'APIs used by various programs',
|
title = 'APIs used by various programs',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/core',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/core',
|
||||||
description = [[Provides APIs used by Opus applications.]],
|
description = [[Provides APIs used by Opus applications.]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@
|
|||||||
* Cow/Sheep Rancher
|
* Cow/Sheep Rancher
|
||||||
* Farmer
|
* Farmer
|
||||||
]],
|
]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Forestry mod applications',
|
title = 'Forestry mod applications',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/forestry',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/forestry',
|
||||||
description = [[WIP]],
|
description = [[WIP]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Games',
|
title = 'Games',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/games',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/games',
|
||||||
description = [[Games by various people]],
|
description = [[Games by various people]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
Uses 4 wireless modems connected to a single turtle or computer connected with network cables.
|
Uses 4 wireless modems connected to a single turtle or computer connected with network cables.
|
||||||
The turtle will also initially place all the modems in the correct locations.
|
The turtle will also initially place all the modems in the correct locations.
|
||||||
]],
|
]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ https://github.com/SquidDev-CC/mbs
|
|||||||
|
|
||||||
MBS is a series of utilities for improving the default CraftOS experience.
|
MBS is a series of utilities for improving the default CraftOS experience.
|
||||||
]],
|
]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@
|
|||||||
Includes: importing, exporting, autocrafting, replenish, limits and much more.
|
Includes: importing, exporting, autocrafting, replenish, limits and much more.
|
||||||
|
|
||||||
Includes over 200 standard Minecraft recipes.]],
|
Includes over 200 standard Minecraft recipes.]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
title = 'Milo extra applications',
|
title = 'Milo extra applications',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/miloApps',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/miloApps',
|
||||||
description = [[Programs for turtles in a Milo network]],
|
description = [[Programs for turtles in a Milo network]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
description = [[Provides two types of automated mining:
|
description = [[Provides two types of automated mining:
|
||||||
* Scanning Miner: Uses a block scanner to very efficiently mine areas
|
* Scanning Miner: Uses a block scanner to very efficiently mine areas
|
||||||
* Simple Miner: A single or multi-turtle miner]],
|
* Simple Miner: A single or multi-turtle miner]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Various monitor related programs',
|
title = 'Various monitor related programs',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/monitor',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/monitor',
|
||||||
description = [[Mirror terminal to monitor, Monitor Window Manager (mwm), and more]],
|
description = [[Mirror terminal to monitor, Monitor Window Manager (mwm), and more]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
title = 'Programs for the neural interface',
|
title = 'Programs for the neural interface',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/neural',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/neural',
|
||||||
description = [[ Applications using various plethora modules ]],
|
description = [[ Applications using various plethora modules ]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
required = {
|
required = {
|
||||||
'core',
|
'core',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
title = 'Move resources around with turtles',
|
title = 'Move resources around with turtles',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/pickup',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/pickup',
|
||||||
description = [[ WiP ]],
|
description = [[ WiP ]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Recipe books for crafting programs',
|
title = 'Recipe books for crafting programs',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/recipeBook',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/recipeBook',
|
||||||
description = [[ WIP ]],
|
description = [[ WIP ]],
|
||||||
licence = 'Recipes for crafting',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
6
secure/.package
Normal file
6
secure/.package
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
title = 'Security features for Opus OS',
|
||||||
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/secure',
|
||||||
|
description = [[ Screen locking ]],
|
||||||
|
license = 'MIT',
|
||||||
|
}
|
||||||
106
secure/autorun/lock.lua
Normal file
106
secure/autorun/lock.lua
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
local Config = require('opus.config')
|
||||||
|
local Util = require('opus.util')
|
||||||
|
|
||||||
|
local device = _G.device
|
||||||
|
local kernel = _G.kernel
|
||||||
|
local keyboard = device.keyboard
|
||||||
|
local multishell = _ENV.multishell
|
||||||
|
|
||||||
|
local config = Config.load('secure', {
|
||||||
|
enabled = false,
|
||||||
|
timeout = 60,
|
||||||
|
})
|
||||||
|
|
||||||
|
if not config.enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local timer = os.startTimer(config.timeout)
|
||||||
|
|
||||||
|
local sandboxEnv = Util.shallowCopy(_ENV)
|
||||||
|
setmetatable(sandboxEnv, { __index = _G })
|
||||||
|
|
||||||
|
local function buildLockScreen()
|
||||||
|
_G.requireInjector(_ENV)
|
||||||
|
|
||||||
|
local Event = require('opus.event')
|
||||||
|
local Security = require('opus.security')
|
||||||
|
local SHA = require('opus.crypto.sha2')
|
||||||
|
local UI = require('opus.ui')
|
||||||
|
|
||||||
|
local counter = .1
|
||||||
|
|
||||||
|
local page = UI.Page {
|
||||||
|
pass = UI.TextEntry {
|
||||||
|
x = 10, ex = -10, y = "50%",
|
||||||
|
limit = 32,
|
||||||
|
mask = true,
|
||||||
|
shadowText = 'password',
|
||||||
|
accelerators = {
|
||||||
|
enter = 'password',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notification = UI.Notification(),
|
||||||
|
}
|
||||||
|
function page:eventHandler(event)
|
||||||
|
if event.type == 'password' then
|
||||||
|
|
||||||
|
if self.pass.value and
|
||||||
|
#self.pass.value > 0 and
|
||||||
|
Security.verifyPassword(SHA.compute(self.pass.value)) then
|
||||||
|
|
||||||
|
UI:exitPullEvents() -- valid
|
||||||
|
else
|
||||||
|
self.notification:error('Invalid password', math.max(counter, 2))
|
||||||
|
self:sync()
|
||||||
|
os.sleep(counter)
|
||||||
|
counter = counter * 2
|
||||||
|
|
||||||
|
self.pass:reset()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
UI.Page.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Event.onTerminate(function() return false end)
|
||||||
|
|
||||||
|
UI:setPage(page)
|
||||||
|
UI:pullEvents()
|
||||||
|
|
||||||
|
-- restart lock timer
|
||||||
|
timer = os.startTimer(config.timeout)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function showLockScreen()
|
||||||
|
timer = nil
|
||||||
|
multishell.openTab({
|
||||||
|
path = 'sys/apps/Lock.lua',
|
||||||
|
fn = buildLockScreen,
|
||||||
|
noTerminate = true,
|
||||||
|
pinned = true,
|
||||||
|
focused = true,
|
||||||
|
title = 'Lock',
|
||||||
|
env = sandboxEnv,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
keyboard.addHotkey('control-l', function()
|
||||||
|
if timer then
|
||||||
|
os.cancelTimer(timer)
|
||||||
|
showLockScreen()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
kernel.hook({ 'mouse_click', 'mouse_up', 'mouse_drag', 'key_up' }, function(event, eventData)
|
||||||
|
if timer then
|
||||||
|
os.cancelTimer(timer)
|
||||||
|
timer = os.startTimer(config.timeout)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
kernel.hook('timer', function(_, eventData)
|
||||||
|
if timer and eventData[1] == timer then
|
||||||
|
showLockScreen()
|
||||||
|
end
|
||||||
|
end)
|
||||||
4
secure/autorun/startup.lua
Normal file
4
secure/autorun/startup.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
local fs = _G.fs
|
||||||
|
|
||||||
|
-- add a System setup tab
|
||||||
|
fs.mount('sys/apps/system/secure.lua', 'linkfs', 'packages/secure/system/secure.lua')
|
||||||
59
secure/system/secure.lua
Normal file
59
secure/system/secure.lua
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
local Config = require('opus.config')
|
||||||
|
local UI = require('opus.ui')
|
||||||
|
|
||||||
|
local config = Config.load('secure', {
|
||||||
|
enabled = false,
|
||||||
|
timeout = 60,
|
||||||
|
})
|
||||||
|
|
||||||
|
local tab = UI.Tab {
|
||||||
|
tabTitle = 'Secure',
|
||||||
|
description = 'Secure options',
|
||||||
|
label1 = UI.Text {
|
||||||
|
x = 2, y = 3,
|
||||||
|
value = 'Screen Locking',
|
||||||
|
},
|
||||||
|
checkbox = UI.Checkbox {
|
||||||
|
x = 20, y = 3,
|
||||||
|
value = config.enabled
|
||||||
|
},
|
||||||
|
label2 = UI.Text {
|
||||||
|
x = 2, y = 4,
|
||||||
|
value = 'Lock timeout',
|
||||||
|
},
|
||||||
|
timeout = UI.TextEntry {
|
||||||
|
x = 20, y = 4, width = 6,
|
||||||
|
limit = 4,
|
||||||
|
transform = 'number',
|
||||||
|
value = config.timeout,
|
||||||
|
accelerators = {
|
||||||
|
enter = 'update',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
label3 = UI.Text {
|
||||||
|
ex = -2, y = -2, width = 20,
|
||||||
|
textColor = colors.yellow,
|
||||||
|
},
|
||||||
|
button = UI.Button {
|
||||||
|
x = 20, y = 6,
|
||||||
|
text = 'Update',
|
||||||
|
event = 'update',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function tab:eventHandler(event)
|
||||||
|
if event.type =='checkbox_change' then
|
||||||
|
config.enabled = not not event.checked
|
||||||
|
|
||||||
|
elseif event.type == 'update' then
|
||||||
|
config.timeout = self.timeout.value
|
||||||
|
Config.update('secure', config)
|
||||||
|
|
||||||
|
self:emit({ type = 'success_message', message = 'Settings updated' })
|
||||||
|
self.label3.value = 'Restart is required'
|
||||||
|
self.label3:draw()
|
||||||
|
end
|
||||||
|
return UI.Tab.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
|
||||||
|
return tab
|
||||||
@@ -8,5 +8,5 @@ Linux style shell commands:
|
|||||||
grep, cat, touch, df, etc.
|
grep, cat, touch, df, etc.
|
||||||
|
|
||||||
Linux style cp, ls]],
|
Linux style cp, ls]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Switchcraft basic shop',
|
title = 'Switchcraft basic shop',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/swshop',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/swshop',
|
||||||
description = 'Modification of the k store by Lemmmy\nRun installPlugin.lua after install',
|
description = 'Modification of the k store by Lemmmy\nRun installPlugin.lua after install',
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
title = 'Turtle programs and apis',
|
title = 'Turtle programs and apis',
|
||||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/turtle',
|
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/turtle',
|
||||||
description = [[Support programs and apis for turtles]],
|
description = [[Support programs and apis for turtles]],
|
||||||
licence = 'MIT',
|
license = 'MIT',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user