diff --git a/plinth/modules/pagekite/forms.py b/plinth/modules/pagekite/forms.py
index 5c1710417..e9286c508 100644
--- a/plinth/modules/pagekite/forms.py
+++ b/plinth/modules/pagekite/forms.py
@@ -112,6 +112,24 @@ class ConfigurationForm(forms.Form):
if old['enabled'] != new['enabled']:
if new['enabled']:
utils.run(['start-and-enable'])
+ # Ensure all standard/predefined services are enabled
+ for service_name in utils.PREDEFINED_SERVICES.keys():
+ service = \
+ utils.PREDEFINED_SERVICES[service_name]['params']
+ service = json.dumps(service)
+
+ # Probably should keep track of which services
+ # are enabled since adding the service produces
+ # an error if it is already added. But this works
+ # too.
+
+ try:
+ utils.run(['add-service', '--service', service])
+ except ActionError as exception:
+ if "already exists" in str(exception):
+ pass
+ else:
+ raise
messages.success(request, _('PageKite enabled'))
else:
utils.run(['stop-and-disable'])
@@ -127,43 +145,6 @@ class ConfigurationForm(forms.Form):
kite_name=new['kite_name'])
-class StandardServiceForm(forms.Form):
- """Creates a form out of PREDEFINED_SERVICES"""
-
- def __init__(self, *args, **kwargs):
- """Add the fields from PREDEFINED_SERVICES"""
- super(StandardServiceForm, self).__init__(*args, **kwargs)
- kite = utils.get_kite_details()
- for name, service in utils.PREDEFINED_SERVICES.items():
- if name in ('http', 'https'):
- help_text = service['help_text'].format(kite['kite_name'])
- else:
- help_text = service['help_text']
- self.fields[name] = forms.BooleanField(
- label=service['label'], help_text=help_text, required=False)
-
- def save(self, request):
- formdata = self.cleaned_data
- for service_name in utils.PREDEFINED_SERVICES.keys():
- if self.initial[service_name] != formdata[service_name]:
- service = utils.PREDEFINED_SERVICES[service_name]['params']
- service = json.dumps(service)
- if formdata[service_name]:
- utils.run(['add-service', '--service', service])
- messages.success(
- request,
- _('Service enabled: {name}').format(name=service_name))
- else:
- utils.run(['remove-service', '--service', service])
- messages.success(
- request,
- _('Service disabled: {name}').format(
- name=service_name))
-
- # Update kite services registered with Name Services module.
- utils.update_names_module()
-
-
class BaseCustomServiceForm(forms.Form):
"""Basic form functionality to handle a custom service"""
choices = [('http', 'http'), ('https', 'https'), ('raw', 'raw')]
diff --git a/plinth/modules/pagekite/static/pagekite.js b/plinth/modules/pagekite/static/pagekite.js
deleted file mode 100644
index 5cba2f6b7..000000000
--- a/plinth/modules/pagekite/static/pagekite.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * @licstart The following is the entire license notice for the JavaScript
- * code in this page.
- *
- * This file is part of FreedomBox.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see