mirror of
https://github.com/kepler155c/opus
synced 2025-01-23 21:56:53 +00:00
web run applications
This commit is contained in:
parent
f7a03b2eea
commit
9f5c58cc4c
38
sys/apis/opus.lua
Normal file
38
sys/apis/opus.lua
Normal file
@ -0,0 +1,38 @@
|
||||
local Opus = { }
|
||||
|
||||
local function runDir(directory, desc, open)
|
||||
if not fs.exists(directory) then
|
||||
return true
|
||||
end
|
||||
|
||||
local success = true
|
||||
local files = fs.list(directory)
|
||||
table.sort(files)
|
||||
|
||||
for _,file in ipairs(files) do
|
||||
print(desc .. file)
|
||||
os.sleep(0)
|
||||
local result, err = open(directory .. '/' .. file)
|
||||
if not result then
|
||||
printError(err)
|
||||
success = false
|
||||
end
|
||||
end
|
||||
|
||||
return success
|
||||
end
|
||||
|
||||
function Opus.loadExtensions()
|
||||
return runDir('sys/extensions', '[ ext ] ', shell.run)
|
||||
end
|
||||
|
||||
function Opus.loadServices()
|
||||
return runDir('sys/services', '[ svc ] ', shell.openHiddenTab)
|
||||
end
|
||||
|
||||
function Opus.autorun()
|
||||
local s = runDir('sys/autorun', '[ aut ] ', shell.run)
|
||||
return runDir('usr/autorun', '[ aut ] ', shell.run) and s
|
||||
end
|
||||
|
||||
return Opus
|
@ -1,4 +1,4 @@
|
||||
local injector = requireInjector or load(http.get('http://pastebin.com/raw/c0TWsScv').readAll())()
|
||||
local injector = requireInjector or load(http.get('https://raw.githubusercontent.com/kepler155c/opus/master/sys/apis/injector.lua').readAll())()
|
||||
injector(getfenv(1))
|
||||
|
||||
local Event = require('event')
|
||||
|
@ -20,6 +20,11 @@ if Util.getVersion() == 1.8 then
|
||||
ChestProvider = require('chestProvider18')
|
||||
end
|
||||
|
||||
if not turtle.point then
|
||||
local Opus = require('opus')
|
||||
Opus.loadExtensions()
|
||||
end
|
||||
|
||||
local BUILDER_DIR = 'usr/builder'
|
||||
|
||||
local schematic = Schematic()
|
||||
@ -2034,6 +2039,7 @@ function startPage:eventHandler(event)
|
||||
Builder:build()
|
||||
|
||||
elseif event.type == 'quit' then
|
||||
UI.term:reset()
|
||||
Event.exitPullEvents()
|
||||
end
|
||||
|
||||
|
@ -22,6 +22,7 @@ end
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local Config = require('config')
|
||||
local Opus = require('opus')
|
||||
local Util = require('util')
|
||||
|
||||
-- Begin multishell
|
||||
@ -462,27 +463,10 @@ end)
|
||||
local function startup()
|
||||
local hasError
|
||||
|
||||
local function runDir(directory, desc, open)
|
||||
if not fs.exists(directory) then
|
||||
return
|
||||
end
|
||||
|
||||
local files = fs.list(directory)
|
||||
table.sort(files)
|
||||
|
||||
for _,file in ipairs(files) do
|
||||
print(desc .. file)
|
||||
os.sleep(0)
|
||||
local result, err = open(directory .. '/' .. file)
|
||||
if not result then
|
||||
printError(err)
|
||||
hasError = true
|
||||
end
|
||||
end
|
||||
if not Opus.loadExtensions() then
|
||||
hasError = true
|
||||
end
|
||||
|
||||
runDir('sys/extensions', '[ ext ] ', shell.run)
|
||||
|
||||
local overviewId = multishell.openTab({
|
||||
path = 'sys/apps/Overview.lua',
|
||||
focused = true,
|
||||
@ -491,9 +475,13 @@ local function startup()
|
||||
})
|
||||
overviewTab = tabs[overviewId]
|
||||
|
||||
runDir('sys/services', '[ svc ] ', shell.openHiddenTab)
|
||||
runDir('sys/autorun', '[ aut ] ', shell.run)
|
||||
runDir('usr/autorun', '[ aut ] ', shell.run)
|
||||
if not Opus.loadServices() then
|
||||
hasError = true
|
||||
end
|
||||
|
||||
if not Opus.autorun() then
|
||||
hasError = true
|
||||
end
|
||||
|
||||
if hasError then
|
||||
error('An autorun program has errored')
|
||||
|
@ -1,3 +1,7 @@
|
||||
if _G.clipboard then
|
||||
return
|
||||
end
|
||||
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local Util = require('util')
|
||||
@ -32,6 +36,8 @@ function clipboard.useInternal(mode)
|
||||
end
|
||||
end
|
||||
|
||||
multishell.addHotkey(20, function()
|
||||
clipboard.useInternal(not clipboard.isInternal())
|
||||
end)
|
||||
if multishell and multishell.addHotkey then
|
||||
multishell.addHotkey(20, function()
|
||||
clipboard.useInternal(not clipboard.isInternal())
|
||||
end)
|
||||
end
|
||||
|
@ -1,3 +1,7 @@
|
||||
if _G.device then
|
||||
return
|
||||
end
|
||||
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local Peripheral = require('peripheral')
|
||||
|
@ -1,4 +1,4 @@
|
||||
if not turtle then
|
||||
if not turtle or turtle.pathfind then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
if not turtle then
|
||||
if not turtle or turtle.abortAction then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
if not turtle then
|
||||
if not turtle or turtle.enableGPS then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
if not turtle then
|
||||
if not turtle or turtle.getPoint then
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user