Software /
code /
prosody
Comparison
plugins/mod_http_file_share.lua @ 11350:3287dbdde33e
mod_http_file_share: Reorder arguments
'filetype' is optional, so having it last seems sensible.
'slot' is pretty important, so moving it earlier seems sensible.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 31 Jan 2021 20:38:40 +0100 |
parent | 11349:a219001b449d |
child | 11355:89efa3f2966b |
comparison
equal
deleted
inserted
replaced
11349:a219001b449d | 11350:3287dbdde33e |
---|---|
119 end | 119 end |
120 | 120 |
121 return true; | 121 return true; |
122 end | 122 end |
123 | 123 |
124 function get_authz(uploader, filename, filesize, filetype, slot) | 124 function get_authz(slot, uploader, filename, filesize, filetype) |
125 return jwt.sign(secret, { | 125 return jwt.sign(secret, { |
126 sub = uploader; | 126 sub = uploader; |
127 filename = filename; | 127 filename = filename; |
128 filesize = filesize; | 128 filesize = filesize; |
129 filetype = filetype; | 129 filetype = filetype; |
173 if cached_quota and cached_quota.time > os.time()-86400 then | 173 if cached_quota and cached_quota.time > os.time()-86400 then |
174 cached_quota.size = cached_quota.size + filesize; | 174 cached_quota.size = cached_quota.size + filesize; |
175 quota_cache:set(uploader, cached_quota); | 175 quota_cache:set(uploader, cached_quota); |
176 end | 176 end |
177 | 177 |
178 local authz = get_authz(uploader, filename, filesize, filetype, slot); | 178 local authz = get_authz(slot, uploader, filename, filesize, filetype); |
179 local slot_url = get_url(slot, filename); | 179 local slot_url = get_url(slot, filename); |
180 local upload_url = slot_url; | 180 local upload_url = slot_url; |
181 | 181 |
182 local reply = st.reply(stanza) | 182 local reply = st.reply(stanza) |
183 :tag("slot", { xmlns = namespace }) | 183 :tag("slot", { xmlns = namespace }) |