mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
xmpp: Replace jwchat with jsxc
- Update action to not configure jwchat anymore. - Update action to not disable jwchat apache configuration. Since the package is no longer installed, this could cause failures. - Update action to no refer to jwchat in comments. - Update jwchat-plinth Apache configuration to not include jwchat anymore. Keep this file name for now instead of renaming it to jsxc-plinth as this would introduce additional complexity with little benefit. - Install package libjs-jsxc instead of jwchat during xmpp setup. - Create jsxc front page shortcut instead of for jwchat. - Perform diagnostics on /http-bind/ URL needed for jwchat instead of /jwchat. - Update links that launch XMPP web client.
This commit is contained in:
1 parent
e57aa2ae85
commit
305cc3218d
4 files changed
+19
-48
No files matched your search
+7
-27
@@ -26,13 +26,11 @@ import os
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import re
|
||||
import ruamel.yaml
|
||||
|
||||
from plinth import action_utils
|
||||
|
||||
|
||||
JWCHAT_CONFIG = '/etc/jwchat/config.js'
|
||||
EJABBERD_CONFIG = '/etc/ejabberd/ejabberd.yml'
|
||||
EJABBERD_BACKUP = '/var/log/ejabberd/ejabberd.dump'
|
||||
EJABBERD_BACKUP_NEW = '/var/log/ejabberd/ejabberd_new.dump'
|
||||
@@ -51,8 +49,8 @@ def parse_arguments():
|
||||
'--domainname',
|
||||
help='The domain name that will be used by the XMPP service.')
|
||||
|
||||
# Setup jwchat apache conf
|
||||
subparsers.add_parser('setup', help='Setup jwchat apache conf')
|
||||
# Setup ejabberd configuration
|
||||
subparsers.add_parser('setup', help='Setup ejabberd configuration')
|
||||
|
||||
subparsers.add_parser('enable', help='Enable XMPP service')
|
||||
subparsers.add_parser('disable', help='Disable XMPP service')
|
||||
@@ -74,10 +72,10 @@ def parse_arguments():
|
||||
hostname_change.add_argument('--new-hostname',
|
||||
help='New hostname')
|
||||
|
||||
# Update ejabberd and jwchat with new domainname
|
||||
# Update ejabberd with new domainname
|
||||
domainname_change = subparsers.add_parser(
|
||||
'change-domainname',
|
||||
help='Update ejabberd and jwchat with new domainname')
|
||||
help='Update ejabberd with new domainname')
|
||||
domainname_change.add_argument('--domainname', help='New domainname')
|
||||
|
||||
return parser.parse_args()
|
||||
@@ -93,13 +91,10 @@ def subcommand_pre_install(arguments):
|
||||
subprocess.check_output(
|
||||
['debconf-set-selections'],
|
||||
input=b'ejabberd ejabberd/hostname string ' + domainname.encode())
|
||||
subprocess.check_output(
|
||||
['debconf-set-selections'],
|
||||
input=b'jwchat jwchat/ApacheServerName string ' + domainname.encode())
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
"""Enabled LDAP authentication and setup jwchat apache conf"""
|
||||
"""Enabled LDAP authentication"""
|
||||
with open(EJABBERD_CONFIG, 'r') as file_handle:
|
||||
conf = ruamel.yaml.round_trip_load(file_handle, preserve_quotes=True)
|
||||
|
||||
@@ -121,7 +116,6 @@ def subcommand_setup(_):
|
||||
print('Failed to restart ejabberd with new configuration: %s', err)
|
||||
|
||||
with action_utils.WebserverChange() as webserver_change:
|
||||
webserver_change.disable('jwchat', kind='site')
|
||||
webserver_change.enable('jwchat-plinth')
|
||||
|
||||
|
||||
@@ -158,7 +152,7 @@ def subcommand_pre_change_hostname(arguments):
|
||||
|
||||
|
||||
def subcommand_change_hostname(arguments):
|
||||
"""Update ejabberd and jwchat with new hostname"""
|
||||
"""Update ejabberd with new hostname"""
|
||||
if not shutil.which('ejabberdctl'):
|
||||
print('ejabberdctl not found. Is ejabberd installed?')
|
||||
return
|
||||
@@ -188,7 +182,7 @@ def subcommand_change_hostname(arguments):
|
||||
|
||||
|
||||
def subcommand_change_domainname(arguments):
|
||||
"""Update ejabberd and jwchat with new domainname"""
|
||||
"""Update ejabberd with new domainname"""
|
||||
if not shutil.which('ejabberdctl'):
|
||||
print('ejabberdctl not found. Is ejabberd installed?')
|
||||
return
|
||||
@@ -198,20 +192,6 @@ def subcommand_change_domainname(arguments):
|
||||
# If new domainname is blank, use hostname instead.
|
||||
domainname = socket.gethostname()
|
||||
|
||||
# update jwchat's sitename, if it's installed
|
||||
if os.path.exists(JWCHAT_CONFIG):
|
||||
with open(JWCHAT_CONFIG, 'r') as conffile:
|
||||
lines = conffile.readlines()
|
||||
with open(JWCHAT_CONFIG, 'w') as conffile:
|
||||
for line in lines:
|
||||
if re.match(r'\s*var\s+SITENAME', line):
|
||||
conffile.write('var SITENAME = "' + domainname + '";\n')
|
||||
else:
|
||||
conffile.write(line)
|
||||
else:
|
||||
print('Skipping configuring jwchat sitename: %s not found',
|
||||
JWCHAT_CONFIG)
|
||||
|
||||
action_utils.service_stop('ejabberd')
|
||||
subprocess.call(['pkill', '-u', 'ejabberd'])
|
||||
|
||||
|
||||
Reference in new issue
Block a user