1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

update to movim upstream

This commit is contained in:
src386 2016-04-15 10:05:14 +02:00
parent fa04195341
commit dae5ad547e
17 changed files with 150 additions and 23 deletions

View file

@ -1,7 +1,7 @@
**Changelog** **Changelog**
1.8 2016? 1.8 2016?
- Update to movim 0.9 git2016-04-14 - Update to movim 0.9 git2016-04-15
- Removed "environment" variable - Removed "environment" variable
1.7.1 2016-30-30 1.7.1 2016-30-30

View file

@ -5,7 +5,7 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt. It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
Provided Movim version : 0.9 git2016-04-14 Provided Movim version : 0.9 git2016-04-15
Please read CHANGELOG. Please read CHANGELOG.

View file

@ -3,6 +3,8 @@ Movim Changelog
v0.9.1 (trunk) v0.9.1 (trunk)
--------------------------- ---------------------------
* Put your own XMPP server as default in the configuration (movim.eu in fallback)
* Close the Dialog box when pressing ESC
* Moving values from Sessionx to Session * Moving values from Sessionx to Session
* Using chart.js for the statistics * Using chart.js for the statistics
* Refactor the "public" system for the Posts * Refactor the "public" system for the Posts

View file

@ -182,4 +182,10 @@ var MovimTpl = {
movim_add_onload(function() { movim_add_onload(function() {
MovimTpl.init(); MovimTpl.init();
document.body.addEventListener('click', MovimTpl.toggleContextMenu, false); document.body.addEventListener('click', MovimTpl.toggleContextMenu, false);
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 27 && Dialog.filled()) {
Dialog.clear();
}
};
}); });

View file

@ -9,13 +9,17 @@ class Config extends Model {
public $maxusers; public $maxusers;
public $loglevel; public $loglevel;
public $timezone; public $timezone;
public $xmppwhitelist;
public $info; public $info;
public $unregister; public $unregister;
public $username; public $username;
public $password; public $password;
public $sizelimit; public $sizelimit;
public $xmppdomain;
public $xmppdescription;
public $xmppcountry;
public $xmppwhitelist;
public function __construct() { public function __construct() {
$this->_struct = ' $this->_struct = '
{ {
@ -31,8 +35,6 @@ class Config extends Model {
{"type":"string", "size":16, "mandatory":true }, {"type":"string", "size":16, "mandatory":true },
"timezone" : "timezone" :
{"type":"string", "size":32, "mandatory":true }, {"type":"string", "size":32, "mandatory":true },
"xmppwhitelist" :
{"type":"text" },
"info" : "info" :
{"type":"text" }, {"type":"text" },
"unregister" : "unregister" :
@ -42,7 +44,15 @@ class Config extends Model {
"password" : "password" :
{"type":"string", "size":64, "mandatory":true }, {"type":"string", "size":64, "mandatory":true },
"sizelimit" : "sizelimit" :
{"type":"int", "size":16 } {"type":"int", "size":16 },
"xmppdomain" :
{"type":"string", "size":32 },
"xmppdescription" :
{"type":"text" },
"xmppcountry" :
{"type":"string", "size":4 },
"xmppwhitelist" :
{"type":"text" }
}'; }';
parent::__construct(); parent::__construct();

View file

@ -12,6 +12,9 @@ class ConfigDAO extends SQL {
maxusers = :maxusers, maxusers = :maxusers,
loglevel = :loglevel, loglevel = :loglevel,
timezone = :timezone, timezone = :timezone,
xmppdomain = :xmppdomain,
xmppdescription = :xmppdescription,
xmppcountry = :xmppcountry,
xmppwhitelist = :xmppwhitelist, xmppwhitelist = :xmppwhitelist,
info = :info, info = :info,
unregister = :unregister, unregister = :unregister,
@ -28,6 +31,9 @@ class ConfigDAO extends SQL {
'maxusers' => $c->maxusers, 'maxusers' => $c->maxusers,
'loglevel' => $c->loglevel, 'loglevel' => $c->loglevel,
'timezone' => $c->timezone, 'timezone' => $c->timezone,
'xmppdomain' => $c->xmppdomain,
'xmppdescription' => $c->xmppdescription,
'xmppcountry' => $c->xmppcountry,
'xmppwhitelist'=> $c->xmppwhitelist, 'xmppwhitelist'=> $c->xmppwhitelist,
'info' => $c->info, 'info' => $c->info,
'unregister' => $c->unregister, 'unregister' => $c->unregister,
@ -60,6 +66,9 @@ class ConfigDAO extends SQL {
maxusers, maxusers,
loglevel, loglevel,
timezone, timezone,
xmppdomain,
xmppdescription,
xmppcountry,
xmppwhitelist, xmppwhitelist,
info, info,
unregister, unregister,
@ -75,6 +84,9 @@ class ConfigDAO extends SQL {
:maxusers, :maxusers,
:loglevel, :loglevel,
:timezone, :timezone,
:xmppdomain,
:xmppdescription,
:xmppcountry,
:xmppwhitelist, :xmppwhitelist,
:info, :info,
:unregister, :unregister,
@ -93,6 +105,9 @@ class ConfigDAO extends SQL {
'maxusers' => $c->maxusers, 'maxusers' => $c->maxusers,
'loglevel' => $c->loglevel, 'loglevel' => $c->loglevel,
'timezone' => $c->timezone, 'timezone' => $c->timezone,
'xmppdomain' => $c->xmppdomain,
'xmppdescription' => $c->xmppdescription,
'xmppcountry' => $c->xmppcountry,
'xmppwhitelist'=> $c->xmppwhitelist, 'xmppwhitelist'=> $c->xmppwhitelist,
'info' => $c->info, 'info' => $c->info,
'unregister' => $c->unregister, 'unregister' => $c->unregister,

View file

@ -5,7 +5,6 @@ namespace modl;
class Sessionx extends Model { class Sessionx extends Model {
public $session; public $session;
public $username; public $username;
public $password;
public $hash; public $hash;
public $resource; public $resource;
public $rid; public $rid;
@ -27,8 +26,6 @@ class Sessionx extends Model {
{"type":"string", "size":32, "key":true }, {"type":"string", "size":32, "key":true },
"username" : "username" :
{"type":"string", "size":64 }, {"type":"string", "size":64 },
"password" :
{"type":"string", "size":64 },
"hash" : "hash" :
{"type":"string", "size":64 }, {"type":"string", "size":64 },
"resource" : "resource" :

View file

@ -88,5 +88,6 @@ class AdminMain extends \Movim\Widget\Base
$this->view->assign('timezones', getTimezoneList()); $this->view->assign('timezones', getTimezoneList());
$this->view->assign('langs', $l->getList()); $this->view->assign('langs', $l->getList());
$this->view->assign('countries', getCountries());
} }
} }

View file

@ -6,7 +6,7 @@
<label for="da">{$c->__('general.language')}</label> <label for="da">{$c->__('general.language')}</label>
<div class="select"> <div class="select">
<select id="locale" name="locale"> <select id="locale" name="locale">
<option value="en">English (default)</option>'; <option value="en">English (default)</option>
{loop="$langs"} {loop="$langs"}
<option value="{$key}" <option value="{$key}"
{if="$conf->locale == $key"} {if="$conf->locale == $key"}
@ -61,6 +61,37 @@
<br /> <br />
<h3>{$c->__('xmpp.title')}</h3>
<div>
<input type="text" name="xmppdomain" id="xmppdomain" placeholder="server.tld" value="{$conf->xmppdomain}" />
<label for="xmppdomain">{$c->__('xmpp.domain')}</label>
</div>
<div>
<textarea type="text" name="xmppdescription" id="xmppdescription" placeholder="{$c->__('xmpp.description')}" />{$conf->xmppdescription}</textarea>
<label for="xmppdescription">{$c->__('xmpp.description')}</label>
</div>
<div>
<div class="select">
<select id="xmppcountry" name="xmppcountry">
<option value=""></option>
{loop="$countries"}
<option value="{$key}"
{if="$conf->xmppcountry == $key"}
selected="selected"
{/if}>
{$value}
</option>
{/loop}
</select>
</div>
<label for="xmppcountry">{$c->__('xmpp.country')}</label>
</div>
<br />
<h3>{$c->__('whitelist.title')}</h3> <h3>{$c->__('whitelist.title')}</h3>
<div> <div>

View file

@ -23,7 +23,7 @@ password = Password
re_password = Retype password re_password = Retype password
[whitelist] [whitelist]
title = Whitelist - XMPP Server title = Whitelisted XMPP Servers
info1 = If you want to specify a list of authorized XMPP servers on your Movim pod and forbid the connection on all the others please put their domain name here, with comma (ex: movim.eu,jabber.fr) info1 = If you want to specify a list of authorized XMPP servers on your Movim pod and forbid the connection on all the others please put their domain name here, with comma (ex: movim.eu,jabber.fr)
info2 = Leave this field blank if you allow the access to all the XMPP accounts. info2 = Leave this field blank if you allow the access to all the XMPP accounts.
label = List of whitelisted XMPP servers label = List of whitelisted XMPP servers
@ -35,6 +35,12 @@ info1 = This message will be displayed on the login page
info2 = "Leave this field blank if you dont want to show any message." info2 = "Leave this field blank if you dont want to show any message."
label = Information Message label = Information Message
[xmpp]
title = Default XMPP server
domain = Main XMPP server domain
description = Main XMPP server description
country = Main XMPP server country
[log] [log]
empty = Empty empty = Empty
syslog = Syslog syslog = Syslog

View file

@ -76,6 +76,13 @@ class Login extends \Movim\Widget\Base
$this->view->assign('info', $config->info); $this->view->assign('info', $config->info);
$this->view->assign('whitelist',$config->xmppwhitelist); $this->view->assign('whitelist',$config->xmppwhitelist);
if(isset($config->xmppdomain)
&& !empty($config->xmppdomain)) {
$this->view->assign('domain', $config->xmppdomain);
} else {
$this->view->assign('domain', 'movim.eu');
}
$pop = 0; $pop = 0;
foreach(scandir(USERS_PATH) as $f) foreach(scandir(USERS_PATH) as $f)

View file

@ -1,4 +1,5 @@
var Login = { var Login = {
domain : '@movim.eu',
submitted : false, submitted : false,
fillExample : function(login, pass) { fillExample : function(login, pass) {
document.querySelector('#login').value = login; document.querySelector('#login').value = login;
@ -134,7 +135,7 @@ var Login = {
*/ */
setCookie : function(value) { setCookie : function(value) {
document.cookie = 'MOVIM_SESSION_ID='+value; document.cookie = 'MOVIM_SESSION_ID='+value;
} },
} }
MovimWebsocket.attach(function() MovimWebsocket.attach(function()
@ -176,7 +177,7 @@ movim_add_onload(function() {
login.addEventListener('input', function() { login.addEventListener('input', function() {
if(this.value.indexOf('@') == -1) { if(this.value.indexOf('@') == -1) {
// TODO allow another server here // TODO allow another server here
document.querySelector('input#complete').value = this.value + '@movim.eu'; document.querySelector('input#complete').value = this.value + '@' + Login.domain;
} else { } else {
document.querySelector('input#complete').value = this.value; document.querySelector('input#complete').value = this.value;
} }

View file

@ -1,8 +1,9 @@
<div id="login_widget"> <div id="login_widget">
<div id="sessions" class="dialog actions"></div> <div id="sessions" class="dialog actions"></div>
{if="isset($httpAuthUser)"}
<script type="text/javascript"> <script type="text/javascript">
Login.domain = '{$domain}';
{if="isset($httpAuthUser)"}
localStorage.username = '{$httpAuthUser}'; localStorage.username = '{$httpAuthUser}';
MovimWebsocket.attach(function() { MovimWebsocket.attach(function() {
MovimWebsocket.connection.register('{$httpAuthHost}'); MovimWebsocket.connection.register('{$httpAuthHost}');
@ -10,8 +11,8 @@
MovimWebsocket.register(function() { MovimWebsocket.register(function() {
Login_ajaxHTTPLogin('{$httpAuthUser}', '{$httpAuthPassword}'); Login_ajaxHTTPLogin('{$httpAuthUser}', '{$httpAuthPassword}');
}); });
</script>
{/if} {/if}
</script>
<div id="form" class="dialog"> <div id="form" class="dialog">
<section> <section>

View file

@ -38,6 +38,9 @@ class Subscribe extends \Movim\Widget\Base {
$json = requestURL(MOVIM_API.'servers', 1); $json = requestURL(MOVIM_API.'servers', 1);
$json = json_decode($json); $json = json_decode($json);
$cd = new \Modl\ConfigDAO;
$this->view->assign('config', $cd->get());
if(is_object($json) && $json->status == 200) { if(is_object($json) && $json->status == 200) {
$this->view->assign('servers', $json->servers); $this->view->assign('servers', $json->servers);
} }

View file

@ -7,6 +7,32 @@
</ul> </ul>
<ul class="list card shadow active flex"> <ul class="list card shadow active flex">
{if="!empty($config->xmppdomain)"}
<li
class="block large"
onclick="movim_redirect('{$c->route('accountnext', array($config->xmppdomain, false))}')">
<span class="primary icon bubble color {$config->xmppdomain|stringToColor}">
{$config->xmppdomain|firstLetterCapitalize}
</span>
<p>
{if="!empty($config->xmppcountry)"}
<span class="info">
<img
class="flag"
title="{$config->xmppcountry}"
alt="{$config->xmppc}"
src="{$c->flagPath($config->xmppcountry)}"/>
</span>
{/if}
{$config->xmppdomain}
</p>
{if="!empty($config->xmppdescription)"}
<p>
{$config->xmppdescription}<br />
</p>
{/if}
</li>
{/if}
{loop="$servers"} {loop="$servers"}
<li <li
class="block" class="block"
@ -30,9 +56,6 @@
</p> </p>
<p> <p>
{$value->description}<br /> {$value->description}<br />
<!--<a target="_blank" href="{$value->url}">
{$value->url}
</a>-->
</p> </p>
</li> </li>
{/loop} {/loop}

View file

@ -50,6 +50,30 @@ class ConfigCommand extends Command
InputOption::VALUE_REQUIRED, InputOption::VALUE_REQUIRED,
'The server main locale' 'The server main locale'
) )
->addOption(
'xmppdomain',
null,
InputOption::VALUE_REQUIRED,
'The default XMPP server domain'
)
->addOption(
'xmppdescription',
null,
InputOption::VALUE_REQUIRED,
'The default XMPP server description'
)
->addOption(
'xmppcountry',
null,
InputOption::VALUE_REQUIRED,
'The default XMPP server country'
)
->addOption(
'xmppwhitelist',
null,
InputOption::VALUE_REQUIRED,
'The whitelisted XMPP servers'
)
; ;
} }

View file

@ -66,7 +66,7 @@ class Builder
{ {
$this->_view = $view; $this->_view = $view;
$template = $this->_view.'.tpl'; $template = $this->_view.'.tpl';
//if (ENVIRONMENT === 'production') ob_clean();
ob_start(); ob_start();
require($this->viewsPath($template)); require($this->viewsPath($template));