diff --git a/pleroma-comments.lua b/pleroma-comments.lua index a9560a8..b62550b 100644 --- a/pleroma-comments.lua +++ b/pleroma-comments.lua @@ -1,24 +1,29 @@ local json = require("cjson") -pleroma_avatar_save_path = nil -- location of downloaded images -pleroma_avatar_path = nil -- prepended to image file, written on page --- to configure, put above vars in a file named 'config.lua' +-- GLOBAL VARIABLES +-- & meant to be assigned in config.lua +-------------------- +-- location of downloaded images +pleroma_avatar_save_path = nil +-- prepended to image file, written on page +pleroma_avatar_path = nil + +-- instances may require auth to access api +-- pleroma_auth_token = nil + pcall( function () dofile("config.lua") end ) + --[[ -if these variables are still `nil` after `dofile()` then -the script will look for it in the yaml header. +if `pleroma_avatar_*` are still `nil` after `dofile()` then the script will look for it in the yaml header. -note: lua filters can not access variables defined on the command line, -e.g `pandoc -V foo="bar"` -and it may not be ideal to define paths in yaml headers, -i.e changing the path for avatars on a website would involve editing each -manuscript. +if they are still nil afterwards, then the script +will hotlink. ]]-- @@ -98,6 +103,8 @@ function get(link, filename) } end -- don't use auth bearer for downloading images' + -- its either not needed OR + -- there should be an extra check on the host if pleroma_auth_token and not filename then local h = "--header=\"Authorization: Bearer %s\" " table.insert(