forked from lbsadmin/nodeMessageBoard
Auflöung der umwandlung von Emojis in PNG-Bilder, da dies nicht mehr Zeitgerecht ist, wenn eine UTF-8 Kodierung verwendet wird.
This commit is contained in:
parent
d1a99e9f65
commit
9cb20bc7fa
4
app.js
4
app.js
@ -7,8 +7,8 @@ var debug = false; // todo move this to configfile
|
|||||||
var handle = {}
|
var handle = {}
|
||||||
handle["/"] = requestHandlers.sendInterface;
|
handle["/"] = requestHandlers.sendInterface;
|
||||||
handle["/interface"] = requestHandlers.sendInterface;
|
handle["/interface"] = requestHandlers.sendInterface;
|
||||||
handle["/sprite/emoji.css"] = requestHandlers.sendEmojiCss;
|
// handle["/sprite/emoji.css"] = requestHandlers.sendEmojiCss;
|
||||||
handle["/sprite/emoji.png"] = requestHandlers.sendEmojiPng;
|
// handle["/sprite/emoji.png"] = requestHandlers.sendEmojiPng;
|
||||||
handle["/js/jquery-1.12.1.min"] = requestHandlers.sendJquery;
|
handle["/js/jquery-1.12.1.min"] = requestHandlers.sendJquery;
|
||||||
handle["/js/jquery-ui.js"] = requestHandlers.sendJqueryUI;
|
handle["/js/jquery-ui.js"] = requestHandlers.sendJqueryUI;
|
||||||
handle["/css/bootstrap.min.css"] = requestHandlers.sendBootstrap;
|
handle["/css/bootstrap.min.css"] = requestHandlers.sendBootstrap;
|
||||||
|
1
package.json
Normal file → Executable file
1
package.json
Normal file → Executable file
@ -5,7 +5,6 @@
|
|||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^2.0.0-rc.6",
|
"async": "^2.0.0-rc.6",
|
||||||
"emojize": "^0.2.0",
|
|
||||||
"lowdb": "^0.12.5",
|
"lowdb": "^0.12.5",
|
||||||
"serialport": "^4.0.5",
|
"serialport": "^4.0.5",
|
||||||
"socket.io": "^1.4.8"
|
"socket.io": "^1.4.8"
|
||||||
|
30
requestHandlers.js
Normal file → Executable file
30
requestHandlers.js
Normal file → Executable file
@ -12,19 +12,19 @@ function sendInterface(response) {
|
|||||||
response.end(html);
|
response.end(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendEmojiCss(response) {
|
// function sendEmojiCss(response) {
|
||||||
console.log("Request handler 'Emojicss' was called.");
|
// console.log("Request handler 'Emojicss' was called.");
|
||||||
response.writeHead(200, {"Content-Type": "text/css"});
|
// response.writeHead(200, {"Content-Type": "text/css"});
|
||||||
var html = fs.readFileSync(__dirname + "/served/emoji.css")
|
// var html = fs.readFileSync(__dirname + "/served/emoji.css")
|
||||||
response.end(html);
|
// response.end(html);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
function sendEmojiPng(response) {
|
// function sendEmojiPng(response) {
|
||||||
console.log("Request handler 'Emojipng' was called.");
|
// console.log("Request handler 'Emojipng' was called.");
|
||||||
response.writeHead(200, {"Content-Type": "image/png"});
|
// response.writeHead(200, {"Content-Type": "image/png"});
|
||||||
var html = fs.readFileSync(__dirname + "/served/emoji.png")
|
// var html = fs.readFileSync(__dirname + "/served/emoji.png")
|
||||||
response.end(html);
|
// response.end(html);
|
||||||
}
|
// }
|
||||||
|
|
||||||
function sendBootstrap(response) {
|
function sendBootstrap(response) {
|
||||||
console.log("Request handler 'css' was called.");
|
console.log("Request handler 'css' was called.");
|
||||||
@ -68,6 +68,6 @@ exports.sendDemo = sendDemo;
|
|||||||
exports.sendBootstrap = sendBootstrap;
|
exports.sendBootstrap = sendBootstrap;
|
||||||
exports.sendJqueryUI = sendJqueryUI;
|
exports.sendJqueryUI = sendJqueryUI;
|
||||||
exports.sendJquery = sendJquery;
|
exports.sendJquery = sendJquery;
|
||||||
exports.sendEmojiPng = sendEmojiPng;
|
// exports.sendEmojiPng = sendEmojiPng;
|
||||||
exports.sendEmojiCss = sendEmojiCss;
|
// exports.sendEmojiCss = sendEmojiCss;
|
||||||
exports.sendInterface = sendInterface;
|
exports.sendInterface = sendInterface;
|
||||||
|
5051
served/emoji.css
5051
served/emoji.css
File diff suppressed because it is too large
Load Diff
BIN
served/emoji.png
BIN
served/emoji.png
Binary file not shown.
Before Width: | Height: | Size: 3.7 MiB |
@ -7,7 +7,7 @@ low = require('lowdb'),
|
|||||||
storage = require('lowdb/file-async'),
|
storage = require('lowdb/file-async'),
|
||||||
db = low('db.json', { storage });
|
db = low('db.json', { storage });
|
||||||
|
|
||||||
var convert = require('emojize').emojize;
|
// var convert = require('emojize').emojize;
|
||||||
var config = low('config.json', { storage });
|
var config = low('config.json', { storage });
|
||||||
var socketServer;
|
var socketServer;
|
||||||
var port = config('mainConfig').chain().find({ param: 'port' }).value()['value'];
|
var port = config('mainConfig').chain().find({ param: 'port' }).value()['value'];
|
||||||
@ -115,7 +115,7 @@ function initSocketIO(httpServer,debug)
|
|||||||
var colors = db('messages').chain().takeRight(number).map('color').value();
|
var colors = db('messages').chain().takeRight(number).map('color').value();
|
||||||
|
|
||||||
for(var i = 0; i < messages.length; i++){
|
for(var i = 0; i < messages.length; i++){
|
||||||
socket.emit('newMessage',times[i],numbers[i],convert(messages[i]),colors[i]);
|
socket.emit('newMessage',times[i],numbers[i],/*convert(*/messages[i]/*)*/,colors[i]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ function initSocketIO(httpServer,debug)
|
|||||||
var messageRecieved = escapeHtml(message);
|
var messageRecieved = escapeHtml(message);
|
||||||
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
|
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
|
||||||
//add a new message to the board directly
|
//add a new message to the board directly
|
||||||
socketServer.emit('newMessage', timeRecieved, numberRecieved, convert(messageRecieved),color);
|
socketServer.emit('newMessage', timeRecieved, numberRecieved, /*convert(*/messageRecieved/*)*/,color);
|
||||||
numberStringRecieved = null;
|
numberStringRecieved = null;
|
||||||
numberRecieved = null;
|
numberRecieved = null;
|
||||||
timeRecieved = null;
|
timeRecieved = null;
|
||||||
@ -187,7 +187,7 @@ function serialListener(debug)
|
|||||||
var messageRecieved = escapeHtml(ucs2Parse(data));
|
var messageRecieved = escapeHtml(ucs2Parse(data));
|
||||||
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
|
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
|
||||||
//add a new message to the board directly
|
//add a new message to the board directly
|
||||||
socketServer.emit('newMessage', timeRecieved, numberRecieved, convert(messageRecieved),color);
|
socketServer.emit('newMessage', timeRecieved, numberRecieved, /*convert(*/messageRecieved/*)*/,color);
|
||||||
numberStringRecieved = null;
|
numberStringRecieved = null;
|
||||||
numberRecieved = null;
|
numberRecieved = null;
|
||||||
timeRecieved = null;
|
timeRecieved = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user