This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/docker/nginx/libs/skynet/skylink.lua

17 lines
350 B
Lua
Raw Normal View History

2021-11-05 11:57:06 +00:00
local _M = {}
2021-11-05 14:32:32 +00:00
local basexx = require("basexx")
2021-11-05 11:57:06 +00:00
-- parse any skylink and return base64 version
function _M.parse(skylink)
if string.len(skylink) == 55 then
2021-11-05 14:32:32 +00:00
local decoded = basexx.from_basexx(string.upper(skylink), "0123456789ABCDEFGHIJKLMNOPQRSTUV", 5)
2021-11-05 11:57:06 +00:00
2021-11-05 14:32:32 +00:00
return basexx.to_url64(decoded)
2021-11-05 11:57:06 +00:00
end
return skylink
end
return _M