mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
update to movim 0.9 git2016-02-12
This commit is contained in:
parent
8fb1bb594f
commit
0c4eae3aff
27 changed files with 123 additions and 51 deletions
|
@ -1,5 +1,8 @@
|
|||
**Changelog**
|
||||
|
||||
1.6.1 2016-02-12
|
||||
- Update to movim 0.9 git2016-01-27
|
||||
|
||||
1.6 2016-01-27
|
||||
- Update to movim 0.9 git2016-01-27
|
||||
- Repository moved to Movim organization on github
|
||||
|
|
|
@ -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.
|
||||
|
||||
Provided Movim version : 0.9 git2016-01-27
|
||||
Provided Movim version : 0.9 git2016-02-12
|
||||
|
||||
Please read CHANGELOG.
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
Movim Changelog
|
||||
================
|
||||
|
||||
v0.9 (trunk)
|
||||
v0.9.1 (trunk)
|
||||
---------------------------
|
||||
* CSS fixes
|
||||
|
||||
v0.9
|
||||
---------------------------
|
||||
* New User Interface for the whole project
|
||||
* Removed BOSH connections and introduce pure XMPP TLS connections
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.9
|
||||
0.9.1dev
|
||||
|
|
|
@ -405,7 +405,7 @@ class Contact extends Model {
|
|||
|
||||
$json = json_decode(requestURL($uri, 2));
|
||||
|
||||
if($json->album) {
|
||||
if(isset($json->album)) {
|
||||
$json->album->url = $json->album->image[2]->{'#text'};
|
||||
return $json->album;
|
||||
}
|
||||
|
|
|
@ -255,6 +255,20 @@ class SessionxDAO extends SQL {
|
|||
return $this->run('Sessionx');
|
||||
}
|
||||
|
||||
function deleteEmpty() {
|
||||
$this->_sql = '
|
||||
delete from sessionx
|
||||
where
|
||||
active = 0';
|
||||
|
||||
$this->prepare(
|
||||
'Sessionx',
|
||||
array()
|
||||
);
|
||||
|
||||
return $this->run('Sessionx');
|
||||
}
|
||||
|
||||
/*function clean() {
|
||||
$this->_sql = '
|
||||
delete from sessionx
|
||||
|
|
|
@ -438,6 +438,7 @@ class Chat extends WidgetBase
|
|||
|
||||
$view->assign('emoji', prepareString('😀'));
|
||||
$view->assign('muc', $muc);
|
||||
$view->assign('anon', false);
|
||||
|
||||
if($muc) {
|
||||
$md = new \Modl\MessageDAO;
|
||||
|
|
|
@ -105,6 +105,9 @@
|
|||
data-jid="{$jid}"
|
||||
onkeypress="
|
||||
if(event.keyCode == 13) {
|
||||
if(event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
state = 0;
|
||||
Chat.sendMessage(this.dataset.jid, {if="$muc"}true{else}false{/if});
|
||||
return false;
|
||||
|
|
|
@ -91,7 +91,7 @@ var Chat = {
|
|||
message.body = message.body.substr(4);
|
||||
}
|
||||
|
||||
bubble.querySelector('p.message').innerHTML = message.body;
|
||||
bubble.querySelector('p.message').innerHTML = message.body.replace(/\r\n?|\n/g, '<br />');
|
||||
bubble.querySelector('span.info').innerHTML = message.publishedPrepared;
|
||||
bubble.querySelector('p.user').className = 'user ' + message.color;
|
||||
|
||||
|
@ -133,7 +133,7 @@ var Chat = {
|
|||
}
|
||||
|
||||
if(bubble) {
|
||||
bubble.querySelector('div.bubble > p').innerHTML = message.body;
|
||||
bubble.querySelector('div.bubble > p').innerHTML = message.body.replace(/\r\n?|\n/g, '<br />');
|
||||
|
||||
bubble.querySelector('div.bubble > span.info').innerHTML = message.publishedPrepared;
|
||||
|
||||
|
|
|
@ -205,7 +205,11 @@ class Chats extends WidgetBase
|
|||
$view->assign('message', $m[0]);
|
||||
}
|
||||
|
||||
return $view->draw('_chats_item', true);
|
||||
$html = $view->draw('_chats_item', true);
|
||||
|
||||
unset($view);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
private function validateJid($jid)
|
||||
|
|
|
@ -37,14 +37,13 @@ class Contact extends WidgetBase
|
|||
{
|
||||
if(!$this->validateJid($jid)) return;
|
||||
|
||||
$html = $this->prepareContact($jid);
|
||||
$html = $this->prepareContact($jid, $page);
|
||||
|
||||
$r = new GetItems;
|
||||
$r->setTo($jid)
|
||||
->setNode('urn:xmpp:microblog:0')
|
||||
->request();
|
||||
|
||||
Header::fill($header);
|
||||
RPC::call('movim_fill', 'contact_widget', $html);
|
||||
RPC::call('MovimTpl.showPanel');
|
||||
RPC::call('MovimTpl.scrollHeaders');
|
||||
|
@ -168,7 +167,7 @@ class Contact extends WidgetBase
|
|||
}
|
||||
}
|
||||
|
||||
function prepareContact($jid)
|
||||
function prepareContact($jid, $page = 0)
|
||||
{
|
||||
if(!$this->validateJid($jid)) return;
|
||||
|
||||
|
@ -196,6 +195,7 @@ class Contact extends WidgetBase
|
|||
|
||||
$presencestxt = getPresencesTxt();
|
||||
|
||||
$view->assign('page', $page);
|
||||
$view->assign('edit',
|
||||
$this->call(
|
||||
'ajaxEditContact',
|
||||
|
|
|
@ -15,7 +15,13 @@ class Dialog extends WidgetBase
|
|||
RPC::call('Dialog.addScroll');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ajaxClear()
|
||||
{
|
||||
RPC::call('movim_remove_class', '#dialog', 'scroll');
|
||||
RPC::call('MovimTpl.fill', '#dialog', '');
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ var Dialog = {
|
|||
return false;
|
||||
},
|
||||
clear : function() {
|
||||
movim_remove_class('#dialog', 'scroll');
|
||||
document.querySelector('#dialog').innerHTML = '';
|
||||
Dialog_ajaxClear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,6 +198,7 @@ class Group extends WidgetBase
|
|||
|
||||
RPC::call('MovimTpl.fill', '#group_widget.'.stringToUri($server.'_'.$node), $html);
|
||||
RPC::call('Group.enableVideos');
|
||||
unset($html);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@
|
|||
<p>
|
||||
{$value->getContact()->getTrueName()}
|
||||
</p>
|
||||
<p>
|
||||
<p class="all">
|
||||
<span class="info">{$value->published|strtotime|prepareDate}</span>
|
||||
{if="$value->title"}
|
||||
{$value->title}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<div id="share_widget">
|
||||
<ul class="thick">
|
||||
<ul class="list thick">
|
||||
{if="isset($url)"}
|
||||
<li class="condensed action">
|
||||
<div class="action">
|
||||
<li>
|
||||
<span class="control icon gray">
|
||||
<i class="zmdi zmdi-link"></i>
|
||||
</div>
|
||||
<span class="icon bubble blue color">
|
||||
</span>
|
||||
<span class="primary icon bubble blue color">
|
||||
<i class="zmdi zmdi-share"></i>
|
||||
</span>
|
||||
<span>{$c->__('page.share')}</span>
|
||||
<p>{$c->__('page.share')}</p>
|
||||
<p>{$c->__('share.success')}</p>
|
||||
<p><a href="{$url}">{$url}</a></p>
|
||||
</li>
|
||||
|
@ -17,11 +17,11 @@
|
|||
movim_redirect('{$c->route('news')}');
|
||||
</script>
|
||||
{else}
|
||||
<li class="condensed">
|
||||
<span class="icon bubble orange color">
|
||||
<li>
|
||||
<span class="primary icon bubble orange color">
|
||||
<i class="zmdi zmdi-alert-triangle"></i>
|
||||
</span>
|
||||
<span>{$c->__('page.share')}</span>
|
||||
<p>{$c->__('page.share')}</p>
|
||||
<p>{$c->__('share.error')}</p>
|
||||
</li>
|
||||
{/if}
|
||||
|
|
|
@ -338,4 +338,13 @@ class Bootstrap {
|
|||
$db = Modl\Modl::getInstance();
|
||||
$db->setUser($user->getLogin());
|
||||
}
|
||||
|
||||
public function getWidgets() {
|
||||
// Return a list of interesting widgets to load (to save memory)
|
||||
return["Account","AccountNext","Ack","AdHoc","Avatar","Bookmark","Chat",
|
||||
"Chats","Config","Contact","Dialog","Group","Groups","Header","Init",
|
||||
"Login","LoginAnonymous","Menu","Notifs","Post","Presence","Publish",
|
||||
"Rooms","Roster","Upload","Vcard4"];
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ if($infos != null) {
|
|||
echo colorize("\nTo update the database run\n", 'green');
|
||||
echo colorize("php mud.php db set\n", 'purple');
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
$loop = Factory::create();
|
||||
|
|
|
@ -23,7 +23,7 @@ fwrite(STDERR, colorize(getenv('sid'), 'yellow')." widgets before : ".\sizeToCle
|
|||
|
||||
// We load and register all the widgets
|
||||
$wrapper = WidgetWrapper::getInstance();
|
||||
$wrapper->registerAll(true);
|
||||
$wrapper->registerAll($bootstrap->getWidgets());
|
||||
|
||||
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." widgets : ".\sizeToCleanSize(memory_get_usage())."\n");
|
||||
|
||||
|
@ -33,11 +33,20 @@ $parser = new \Moxl\Parser;
|
|||
|
||||
$buffer = '';
|
||||
|
||||
$timestamp = time();
|
||||
|
||||
function handleSSLErrors($errno, $errstr) {
|
||||
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." : ".colorize($errstr, 'red')."\n");
|
||||
}
|
||||
|
||||
$stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour, &$parser) {
|
||||
// Temporary linker killer
|
||||
$loop->addPeriodicTimer(5, function() use(&$conn, &$timestamp) {
|
||||
if($timestamp < time() - 3600*2) {
|
||||
$conn->close();
|
||||
}
|
||||
});
|
||||
|
||||
$stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour, &$parser, &$timestamp) {
|
||||
if(substr($data, -1) == "") {
|
||||
$messages = explode("", $buffer . substr($data, 0, -1));
|
||||
$buffer = '';
|
||||
|
@ -53,6 +62,10 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
|
|||
} elseif($msg->func == 'unregister') {
|
||||
\Moxl\Stanza\Stream::end();
|
||||
} elseif($msg->func == 'register') {
|
||||
if(is_resource($conn->stream)) {
|
||||
$conn->stream->close();
|
||||
}
|
||||
|
||||
$cd = new \Modl\ConfigDAO();
|
||||
$config = $cd->get();
|
||||
|
||||
|
@ -83,6 +96,7 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
|
|||
\Moxl\API::clear();
|
||||
|
||||
if(!empty($xml) && $conn) {
|
||||
//$timestamp = time();
|
||||
$conn->write(trim($xml));
|
||||
#fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
|
||||
}
|
||||
|
@ -92,7 +106,7 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
|
|||
}
|
||||
};
|
||||
|
||||
$xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$stdin, $stdin_behaviour, $parser) {
|
||||
$xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$stdin, $stdin_behaviour, $parser, &$timestamp) {
|
||||
$conn = $stream;
|
||||
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." : ".colorize('linker launched', 'blue')."\n");
|
||||
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." launched : ".\sizeToCleanSize(memory_get_usage())."\n");
|
||||
|
@ -102,7 +116,7 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
|||
|
||||
// We define a huge buffer to prevent issues with SSL streams, see https://bugs.php.net/bug.php?id=65137
|
||||
$conn->bufferSize = 1024*32;
|
||||
$conn->on('data', function($message) use (&$conn, $loop, $parser) {
|
||||
$conn->on('data', function($message) use (&$conn, $loop, $parser, &$timestamp) {
|
||||
if(!empty($message)) {
|
||||
$restart = false;
|
||||
|
||||
|
@ -139,6 +153,8 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
|||
\Moxl\API::clear();
|
||||
\RPC::clear();
|
||||
|
||||
$timestamp = time();
|
||||
|
||||
if(!$parser->parse($message)) {
|
||||
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." ".$parser->getError()."\n");
|
||||
}
|
||||
|
@ -163,6 +179,7 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
|||
$xml = \Moxl\API::commit();
|
||||
|
||||
if(!empty($xml)) {
|
||||
//$timestamp = time();
|
||||
$conn->write(trim($xml));
|
||||
#fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class Core implements MessageComponentInterface {
|
|||
public function onMessage(ConnectionInterface $from, $msg)
|
||||
{
|
||||
$sid = $this->getSid($from);
|
||||
if($sid != null) {
|
||||
if($sid != null && isset($this->sessions[$sid])) {
|
||||
$this->sessions[$sid]->messageIn($from, $msg);
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +102,12 @@ class Core implements MessageComponentInterface {
|
|||
public function onClose(ConnectionInterface $conn)
|
||||
{
|
||||
$sid = $this->getSid($conn);
|
||||
if($sid != null) {
|
||||
if($sid != null && isset($this->sessions[$sid])) {
|
||||
$this->sessions[$sid]->detach($conn);
|
||||
$this->closeEmptySession($sid);
|
||||
|
||||
if($this->sessions[$sid]->process == null) {
|
||||
unset($this->sessions[$sid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,26 +115,24 @@ class Core implements MessageComponentInterface {
|
|||
{
|
||||
$this->loop->addPeriodicTimer(5, function() {
|
||||
foreach($this->sessions as $sid => $session) {
|
||||
if((time()-$session->timestamp > $this->cleanerdelay*3600)
|
||||
|| ($session->countClients() == 0
|
||||
&& $session->registered == null)) {
|
||||
if($session->countClients() == 0
|
||||
&& $session->registered == null) {
|
||||
$session->killLinker();
|
||||
$this->closeEmptySession($sid);
|
||||
}
|
||||
|
||||
if($session->process == null) {
|
||||
unset($this->sessions[$sid]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->cleanupDBSessions();
|
||||
});
|
||||
}
|
||||
|
||||
private function closeEmptySession($sid)
|
||||
private function cleanupDBSessions()
|
||||
{
|
||||
// No WebSockets and no linker ? We close the whole session
|
||||
if($this->sessions[$sid]->countClients() == 0
|
||||
&& ($this->sessions[$sid]->process == null)) {
|
||||
$sd = new \Modl\SessionxDAO();
|
||||
$sd->delete($sid);
|
||||
|
||||
unset($this->sessions[$sid]);
|
||||
}
|
||||
$sd = new \Modl\SessionxDAO();
|
||||
$sd->deleteEmpty();
|
||||
}
|
||||
|
||||
public function onError(ConnectionInterface $conn, \Exception $e)
|
||||
|
|
|
@ -48,7 +48,7 @@ class Session {
|
|||
|
||||
// Launching the linker
|
||||
$this->process = new \React\ChildProcess\Process(
|
||||
'exec php linker.php',
|
||||
'exec php linker.php ' . $this->sid,
|
||||
null,
|
||||
array(
|
||||
'sid' => $this->sid,
|
||||
|
|
|
@ -104,6 +104,7 @@ class Picture {
|
|||
$im->setImageCompressionQuality(95);
|
||||
$im->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
||||
$im->writeImage($path);
|
||||
$im->clear();
|
||||
}
|
||||
} catch (ImagickException $e) {
|
||||
error_log($e->getMessage());
|
||||
|
@ -135,6 +136,6 @@ class Picture {
|
|||
$im->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
||||
|
||||
$im->writeImage($path);
|
||||
|
||||
$im->clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ function createEmailPic($jid, $email) {
|
|||
|
||||
$canvas->setImageFormat('PNG');
|
||||
$canvas->writeImage($cachefile);
|
||||
|
||||
$canvas->clear();
|
||||
} catch (ImagickException $e) {
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ class WidgetBase
|
|||
function display() {}
|
||||
|
||||
/**
|
||||
* àdesc Return the template's HTML code
|
||||
* @desc Return the template's HTML code
|
||||
*/
|
||||
function draw()
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ class WidgetWrapper
|
|||
|
||||
private $_widgets = array();
|
||||
private $_events = array();
|
||||
private $_eventWidgets = array();
|
||||
|
||||
private $_view = ''; // The current page where the widget is displayed
|
||||
|
||||
|
@ -49,7 +50,12 @@ class WidgetWrapper
|
|||
if(is_dir(APP_PATH ."widgets/".$widget_dir) &&
|
||||
$widget_dir != '..' &&
|
||||
$widget_dir != '.') {
|
||||
if($load) $this->loadWidget($widget_dir, true);
|
||||
|
||||
if($load != false
|
||||
&& in_array($widget_dir, $load)) {
|
||||
$this->loadWidget($widget_dir, true);
|
||||
}
|
||||
|
||||
array_push($this->_widgets, $widget_dir);
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +117,7 @@ class WidgetWrapper
|
|||
$this->_events[$key] = array($name);
|
||||
}
|
||||
}
|
||||
array_push($this->_eventWidgets, $name);
|
||||
}
|
||||
} else {
|
||||
if($this->_view != '') {
|
||||
|
|
|
@ -90,7 +90,8 @@ article section content div.quote {
|
|||
display: block;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
padding: 2rem;
|
||||
padding: 1rem 2rem;
|
||||
margin-bottom: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ ul.list li > .primary.small {
|
|||
margin-top: -1.5rem;
|
||||
}
|
||||
|
||||
ul.list > li > *:not(.counter):not(span):not(.bubble),
|
||||
ul.list > li > *:not(.counter):not(span):not(.bubble):not(.button),
|
||||
ul.list li.subheader p {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
@ -127,7 +127,7 @@ ul.list li > p:nth-last-of-type(2) + p {
|
|||
|
||||
ul.list li > p:nth-last-of-type(3) + p.all,
|
||||
ul.list li > p:nth-last-of-type(2) + p.all {
|
||||
max-height: auto;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
/* Subheader */
|
||||
|
|
Loading…
Add table
Reference in a new issue