81 lines
No EOL
3.5 KiB
Lua
81 lines
No EOL
3.5 KiB
Lua
-- follow the instructions on statuscafe.lua or last.lua
|
|
function shuffle(tbl)
|
|
for i = #tbl, 2, -1 do
|
|
local j = math.random(i)
|
|
tbl[i], tbl[j] = tbl[j], tbl[i]
|
|
end
|
|
return tbl
|
|
end
|
|
local function drawImage(monitor, image, x, y, palette)
|
|
for _, frame in ipairs(image) do
|
|
for y, row in ipairs(frame) do
|
|
monitor.setCursorPos(1, y)
|
|
monitor.blit(table.unpack(row))
|
|
end
|
|
if frame.palette then for i = 0, #frame.palette do
|
|
local c = frame.palette[i]
|
|
if type(c) == "table" then monitor.setPaletteColor(2^i, table.unpack(c))
|
|
else monitor.setPaletteColor(2^i, c) end
|
|
end end
|
|
if image.animation then sleep(frame.duration or image.secondsPerFrame or 0.05) end
|
|
end
|
|
monitor.setBackgroundColor(colors.black)
|
|
monitor.setTextColor(colors.white)
|
|
--monitor.clear()
|
|
monitor.setCursorPos(1, 1)
|
|
--for i = 0, 15 do monitor.setPaletteColor(2^i, monitor.nativePaletteColor(2^i)) end
|
|
end
|
|
|
|
local binkies = textutils.unserialiseJSON('[["https://sad.ovh","sadovh.png"],["https://unnick.mice.tel","unnick.png"],["https://github.com/NotNite/eightyeightthirtyone","eighteightthirtyone.png"],["https://onz.ee","shame.png"],["https://moosyu.github.io","moosyu.gif"],["https://trademarkhell.net/","tm.png"],["https://thinliquid.dev","lqd.png"],["https://joosh.nekoweb.org/","joosh.gif"],["https://ctrlaustin.nekoweb.org","ctrlaustin.gif"],["https://satorikeiko.surge.sh","satorikeiko.png"],["https://nekoaerospace.nekoweb.org","nekoaerospace.png"],["https://derg.rest","tom.png"],["https://sillylaird.nekoweb.org/","sillylairdb.png"],["https://2rin.nekoweb.org","2rin.gif"],["https://status.cafe","statuscafe.png"],["https://windigone.nekoweb.org","windigone.gif"],["https://eye.nekoweb.org","eye.gif"],["https://yumeo.nekoweb.org","yumeo.gif"],["https://bee.nekoweb.org/","bee.png"],["https://ultrakill.nekoweb.org/","ultrakill.png"],["https://immjs.dev","immjs.gif"],["https://lel.nekoweb.org","lel.gif"],["https://lunaui.nekoweb.org","lunaui.gif"],["https://amoebalous.net","amoebalous.gif"],["https://darkosparko.nekoweb.org/","darkosparko.png"],["https://rice.place/","rice.place.gif"],["https://max.nekoweb.org/","maxpixels.gif"],["https://giikis2.nekoweb.org","giikis2.png"],["insane.gif","piracy.gif","dsb.gif","universe.gif","css.png","vscbutton.gif","ezgif.gif"]]')
|
|
|
|
local display = {}
|
|
local currDisplay = 0
|
|
|
|
|
|
local monitor = peripheral.find("monitor")
|
|
monitor.clear()
|
|
monitor.setTextScale(0.5)
|
|
|
|
monitor.setCursorPos(2,2)
|
|
monitor.write("Loading..")
|
|
|
|
for i, pair in ipairs(binkies) do
|
|
if type(pair) == "table" and #pair == 2 then
|
|
local url = pair[1]
|
|
local image = "https://sad.ovh/assets/binkies/" .. pair[2]
|
|
currDisplay = currDisplay + 1
|
|
display[currDisplay] = image
|
|
end
|
|
end
|
|
|
|
shuffle(display)
|
|
|
|
local id = os.startTimer(15)
|
|
while true do
|
|
_, id = os.pullEvent('timer')
|
|
currDisplay = currDisplay + 1
|
|
if currDisplay > #display then
|
|
currDisplay = 1
|
|
shuffle(display)
|
|
end
|
|
|
|
monitor.clear()
|
|
monitor.setCursorPos(2,2)
|
|
monitor.write("Loading..")
|
|
|
|
local req = http.post({
|
|
url = "https://sanjuuni.sad.ovh/render",
|
|
body = textutils.serialiseJSON({
|
|
["imageUrl"] = display[currDisplay]
|
|
}),
|
|
headers = {
|
|
["Content-Type"] = "application/json",
|
|
["Authorization"] = "<..>"
|
|
}
|
|
})
|
|
|
|
local data = req.readAll() -- actually read the data.
|
|
data = textutils.unserialize(data) -- convert the string file data into a usable lua object
|
|
drawImage(monitor, data, 0, 0)
|
|
id = os.startTimer(15)
|
|
end |