a
This commit is contained in:
parent
ded2bd15b5
commit
3a05a88d4d
@ -45,6 +45,10 @@ function readFileAll(file)
|
|||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ntfy(msg)
|
||||||
|
http.post("https://ntfy.brammer.cc/8DI2nmDPVG6l7A0x", msg)
|
||||||
|
end
|
||||||
|
|
||||||
function splitStringToArray(input_str)
|
function splitStringToArray(input_str)
|
||||||
table = {}
|
table = {}
|
||||||
i = 0
|
i = 0
|
||||||
@ -81,6 +85,7 @@ return
|
|||||||
appendToFileNl=appendToFileNl,
|
appendToFileNl=appendToFileNl,
|
||||||
readFileOneline=readFileOneline,
|
readFileOneline=readFileOneline,
|
||||||
readFileAll=readFileAll,
|
readFileAll=readFileAll,
|
||||||
|
ntfy=ntfy,
|
||||||
splitStringToArray=splitStringToArray,
|
splitStringToArray=splitStringToArray,
|
||||||
secureDig=secureDig,
|
secureDig=secureDig,
|
||||||
secureDigUp=secureDigUp,
|
secureDigUp=secureDigUp,
|
||||||
|
@ -51,6 +51,7 @@ function sendLog(to, targetPath, logMsg)
|
|||||||
payloadTable[1] = basic.getCurrentTime() .. ": " .. logMsg
|
payloadTable[1] = basic.getCurrentTime() .. ": " .. logMsg
|
||||||
|
|
||||||
sendMessage(to, "log", payloadTable)
|
sendMessage(to, "log", payloadTable)
|
||||||
|
basic.ntfy(os.getComputerLabel() .. ": " .. payloadTable[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
function sendFile(to, originPath, targetPath)
|
function sendFile(to, originPath, targetPath)
|
||||||
|
22
src/brulijam/systemlock.lua
Normal file
22
src/brulijam/systemlock.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
basic = require("lib.basic")
|
||||||
|
hash = require("lib.hash")
|
||||||
|
|
||||||
|
local pwHash = ""
|
||||||
|
|
||||||
|
local function setState()
|
||||||
|
basic.writeToFile("/brulijam/config/systemlock.config", asdasd)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getState()
|
||||||
|
if not fs.exists "/brulijam/config/systemlock.config" then
|
||||||
|
config = {}
|
||||||
|
config["locked"] = true
|
||||||
|
config["pwHash"] = createPwHash()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function createPwHash()
|
||||||
|
print("Create a new password: ")
|
||||||
|
local input = read("*")
|
||||||
|
pwHash = hash.digestStr(input .. os.getComputerID())
|
||||||
|
return pwHash
|
||||||
|
end
|
@ -6,8 +6,6 @@ file = fs.open("/brulijam/sync.lua", "w")
|
|||||||
file.write(getRequest.readAll())
|
file.write(getRequest.readAll())
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
--execute sync script
|
|
||||||
shell.run("/brulijam/sync.lua")
|
|
||||||
|
|
||||||
--task.lua contains stuff that should be done after boot
|
--task.lua contains stuff that should be done after boot
|
||||||
if not (fs.exists("brulijam/task.lua")) then
|
if not (fs.exists("brulijam/task.lua")) then
|
||||||
@ -16,3 +14,14 @@ if not (fs.exists("brulijam/task.lua")) then
|
|||||||
file.close()
|
file.close()
|
||||||
end
|
end
|
||||||
shell.run("brulijam/task.lua")
|
shell.run("brulijam/task.lua")
|
||||||
|
|
||||||
|
|
||||||
|
--execute sync script
|
||||||
|
shell.run("/brulijam/sync.lua")
|
||||||
|
|
||||||
|
--shell.run("/brulijam/systemlock.lua")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user