aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-01-13 10:58:12 +0100
committerKim Alvefur <zash@zash.se>2024-01-13 10:58:12 +0100
commit1252713d89dcd2f17d68ce27d1bb45daf5f313c8 (patch)
treea401284e46dc2f078616adebc04bc99dde3e7ead /plugins
parenta7799e11a9521d33cc322fa8b9cae99134219089 (diff)
downloadprosody-1252713d89dcd2f17d68ce27d1bb45daf5f313c8.tar.gz
prosody-1252713d89dcd2f17d68ce27d1bb45daf5f313c8.zip
mod_invites: Allow specifying invite ttl on command line
Was missing a way to pass TTL via command or shell.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_invites.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_invites.lua b/plugins/mod_invites.lua
index 04265070..d49d5d36 100644
--- a/plugins/mod_invites.lua
+++ b/plugins/mod_invites.lua
@@ -4,6 +4,7 @@ local url = require "socket.url";
local jid_node = require "prosody.util.jid".node;
local jid_split = require "prosody.util.jid".split;
local argparse = require "prosody.util.argparse";
+local human_io = require "prosody.util.human.io";
local default_ttl = module:get_option_period("invite_expiry", "1 week");
@@ -283,6 +284,7 @@ function subcommands.generate(arg)
print(" --role ROLE Grant the given ROLE to the new user")
print(" --group GROUPID Add the user to the group with the given ID")
print(" Can be specified multiple times")
+ print(" --expires-after T Time until the invite expires (e.g. '1 week')")
print()
print("--group can be specified multiple times; the user will be added to all groups.")
print()
@@ -332,7 +334,7 @@ function subcommands.generate(arg)
invite = assert(invites.create_account(nil, {
roles = roles,
groups = groups
- }));
+ }, opts.expires_after and human_io.parse_duration(opts.expires_after)));
end
print(invite.landing_page or invite.uri);