wiki:how-to/servers/support/gnusocial

Version 4 (modified by Mats Sjöberg, 5 years ago) (diff)

--

Setting up Meteor real-time updates

In order to have real-time updates in the web interface of GNU Social one needs to enable the Meteor plugin (part of GNU Social) and set up a Meteor server. The Meteor server can be downloaded from http://meteorserver.org/#download - I used the latest stable source package. Unpack the source code in some suitable directory, then copy the sample config to its place:

cp meteord.conf.dist /etc/meteord.conf

At the beginning of this file you need to add these configuration options:

ControllerIP 127.0.0.1
ControllerPort 4671
SubscriberIP 127.0.0.1
SubscriberPort 8085
SubscriberDocumentRoot /path/to/your/meteor/public_html/

Set the SubscriberDocumentRoot to where you unpacked the meteor source and append /public_html/. If you are serving over https (which you should) you need to edit public_html/meteor.js and change the scheme: setting from http to https.

Adding MF/PL statement check box

In order to add a check box to have users agree to the MF/PL Statement of Unity I edited two files: actions/register.php and plugins/OpenID/actions/finishopenidlogin.php. The exact changes are shown below from the output of git diff.

diff --git a/actions/register.php b/actions/register.php
index 82fb9fc..8ae5c00 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -200,6 +200,10 @@ class RegisterAction extends Action
                 // TRANS: Form validation error displayed when trying to register without agreeing to the site license.
                 $this->showForm(_('You cannot register if you do not '.
                                   'agree to the license.'));
+            } else if (!$this->boolean('mfpl_statement')) {
+                // TRANS: Form validation error displayed when trying to register without agreeing to the statement.
+                $this->showForm(_('You cannot register if you do not '.
+                                  'agree to the MF/PL Statement of Unity.'));
             } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
                 // TRANS: Form validation error displayed when trying to register without a valid e-mail address.
                 $this->showForm(_('Not a valid email address.'));
@@ -499,6 +503,21 @@ class RegisterAction extends Action
             $this->raw($this->licenseCheckbox());
             $this->elementEnd('label');
             $this->elementEnd('li');
+            // MFPL statement
+            $attrs = array('type' => 'checkbox',
+                           'id' => 'mfpl_statement',
+                           'class' => 'checkbox',
+                           'name' => 'mfpl_statement',
+                           'value' => 'true');
+            if ($this->boolean('mfpl_statement')) {
+                $attrs['checked'] = 'checked';
+            }
+            $this->elementStart('li');
+            $this->element('input', $attrs);
+            $this->elementStart('label', array('class' => 'checkbox', 'for' => 'mfpl_statement'));
+            $this->raw($this->statementCheckbox());
+            $this->elementEnd('label');
+            $this->elementEnd('li');
         }
         $this->elementEnd('ul');
         // TRANS: Button text to register a user on account registration page.
@@ -541,7 +560,7 @@ class RegisterAction extends Action
             $message = _('My text and files are available under %s ' .
                          'except this private data: password, ' .
                          'email address, IM address, and phone number.');
-            $link = '<a href="' .
+            $link = '<a target="_blank" href="' .
                     htmlspecialchars(common_config('license', 'url')) .
                     '">' .
                     htmlspecialchars(common_config('license', 'title')) .
@@ -551,6 +570,12 @@ class RegisterAction extends Action
         return $out;
     }
 
+    function statementCheckbox()
+    {
+        // TRANS: Statement checkbox label in registration dialog.
+        return _('I agree to the <a href="https://mayfirst.org/unity" target="_blank">May First/People Link Statement of Unity.</a>');
+    }
+
     /**
      * Show some information about registering for the site
      *
diff --git a/plugins/OpenID/actions/finishopenidlogin.php b/plugins/OpenID/actions/finishopenidlogin.php
index 3a99988..755516d 100644
--- a/plugins/OpenID/actions/finishopenidlogin.php
+++ b/plugins/OpenID/actions/finishopenidlogin.php
@@ -49,6 +49,12 @@ class FinishopenidloginAction extends Action
                                     $this->trimmed('newname'));
                     return;
                 }
+                if (!$this->boolean('mfpl_statement')) {
+                    // TRANS: Message given if user does not agree with the statement.
+                    $this->showForm(_m('You cannot register if you do not agree to the MF/PL Statement of Unity.'),
+                                    $this->trimmed('newname'));
+                    return;
+                }
                 $this->createNewUser();
             } else if ($this->arg('connect')) {
                 $this->connectUser();
@@ -155,7 +161,7 @@ class FinishopenidloginAction extends Action
         $message = _m('My text and files are available under %s ' .
                      'except this private data: password, ' .
                      'email address, IM address, and phone number.');
-        $link = '<a href="' .
+        $link = '<a target="_blank" href="' .
                 htmlspecialchars(common_config('license', 'url')) .
                 '">' .
                 htmlspecialchars(common_config('license', 'title')) .
@@ -163,6 +169,23 @@ class FinishopenidloginAction extends Action
         $this->raw(sprintf(htmlspecialchars($message), $link));
         $this->elementEnd('label');
         $this->elementEnd('li');
+
+        // MFPL statement
+        $this->elementStart('li');
+        $this->element('input', array('type' => 'checkbox',
+                                      'id' => 'mfpl_statement',
+                                      'class' => 'checkbox',
+                                      'name' => 'mfpl_statement',
+                                      'value' => 'true'));
+        $this->elementStart('label', array('for' => 'mfpl_statement',
+                                          'class' => 'checkbox'));
+        // TRANS: OpenID plugin link text.
+        // TRANS: %s is a link to a license with the license name as link text.
+        $message = _m('I agree to the <a href="https://mayfirst.org/unity" target="_blank">May First/People Link Statement of Unity.</a>');
+        $this->raw($message);
+        $this->elementEnd('label');
+        $this->elementEnd('li');
+
         $this->elementEnd('ul');
         // TRANS: Button label in form in which to create a new user on the site for an OpenID.
         $this->submit('create', _m('BUTTON', 'Create'));