In LÖVE v12 you no longer need to run it through the unfurl.lua shim,
and you can now open new threads by pasting their links into the app
using ctrl+v.
TQUVV6ZZAXGVEFRBUHRXFUIZYVBT5VFGUKSM25MYWS3QF6OB4VEQC QVTMKCHF42UO2Y5EI2I22YWUNWYE5LJM6KQS3VBH5NTNQNIVF6NAC 3RLPFCICVQARJBY26A4SX3JZCQWMGPOZC5TDIKHJ75M4EPKJVAWQC QQNT7EE4ZKTX2N6WNMCWCNYTBYSP3GD23TOODN6NOFCOF32QWO4QC HMH2GYB6BLH4HE7N6J6ZK57RKFICWXSU3KJL7EGYTXJ5DC5XHBIQC 36Z442IVPXHZ7D2QI26YLN3TDDEMDRQ2GKBYQAD6NUHQZVCCY4VAC TVCPXAAU4P3K5MFYINH2MWDK3KGTQ2GE74TUNERYOONG2G5EYKMQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC HUDGLWXFMJ2KIMJTTDLYCCTNEFFIE4HQXVF6VU362XQTEEZTRWBAC DFXPZNH6FTVKXXFSTTE6UO7UK7A5H3JMYUDQPQSTPWP4SXAVEMLAC FS2ITYYHBLFT66YUC3ENPFYI2HOYHOVEPQIN7NQR6KF5MEK4NKZAC PNBKVYZ4ANUAZNQN6KEWYNDF7552ROZPNAPRJE7Q6O7ZZJMJ3S3QC H2KZUAWHQXTRUFDPDH4AUG6EP3OR5U3GGFPVGTCY2XJB3WOEO7TQC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC QDXO357AHOOUH3RHQFIF6XHLWOEGZFCSGUHPIL6QIQNY53CPNXFAC BF7TW3EKRIDYC6J2Q2J4YOBAVQF55Y3H6KGZIHNXMH4N72MR6GXQC X7HYGAL2QVKG7M5EMZ2VSH37UYWGE3EPUXYQBJOVL6IGJFZ2I5AAC ## Getting started (LÖVE v12 pre-release)Install LÖVE from a nightly build.* Go to https://github.com/love2d/love/actions* Click on the most recent successful build (with a green check mark before it)* Scroll down to the "Artifacts" section* Download the artifact for your OS* If you don't have a Github account, these won't be clickable.Copy the URL for the build and paste it into https://nightly.link to getclickable links to artifacts.Run LÖVE from the commandline and pass in this directory. Optionally also passin a link to a Mastodon toot.Copy a link to any mastodon toot and paste it into the app window using`ctrl+v` to view it in the context of its thread.
url_from_ml = function(ml)return ('%s/api/v1/statuses/%s'):format(ml.host, ml.id)end
ml_from_url = function(url)local host, user, id = url:match('^([^/]*://[^/]*)/@([^/]*)/(%d*)$')if host then return {host=host, user=user, id=id} endlocal host, user, id = url:match('^([^/]*://[^/]*)/users/([^/]*)/statuses/(%d*)$')if host then return {host=host, user=user, id=id} endend
Url = nil
try_load_nodes_from_url = function(initial_ml)local result = get_toot(initial_ml)if result.ancestors and #result.ancestors > 0 then-- redo with oldest ancestorresult = get_toot(ml_from_url(result.ancestors[1].url))endreturn resultend
get_toot = function(ml)local url = url_from_ml(ml)local code, response, response_headers = https.request(url)local result = json.decode(response)code, response, response_headers = https.request(url..'/context')local rels = json.decode(response)result.host = ml.hostresult.user = ml.userresult.id = ml.idresult.ancestors = rels.ancestorsresult.descendants = rels.descendantsreturn resultend
if Input_filename thenlove.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current fontlocal f = io.open(Input_filename)assert(f)local thread_data = json.decode(f:read('*a'))f:close()render_thread_to_surface(thread_data)
if Major_version >= 12 then-- reload Url from networkif Url thenlocal initial_ml = ml_from_url(Url)local thread_data = try_load_nodes_from_url(initial_ml)render_thread_to_surface(thread_data)Cursor_node = Rootif Nodes[initial_ml.id] thenCursor_node = Nodes[initial_ml.id]endensure_cursor_node_within_viewport()endB()else-- LÖVE pre-v12 has no https-- reload same thread from fileif Input_filename thenlove.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current fontlocal f = io.open(Input_filename)assert(f)local thread_data = json.decode(f:read('*a'))f:close()render_thread_to_surface(thread_data)endB()
elseif chord == 'C-v' then-- load new URLif Major_version >= 12 then -- requires LÖVE with https-- ignore stuff in the clipboard that doesn't look like a urllocal cb = App.get_clipboard()if #cb > 300 thenprint('clipboard: '..cb:sub(1,300)..'...')elseprint('clipboard: '..cb)endif cb:match('^%s*https://[^%s]*%s*$') thenprint('clipboard contains a URL')Url = trim(cb)A()endend
if #arg == 0 thenerror('Please pass in a file containing a Mastodon thread, and optionally an id within it to start out focused on.\n\nThis app currently needs to be invoked from a terminal.')endInput_filename = arg[1]A()Cursor_node = Rootif #arg >= 2 thenlocal initial_id = arg[2]if Nodes[initial_id] thenCursor_node = Nodes[initial_id]
if Major_version >= 12 then-- LÖVE has https-- commandline arg is a urlif #arg > 0 thenUrl = arg[1]A()endelse-- LÖVE pre-v12 doesn't have https-- we depend on an external shim to download-- commandline arg is a filenameif #arg == 0 then-- no ability to load new URLerror('When running with LÖVE v11, please pass in a file containing a Mastodon thread, and optionally an id within it to start out focused on.\n\nThis app currently needs to be invoked from a terminal.')endInput_filename = arg[1]A()Cursor_node = Rootif #arg >= 2 thenlocal initial_id = arg[2]if Nodes[initial_id] thenCursor_node = Nodes[initial_id]end