Comparison

plugins/mod_http_file_share.lua @ 13168:536055476912

mod_http_file_share: Set slot token TTL so util.jwt validates expiry Overrides the util.jwt default of 1h with the intended TTL of 10 minutes. Because util.jwt now has its own expiry checks, so the 'expiry' field is no longer used and can thus be removed.
author Kim Alvefur <zash@zash.se>
date Wed, 28 Jun 2023 17:17:20 +0200
parent 13056:c38b1c63aa5c
child 13176:0d1cd3185299
comparison
equal deleted inserted replaced
13167:6226f75f55a7 13168:536055476912
47 return false; 47 return false;
48 end 48 end
49 local daily_quota = module:get_option_number(module.name .. "_daily_quota", file_size_limit*10); -- 100 MB / day 49 local daily_quota = module:get_option_number(module.name .. "_daily_quota", file_size_limit*10); -- 100 MB / day
50 local total_storage_limit = module:get_option_number(module.name.."_global_quota", unlimited); 50 local total_storage_limit = module:get_option_number(module.name.."_global_quota", unlimited);
51 51
52 local create_jwt, verify_jwt = require "prosody.util.jwt".init("HS256", secret); 52 local create_jwt, verify_jwt = require"prosody.util.jwt".init("HS256", secret, secret, { default_ttl = 600 });
53 53
54 local access = module:get_option_set(module.name .. "_access", {}); 54 local access = module:get_option_set(module.name .. "_access", {});
55 55
56 if not external_base_url then 56 if not external_base_url then
57 module:depends("http"); 57 module:depends("http");
180 -- token properties 180 -- token properties
181 sub = uploader; 181 sub = uploader;
182 182
183 -- slot properties 183 -- slot properties
184 slot = slot; 184 slot = slot;
185 expires = expiry >= 0 and (os.time()+expiry) or nil;
186 -- file properties 185 -- file properties
187 filename = filename; 186 filename = filename;
188 filesize = filesize; 187 filesize = filesize;
189 filetype = filetype; 188 filetype = filetype;
190 }); 189 });