view mod_compact_resource/mod_compact_resource.lua @ 4161:032e1c79d039

mod_muc_inject_mentions: Add new configuration setting to look for mentions even if the client sent some already
author Seve Ferrer <seve@delape.net>
date Tue, 29 Sep 2020 17:05:14 +0200
parents 6f34e51a23f0
children
line wrap: on
line source


local base64_encode = require"util.encodings".base64.encode;
local random_bytes = require"util.random".bytes;

local b64url = { ["+"] = "-", ["/"] = "_", ["="] = "" };
local function random_resource()
	return base64_encode(random_bytes(8)):gsub("[+/=]", b64url);
end

module:hook("pre-resource-bind", function (event)
	event.resource = random_resource();
end);