diff --git a/actions/diaspora b/actions/diaspora deleted file mode 100755 index ef6ffa52d..000000000 --- a/actions/diaspora +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/python3 -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Configuration helper for diaspora* pod. -""" - -import argparse -import subprocess - -import augeas - -from plinth import action_utils -from plinth.modules import diaspora - -DIASPORA_YAML = "/etc/diaspora/diaspora.yml" - - -def parse_arguments(): - """Return parsed command line arguments as dictionary.""" - parser = argparse.ArgumentParser() - subparsers = parser.add_subparsers(dest='subcommand', help='Sub command') - subparsers.add_parser( - 'pre-install', - help='Preseed debconf values before packages are installed.') - subparsers.add_parser( - 'enable-user-registrations', - help='Allow users to sign up to this diaspora* pod without an ' - 'invitation.') - subparsers.add_parser( - 'disable-user-registrations', - help='Allow only users with an invitation to register to this ' - 'diaspora* pod') - subparsers.add_parser('start-diaspora', help='Start diaspora* service') - subparsers.add_parser( - 'disable-ssl', help="Disable SSL on the diaspora* application server") - setup = subparsers.add_parser('setup', - help='Set Domain name for diaspora*') - setup.add_argument('--domain-name', - help='The domain name that will be used by diaspora*') - - return parser.parse_args() - - -def subcommand_setup(arguments): - """Set the domain_name in diaspora configuration files""" - domain_name = arguments.domain_name - with open('/etc/diaspora/domain_name', 'w') as dnf: - dnf.write(domain_name) - set_domain_name(domain_name) - uncomment_user_registrations() - - -def set_domain_name(domain_name): - """Write a new domain name to diaspora configuration files""" - # This did not set the domain_name - # action_utils.dpkg_reconfigure('diaspora-common', - # {'url': domain_name}) - # Manually changing the domain name in the conf files. - conf_file = '/etc/diaspora.conf' - aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + - augeas.Augeas.NO_MODL_AUTOLOAD) - - # lens for shell-script config file - aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns') - aug.set('/augeas/load/Shellvars/incl[last() + 1]', conf_file) - aug.load() - - aug.set('/files/etc/diaspora.conf/SERVERNAME', '"{}"'.format(domain_name)) - aug.set('/files/etc/diaspora.conf/ENVIRONMENT_URL', - 'http://{}:3000'.format(domain_name)) - aug.save() - - diaspora.generate_apache_configuration( - '/etc/apache2/conf-available/diaspora-plinth.conf', domain_name) - - action_utils.service_enable('diaspora') - action_utils.service_start('diaspora') - - -def subcommand_disable_ssl(_): - """ - Disable ssl in the diaspora configuration - as the apache server takes care of ssl - """ - # Using sed because ruamel.yaml has a bug for this kind of files - subprocess.call([ - "sed", "-i", "s/#require_ssl: true/require_ssl: false/g", DIASPORA_YAML - ]) - - -def uncomment_user_registrations(): - """Uncomment the enable_registrations line which is commented by default""" - subprocess.call([ - "sed", "-i", "s/#enable_registrations/enable_registrations/g", - DIASPORA_YAML - ]) - - -def subcommand_enable_user_registrations(_): - """Enable new user registrations on the diaspora* pod """ - subprocess.call([ - "sed", "-i", - "s/enable_registrations: false/enable_registrations: true/g", - DIASPORA_YAML - ]) - - -def subcommand_disable_user_registrations(_): - """Disable new user registrations on the diaspora* pod """ - subprocess.call([ - "sed", "-i", - "s/enable_registrations: true/enable_registrations: false/g", - DIASPORA_YAML - ]) - - -def subcommand_pre_install(_): - """Pre installation configuration for diaspora""" - presets = [ - 'diaspora-common diaspora-common/url string dummy_domain_name', - 'diaspora-common diaspora-common/dbpass note ', - 'diaspora-common diaspora-common/enablessl boolean false', - 'diaspora-common diaspora-common/useletsencrypt string false', - 'diaspora-common diaspora-common/services multiselect ', - 'diaspora-common diaspora-common/ssl boolean false', - 'diaspora-common diaspora-common/pgsql/authmethod-admin string ident', - 'diaspora-common diaspora-common/letsencrypt boolean false', - 'diaspora-common diaspora-common/remote/host string localhost', - 'diaspora-common diaspora-common/database-type string pgsql', - 'diaspora-common diaspora-common/dbconfig-install boolean true' - ] - - action_utils.debconf_set_selections(presets) - - -def main(): - """Parse arguments and perform all duties.""" - arguments = parse_arguments() - - subcommand = arguments.subcommand.replace('-', '_') - subcommand_method = globals()['subcommand_' + subcommand] - subcommand_method(arguments) - - -if __name__ == '__main__': - main() diff --git a/debian/copyright b/debian/copyright index 1c2aa540e..bf5b4de20 100644 --- a/debian/copyright +++ b/debian/copyright @@ -60,9 +60,7 @@ Copyright: 2007 Andrew Wedderburn Comment: https://commons.wikimedia.org/wiki/File:Deluge-Logo.svg License: GPL-2+ -Files: static/themes/default/icons/diaspora.png - static/themes/default/icons/diaspora.svg - static/themes/default/icons/ejabberd.png +Files: static/themes/default/icons/ejabberd.png static/themes/default/icons/ejabberd.svg static/themes/default/icons/matrixsynapse.svg static/themes/default/icons/privoxy.png diff --git a/debian/freedombox.maintscript b/debian/freedombox.maintscript index 943a06034..290d29cca 100644 --- a/debian/freedombox.maintscript +++ b/debian/freedombox.maintscript @@ -13,4 +13,5 @@ rm_conffile /etc/apt/preferences.d/50freedombox3.pref 20.5~ rm_conffile /etc/plinth/plinth.config 20.12~ rm_conffile /etc/plinth/custom-shortcuts.json 20.12~ rm_conffile /etc/plinth/modules-enabled/coquelicot 20.14~ +rm_conffile /etc/plinth/modules-enabled/diaspora 21.16~ rm_conffile /etc/plinth/modules-enabled/monkeysphere 21.16~ diff --git a/plinth/modules/diaspora/__init__.py b/plinth/modules/diaspora/__init__.py deleted file mode 100644 index 1dbf13aaa..000000000 --- a/plinth/modules/diaspora/__init__.py +++ /dev/null @@ -1,194 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -import os - -import augeas -from django.utils.translation import gettext_lazy as _ - -from plinth import actions -from plinth import app as app_module -from plinth import frontpage, menu -from plinth.daemon import Daemon -from plinth.errors import DomainNotRegisteredError -from plinth.modules.apache.components import Webserver, diagnose_url -from plinth.modules.firewall.components import Firewall -from plinth.package import Packages -from plinth.utils import format_lazy - -domain_name_file = "/etc/diaspora/domain_name" -lazy_domain_name = None # To avoid repeatedly reading from file - - -def is_setup(): - return os.path.exists(domain_name_file) - - -def get_configured_domain_name(): - global lazy_domain_name - if lazy_domain_name: - return lazy_domain_name - - if not is_setup(): - raise DomainNotRegisteredError() - - with open(domain_name_file) as dnf: - lazy_domain_name = dnf.read().rstrip() - return lazy_domain_name - - -_description = [ - _('diaspora* is a decentralized social network where you can store ' - 'and control your own data.'), - format_lazy( - 'When enabled, the diaspora* pod will be available from ' - 'diaspora.{host} path on the ' - 'web server.'.format(host=get_configured_domain_name()) if is_setup() - else 'Please register a domain name for your FreedomBox to be able to' - ' federate with other diaspora* pods.') -] - -app = None - - -class DiasporaApp(app_module.App): - """FreedomBox app for Diaspora.""" - - app_id = 'diaspora' - - _version = 1 - - def __init__(self): - """Create components for the app.""" - super().__init__() - from . import manifest - - info = app_module.Info(app_id=self.app_id, version=self._version, - name=_('diaspora*'), icon_filename='diaspora', - short_description=_('Federated Social Network'), - description=_description, - clients=manifest.clients) - self.add(info) - - menu_item = menu.Menu('menu-diaspora', info.name, - info.short_description, info.icon_filename, - 'diaspora:index', parent_url_name='apps') - self.add(menu_item) - - shortcut = Shortcut('shortcut-diaspora', info.name, - short_description=info.short_description, - icon=info.icon_filename, url=None, - clients=info.clients, login_required=True) - self.add(shortcut) - - packages = Packages('packages-diaspora', ['diaspora']) - self.add(packages) - - firewall = Firewall('firewall-diaspora', info.name, - ports=['http', 'https'], is_external=True) - self.add(firewall) - - webserver = Webserver('webserver-diaspora', 'diaspora-plinth') - self.add(webserver) - - daemon = Daemon('daemon-diaspora', 'diaspora') - self.add(daemon) - - def diagnose(self): - """Run diagnostics and return the results.""" - results = super().diagnose() - - results.append( - diagnose_url('http://diaspora.localhost', kind='4', - check_certificate=False)) - results.append( - diagnose_url('http://diaspora.localhost', kind='6', - check_certificate=False)) - results.append( - diagnose_url( - 'http://diaspora.{}'.format(get_configured_domain_name()), - kind='4', check_certificate=False)) - - return results - - -class Shortcut(frontpage.Shortcut): - """Frontpage shortcut to use configured domain name for URL.""" - - def enable(self): - """Set the proper shortcut URL when enabled.""" - super().enable() - self.url = 'https://diaspora.{}'.format(get_configured_domain_name()) - - -def setup(helper, old_version=None): - """Install and configure the module.""" - helper.call('pre', actions.superuser_run, 'diaspora', ['pre-install']) - app.setup(old_version) - helper.call('custom_config', actions.superuser_run, 'diaspora', - ['disable-ssl']) - - -def setup_domain_name(domain_name): - actions.superuser_run('diaspora', ['setup', '--domain-name', domain_name]) - app.enable() - - -def is_user_registrations_enabled(): - """Return whether user registrations are enabled""" - with open('/etc/diaspora/diaspora.yml') as f: - for line in f.readlines(): - if "enable_registrations" in line: - return line.split(":")[1].strip() == "true" - - -def enable_user_registrations(): - """Allow users to register without invitation""" - actions.superuser_run('diaspora', ['enable-user-registrations']) - - -def disable_user_registrations(): - """Disallow users from registering without invitation""" - actions.superuser_run('diaspora', ['disable-user-registrations']) - - -def generate_apache_configuration(conf_file, domain_name): - """Generate Diaspora's apache configuration with the given domain name""" - open(conf_file, 'w').close() - - diaspora_domain_name = ".".join(["diaspora", domain_name]) - - aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + - augeas.Augeas.NO_MODL_AUTOLOAD) - - aug.set('/augeas/load/Httpd/lens', 'Httpd.lns') - aug.set('/augeas/load/Httpd/incl[last() + 1]', conf_file) - aug.load() - - aug.defvar('conf', '/files' + conf_file) - - aug.set('$conf/VirtualHost', None) - aug.defvar('vh', '$conf/VirtualHost') - aug.set('$vh/arg', diaspora_domain_name) - aug.set('$vh/directive[1]', 'ServerName') - aug.set('$vh/directive[1]/arg', diaspora_domain_name) - aug.set('$vh/directive[2]', 'DocumentRoot') - aug.set('$vh/directive[2]/arg', '"/var/lib/diaspora/public/"') - - aug.set('$vh/Location', None) - aug.set('$vh/Location/arg', '"/"') - aug.set('$vh/Location/directive[1]', 'ProxyPass') - aug.set('$vh/Location/directive[1]/arg', - '"unix:/var/run/diaspora/diaspora.sock|http://localhost/"') - - aug.set('$vh/Location[last() + 1]', None) - aug.set('$vh/Location[last()]/arg', '"/assets"') - aug.set('$vh/Location[last()]/directive[1]', 'ProxyPass') - aug.set('$vh/Location[last()]/directive[1]/arg', '!') - - aug.set('$vh/Directory', None) - aug.set('$vh/Directory/arg', '/var/lib/diaspora/public/') - aug.set('$vh/Directory/directive[1]', 'Require') - aug.set('$vh/Directory/directive[1]/arg[1]', 'all') - aug.set('$vh/Directory/directive[1]/arg[2]', 'granted') - - aug.save() diff --git a/plinth/modules/diaspora/forms.py b/plinth/modules/diaspora/forms.py deleted file mode 100644 index 89eb3bc7f..000000000 --- a/plinth/modules/diaspora/forms.py +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Forms for configuring diaspora* -""" - -from django import forms -from django.utils.translation import gettext_lazy as _ - - -class DiasporaAppForm(forms.Form): - """Service Form with additional fields for diaspora*""" - is_user_registrations_enabled = forms.BooleanField( - label=_('Enable new user registrations'), required=False) diff --git a/plinth/modules/diaspora/manifest.py b/plinth/modules/diaspora/manifest.py deleted file mode 100644 index 78b988d0a..000000000 --- a/plinth/modules/diaspora/manifest.py +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -from django.utils.translation import gettext_lazy as _ - -from plinth.clients import store_url -from plinth.modules import diaspora -from plinth.utils import format_lazy - -clients = [{ - 'name': - _('dandelion*'), - 'description': - _('It is an unofficial webview based client for the ' - 'community-run, distributed social network diaspora*'), - 'platforms': [{ - 'type': 'store', - 'os': 'android', - 'store_name': 'f-droid', - 'url': store_url('f-droid', 'com.github.dfa.diaspora_android'), - }] -}, { - 'name': - _('diaspora*'), - 'platforms': [{ - 'type': - 'web', - 'url': - format_lazy( - 'https://diaspora.{host}', - host=diaspora.get_configured_domain_name() - if diaspora.is_setup() else "") - }] -}] diff --git a/plinth/modules/diaspora/templates/diaspora-post-setup.html b/plinth/modules/diaspora/templates/diaspora-post-setup.html deleted file mode 100644 index b58f9748d..000000000 --- a/plinth/modules/diaspora/templates/diaspora-post-setup.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "app.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load i18n %} - -{% block description %} - -{% for paragraph in description %} -

{{ paragraph|safe }}

-{% endfor %} - -

- {% url 'config:index' as index_url %} - {% blocktrans trimmed with domain_name=domain_name %} - The diaspora* pod domain is set to {{ domain_name }}. User - IDs will look like username@diaspora.{{ domain_name }}
- If the FreedomBox domain name is changed, all data of the users - registered with the previous podname wouldn't be accessible.
- You can access the diaspora* pod at diaspora.{{domain_name}} - {% endblocktrans %} -

-{% endblock %} diff --git a/plinth/modules/diaspora/templates/diaspora-pre-setup.html b/plinth/modules/diaspora/templates/diaspora-pre-setup.html deleted file mode 100644 index cf0892860..000000000 --- a/plinth/modules/diaspora/templates/diaspora-pre-setup.html +++ /dev/null @@ -1,47 +0,0 @@ -{% extends "base.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} - -{% block content %} - {% block pagetitle %} -

{{ title }}

- {% endblock %} - - {% block description %} - {% for paragraph in description %} -

{{ paragraph|safe }}

- {% endfor %} - {% endblock %} - -

- {% url 'config:index' as index_url %} - {% if domain_names|length == 0 %} - No domain(s) are set. You can setup your domain on the system at - Configure page. - {% endif %} -

- - {% block status %} - {% endblock %} - - {% block diagnostics %} - {% endblock %} - - {% block configuration %} - {% if domain_names|length > 0 %} -

{% trans "Configuration" %}

-
- {% csrf_token %} - - {{ form|bootstrap }} - - -
- {% endif %} - {% endblock %} -{% endblock %} diff --git a/plinth/modules/diaspora/tests/__init__.py b/plinth/modules/diaspora/tests/__init__.py deleted file mode 100644 index 1652e34b1..000000000 --- a/plinth/modules/diaspora/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/plinth/modules/diaspora/tests/test_apache_config.py b/plinth/modules/diaspora/tests/test_apache_config.py deleted file mode 100644 index ce9ee2d5f..000000000 --- a/plinth/modules/diaspora/tests/test_apache_config.py +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Test Apache configuration generation for diaspora* -""" - -import os -import tempfile - -from plinth.modules import diaspora - - -def test_generate_apache_configuration(): - """Test that Apache configuration is created properly.""" - with tempfile.NamedTemporaryFile() as conf_file: - diaspora.generate_apache_configuration(conf_file.name, - 'freedombox.rocks') - - assert os.stat(conf_file.name).st_size != 0 - - with open(conf_file.name) as file_handle: - contents = file_handle.read() - - assert all( - word in contents - for word in ['VirtualHost', 'Location', 'Directory', 'assets']) diff --git a/plinth/modules/diaspora/urls.py b/plinth/modules/diaspora/urls.py deleted file mode 100644 index cf5dd66a6..000000000 --- a/plinth/modules/diaspora/urls.py +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -URLs for the diaspora module -""" - -from django.urls import re_path - -from .views import DiasporaAppView, DiasporaSetupView - -urlpatterns = [ - re_path(r'^apps/diaspora/setup$', DiasporaSetupView.as_view(), - name='setup'), - re_path(r'^apps/diaspora/$', DiasporaAppView.as_view(), name='index') -] diff --git a/plinth/modules/diaspora/views.py b/plinth/modules/diaspora/views.py deleted file mode 100644 index 1c449721e..000000000 --- a/plinth/modules/diaspora/views.py +++ /dev/null @@ -1,80 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Views for the diaspora module -""" - -from django.contrib import messages -from django.shortcuts import redirect -from django.urls import reverse_lazy -from django.utils.translation import gettext as _ -from django.views.generic import FormView - -from plinth.forms import DomainSelectionForm -from plinth.modules import diaspora, names -from plinth.views import AppView - -from .forms import DiasporaAppForm - - -class DiasporaSetupView(FormView): - """Show diaspora setup page.""" - template_name = 'diaspora-pre-setup.html' - form_class = DomainSelectionForm - description = diaspora.app.info.description - title = diaspora.app.info.name - success_url = reverse_lazy('diaspora:index') - - def form_valid(self, form): - domain_name = form.cleaned_data['domain_name'] - diaspora.setup_domain_name(domain_name) - - return super().form_valid(form) - - def get_context_data(self, *args, **kwargs): - context = super().get_context_data(**kwargs) - context['description'] = self.description - context['title'] = self.title - context['domain_names'] = names.components.DomainName.list_names( - 'https') - - return context - - -class DiasporaAppView(AppView): - """Show diaspora service page.""" - form_class = DiasporaAppForm - app_id = 'diaspora' - template_name = 'diaspora-post-setup.html' - - def dispatch(self, request, *args, **kwargs): - if not diaspora.is_setup(): - return redirect('diaspora:setup') - return super().dispatch(request, *args, **kwargs) - - def get_context_data(self, *args, **kwargs): - context = super().get_context_data(**kwargs) - context['domain_name'] = diaspora.get_configured_domain_name() - return context - - def get_initial(self): - """Return the status of the service to fill in the form.""" - status = super().get_initial() - status['is_user_registrations_enabled'] = \ - diaspora.is_user_registrations_enabled() - return status - - def form_valid(self, form): - """Enable/disable user registrations""" - old_registration = form.initial['is_user_registrations_enabled'] - new_registration = form.cleaned_data['is_user_registrations_enabled'] - - if old_registration != new_registration: - if new_registration: - diaspora.enable_user_registrations() - messages.success(self.request, _('User registrations enabled')) - else: - diaspora.disable_user_registrations() - messages.success(self.request, - _('User registrations disabled')) - - return super().form_valid(form) diff --git a/static/themes/default/icons/diaspora.png b/static/themes/default/icons/diaspora.png deleted file mode 100644 index ab98a53ad..000000000 Binary files a/static/themes/default/icons/diaspora.png and /dev/null differ diff --git a/static/themes/default/icons/diaspora.svg b/static/themes/default/icons/diaspora.svg deleted file mode 100644 index 758c10732..000000000 --- a/static/themes/default/icons/diaspora.svg +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - -