For an WhatsApp gateway implementation (see https://git.theta.eu.org/eta/whatsxmpp) mod_http_upload bridge usage is needed. The author patched mod_http_upload.lua to allow it, please see the differences below or the changed file here: https://git.theta.eu.org/eta/whatsxmpp/raw/branch/master/doc/mod_http_upload.lua
Is it possible to get these changes into the official code?
--- mod_http_upload.lua.org 2020-04-10 02:27:49.000000000 +0200
+++ mod_http_upload.lua 2020-06-30 16:09:03.729356376 +0200
@@ -166,7 +166,7 @@
local function handle_request(origin, stanza, xmlns, filename, filesize)
local username, host = origin.username, origin.host;
-- local clients only
- if origin.type ~= "c2s" then
+ if origin.type ~= "c2s" and origin.type ~= "component" then
module:log("debug", "Request for upload slot from a %s", origin.type);
return nil, st.error_reply(stanza, "cancel", "not-authorized");
end
@@ -205,7 +205,7 @@
end
local slot = random_dir.."/"..filename;
- pending_slots[slot] = origin.full_jid;
+ pending_slots[slot] = stanza.attr.from;
module:add_timer(900, function()
pending_slots[slot] = nil;
@@ -415,7 +415,7 @@
function module.command(args)
datamanager = require "core.storagemanager".olddm;
-- luacheck: ignore 421/user
- if args[1] == "expire" and args[2] then
+ if args[1] == "expire" then
local split = require "util.jid".prepped_split;
for i = 2, #args do
local user, host = split(args[i]);
@@ -427,10 +427,8 @@
end
end
end
- else
- print("prosodyctl mod_http_upload expire [host or user@host]+")
- print("\tProcess upload expiry for the given list of hosts and/or users");
- return 1;
end
end
+
+
For an WhatsApp gateway implementation (see https://git.theta.eu.org/eta/whatsxmpp) mod_http_upload bridge usage is needed. The author patched mod_http_upload.lua to allow it, please see the differences below or the changed file here: https://git.theta.eu.org/eta/whatsxmpp/raw/branch/master/doc/mod_http_upload.lua Is it possible to get these changes into the official code? --- mod_http_upload.lua.org 2020-04-10 02:27:49.000000000 +0200 +++ mod_http_upload.lua 2020-06-30 16:09:03.729356376 +0200 @@ -166,7 +166,7 @@ local function handle_request(origin, stanza, xmlns, filename, filesize) local username, host = origin.username, origin.host; -- local clients only - if origin.type ~= "c2s" then + if origin.type ~= "c2s" and origin.type ~= "component" then module:log("debug", "Request for upload slot from a %s", origin.type); return nil, st.error_reply(stanza, "cancel", "not-authorized"); end @@ -205,7 +205,7 @@ end local slot = random_dir.."/"..filename; - pending_slots[slot] = origin.full_jid; + pending_slots[slot] = stanza.attr.from; module:add_timer(900, function() pending_slots[slot] = nil; @@ -415,7 +415,7 @@ function module.command(args) datamanager = require "core.storagemanager".olddm; -- luacheck: ignore 421/user - if args[1] == "expire" and args[2] then + if args[1] == "expire" then local split = require "util.jid".prepped_split; for i = 2, #args do local user, host = split(args[i]); @@ -427,10 +427,8 @@ end end end - else - print("prosodyctl mod_http_upload expire [host or user@host]+") - print("\tProcess upload expiry for the given list of hosts and/or users"); - return 1; end end + +