1
0

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:
eorg_oz 2017-03-06 20:32:46 +01:00
parent d1a99e9f65
commit 9cb20bc7fa
6 changed files with 21 additions and 5073 deletions

4
app.js
View File

@ -7,8 +7,8 @@ var debug = false; // todo move this to configfile
var handle = {}
handle["/"] = requestHandlers.sendInterface;
handle["/interface"] = requestHandlers.sendInterface;
handle["/sprite/emoji.css"] = requestHandlers.sendEmojiCss;
handle["/sprite/emoji.png"] = requestHandlers.sendEmojiPng;
// handle["/sprite/emoji.css"] = requestHandlers.sendEmojiCss;
// handle["/sprite/emoji.png"] = requestHandlers.sendEmojiPng;
handle["/js/jquery-1.12.1.min"] = requestHandlers.sendJquery;
handle["/js/jquery-ui.js"] = requestHandlers.sendJqueryUI;
handle["/css/bootstrap.min.css"] = requestHandlers.sendBootstrap;

1
package.json Normal file → Executable file
View File

@ -5,7 +5,6 @@
"main": "app.js",
"dependencies": {
"async": "^2.0.0-rc.6",
"emojize": "^0.2.0",
"lowdb": "^0.12.5",
"serialport": "^4.0.5",
"socket.io": "^1.4.8"

30
requestHandlers.js Normal file → Executable file
View File

@ -12,19 +12,19 @@ function sendInterface(response) {
response.end(html);
}
function sendEmojiCss(response) {
console.log("Request handler 'Emojicss' was called.");
response.writeHead(200, {"Content-Type": "text/css"});
var html = fs.readFileSync(__dirname + "/served/emoji.css")
response.end(html);
}
function sendEmojiPng(response) {
console.log("Request handler 'Emojipng' was called.");
response.writeHead(200, {"Content-Type": "image/png"});
var html = fs.readFileSync(__dirname + "/served/emoji.png")
response.end(html);
}
// function sendEmojiCss(response) {
// console.log("Request handler 'Emojicss' was called.");
// response.writeHead(200, {"Content-Type": "text/css"});
// var html = fs.readFileSync(__dirname + "/served/emoji.css")
// response.end(html);
// }
//
// function sendEmojiPng(response) {
// console.log("Request handler 'Emojipng' was called.");
// response.writeHead(200, {"Content-Type": "image/png"});
// var html = fs.readFileSync(__dirname + "/served/emoji.png")
// response.end(html);
// }
function sendBootstrap(response) {
console.log("Request handler 'css' was called.");
@ -68,6 +68,6 @@ exports.sendDemo = sendDemo;
exports.sendBootstrap = sendBootstrap;
exports.sendJqueryUI = sendJqueryUI;
exports.sendJquery = sendJquery;
exports.sendEmojiPng = sendEmojiPng;
exports.sendEmojiCss = sendEmojiCss;
// exports.sendEmojiPng = sendEmojiPng;
// exports.sendEmojiCss = sendEmojiCss;
exports.sendInterface = sendInterface;

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

View File

@ -7,7 +7,7 @@ low = require('lowdb'),
storage = require('lowdb/file-async'),
db = low('db.json', { storage });
var convert = require('emojize').emojize;
// var convert = require('emojize').emojize;
var config = low('config.json', { storage });
var socketServer;
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();
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);
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
//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;
numberRecieved = null;
timeRecieved = null;
@ -187,7 +187,7 @@ function serialListener(debug)
var messageRecieved = escapeHtml(ucs2Parse(data));
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
//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;
numberRecieved = null;
timeRecieved = null;