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('template.tar')) unlink('template.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/style/*.css') as $cssFile) unlink($cssFile);
|
||||
if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar');
|
||||
@ -40,7 +40,7 @@
|
||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $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";
|
||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
||||
if ($code != 0) exit($code);
|
||||
@ -124,6 +124,6 @@
|
||||
if (file_exists('file.tar')) unlink('file.tar');
|
||||
if (file_exists('template.tar')) unlink('template.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/style/*.css') as $cssFile) unlink($cssFile);
|
||||
|
@ -6,12 +6,12 @@ if [ -d "bin" ]; then
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
echo "Installing dependencies"
|
||||
npm install
|
||||
/usr/bin/env npm install
|
||||
|
||||
cd "../lib"
|
||||
|
@ -5,8 +5,9 @@
|
||||
# @copyright 2010-2012 Tim Düsterhus
|
||||
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
# @package be.bastelstu.wcf.chat
|
||||
# @subpackage nodePush
|
||||
###
|
||||
process.title = 'Tims Chat Pushserver'
|
||||
process.title = 'nodePush - Tims Chat'
|
||||
|
||||
io = require 'socket.io'
|
||||
net = require 'net'
|
||||
@ -15,7 +16,7 @@ fs = require 'fs'
|
||||
config = require('../config.js').config
|
||||
|
||||
log = (message) ->
|
||||
console.log '[be.bastelstu.wcf.chat.serverPush] '+message
|
||||
console.log '[be.bastelstu.wcf.chat.nodePush] '+message
|
||||
|
||||
class Server
|
||||
constructor: () ->
|
||||
@ -26,6 +27,7 @@ class Server
|
||||
@initUnixSocket()
|
||||
@initSocketIO()
|
||||
initSocketIO: () ->
|
||||
log 'Initializing socket.io'
|
||||
@socket = io.listen config.port
|
||||
|
||||
@socket.set 'log level', 1
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "be.bastelstu.wcf.chat.serverPush",
|
||||
"description" : "Server-Pushing for Tims Chat",
|
||||
"name" : "be.bastelstu.wcf.chat.nodePush",
|
||||
"description" : "node.js-Pushing for Tims Chat",
|
||||
"homepage" : "https://github.com/wbbaddons/Tims-Chat",
|
||||
"keywords" : ["chat"],
|
||||
"author" : "Tim Düsterhus <timwolla@googlemail.com>",
|
||||
@ -9,11 +9,8 @@
|
||||
"dependencies" : {
|
||||
"socket.io" : "0.8.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint" : "*"
|
||||
},
|
||||
"engines" : { "node" : ">=0.6.0",
|
||||
"npm" : ">=1.0"
|
||||
},
|
||||
"version" : "1.0.0"
|
||||
"version" : "3.0.0 Alpha 1"
|
||||
}
|
@ -21,13 +21,11 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
|
||||
*/
|
||||
public static function create(array $parameters = array()) {
|
||||
try {
|
||||
if (CHAT_SOCKET_IO_PATH) {
|
||||
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.serverPush/data.sock', $errno, $errstr, 1);
|
||||
if (\wcf\util\ChatUtil::nodePushRunning())
|
||||
$sock = stream_socket_client('unix://'.WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock', $errno, $errstr, 1);
|
||||
fclose($sock);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) { }
|
||||
|
||||
return parent::create($parameters);
|
||||
|
@ -45,7 +45,7 @@ final class ChatUtil {
|
||||
*/
|
||||
public static function getDiedUsers() {
|
||||
$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
|
||||
time
|
||||
FROM
|
||||
@ -133,6 +133,19 @@ public static function gradient($string, $start, $end) {
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user