wiki:how-to/servers/support/gnusocial

Version 8 (modified by Steve Revilak, 2 years ago) (diff)

keyringer note

Administration

The administrative credentials are stored in keyringer. Look for social.mayfirst.org.

Setting up Meteor real-time updates over https

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. We want to serve Meteor over https, and opt to use Apache for proxying the URLs for this. In this way the traffic will be encrypted, and also Meteor won't be directly available externally, which always feels safer :-)

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. It means that the Meteor server will be listening to localhost for both controller (sending messages) and subscriber (client waiting for messages). The subscriber is the web browser, but this will be proxied via apache, which is why we can bind to localhost.

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.

Next set up Apache proxying in the place for your GNU Social virtual host:

  # Proxy for Meteor server
  <IfModule mod_proxy.c>
    ProxyPass /poll.html http://127.0.0.1:8085/poll.html
    ProxyPassReverse /poll.html http://127.0.0.1:8085/poll.html
    ProxyPass /stream.html http://127.0.0.1:8085/stream.html
    ProxyPassReverse /stream.html http://127.0.0.1:8085/stream.html
    ProxyPass /meteor.js http://127.0.0.1:8085/meteor.js
    ProxyPassReverse /meteor.js http://127.0.0.1:8085/meteor.js
    ProxyPass /push/ http://127.0.0.1:8085/push/
    ProxyPassReverse /push/ http://127.0.0.1:8085/push/
  </IfModule>

You also need to add the proper modules to apache and restart:

a2enmod proxy
a2enmod proxy_http
service apache2 restart

Finally enable the plugins in the GNU Social config.php file:

addPlugin('Realtime');
addPlugin('Meteor', array('webserver' => 'your.gnu-social.site.com',
    'webport' => '443',
    'controlserver' => '127.0.0.1',
    'controlport' => '4671',
    'protocol' => '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'));