2017-07-15 03:18:23 +00:00
|
|
|
local bare = require "util.jid".bare;
|
|
|
|
local generate_uuid = require "util.uuid".generate;
|
|
|
|
local jid = require "util.jid";
|
|
|
|
local neturl = require "net.url";
|
|
|
|
local parse = neturl.parseQuery;
|
|
|
|
local st = require "util.stanza";
|
|
|
|
local get_room_from_jid = module:require "util".get_room_from_jid;
|
2017-07-20 20:16:29 +00:00
|
|
|
local wrap_async_run = module:require "util".wrap_async_run;
|
2017-07-18 00:29:00 +00:00
|
|
|
local timer = require "util.timer";
|
2017-07-15 03:18:23 +00:00
|
|
|
|
|
|
|
-- Options
|
|
|
|
local poltergeist_component
|
|
|
|
= module:get_option_string("poltergeist_component", module.host);
|
2017-07-18 00:29:00 +00:00
|
|
|
-- defaults to 3 min
|
|
|
|
local poltergeist_timeout
|
|
|
|
= module:get_option_string("poltergeist_leave_timeout", 180);
|
2017-07-19 16:36:49 +00:00
|
|
|
-- this basically strips the domain from the conference.domain address
|
|
|
|
local parentHostName = string.gmatch(tostring(module.host), "%w+.(%w.+)")();
|
|
|
|
if parentHostName == nil then
|
|
|
|
log("error", "Failed to start - unable to get parent hostname");
|
|
|
|
return;
|
|
|
|
end
|
2017-07-15 03:18:23 +00:00
|
|
|
|
2017-07-20 18:56:55 +00:00
|
|
|
local parentCtx = module:context(parentHostName);
|
|
|
|
if parentCtx == nil then
|
|
|
|
log("error",
|
|
|
|
"Failed to start - unable to get parent context for host: %s",
|
|
|
|
tostring(parentHostName));
|
|
|
|
return;
|
|
|
|
end
|
|
|
|
local token_util = module:require "token/util".new(parentCtx);
|
|
|
|
|
|
|
|
-- option to enable/disable token verifications
|
|
|
|
local disableTokenVerification
|
|
|
|
= module:get_option_boolean("disable_polergeist_token_verification", false);
|
|
|
|
|
2017-07-20 19:16:42 +00:00
|
|
|
-- option to expire poltergeist with custom status text
|
|
|
|
local poltergeistExpiredStatus
|
|
|
|
= module:get_option_string("poltergeist_expired_status");
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
-- table to store all poltergeists we create
|
|
|
|
local poltergeists = {};
|
2017-07-18 00:29:00 +00:00
|
|
|
-- table to mark that outgoing unavailable presences
|
|
|
|
-- should be marked with ignore
|
|
|
|
local poltergeists_pr_ignore = {};
|
2017-07-15 03:18:23 +00:00
|
|
|
|
|
|
|
-- poltergaist management functions
|
|
|
|
|
|
|
|
-- Returns the room if available, work and in multidomain mode
|
|
|
|
-- @param room_name the name of the room
|
|
|
|
-- @param group name of the group (optional)
|
|
|
|
-- @return returns room if found or nil
|
|
|
|
function get_room(room_name, group)
|
|
|
|
local room_address = jid.join(room_name, module:get_host());
|
2017-07-19 16:36:49 +00:00
|
|
|
-- if there is a group we are in multidomain mode and that group is not
|
|
|
|
-- our parent host
|
|
|
|
if group and group ~= "" and group ~= parentHostName then
|
2017-07-15 03:18:23 +00:00
|
|
|
room_address = "["..group.."]"..room_address;
|
|
|
|
end
|
|
|
|
|
|
|
|
return get_room_from_jid(room_address);
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Stores the username in the table where we store poltergeist usernames
|
|
|
|
-- based on their room names
|
|
|
|
-- @param room the room instance
|
|
|
|
-- @param user_id the user id
|
|
|
|
-- @param username the username to store
|
|
|
|
function store_username(room, user_id, username)
|
|
|
|
local room_name = jid.node(room.jid);
|
|
|
|
|
|
|
|
-- we store in poltergeist user ids for room names
|
|
|
|
if (not poltergeists[room_name]) then
|
|
|
|
poltergeists[room_name] = {};
|
|
|
|
end
|
|
|
|
poltergeists[room_name][user_id] = username;
|
|
|
|
log("debug", "stored in session: %s", username);
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Retrieve the username for a user
|
|
|
|
-- @param room the room instance
|
|
|
|
-- @param user_id the user id
|
|
|
|
-- @return returns the stored username for user or nil
|
|
|
|
function get_username(room, user_id)
|
|
|
|
local room_name = jid.node(room.jid);
|
|
|
|
|
|
|
|
if (not poltergeists[room_name]) then
|
|
|
|
return nil;
|
|
|
|
end
|
|
|
|
|
|
|
|
return poltergeists[room_name][user_id];
|
|
|
|
end
|
|
|
|
|
2017-07-18 16:11:14 +00:00
|
|
|
-- Removes poltergeist values from table
|
|
|
|
-- @param room the room instance
|
|
|
|
-- @param nick the user nick
|
|
|
|
function remove_username(room, nick)
|
|
|
|
local room_name = jid.node(room.jid);
|
|
|
|
if (poltergeists[room_name]) then
|
|
|
|
local user_id_to_remove;
|
|
|
|
for name,username in pairs(poltergeists[room_name]) do
|
|
|
|
if (string.sub(username, 0, 8) == nick) then
|
|
|
|
user_id_to_remove = name;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if (user_id_to_remove) then
|
|
|
|
poltergeists[room_name][user_id_to_remove] = nil;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-20 18:56:55 +00:00
|
|
|
--- Verifies room name, domain name with the values in the token
|
|
|
|
-- @param token the token we received
|
|
|
|
-- @param room_name the room name
|
|
|
|
-- @param group name of the group (optional)
|
|
|
|
-- @return true if values are ok or false otherwise
|
|
|
|
function verify_token(token, room_name, group)
|
|
|
|
if disableTokenVerification then
|
|
|
|
return true;
|
|
|
|
end
|
|
|
|
|
|
|
|
-- if not disableTokenVerification and we do not have token
|
|
|
|
-- stop here, cause the main virtual host can have guest access enabled
|
|
|
|
-- (allowEmptyToken = true) and we will allow access to rooms info without
|
|
|
|
-- a token
|
|
|
|
if token == nil then
|
|
|
|
log("warn", "no token provided");
|
|
|
|
return false;
|
|
|
|
end
|
|
|
|
|
|
|
|
local session = {};
|
|
|
|
session.auth_token = token;
|
|
|
|
local verified, reason = token_util:process_and_verify_token(session);
|
|
|
|
if not verified then
|
|
|
|
log("warn", "not a valid token %s", tostring(reason));
|
|
|
|
return false;
|
|
|
|
end
|
|
|
|
|
|
|
|
local room_address = jid.join(room_name, module:get_host());
|
|
|
|
-- if there is a group we are in multidomain mode and that group is not
|
|
|
|
-- our parent host
|
|
|
|
if group and group ~= "" and group ~= parentHostName then
|
|
|
|
room_address = "["..group.."]"..room_address;
|
|
|
|
end
|
|
|
|
|
|
|
|
if not token_util:verify_room(session, room_address) then
|
|
|
|
log("warn", "Token %s not allowed to join: %s",
|
|
|
|
tostring(token), tostring(room_address));
|
|
|
|
return false;
|
|
|
|
end
|
|
|
|
|
|
|
|
return true;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
-- if we found that a session for a user with id has a poltergiest already
|
|
|
|
-- created, retrieve its jid and return it to the authentication
|
|
|
|
-- so we can reuse it and we that real user will replace the poltergiest
|
|
|
|
prosody.events.add_handler("pre-jitsi-authentication", function(session)
|
|
|
|
|
|
|
|
if (session.jitsi_meet_context_user) then
|
|
|
|
local room = get_room(
|
|
|
|
session.jitsi_bosh_query_room,
|
2017-07-19 16:36:49 +00:00
|
|
|
session.jitsi_meet_domain);
|
2017-07-15 03:18:23 +00:00
|
|
|
|
|
|
|
if (not room) then
|
|
|
|
return nil;
|
|
|
|
end
|
|
|
|
|
|
|
|
local username
|
|
|
|
= get_username(room, session.jitsi_meet_context_user["id"]);
|
|
|
|
|
|
|
|
if (not username) then
|
|
|
|
return nil;
|
|
|
|
end
|
|
|
|
|
|
|
|
log("debug", "Found predefined username %s", username);
|
|
|
|
|
|
|
|
-- let's find the room and if the poltergeist occupant is there
|
|
|
|
-- lets remove him before the real participant joins
|
|
|
|
-- when we see the unavailable presence to go out the server
|
|
|
|
-- we will mark it with ignore tag
|
|
|
|
local nick = string.sub(username, 0, 8);
|
|
|
|
if (have_poltergeist_occupant(room, nick)) then
|
2017-07-18 00:29:00 +00:00
|
|
|
remove_poltergeist_occupant(room, nick, true);
|
2017-07-15 03:18:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return username;
|
|
|
|
end
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
end);
|
|
|
|
|
|
|
|
-- Creates poltergeist occupant
|
|
|
|
-- @param room the room instance where we create the occupant
|
|
|
|
-- @param nick the nick to use for the new occupant
|
|
|
|
-- @param name the display name fot the occupant (optional)
|
|
|
|
-- @param avatar the avatar to use for the new occupant (optional)
|
2017-07-20 18:29:54 +00:00
|
|
|
-- @param status the initial status to use for the new occupant (optional)
|
|
|
|
function create_poltergeist_occupant(room, nick, name, avatar, status)
|
2017-07-15 03:18:23 +00:00
|
|
|
log("debug", "create_poltergeist_occupant %s:", nick);
|
|
|
|
-- Join poltergeist occupant to room, with the invited JID as their nick
|
|
|
|
local join_presence = st.presence({
|
|
|
|
to = room.jid.."/"..nick,
|
|
|
|
from = poltergeist_component.."/"..nick
|
|
|
|
}):tag("x", { xmlns = "http://jabber.org/protocol/muc" }):up();
|
|
|
|
|
|
|
|
if (name) then
|
|
|
|
join_presence:tag(
|
|
|
|
"nick",
|
|
|
|
{ xmlns = "http://jabber.org/protocol/nick" }):text(name):up();
|
|
|
|
end
|
|
|
|
if (avatar) then
|
|
|
|
join_presence:tag("avatar-url"):text(avatar):up();
|
|
|
|
end
|
2017-07-20 18:29:54 +00:00
|
|
|
if (status) then
|
|
|
|
join_presence:tag("status"):text(status):up();
|
|
|
|
end
|
2017-07-15 03:18:23 +00:00
|
|
|
|
|
|
|
room:handle_first_presence(
|
|
|
|
prosody.hosts[poltergeist_component], join_presence);
|
2017-07-18 00:29:00 +00:00
|
|
|
|
2017-07-20 19:16:42 +00:00
|
|
|
local timeout = poltergeist_timeout;
|
|
|
|
-- the timeout before removing so participants can see the status update
|
|
|
|
local removeTimeout = 5;
|
|
|
|
if (poltergeistExpiredStatus) then
|
|
|
|
timeout = timeout - removeTimeout;
|
|
|
|
end
|
|
|
|
|
|
|
|
timer.add_task(timeout,
|
2017-07-18 00:29:00 +00:00
|
|
|
function ()
|
2017-07-20 19:16:42 +00:00
|
|
|
if (poltergeistExpiredStatus) then
|
|
|
|
update_poltergeist_occupant_status(
|
|
|
|
room, nick, poltergeistExpiredStatus);
|
|
|
|
-- and remove it after some time so participant can see
|
|
|
|
-- the update
|
|
|
|
timer.add_task(removeTimeout,
|
|
|
|
function ()
|
|
|
|
if (have_poltergeist_occupant(room, nick)) then
|
|
|
|
remove_poltergeist_occupant(room, nick, false);
|
|
|
|
end
|
|
|
|
end);
|
|
|
|
else
|
|
|
|
if (have_poltergeist_occupant(room, nick)) then
|
|
|
|
remove_poltergeist_occupant(room, nick, false);
|
|
|
|
end
|
2017-07-18 00:29:00 +00:00
|
|
|
end
|
|
|
|
end);
|
2017-07-15 03:18:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Removes poltergeist occupant
|
|
|
|
-- @param room the room instance where to remove the occupant
|
|
|
|
-- @param nick the nick of the occupant to remove
|
2017-07-18 00:29:00 +00:00
|
|
|
-- @param ignore to mark the poltergeist unavailble presence to be ignored
|
|
|
|
function remove_poltergeist_occupant(room, nick, ignore)
|
2017-07-15 03:18:23 +00:00
|
|
|
log("debug", "remove_poltergeist_occupant %s", nick);
|
|
|
|
local leave_presence = st.presence({
|
|
|
|
to = room.jid.."/"..nick,
|
|
|
|
from = poltergeist_component.."/"..nick,
|
|
|
|
type = "unavailable" });
|
2017-07-18 00:29:00 +00:00
|
|
|
if (ignore) then
|
|
|
|
poltergeists_pr_ignore[room.jid.."/"..nick] = true;
|
|
|
|
end
|
2017-07-15 03:18:23 +00:00
|
|
|
room:handle_normal_presence(
|
|
|
|
prosody.hosts[poltergeist_component], leave_presence);
|
2017-07-18 16:11:14 +00:00
|
|
|
remove_username(room, nick);
|
2017-07-15 03:18:23 +00:00
|
|
|
end
|
|
|
|
|
2017-07-20 19:16:42 +00:00
|
|
|
-- Updates poltergeist occupant status
|
|
|
|
-- @param room the room instance where to remove the occupant
|
|
|
|
-- @param nick the nick of the occupant to remove
|
|
|
|
-- @param status the status to update
|
|
|
|
function update_poltergeist_occupant_status(room, nick, status)
|
|
|
|
local update_presence = get_presence(room, nick);
|
|
|
|
|
|
|
|
if (not update_presence) then
|
|
|
|
-- no presence found for occupant, create one
|
|
|
|
update_presence = st.presence({
|
|
|
|
to = room.jid.."/"..nick,
|
|
|
|
from = poltergeist_component.."/"..nick
|
|
|
|
});
|
|
|
|
else
|
|
|
|
-- update occupant presence with appropriate to and from
|
|
|
|
-- so we can send it again
|
|
|
|
update_presence = st.clone(update_presence);
|
|
|
|
update_presence.attr.to = room.jid.."/"..nick;
|
|
|
|
update_presence.attr.from = poltergeist_component.."/"..nick;
|
|
|
|
end
|
|
|
|
|
|
|
|
local once = false;
|
|
|
|
-- the status tag we will attach
|
|
|
|
local statusTag = st.stanza("status"):text(status);
|
|
|
|
|
|
|
|
-- if there is already a status tag replace it
|
|
|
|
update_presence:maptags(function (tag)
|
|
|
|
if tag.name == statusTag.name then
|
|
|
|
if not once then
|
|
|
|
once = true;
|
|
|
|
return statusTag;
|
|
|
|
else
|
|
|
|
return nil;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return tag;
|
|
|
|
end);
|
|
|
|
if (not once) then
|
|
|
|
-- no status tag was repleced, attach it
|
|
|
|
update_presence:add_child(statusTag);
|
|
|
|
end
|
|
|
|
|
|
|
|
room:handle_normal_presence(
|
|
|
|
prosody.hosts[poltergeist_component], update_presence);
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
-- Checks for existance of a poltergeist occupant
|
|
|
|
-- @param room the room instance where to check for occupant
|
|
|
|
-- @param nick the nick of the occupant
|
|
|
|
-- @return true if occupant is found, false otherwise
|
|
|
|
function have_poltergeist_occupant(room, nick)
|
|
|
|
-- Find out if we have a poltergeist occupant in the room for this JID
|
|
|
|
return not not room:get_occupant_jid(poltergeist_component.."/"..nick);
|
|
|
|
end
|
|
|
|
|
2017-07-18 18:08:18 +00:00
|
|
|
-- Returns the last presence of occupant
|
|
|
|
-- @param room the room instance where to check for occupant
|
|
|
|
-- @param nick the nick of the occupant
|
|
|
|
-- @return presence of the occupant
|
|
|
|
function get_presence(room, nick)
|
|
|
|
local occupant_jid
|
|
|
|
= room:get_occupant_jid(poltergeist_component.."/"..nick);
|
|
|
|
if (occupant_jid) then
|
|
|
|
return room:get_occupant_by_nick(occupant_jid):get_presence();
|
|
|
|
end
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
-- Event handlers
|
|
|
|
|
|
|
|
--- Note: mod_muc and some of its sub-modules add event handlers between 0 and -100,
|
|
|
|
--- e.g. to check for banned users, etc.. Hence adding these handlers at priority -100.
|
|
|
|
module:hook("muc-decline", function (event)
|
2017-07-18 00:29:00 +00:00
|
|
|
remove_poltergeist_occupant(event.room, bare(event.stanza.attr.from), false);
|
2017-07-15 03:18:23 +00:00
|
|
|
end, -100);
|
|
|
|
-- before sending the presence for a poltergeist leaving add ignore tag
|
|
|
|
-- as poltergeist is leaving just before the real user joins and in the client
|
|
|
|
-- we ignore this presence to avoid leaving/joining experience and the real
|
|
|
|
-- user will reuse all currently created UI components for the same nick
|
|
|
|
module:hook("muc-broadcast-presence", function (event)
|
|
|
|
if (bare(event.occupant.jid) == poltergeist_component) then
|
2017-07-18 00:29:00 +00:00
|
|
|
if(event.stanza.attr.type == "unavailable"
|
|
|
|
and poltergeists_pr_ignore[event.occupant.nick]) then
|
2017-07-15 03:18:23 +00:00
|
|
|
event.stanza:tag(
|
|
|
|
"ignore", { xmlns = "http://jitsi.org/jitmeet/" }):up();
|
2017-07-18 00:29:00 +00:00
|
|
|
poltergeists_pr_ignore[event.occupant.nick] = nil;
|
2017-07-15 03:18:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end, -100);
|
|
|
|
|
2017-07-18 16:11:14 +00:00
|
|
|
-- cleanup room table after room is destroyed
|
|
|
|
module:hook("muc-room-destroyed",function(event)
|
|
|
|
local room_name = jid.node(event.room.jid);
|
|
|
|
if (poltergeists[room_name]) then
|
|
|
|
poltergeists[room_name] = nil;
|
|
|
|
end
|
|
|
|
end);
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
--- Handles request for creating/managing poltergeists
|
|
|
|
-- @param event the http event, holds the request query
|
|
|
|
-- @return GET response, containing a json with response details
|
|
|
|
function handle_create_poltergeist (event)
|
2017-07-17 22:38:29 +00:00
|
|
|
if (not event.request.url.query) then
|
|
|
|
return 400;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
local params = parse(event.request.url.query);
|
|
|
|
local user_id = params["user"];
|
|
|
|
local room_name = params["room"];
|
|
|
|
local group = params["group"];
|
|
|
|
local name = params["name"];
|
|
|
|
local avatar = params["avatar"];
|
2017-07-20 18:29:54 +00:00
|
|
|
local status = params["status"];
|
2017-07-15 03:18:23 +00:00
|
|
|
|
2017-07-20 18:56:55 +00:00
|
|
|
if not verify_token(params["token"], room_name, group) then
|
|
|
|
return 403;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
local room = get_room(room_name, group);
|
|
|
|
if (not room) then
|
2017-07-17 22:26:47 +00:00
|
|
|
log("error", "no room found %s", room_name);
|
2017-07-15 03:18:23 +00:00
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
|
|
|
|
local username = generate_uuid();
|
|
|
|
store_username(room, user_id, username)
|
|
|
|
|
2017-07-20 18:29:54 +00:00
|
|
|
create_poltergeist_occupant(
|
|
|
|
room, string.sub(username,0,8), name, avatar, status);
|
2017-07-15 03:18:23 +00:00
|
|
|
|
|
|
|
return 200;
|
|
|
|
end
|
|
|
|
|
|
|
|
--- Handles request for updating poltergeists status
|
|
|
|
-- @param event the http event, holds the request query
|
|
|
|
-- @return GET response, containing a json with response details
|
|
|
|
function handle_update_poltergeist (event)
|
2017-07-17 22:38:29 +00:00
|
|
|
if (not event.request.url.query) then
|
|
|
|
return 400;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
local params = parse(event.request.url.query);
|
|
|
|
local user_id = params["user"];
|
|
|
|
local room_name = params["room"];
|
|
|
|
local group = params["group"];
|
|
|
|
local status = params["status"];
|
|
|
|
|
2017-07-20 18:56:55 +00:00
|
|
|
if not verify_token(params["token"], room_name, group) then
|
|
|
|
return 403;
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
local room = get_room(room_name, group);
|
|
|
|
if (not room) then
|
2017-07-17 22:26:47 +00:00
|
|
|
log("error", "no room found %s", room_name);
|
2017-07-15 03:18:23 +00:00
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
|
|
|
|
local username = get_username(room, user_id);
|
|
|
|
if (not username) then
|
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
|
|
|
|
local nick = string.sub(username, 0, 8);
|
|
|
|
if (have_poltergeist_occupant(room, nick)) then
|
2017-07-20 19:16:42 +00:00
|
|
|
update_poltergeist_occupant_status(room, nick, status);
|
2017-07-15 03:18:23 +00:00
|
|
|
return 200;
|
|
|
|
else
|
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-18 00:29:00 +00:00
|
|
|
--- Handles remove poltergeists
|
|
|
|
-- @param event the http event, holds the request query
|
|
|
|
-- @return GET response, containing a json with response details
|
|
|
|
function handle_remove_poltergeist (event)
|
|
|
|
if (not event.request.url.query) then
|
|
|
|
return 400;
|
|
|
|
end
|
|
|
|
|
|
|
|
local params = parse(event.request.url.query);
|
|
|
|
local user_id = params["user"];
|
|
|
|
local room_name = params["room"];
|
|
|
|
local group = params["group"];
|
|
|
|
|
2017-07-20 18:56:55 +00:00
|
|
|
if not verify_token(params["token"], room_name, group) then
|
|
|
|
return 403;
|
|
|
|
end
|
|
|
|
|
2017-07-18 00:29:00 +00:00
|
|
|
local room = get_room(room_name, group);
|
|
|
|
if (not room) then
|
|
|
|
log("error", "no room found %s", room_name);
|
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
|
|
|
|
local username = get_username(room, user_id);
|
|
|
|
if (not username) then
|
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
|
|
|
|
local nick = string.sub(username, 0, 8);
|
|
|
|
if (have_poltergeist_occupant(room, nick)) then
|
|
|
|
remove_poltergeist_occupant(room, nick, false);
|
|
|
|
return 200;
|
|
|
|
else
|
|
|
|
return 404;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-15 03:18:23 +00:00
|
|
|
log("info", "Loading poltergeist service");
|
|
|
|
module:depends("http");
|
|
|
|
module:provides("http", {
|
|
|
|
default_path = "/";
|
|
|
|
name = "poltergeist";
|
|
|
|
route = {
|
2017-07-20 20:16:29 +00:00
|
|
|
["GET /poltergeist/create"] = function (event) return wrap_async_run(event,handle_create_poltergeist) end;
|
|
|
|
["GET /poltergeist/update"] = function (event) return wrap_async_run(event,handle_update_poltergeist) end;
|
|
|
|
["GET /poltergeist/remove"] = function (event) return wrap_async_run(event,handle_remove_poltergeist) end;
|
2017-07-15 03:18:23 +00:00
|
|
|
};
|
|
|
|
});
|