mirror of
https://github.com/YunoHost-Apps/jitsi_ynh.git
synced 2024-09-03 19:35:57 +02:00
First Fix
This commit is contained in:
parent
a7c5ff9a29
commit
96f620c206
17 changed files with 708 additions and 66 deletions
|
@ -17,10 +17,10 @@ Jitsi Meet is an open-source (Apache) WebRTC JavaScript application that uses Ji
|
|||
|
||||
1. **Jitsi** require a dedicated **root domain**, eg. jitsi.domain.tld
|
||||
1. **Jitsi** require your create additionals dns names in your dns that goes to your YunoHost
|
||||
1. auth.jitsi.domain.tld
|
||||
1. conference.jitsi.domain.tld
|
||||
1. jitsi-videobridge.jitsi.domain.tld
|
||||
1. focus.jitsi.domain.tld
|
||||
* auth.jitsi.domain.tld
|
||||
* conference.jitsi.domain.tld
|
||||
* jitsi-videobridge.jitsi.domain.tld
|
||||
* focus.jitsi.domain.tld
|
||||
1. **Jitsi** require the ports TCP/4443 and UDP/10000 been redirected to your YunoHost
|
||||
|
||||
## Screenshots
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/jitsi-jicofo/
|
||||
ExecStart=__FINALPATH__/jicofo.sh --host=localhost --domain=__DOMAIN__ --secret=__FOCUS_SECRET__ --user_domain=auth.__DOMAIN__ --user_name=__APP__-focus --user_password=__FOCUS_PASSWORD__ & >> /var/log/__APP__/__APP__-jitsi-jicofo.log 2>&1
|
||||
ExecStart=__FINALPATH__/jitsi-jicofo/jicofo.sh --host=localhost --domain=__DOMAIN__ --secret=__FOCUS_SECRET__ --user_domain=auth.__DOMAIN__ --user_name=__FOCUS_USER__ --user_password=__FOCUS_PASSWORD__ & >> /var/log/__APP__/__APP__-jitsi-jicofo.log 2>&1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/jitsi/jicofo/archive/472.tar.gz
|
||||
SOURCE_SUM=5c3c63a15119187bf547400e1fec04c6cc53fd82dec9fdef33b82a27379d6fc1
|
||||
SOURCE_URL=https://github.com/jitsi/jicofo/archive/84698893c333b386438de9c69616e1cc5c7df243.tar.gz
|
||||
SOURCE_SUM=569898ba95579c59a7e4e6ee467a99c90e9170c7c2596c3461d2652f8cda3b7a
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/jitsi/jitsi-meet/archive/3426.tar.gz
|
||||
SOURCE_SUM=b37b50b784c76df56c3a3d5b7d403eeaa2829d17f69c3c22fbe6e2e4bd31a8b8
|
||||
SOURCE_URL=https://github.com/jitsi/jitsi-meet/archive/f8a049759db966a35daba3fcff1fd4d4fd206381.tar.gz
|
||||
SOURCE_SUM=4ed8fa519e0de417d4ddbd13658d372b0217d8f569cd352c85fb72c0e8e6c0f7
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/jitsi-videobridge/
|
||||
ExecStart=__FINALPATH__/jitsi-videobridge/jvb.sh --host=localhost --domain=__DOMAIN__ --port=5347 --secret=__VIDEOBRIDGE_SECRET__ & >> /var/log/__APP__/__APP__-jitsi-videobridge.log 2>&1
|
||||
ExecStart=/bin/bash -c "exec __FINALPATH__/jitsi-videobridge/jvb.sh --host=127.0.0.1 --domain=__DOMAIN__ --port=__PORT_VIDEOBRIDGE__ --secret=__VIDEOBRIDGE_SECRET__ < /dev/null >> ${LOGFILE} 2>&1"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://github.com/jitsi/jitsi-videobridge/archive/1119.tar.gz
|
||||
SOURCE_SUM=22f1803158fd6e2898b61bbb4d5b53d063ac1cc29c07c7ab502ba93f89d262c1
|
||||
SOURCE_URL=https://download.jitsi.org/jitsi-videobridge/linux/jitsi-videobridge-linux-x64-1120.zip
|
||||
SOURCE_SUM=6f00ce479d7f010b42fef3f262b1ecd42d11e6a5872c164231ea38db7216d680
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
-- Example: admins = { "user1@example.com", "user2@example.net" }
|
||||
admins = { "focus__APP__@auth.__DOMAIN__" }
|
||||
daemonize = true
|
||||
-- cross_domain_bosh = true;
|
||||
component_ports = { 5347 }
|
||||
cross_domain_bosh = true;
|
||||
component_ports = { __PORT_VIDEOBRIDGE__ }
|
||||
--component_interface = "192.168.0.10"
|
||||
|
||||
-- Enable use of libevent for better performance under high load
|
||||
|
|
137
conf/mod_carbons.lua
Normal file
137
conf/mod_carbons.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
-- XEP-0280: Message Carbons implementation for Prosody
|
||||
-- Copyright (C) 2011 Kim Alvefur
|
||||
--
|
||||
-- This file is MIT/X11 licensed.
|
||||
|
||||
local st = require "util.stanza";
|
||||
local jid_bare = require "util.jid".bare;
|
||||
local xmlns_carbons = "urn:xmpp:carbons:2";
|
||||
local xmlns_carbons_old = "urn:xmpp:carbons:1";
|
||||
local xmlns_carbons_really_old = "urn:xmpp:carbons:0";
|
||||
local xmlns_forward = "urn:xmpp:forward:0";
|
||||
local full_sessions, bare_sessions = full_sessions, bare_sessions;
|
||||
|
||||
local function toggle_carbons(event)
|
||||
local origin, stanza = event.origin, event.stanza;
|
||||
local state = stanza.tags[1].attr.mode or stanza.tags[1].name;
|
||||
module:log("debug", "%s %sd carbons", origin.full_jid, state);
|
||||
origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns;
|
||||
return origin.send(st.reply(stanza));
|
||||
end
|
||||
module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons);
|
||||
module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons);
|
||||
|
||||
-- COMPAT
|
||||
module:hook("iq-set/self/"..xmlns_carbons_old..":disable", toggle_carbons);
|
||||
module:hook("iq-set/self/"..xmlns_carbons_old..":enable", toggle_carbons);
|
||||
module:hook("iq-set/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons);
|
||||
|
||||
local function message_handler(event, c2s)
|
||||
local origin, stanza = event.origin, event.stanza;
|
||||
local orig_type = stanza.attr.type;
|
||||
local orig_from = stanza.attr.from;
|
||||
local orig_to = stanza.attr.to;
|
||||
|
||||
if not (orig_type == nil
|
||||
or orig_type == "normal"
|
||||
or orig_type == "chat") then
|
||||
return -- No carbons for messages of type error or headline
|
||||
end
|
||||
|
||||
-- Stanza sent by a local client
|
||||
local bare_jid = jid_bare(orig_from);
|
||||
local target_session = origin;
|
||||
local top_priority = false;
|
||||
local user_sessions = bare_sessions[bare_jid];
|
||||
|
||||
-- Stanza about to be delivered to a local client
|
||||
if not c2s then
|
||||
bare_jid = jid_bare(orig_to);
|
||||
target_session = full_sessions[orig_to];
|
||||
user_sessions = bare_sessions[bare_jid];
|
||||
if not target_session and user_sessions then
|
||||
-- The top resources will already receive this message per normal routing rules,
|
||||
-- so we are going to skip them in order to avoid sending duplicated messages.
|
||||
local top_resources = user_sessions.top_resources;
|
||||
top_priority = top_resources and top_resources[1].priority
|
||||
end
|
||||
end
|
||||
|
||||
if not user_sessions then
|
||||
module:log("debug", "Skip carbons for offline user");
|
||||
return -- No use in sending carbons to an offline user
|
||||
end
|
||||
|
||||
if stanza:get_child("private", xmlns_carbons) then
|
||||
if not c2s then
|
||||
stanza:maptags(function(tag)
|
||||
if not ( tag.attr.xmlns == xmlns_carbons and tag.name == "private" ) then
|
||||
return tag;
|
||||
end
|
||||
end);
|
||||
end
|
||||
module:log("debug", "Message tagged private, ignoring");
|
||||
return
|
||||
elseif stanza:get_child("no-copy", "urn:xmpp:hints") then
|
||||
module:log("debug", "Message has no-copy hint, ignoring");
|
||||
return
|
||||
elseif stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
|
||||
module:log("debug", "MUC PM, ignoring");
|
||||
return
|
||||
end
|
||||
|
||||
-- Create the carbon copy and wrap it as per the Stanza Forwarding XEP
|
||||
local copy = st.clone(stanza);
|
||||
copy.attr.xmlns = "jabber:client";
|
||||
local carbon = st.message{ from = bare_jid, type = orig_type, }
|
||||
:tag(c2s and "sent" or "received", { xmlns = xmlns_carbons })
|
||||
:tag("forwarded", { xmlns = xmlns_forward })
|
||||
:add_child(copy):reset();
|
||||
|
||||
-- COMPAT
|
||||
local carbon_old = st.message{ from = bare_jid, type = orig_type, }
|
||||
:tag(c2s and "sent" or "received", { xmlns = xmlns_carbons_old }):up()
|
||||
:tag("forwarded", { xmlns = xmlns_forward })
|
||||
:add_child(copy):reset();
|
||||
|
||||
-- COMPAT
|
||||
local carbon_really_old = st.clone(stanza)
|
||||
:tag(c2s and "sent" or "received", { xmlns = xmlns_carbons_really_old }):up()
|
||||
|
||||
user_sessions = user_sessions and user_sessions.sessions;
|
||||
for _, session in pairs(user_sessions) do
|
||||
-- Carbons are sent to resources that have enabled it
|
||||
if session.want_carbons
|
||||
-- but not the resource that sent the message, or the one that it's directed to
|
||||
and session ~= target_session
|
||||
-- and isn't among the top resources that would receive the message per standard routing rules
|
||||
and (c2s or session.priority ~= top_priority)
|
||||
-- don't send v0 carbons (or copies) for c2s
|
||||
and (not c2s or session.want_carbons ~= xmlns_carbons_really_old) then
|
||||
carbon.attr.to = session.full_jid;
|
||||
module:log("debug", "Sending carbon to %s", session.full_jid);
|
||||
local carbon = session.want_carbons == xmlns_carbons_old and carbon_old -- COMPAT
|
||||
or session.want_carbons == xmlns_carbons_really_old and carbon_really_old -- COMPAT
|
||||
or carbon;
|
||||
session.send(carbon);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function c2s_message_handler(event)
|
||||
return message_handler(event, true)
|
||||
end
|
||||
|
||||
-- Stanzas sent by local clients
|
||||
module:hook("pre-message/host", c2s_message_handler, 1);
|
||||
module:hook("pre-message/bare", c2s_message_handler, 1);
|
||||
module:hook("pre-message/full", c2s_message_handler, 1);
|
||||
-- Stanzas to local clients
|
||||
module:hook("message/bare", message_handler, 1);
|
||||
module:hook("message/full", message_handler, 1);
|
||||
|
||||
module:add_feature(xmlns_carbons);
|
||||
module:add_feature(xmlns_carbons_old);
|
||||
if module:get_option_boolean("carbons_v0") then
|
||||
module:add_feature(xmlns_carbons_really_old);
|
||||
end
|
60
conf/mod_http_altconnect.lua
Normal file
60
conf/mod_http_altconnect.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
-- mod_http_altconnect
|
||||
-- XEP-0156: Discovering Alternative XMPP Connection Methods
|
||||
|
||||
module:depends"http";
|
||||
|
||||
local json = require"util.json";
|
||||
local st = require"util.stanza";
|
||||
local array = require"util.array";
|
||||
|
||||
local host_modules = hosts[module.host].modules;
|
||||
|
||||
local function get_supported()
|
||||
local uris = array();
|
||||
if host_modules["bosh"] then
|
||||
uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") });
|
||||
end
|
||||
if host_modules["websocket"] then
|
||||
uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") });
|
||||
end
|
||||
return uris;
|
||||
end
|
||||
|
||||
|
||||
local function GET_xml(event)
|
||||
local request, response = event.request, event.response;
|
||||
local xrd = st.stanza("XRD", { xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' });
|
||||
local uris = get_supported();
|
||||
for i, method in ipairs(uris) do
|
||||
xrd:tag("Link", method):up();
|
||||
end
|
||||
response.headers.content_type = "application/xrd+xml"
|
||||
response.headers.access_control_allow_origin = "*";
|
||||
return '<?xml version="1.0" encoding="UTF-8"?>' .. tostring(xrd);
|
||||
end
|
||||
|
||||
local function GET_json(event)
|
||||
local request, response = event.request, event.response;
|
||||
local jrd = { links = get_supported() };
|
||||
response.headers.content_type = "application/json"
|
||||
response.headers.access_control_allow_origin = "*";
|
||||
return json.encode(jrd);
|
||||
end;
|
||||
|
||||
local function GET_either(event)
|
||||
local accept_type = event.request.headers.accept or "";
|
||||
if ( accept_type:find("xml") or #accept_type ) < ( accept_type:find("json") or #accept_type+1 ) then
|
||||
return GET_xml(event);
|
||||
else
|
||||
return GET_json(event);
|
||||
end
|
||||
end;
|
||||
|
||||
module:provides("http", {
|
||||
default_path = "/.well-known";
|
||||
route = {
|
||||
["GET /host-meta"] = GET_either;
|
||||
-- ["GET /host-meta.xml"] = GET_xml; -- Hmmm
|
||||
["GET /host-meta.json"] = GET_json;
|
||||
};
|
||||
});
|
394
conf/mod_smacks.lua
Normal file
394
conf/mod_smacks.lua
Normal file
|
@ -0,0 +1,394 @@
|
|||
-- XEP-0198: Stream Management for Prosody IM
|
||||
--
|
||||
-- Copyright (C) 2010-2015 Matthew Wild
|
||||
-- Copyright (C) 2010 Waqas Hussain
|
||||
-- Copyright (C) 2012-2015 Kim Alvefur
|
||||
-- Copyright (C) 2012 Thijs Alkemade
|
||||
-- Copyright (C) 2014 Florian Zeitz
|
||||
--
|
||||
-- This project is MIT/X11 licensed. Please see the
|
||||
-- COPYING file in the source package for more information.
|
||||
--
|
||||
|
||||
local st = require "util.stanza";
|
||||
local uuid_generate = require "util.uuid".generate;
|
||||
|
||||
local t_insert, t_remove = table.insert, table.remove;
|
||||
local math_min = math.min;
|
||||
local os_time = os.time;
|
||||
local tonumber, tostring = tonumber, tostring;
|
||||
local add_filter = require "util.filters".add_filter;
|
||||
local timer = require "util.timer";
|
||||
local datetime = require "util.datetime";
|
||||
|
||||
local xmlns_sm2 = "urn:xmpp:sm:2";
|
||||
local xmlns_sm3 = "urn:xmpp:sm:3";
|
||||
local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas";
|
||||
local xmlns_delay = "urn:xmpp:delay";
|
||||
|
||||
local sm2_attr = { xmlns = xmlns_sm2 };
|
||||
local sm3_attr = { xmlns = xmlns_sm3 };
|
||||
|
||||
local resume_timeout = module:get_option_number("smacks_hibernation_time", 300);
|
||||
local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", false);
|
||||
local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0);
|
||||
local core_process_stanza = prosody.core_process_stanza;
|
||||
local sessionmanager = require"core.sessionmanager";
|
||||
|
||||
local c2s_sessions = module:shared("/*/c2s/sessions");
|
||||
local session_registry = {};
|
||||
|
||||
local function can_do_smacks(session, advertise_only)
|
||||
if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end
|
||||
|
||||
local session_type = session.type;
|
||||
if session_type == "c2s" then
|
||||
if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm
|
||||
return false, "unexpected-request", "Client must bind a resource before enabling stream management";
|
||||
end
|
||||
return true;
|
||||
elseif s2s_smacks and (session_type == "s2sin" or session_type == "s2sout") then
|
||||
return true;
|
||||
end
|
||||
return false, "service-unavailable", "Stream management is not available for this stream";
|
||||
end
|
||||
|
||||
module:hook("stream-features",
|
||||
function (event)
|
||||
if can_do_smacks(event.origin, true) then
|
||||
event.features:tag("sm", sm2_attr):tag("optional"):up():up();
|
||||
event.features:tag("sm", sm3_attr):tag("optional"):up():up();
|
||||
end
|
||||
end);
|
||||
|
||||
module:hook("s2s-stream-features",
|
||||
function (event)
|
||||
if can_do_smacks(event.origin, true) then
|
||||
event.features:tag("sm", sm2_attr):tag("optional"):up():up();
|
||||
event.features:tag("sm", sm3_attr):tag("optional"):up():up();
|
||||
end
|
||||
end);
|
||||
|
||||
local function outgoing_stanza_filter(stanza, session)
|
||||
local is_stanza = stanza.attr and not stanza.attr.xmlns and not stanza.name:find":";
|
||||
if is_stanza and not stanza._cached then -- Stanza in default stream namespace
|
||||
local queue = session.outgoing_stanza_queue;
|
||||
local cached_stanza = st.clone(stanza);
|
||||
cached_stanza._cached = true;
|
||||
|
||||
if cached_stanza and cached_stanza.name ~= "iq" and cached_stanza:get_child("delay", xmlns_delay) == nil then
|
||||
cached_stanza = cached_stanza:tag("delay", { xmlns = xmlns_delay, from = session.host, stamp = datetime.datetime()});
|
||||
end
|
||||
|
||||
queue[#queue+1] = cached_stanza;
|
||||
session.log("debug", "#queue = %d", #queue);
|
||||
if session.hibernating then
|
||||
session.log("debug", "hibernating, stanza queued");
|
||||
return ""; -- Hack to make session.send() not return nil
|
||||
end
|
||||
if #queue > max_unacked_stanzas and not session.awaiting_ack then
|
||||
session.awaiting_ack = true;
|
||||
return tostring(stanza)..tostring(st.stanza("r", { xmlns = session.smacks }));
|
||||
end
|
||||
end
|
||||
return stanza;
|
||||
end
|
||||
|
||||
local function count_incoming_stanzas(stanza, session)
|
||||
if not stanza.attr.xmlns then
|
||||
session.handled_stanza_count = session.handled_stanza_count + 1;
|
||||
session.log("debug", "Handled %d incoming stanzas", session.handled_stanza_count);
|
||||
end
|
||||
return stanza;
|
||||
end
|
||||
|
||||
local function wrap_session_out(session, resume)
|
||||
if not resume then
|
||||
session.outgoing_stanza_queue = {};
|
||||
session.last_acknowledged_stanza = 0;
|
||||
end
|
||||
|
||||
add_filter(session, "stanzas/out", outgoing_stanza_filter, -1000);
|
||||
|
||||
local session_close = session.close;
|
||||
function session.close(...)
|
||||
if session.resumption_token then
|
||||
session_registry[session.resumption_token] = nil;
|
||||
session.resumption_token = nil;
|
||||
end
|
||||
return session_close(...);
|
||||
end
|
||||
return session;
|
||||
end
|
||||
|
||||
local function wrap_session_in(session, resume)
|
||||
if not resume then
|
||||
session.handled_stanza_count = 0;
|
||||
end
|
||||
add_filter(session, "stanzas/in", count_incoming_stanzas, 1000);
|
||||
|
||||
return session;
|
||||
end
|
||||
|
||||
local function wrap_session(session, resume)
|
||||
wrap_session_out(session, resume);
|
||||
wrap_session_in(session, resume);
|
||||
return session;
|
||||
end
|
||||
|
||||
function handle_enable(session, stanza, xmlns_sm)
|
||||
local ok, err, err_text = can_do_smacks(session);
|
||||
if not ok then
|
||||
session.log("warn", "Failed to enable smacks: %s", err_text); -- TODO: XEP doesn't say we can send error text, should it?
|
||||
(session.sends2s or session.send)(st.stanza("failed", { xmlns = xmlns_sm }):tag(err, { xmlns = xmlns_errors}));
|
||||
return true;
|
||||
end
|
||||
|
||||
module:log("debug", "Enabling stream management");
|
||||
session.smacks = xmlns_sm;
|
||||
|
||||
wrap_session(session, false);
|
||||
|
||||
local resume_token;
|
||||
local resume = stanza.attr.resume;
|
||||
if resume == "true" or resume == "1" then
|
||||
resume_token = uuid_generate();
|
||||
session_registry[resume_token] = session;
|
||||
session.resumption_token = resume_token;
|
||||
end
|
||||
(session.sends2s or session.send)(st.stanza("enabled", { xmlns = xmlns_sm, id = resume_token, resume = resume }));
|
||||
return true;
|
||||
end
|
||||
module:hook_stanza(xmlns_sm2, "enable", function (session, stanza) return handle_enable(session, stanza, xmlns_sm2); end, 100);
|
||||
module:hook_stanza(xmlns_sm3, "enable", function (session, stanza) return handle_enable(session, stanza, xmlns_sm3); end, 100);
|
||||
|
||||
module:hook_stanza("http://etherx.jabber.org/streams", "features",
|
||||
function (session, stanza)
|
||||
module:add_timer(0, function ()
|
||||
if can_do_smacks(session) then
|
||||
if stanza:get_child("sm", xmlns_sm3) then
|
||||
session.sends2s(st.stanza("enable", sm3_attr));
|
||||
session.smacks = xmlns_sm3;
|
||||
elseif stanza:get_child("sm", xmlns_sm2) then
|
||||
session.sends2s(st.stanza("enable", sm2_attr));
|
||||
session.smacks = xmlns_sm2;
|
||||
else
|
||||
return;
|
||||
end
|
||||
wrap_session_out(session, false);
|
||||
end
|
||||
end);
|
||||
end);
|
||||
|
||||
function handle_enabled(session, stanza, xmlns_sm)
|
||||
module:log("debug", "Enabling stream management");
|
||||
session.smacks = xmlns_sm;
|
||||
|
||||
wrap_session_in(session, false);
|
||||
|
||||
-- FIXME Resume?
|
||||
|
||||
return true;
|
||||
end
|
||||
module:hook_stanza(xmlns_sm2, "enabled", function (session, stanza) return handle_enabled(session, stanza, xmlns_sm2); end, 100);
|
||||
module:hook_stanza(xmlns_sm3, "enabled", function (session, stanza) return handle_enabled(session, stanza, xmlns_sm3); end, 100);
|
||||
|
||||
function handle_r(origin, stanza, xmlns_sm)
|
||||
if not origin.smacks then
|
||||
module:log("debug", "Received ack request from non-smack-enabled session");
|
||||
return;
|
||||
end
|
||||
module:log("debug", "Received ack request, acking for %d", origin.handled_stanza_count);
|
||||
-- Reply with <a>
|
||||
(origin.sends2s or origin.send)(st.stanza("a", { xmlns = xmlns_sm, h = tostring(origin.handled_stanza_count) }));
|
||||
return true;
|
||||
end
|
||||
module:hook_stanza(xmlns_sm2, "r", function (origin, stanza) return handle_r(origin, stanza, xmlns_sm2); end);
|
||||
module:hook_stanza(xmlns_sm3, "r", function (origin, stanza) return handle_r(origin, stanza, xmlns_sm3); end);
|
||||
|
||||
function handle_a(origin, stanza)
|
||||
if not origin.smacks then return; end
|
||||
origin.awaiting_ack = nil;
|
||||
-- Remove handled stanzas from outgoing_stanza_queue
|
||||
--log("debug", "ACK: h=%s, last=%s", stanza.attr.h or "", origin.last_acknowledged_stanza or "");
|
||||
local h = tonumber(stanza.attr.h);
|
||||
if not h then
|
||||
origin:close{ condition = "invalid-xml"; text = "Missing or invalid 'h' attribute"; };
|
||||
end
|
||||
local handled_stanza_count = h-origin.last_acknowledged_stanza;
|
||||
local queue = origin.outgoing_stanza_queue;
|
||||
if handled_stanza_count > #queue then
|
||||
origin.log("warn", "The client says it handled %d new stanzas, but we only sent %d :)",
|
||||
handled_stanza_count, #queue);
|
||||
origin.log("debug", "Client h: %d, our h: %d", tonumber(stanza.attr.h), origin.last_acknowledged_stanza);
|
||||
for i=1,#queue do
|
||||
origin.log("debug", "Q item %d: %s", i, tostring(queue[i]));
|
||||
end
|
||||
end
|
||||
for i=1,math_min(handled_stanza_count,#queue) do
|
||||
t_remove(origin.outgoing_stanza_queue, 1);
|
||||
end
|
||||
origin.log("debug", "#queue = %d", #queue);
|
||||
origin.last_acknowledged_stanza = origin.last_acknowledged_stanza + handled_stanza_count;
|
||||
return true;
|
||||
end
|
||||
module:hook_stanza(xmlns_sm2, "a", handle_a);
|
||||
module:hook_stanza(xmlns_sm3, "a", handle_a);
|
||||
|
||||
--TODO: Optimise... incoming stanzas should be handled by a per-session
|
||||
-- function that has a counter as an upvalue (no table indexing for increments,
|
||||
-- and won't slow non-198 sessions). We can also then remove the .handled flag
|
||||
-- on stanzas
|
||||
|
||||
function handle_unacked_stanzas(session)
|
||||
local queue = session.outgoing_stanza_queue;
|
||||
local error_attr = { type = "cancel" };
|
||||
if #queue > 0 then
|
||||
session.outgoing_stanza_queue = {};
|
||||
for i=1,#queue do
|
||||
local reply = st.reply(queue[i]);
|
||||
if reply.attr.to ~= session.full_jid then
|
||||
reply.attr.type = "error";
|
||||
reply:tag("error", error_attr)
|
||||
:tag("recipient-unavailable", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"});
|
||||
core_process_stanza(session, reply);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module:hook("pre-resource-unbind", function (event)
|
||||
local session, err = event.session, event.error;
|
||||
if session.smacks then
|
||||
if not session.resumption_token then
|
||||
local queue = session.outgoing_stanza_queue;
|
||||
if #queue > 0 then
|
||||
session.log("warn", "Destroying session with %d unacked stanzas", #queue);
|
||||
handle_unacked_stanzas(session);
|
||||
end
|
||||
else
|
||||
session.log("debug", "mod_smacks hibernating session for up to %d seconds", resume_timeout);
|
||||
local hibernate_time = os_time(); -- Track the time we went into hibernation
|
||||
session.hibernating = hibernate_time;
|
||||
local resumption_token = session.resumption_token;
|
||||
timer.add_task(resume_timeout, function ()
|
||||
session.log("debug", "mod_smacks hibernation timeout reached...");
|
||||
-- We need to check the current resumption token for this resource
|
||||
-- matches the smacks session this timer is for in case it changed
|
||||
-- (for example, the client may have bound a new resource and
|
||||
-- started a new smacks session, or not be using smacks)
|
||||
local curr_session = full_sessions[session.full_jid];
|
||||
if session.destroyed then
|
||||
session.log("debug", "The session has already been destroyed");
|
||||
elseif curr_session and curr_session.resumption_token == resumption_token
|
||||
-- Check the hibernate time still matches what we think it is,
|
||||
-- otherwise the session resumed and re-hibernated.
|
||||
and session.hibernating == hibernate_time then
|
||||
session.log("debug", "Destroying session for hibernating too long");
|
||||
session_registry[session.resumption_token] = nil;
|
||||
session.resumption_token = nil;
|
||||
sessionmanager.destroy_session(session);
|
||||
else
|
||||
session.log("debug", "Session resumed before hibernation timeout, all is well")
|
||||
end
|
||||
end);
|
||||
return true; -- Postpone destruction for now
|
||||
end
|
||||
|
||||
end
|
||||
end);
|
||||
|
||||
local function handle_s2s_destroyed(event)
|
||||
local session = event.session;
|
||||
local queue = session.outgoing_stanza_queue;
|
||||
if queue and #queue > 0 then
|
||||
session.log("warn", "Destroying session with %d unacked stanzas", #queue);
|
||||
handle_unacked_stanzas(session);
|
||||
end
|
||||
end
|
||||
|
||||
module:hook("s2sout-destroyed", handle_s2s_destroyed);
|
||||
module:hook("s2sin-destroyed", handle_s2s_destroyed);
|
||||
|
||||
function handle_resume(session, stanza, xmlns_sm)
|
||||
if session.full_jid then
|
||||
session.log("warn", "Tried to resume after resource binding");
|
||||
session.send(st.stanza("failed", { xmlns = xmlns_sm })
|
||||
:tag("unexpected-request", { xmlns = xmlns_errors })
|
||||
);
|
||||
return true;
|
||||
end
|
||||
|
||||
local id = stanza.attr.previd;
|
||||
local original_session = session_registry[id];
|
||||
if not original_session then
|
||||
session.log("debug", "Tried to resume non-existent session with id %s", id);
|
||||
session.send(st.stanza("failed", { xmlns = xmlns_sm })
|
||||
:tag("item-not-found", { xmlns = xmlns_errors })
|
||||
);
|
||||
elseif session.username == original_session.username
|
||||
and session.host == original_session.host then
|
||||
session.log("debug", "mod_smacks resuming existing session...");
|
||||
-- TODO: All this should move to sessionmanager (e.g. session:replace(new_session))
|
||||
if original_session.conn then
|
||||
session.log("debug", "mod_smacks closing an old connection for this session");
|
||||
local conn = original_session.conn;
|
||||
c2s_sessions[conn] = nil;
|
||||
conn:close();
|
||||
end
|
||||
original_session.ip = session.ip;
|
||||
original_session.conn = session.conn;
|
||||
original_session.send = session.send;
|
||||
original_session.filter = session.filter;
|
||||
original_session.filter.session = original_session;
|
||||
original_session.filters = session.filters;
|
||||
original_session.stream = session.stream;
|
||||
original_session.secure = session.secure;
|
||||
original_session.hibernating = nil;
|
||||
wrap_session(original_session, true);
|
||||
-- Inform xmppstream of the new session (passed to its callbacks)
|
||||
original_session.stream:set_session(original_session);
|
||||
-- Similar for connlisteners
|
||||
c2s_sessions[session.conn] = original_session;
|
||||
|
||||
session.send(st.stanza("resumed", { xmlns = xmlns_sm,
|
||||
h = original_session.handled_stanza_count, previd = id }));
|
||||
|
||||
-- Fake an <a> with the h of the <resume/> from the client
|
||||
original_session:dispatch_stanza(st.stanza("a", { xmlns = xmlns_sm,
|
||||
h = stanza.attr.h }));
|
||||
|
||||
-- Ok, we need to re-send any stanzas that the client didn't see
|
||||
-- ...they are what is now left in the outgoing stanza queue
|
||||
local queue = original_session.outgoing_stanza_queue;
|
||||
session.log("debug", "#queue = %d", #queue);
|
||||
for i=1,#queue do
|
||||
session.send(queue[i]);
|
||||
end
|
||||
session.log("debug", "#queue = %d -- after send", #queue);
|
||||
else
|
||||
module:log("warn", "Client %s@%s[%s] tried to resume stream for %s@%s[%s]",
|
||||
session.username or "?", session.host or "?", session.type,
|
||||
original_session.username or "?", original_session.host or "?", original_session.type);
|
||||
session.send(st.stanza("failed", { xmlns = xmlns_sm })
|
||||
:tag("not-authorized", { xmlns = xmlns_errors }));
|
||||
end
|
||||
return true;
|
||||
end
|
||||
module:hook_stanza(xmlns_sm2, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm2); end);
|
||||
module:hook_stanza(xmlns_sm3, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm3); end);
|
||||
|
||||
local function handle_read_timeout(event)
|
||||
local session = event.session;
|
||||
if session.smacks then
|
||||
if session.awaiting_ack then
|
||||
return false; -- Kick the session
|
||||
end
|
||||
(session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }));
|
||||
session.awaiting_ack = true;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
|
||||
module:hook("s2s-read-timeout", handle_read_timeout);
|
||||
module:hook("c2s-read-timeout", handle_read_timeout);
|
1
conf/sip-communicator.properties
Normal file
1
conf/sip-communicator.properties
Normal file
|
@ -0,0 +1 @@
|
|||
org.jitsi.impl.neomedia.transform.srtp.SRTPCryptoContext.checkReplay=false
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="openjdk-8-jre maven"
|
||||
pkg_dependencies="openjdk-8-jdk openjdk-8-jre maven"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -37,8 +37,8 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="stop" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="stop" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="stop" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="stop" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
|
@ -68,16 +68,16 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-jitsi-videobridge.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-jitsi-jicofo.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-videobridge.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-jicofo.service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="start" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="start" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -27,6 +27,8 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#YOURSECRET3
|
||||
focus_password=$(ynh_string_random --length=8)
|
||||
#YOURSECRET1
|
||||
|
@ -34,7 +36,7 @@ videobridge_secret=$(ynh_string_random --length=8)
|
|||
#YOURSECRET2
|
||||
focus_secret=$(ynh_string_random --length=8)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
focus_user=${app}focus
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
|
@ -47,7 +49,7 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde
|
|||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#! ynh_user_exists --username=${app}-focus || ynh_die --message="User ${app}-focus already exist, please remove it first"
|
||||
#ynh_user_exists --username=$focus_user || ynh_die --message="User $focus_user already exist, please remove it first"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
|
@ -59,6 +61,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||
ynh_app_setting_set --app=$app --key=focus_password --value=$focus_password
|
||||
ynh_app_setting_set --app=$app --key=videobridge_secret --value=$videobridge_secret
|
||||
ynh_app_setting_set --app=$app --key=focus_secret --value=$focus_secret
|
||||
ynh_app_setting_set --app=$app --key=focus_user --value=$focus_user
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -73,6 +76,12 @@ port=$(ynh_find_port --port=4443)
|
|||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
# Find a free port
|
||||
port_videobridge=$(ynh_find_port --port=5347)
|
||||
# Open this port
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_app_setting_set --app=$app --key=port_videobridge --value=$port_videobridge
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -90,7 +99,7 @@ ynh_script_progression --message="Setting up source files..." --time --weight=1
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/jitsi-videobridge" --source_id=jitsi-videobridge
|
||||
ynh_setup_source --dest_dir="$final_path/jitsi-jicofo" --source_id=jitsi-jicofo
|
||||
ynh_setup_source --dest_dir="$final_path/jitsi-jicofo-build" --source_id=jitsi-jicofo
|
||||
ynh_setup_source --dest_dir="$final_path/jitsi-meet" --source_id=jitsi-meet
|
||||
|
||||
#=================================================
|
||||
|
@ -114,43 +123,64 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
# CONFIGURE METRONOME
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring metronome..." --time --weight=1
|
||||
|
||||
# Create additional domains
|
||||
yunohost domain add auth.$domain
|
||||
#yunohost domain add auth.$domain
|
||||
|
||||
# Create focus user
|
||||
yunohost user create ${app}-focus -f ${app}-focus -l ${app}-focus -m ${app}-focus@auth.$domain -p $focus_password -q 0
|
||||
yunohost user create $focus_user -f $focus_user -l $focus_user -m ${focus_user}@auth.$domain -p $focus_password -q 0
|
||||
|
||||
# Configure metronome
|
||||
mv /etc/metronome/conf.d/$domain.cfg.lua /etc/metronome/conf.d/$domain.cfg.lua.back
|
||||
mv /etc/metronome/conf.d/auth.$domain.cfg.lua /etc/metronome/conf.d/auth.$domain.cfg.lua.back
|
||||
mv /etc/metronome/conf.d/conference.$domain.cfg.lua /etc/metronome/conf.d/conference.$domain.cfg.lua.back
|
||||
mv /etc/metronome/conf.d/jitsi-videobridge.$domain.cfg.lua /etc/metronome/conf.d/jitsi-videobridge.$domain.cfg.lua.back
|
||||
mv /etc/metronome/conf.d/focus.$domain.cfg.lua /etc/metronome/conf.d/focus.$domain.cfg.lua.back
|
||||
|
||||
metronome="/etc/metronome/conf.d/$domain.cfg.lua"
|
||||
cp ../conf/metronome.cfg.lua "$metronome"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$metronome"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$metronome"
|
||||
ynh_replace_string --match_string="__VIDEOBRIDGE_SECRET__" --replace_string="$videobridge_secret" --target_file="$metronome"
|
||||
ynh_replace_string --match_string="__FOCUS_SECRET__" --replace_string="$focus_secret" --target_file="$metronome"
|
||||
ynh_systemd_action --service_name=metronome --action=reload
|
||||
ynh_replace_string --match_string="__PORT_VIDEOBRIDGE__" --replace_string="$port_videobridge" --target_file="$metronome"
|
||||
chown -R metronome:metronome "/etc/metronome/conf.d/"
|
||||
|
||||
cp ../conf/mod_carbons.lua /usr/lib/metronome/modules/mod_carbons.lua
|
||||
cp ../conf/mod_http_altconnect.lua /usr/lib/metronome/modules/mod_http_altconnect.lua
|
||||
#cp ../conf/mod_smacks.lua /usr/lib/metronome/modules/mod_smacks.lua
|
||||
|
||||
#metronomectl adduser focusjitsi auth.test31.yh.yalh.net OCL1sd7d
|
||||
|
||||
ynh_systemd_action --service_name=metronome --action=restart
|
||||
|
||||
#=================================================
|
||||
# BUILD JITSI-VIDEOBRIDGE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Jitsi-Videobridge..." --time --weight=1
|
||||
|
||||
pushd "$final_path/jitsi-videobridge"
|
||||
mvn compile exec:exec -Dexec.executable=java -Dexec.args="-cp %classpath org.jitsi.videobridge.Main --domain=\"$domain\" --host=\"localhost \" --port=\"5347\" --secret=\"$videobridge_secret\" -Djava.library.path=$JVB_HOME/lib/native/linux-64 -Djava.util.logging.config.file=$JVB_HOME/lib/logging.properties -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=.jitsi-videobridge "
|
||||
popd
|
||||
mkdir -p "$final_path/.sip-communicator"
|
||||
cp ../conf/sip-communicator.properties "$final_path/.sip-communicator/sip-communicator.propertie"
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# BUILD JITSI-JICOFO
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Jitsi-Jicofo..." --time --weight=1
|
||||
|
||||
pushd "$final_path/jitsi-jicofo"
|
||||
pushd "$final_path/jitsi-jicofo-build"
|
||||
mvn package -DskipTests -Dassembly.skipAssembly=false
|
||||
popd
|
||||
|
||||
unzip $final_path/jitsi-jicofo-build/target/jicofo-linux-x64-1.1-SNAPSHOT.zip -d $final_path
|
||||
|
||||
mv $final_path/jicofo-linux-x64-1.1-SNAPSHOT/ $final_path/jitsi-jicofo/
|
||||
|
||||
#=================================================
|
||||
# BUILD JITSI-MEET
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Jitsi-Meet..." --time --weight=1
|
||||
|
||||
pushd "$final_path/jitsi-meet"
|
||||
ynh_use_nodejs
|
||||
|
@ -170,12 +200,14 @@ ynh_script_progression --message="Configuring a systemd service..." --time --wei
|
|||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/jitsi-videobridge.service"
|
||||
ynh_replace_string --match_string="__VIDEOBRIDGE_SECRET__" --replace_string="$videobridge_secret" --target_file="../conf/jitsi-videobridge.service"
|
||||
ynh_add_systemd_config --service=$app-jitsi-videobridge --template=jitsi-videobridge
|
||||
ynh_replace_string --match_string="__PORT_VIDEOBRIDGE__" --replace_string="$port_videobridge" --target_file="../conf/jitsi-videobridge.service"
|
||||
ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service"
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_replace_string --match_string="__FOCUS_SECRET__" --replace_string="$focus_secret" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_replace_string --match_string="__FOCUS_USER__" --replace_string="$focus_user" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_replace_string --match_string="__FOCUS_PASSWORD__" --replace_string="$focus_password" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_add_systemd_config --service=$app-jitsi-jicofo --template=jitsi-jicofo
|
||||
ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
|
@ -191,7 +223,7 @@ ynh_store_file_checksum --file="$config"
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R root: $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
|
@ -207,8 +239,8 @@ ynh_use_logrotate
|
|||
|
||||
#yunohost service add $app --log "/var/log/$app/$app.log"
|
||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
||||
yunohost service add $app-jitsi-videobridge --description "$app jitsi-videobridge for jitsi" --log "/var/log/$app/$app-jitsi-videobridge.log"
|
||||
yunohost service add $app-jitsi-jicofo --description "$app jitsi-jicofo for jitsi" --log "/var/log/$app/$app-jitsi-jicofo.log"
|
||||
yunohost service add $app-videobridge --description "$app jitsi-videobridge for jitsi" --log "/var/log/$app/$app-videobridge.log"
|
||||
yunohost service add $app-jicofo --description "$app jitsi-jicofo for jitsi" --log "/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -216,8 +248,8 @@ yunohost service add $app-jitsi-jicofo --description "$app jitsi-jicofo for jits
|
|||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="start" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="start" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -18,7 +18,9 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
port_videobridge=$(ynh_app_setting_get --app=$app --key=port_videobridge)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
focus_user=$(ynh_app_setting_get --app=$app --key=focus_user)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -27,15 +29,16 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if ynh_exec_warn_less yunohost service status $app-jitsi-videobridge >/dev/null
|
||||
if ynh_exec_warn_less yunohost service status $app-videobridge >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app-jitsi-videobridge service..." --time --weight=1
|
||||
yunohost service remove $app-jitsi-videobridge
|
||||
ynh_script_progression --message="Removing $app-videobridge service..." --time --weight=1
|
||||
yunohost service remove $app-videobridge
|
||||
fi
|
||||
if ynh_exec_warn_less yunohost service status $app-jitsi-jicofo >/dev/null
|
||||
|
||||
if ynh_exec_warn_less yunohost service status $app-jicofo >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app-jitsi-jicofo service..." --time --weight=1
|
||||
yunohost service remove $app-jitsi-jicofo
|
||||
ynh_script_progression --message="Removing $app-jicofo service..." --time --weight=1
|
||||
yunohost service remove $app-jicofo
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -44,8 +47,8 @@ fi
|
|||
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config --service=$app-jitsi-videobridge
|
||||
ynh_remove_systemd_config --service=$app-jitsi-jicofo
|
||||
ynh_remove_systemd_config --service=$app-videobridge
|
||||
ynh_remove_systemd_config --service=$app-jicofo
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
|
@ -91,6 +94,12 @@ then
|
|||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port_videobridge$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port_videobridge..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port_videobridge
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
@ -98,16 +107,24 @@ fi
|
|||
#=================================================
|
||||
|
||||
# Reconfigure metronome
|
||||
ynh_secure_remove --file="/etc/metronome/conf.d/$domain.cfg.lua.back"
|
||||
ynh_secure_remove --file="/etc/metronome/conf.d/$domain.cfg.lua"
|
||||
mv /etc/metronome/conf.d/$domain.cfg.lua.back /etc/metronome/conf.d/$domain.cfg.lua
|
||||
mv /etc/metronome/conf.d/auth.$domain.cfg.lua.back /etc/metronome/conf.d/auth.$domain.cfg.lua
|
||||
ynh_systemd_action --service_name=metronome --action=reload
|
||||
mv /etc/metronome/conf.d/conference.$domain.cfg.lua.back /etc/metronome/conf.d/conference.$domain.cfg.lua
|
||||
mv /etc/metronome/conf.d/jitsi-videobridge.$domain.cfg.lua.back /etc/metronome/conf.d/jitsi-videobridge.$domain.cfg.lua
|
||||
mv /etc/metronome/conf.d/focus.$domain.cfg.lua.back /etc/metronome/conf.d/focus.$domain.cfg.lua
|
||||
|
||||
ynh_secure_remove --file="/usr/lib/metronome/modules/mod_carbons.lua"
|
||||
ynh_secure_remove --file="/usr/lib/metronome/modules/mod_http_altconnect.lua"
|
||||
#ynh_secure_remove --file="/usr/lib/metronome/modules/mod_smacks.lua"
|
||||
|
||||
ynh_systemd_action --service_name=metronome --action=restart
|
||||
|
||||
# Delete focus user
|
||||
yunohost user delete ${app}-focus --purge
|
||||
yunohost user delete $focus_user --purge
|
||||
|
||||
# Removing additional domains
|
||||
yunohost domain remove auth.$domain
|
||||
#yunohost domain remove auth.$domain
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
|
|
|
@ -88,25 +88,25 @@ ynh_install_nodejs --nodejs_version=10
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-jitsi-videobridge.service"
|
||||
systemctl enable $app-jitsi-videobridge.service
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-jitsi-jicofo.service"
|
||||
systemctl enable $app-jitsi-jicofo.service
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-videobridge.service"
|
||||
systemctl enable $app-videobridge.service
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service"
|
||||
systemctl enable $app-jicofo.service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app-jitsi-videobridge --log "/var/log/$app/$app-jitsi-videobridge.log"
|
||||
yunohost service add $app-jitsi-jicofo --log "/var/log/$app/$app-jitsi-jicofo.log"
|
||||
yunohost service add $app-videobridge --log "/var/log/$app/$app-videobridge.log"
|
||||
yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="start" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="start" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
|
|
|
@ -23,6 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
focus_password=$(ynh_app_setting_get --app=$app --key=$focus_password)
|
||||
videobridge_secret=$(ynh_app_setting_get --app=$app --key=videobridge_secret)
|
||||
focus_secret=$(ynh_app_setting_get --app=$app --key=focus_secret)
|
||||
port_videobridge=$(ynh_app_setting_get --app=$app --key=port_videobridge)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -62,8 +63,8 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="stop" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="stop" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="stop" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="stop" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -111,7 +112,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
|
||||
pushd "$final_path/jitsi-videobridge"
|
||||
mvn compile exec:exec -Dexec.executable=java -Dexec.args="-cp %classpath org.jitsi.videobridge.Main --domain=\"$domain\" --host=\"localhost \" --port=\"5347\" --secret=\"$videobridge_secret\" -Djava.library.path=$JVB_HOME/lib/native/linux-64 -Djava.util.logging.config.file=$JVB_HOME/lib/logging.properties -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=.jitsi-videobridge "
|
||||
mvn compile exec:exec -Dexec.executable=java -Dexec.args="-cp %classpath org.jitsi.videobridge.Main --domain=\"$domain\" --host=\"localhost \" --port=\"$port_videobridge\" --secret=\"$videobridge_secret\" -Djava.library.path=$JVB_HOME/lib/native/linux-64 -Djava.util.logging.config.file=$JVB_HOME/lib/logging.properties -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=.jitsi-videobridge "
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -160,12 +161,12 @@ ynh_script_progression --message="Upgrading systemd configuration..." --time --w
|
|||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/jitsi-videobridge.service"
|
||||
ynh_replace_string --match_string="__VIDEOBRIDGE_SECRET__" --replace_string="$videobridge_secret" --target_file="../conf/jitsi-videobridge.service"
|
||||
ynh_add_systemd_config --service=$app-jitsi-videobridge --template=jitsi-videobridge
|
||||
ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service"
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_replace_string --match_string="__FOCUS_SECRET__" --replace_string="$focus_secret" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_replace_string --match_string="__FOCUS_PASSWORD__" --replace_string="$focus_password" --target_file="../conf/jitsi-jicofo.service"
|
||||
ynh_add_systemd_config --service=$app-jitsi-jicofo --template=jitsi-jicofo
|
||||
ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -189,8 +190,8 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app-jitsi-videobridge --action="start" --log_path="/var/log/$app/$app-jitsi-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jitsi-jicofo --action="start" --log_path="/var/log/$app/$app-jitsi-jicofo.log"
|
||||
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
||||
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue