comparison mod_firewall/mod_firewall.lua @ 6372:81f06628fea4

mod_firewall: Switch to prosody.util.time.now() to get the current time
author Link Mauve <linkmauve@linkmauve.fr>
date Fri, 30 Jan 2026 15:03:21 +0100
parents 254a21a104aa
children 547feb8181eb
comparison
equal deleted inserted replaced
6371:caaa9ea58bec 6372:81f06628fea4
202 for field in what:gmatch("%a+") do 202 for field in what:gmatch("%a+") do
203 table.insert(defs, ("local current_%s = current_date_time.%s;"):format(field, field)); 203 table.insert(defs, ("local current_%s = current_date_time.%s;"):format(field, field));
204 end 204 end
205 return table.concat(defs, " "); 205 return table.concat(defs, " ");
206 end, depends = { "date_time" }; }; 206 end, depends = { "date_time" }; };
207 timestamp = { global_code = [[local get_time = require "socket".gettime;]]; local_code = [[local current_timestamp = get_time();]]; }; 207 timestamp = { global_code = [[local get_time = require "prosody.util.time".now;]]; local_code = [[local current_timestamp = get_time();]]; };
208 globalthrottle = { 208 globalthrottle = {
209 global_code = function (throttle) 209 global_code = function (throttle)
210 assert(idsafe(throttle), "Invalid rate limit name: "..throttle); 210 assert(idsafe(throttle), "Invalid rate limit name: "..throttle);
211 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle); 211 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle);
212 return ("local global_throttle_%s = rates.%s:single();"):format(throttle, throttle); 212 return ("local global_throttle_%s = rates.%s:single();"):format(throttle, throttle);