mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
serverPush -> nodePush
This commit is contained in:
parent
650a540252
commit
3ba9cf7143
@ -25,7 +25,7 @@
|
|||||||
if (file_exists('file.tar')) unlink('file.tar');
|
if (file_exists('file.tar')) unlink('file.tar');
|
||||||
if (file_exists('template.tar')) unlink('template.tar');
|
if (file_exists('template.tar')) unlink('template.tar');
|
||||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.serverPush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
||||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||||
if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar');
|
if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar');
|
||||||
@ -40,7 +40,7 @@
|
|||||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
||||||
if ($code != 0) exit($code);
|
if ($code != 0) exit($code);
|
||||||
}
|
}
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.serverPush/lib/*.coffee') as $coffeeFile) {
|
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.coffee') as $coffeeFile) {
|
||||||
echo $coffeeFile."\n";
|
echo $coffeeFile."\n";
|
||||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
||||||
if ($code != 0) exit($code);
|
if ($code != 0) exit($code);
|
||||||
@ -124,6 +124,6 @@
|
|||||||
if (file_exists('file.tar')) unlink('file.tar');
|
if (file_exists('file.tar')) unlink('file.tar');
|
||||||
if (file_exists('template.tar')) unlink('template.tar');
|
if (file_exists('template.tar')) unlink('template.tar');
|
||||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.serverPush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
||||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||||
|
@ -6,12 +6,12 @@ if [ -d "bin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
echo "You may not start the Push-Server as root!"
|
echo "You may not start nodePush as root!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing dependencies"
|
echo "Installing dependencies"
|
||||||
npm install
|
/usr/bin/env npm install
|
||||||
|
|
||||||
cd "../lib"
|
cd "../lib"
|
||||||
|
|
@ -5,8 +5,9 @@
|
|||||||
# @copyright 2010-2012 Tim Düsterhus
|
# @copyright 2010-2012 Tim Düsterhus
|
||||||
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
# @package be.bastelstu.wcf.chat
|
# @package be.bastelstu.wcf.chat
|
||||||
|
# @subpackage nodePush
|
||||||
###
|
###
|
||||||
process.title = 'Tims Chat Pushserver'
|
process.title = 'nodePush - Tims Chat'
|
||||||
|
|
||||||
io = require 'socket.io'
|
io = require 'socket.io'
|
||||||
net = require 'net'
|
net = require 'net'
|
||||||
@ -15,7 +16,7 @@ fs = require 'fs'
|
|||||||
config = require('../config.js').config
|
config = require('../config.js').config
|
||||||
|
|
||||||
log = (message) ->
|
log = (message) ->
|
||||||
console.log '[be.bastelstu.wcf.chat.serverPush] '+message
|
console.log '[be.bastelstu.wcf.chat.nodePush] '+message
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
constructor: () ->
|
constructor: () ->
|
||||||
@ -26,6 +27,7 @@ class Server
|
|||||||
@initUnixSocket()
|
@initUnixSocket()
|
||||||
@initSocketIO()
|
@initSocketIO()
|
||||||
initSocketIO: () ->
|
initSocketIO: () ->
|
||||||
|
log 'Initializing socket.io'
|
||||||
@socket = io.listen config.port
|
@socket = io.listen config.port
|
||||||
|
|
||||||
@socket.set 'log level', 1
|
@socket.set 'log level', 1
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "be.bastelstu.wcf.chat.serverPush",
|
"name" : "be.bastelstu.wcf.chat.nodePush",
|
||||||
"description" : "Server-Pushing for Tims Chat",
|
"description" : "node.js-Pushing for Tims Chat",
|
||||||
"homepage" : "https://github.com/wbbaddons/Tims-Chat",
|
"homepage" : "https://github.com/wbbaddons/Tims-Chat",
|
||||||
"keywords" : ["chat"],
|
"keywords" : ["chat"],
|
||||||
"author" : "Tim Düsterhus <timwolla@googlemail.com>",
|
"author" : "Tim Düsterhus <timwolla@googlemail.com>",
|
||||||
@ -9,11 +9,8 @@
|
|||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"socket.io" : "0.8.7"
|
"socket.io" : "0.8.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
|
||||||
"jshint" : "*"
|
|
||||||
},
|
|
||||||
"engines" : { "node" : ">=0.6.0",
|
"engines" : { "node" : ">=0.6.0",
|
||||||
"npm" : ">=1.0"
|
"npm" : ">=1.0"
|
||||||
},
|
},
|
||||||
"version" : "1.0.0"
|
"version" : "3.0.0 Alpha 1"
|
||||||
}
|
}
|
@ -21,11 +21,9 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
|
|||||||
*/
|
*/
|
||||||
public static function create(array $parameters = array()) {
|
public static function create(array $parameters = array()) {
|
||||||
try {
|
try {
|
||||||
if (CHAT_SOCKET_IO_PATH) {
|
if (\wcf\util\ChatUtil::nodePushRunning())
|
||||||
if (file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock') && is_writable(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock')) {
|
$sock = stream_socket_client('unix://'.WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock', $errno, $errstr, 1);
|
||||||
$sock = stream_socket_client('unix://'.WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock', $errno, $errstr, 1);
|
fclose($sock);
|
||||||
fclose($sock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (\Exception $e) { }
|
catch (\Exception $e) { }
|
||||||
|
@ -45,7 +45,7 @@ final class ChatUtil {
|
|||||||
*/
|
*/
|
||||||
public static function getDiedUsers() {
|
public static function getDiedUsers() {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
$packageID = \wcf\util\ChatUtil::getPackageID();
|
||||||
if (CHAT_SOCKET_IO_PATH && file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock') && is_writable(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock')) {
|
if (self::nodePushRunning()) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
time
|
time
|
||||||
FROM
|
FROM
|
||||||
@ -133,6 +133,19 @@ public static function gradient($string, $start, $end) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether nodePush is running.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function nodePushRunning() {
|
||||||
|
if (!CHAT_SOCKET_IO_PATH) return false;
|
||||||
|
if (!file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock')) return false;
|
||||||
|
if (!is_writable(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock')) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads user data.
|
* Reads user data.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user