mastodon-unfurl.love/0049-load_nodes_from_url

20 lines
793 B
Plaintext

load_nodes_from_url = function()
-- side effects: Nodes, Root, Cursor_node
-- indicate some progress
-- load can take some time, and it's synchronous, so we'll draw to screen right here
love.graphics.clear(love.graphics.getBackgroundColor())
love.graphics.print('loading '..Url..'...', 5,5)
love.graphics.present()
-- load JSON from Url
local initial_ml = ml_from_url(Url)
local thread = get_toot(initial_ml)
if thread.ancestors and #thread.ancestors > 0 then
-- redo with oldest ancestor
love.graphics.clear(love.graphics.getBackgroundColor())
love.graphics.print('reloading from earliest ancestor '..thread.ancestors[1].url..'...', 5,5)
love.graphics.present()
thread = get_toot(ml_from_url(thread.ancestors[1].url))
end
load_nodes_from_json(thread, initial_ml.id)
end