summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xMakefile26
-rw-r--r--common.mk2
-rw-r--r--config.cpp2
-rw-r--r--config.h2
-rw-r--r--connectionregistry.h2
-rw-r--r--debian/README.Debian32
-rw-r--r--debian/changelog74
-rw-r--r--debian/control15
-rwxr-xr-xdebian/rules4
-rw-r--r--debian/webchat.conf (renamed from debian/whiteboard.conf)14
-rw-r--r--debian/webchat.dirs1
-rw-r--r--debian/webchat.docs (renamed from debian/whiteboard.docs)0
-rw-r--r--debian/webchat.webchat.service (renamed from debian/whiteboard.whiteboard.service)0
-rw-r--r--debian/whiteboard.dirs1
-rw-r--r--diff.cpp188
-rw-r--r--diff.h37
-rw-r--r--html/index.html17
-rw-r--r--html/pdf-icon-100.pngbin4526 -> 0 bytes
-rw-r--r--html/pdf-icon-30.pngbin1356 -> 0 bytes
-rw-r--r--html/pdf-icon-50.pngbin2317 -> 0 bytes
-rw-r--r--html/pdf-icon.svg56
-rw-r--r--html/stats.html2
-rw-r--r--html/stats.js6
-rw-r--r--html/webchat.css (renamed from html/whiteboard.css)0
-rw-r--r--html/webchat.js (renamed from html/whiteboard.js)0
-rw-r--r--main.cpp6
-rw-r--r--qrcode.cpp37
-rw-r--r--qrcode.h11
-rw-r--r--tests/Makefile14
-rw-r--r--tests/test-diff.cpp199
-rw-r--r--tests/test-qrcode.cpp140
-rw-r--r--tests/test-webchat.cpp (renamed from tests/test-whiteboard.cpp)0
-rw-r--r--webassembly/Makefile2
-rw-r--r--webchat.conf (renamed from whiteboard.conf)14
-rw-r--r--webchat.cpp (renamed from whiteboard.cpp)2
-rw-r--r--webchat.h (renamed from whiteboard.h)4
-rw-r--r--webserver.conf.example8
37 files changed, 86 insertions, 832 deletions
diff --git a/Makefile b/Makefile
index aafa42a..24355b7 100755
--- a/Makefile
+++ b/Makefile
@@ -6,39 +6,39 @@
include common.mk
-PROJECTNAME=whiteboard
+PROJECTNAME=webchat
DISTROS=base debian11 ubuntu2210
TGZNAME=$(PROJECTNAME)-$(VERSION).tar.xz
INCLUDES=-I.
-HEADERS=config.h qrcode.h storage.h whiteboard.h compiledsql.h connectionregistry.h diff.h
+HEADERS=config.h storage.h webchat.h compiledsql.h connectionregistry.h
SOURCES=$(HEADERS:.h=.cpp)
OBJECTS=$(HEADERS:.h=.o)
-TARGETS=whiteboard
+TARGETS=webchat
build: $(TARGETS)
$(MAKE) -C webassembly
all: build
- ./whiteboard -c whiteboard.conf
+ ./webchat -c webchat.conf
install:
mkdir -p $(DESTDIR)/usr/bin
- cp whiteboard $(DESTDIR)/usr/bin
+ cp webchat $(DESTDIR)/usr/bin
- mkdir -p $(DESTDIR)/usr/lib/whiteboard/html
- cp -r html/* $(DESTDIR)/usr/lib/whiteboard/html/
+ mkdir -p $(DESTDIR)/usr/lib/webchat/html
+ cp -r html/* $(DESTDIR)/usr/lib/webchat/html/
- uglifyjs html/whiteboard.js -m -c > $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.js || cp html/whiteboard.js $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.js
- htmlmin html/index.html $(DESTDIR)/usr/lib/whiteboard/html/index.html
- cleancss -o $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.css html/whiteboard.css
+ uglifyjs html/webchat.js -m -c > $(DESTDIR)/usr/lib/webchat/html/webchat.js || cp html/webchat.js $(DESTDIR)/usr/lib/webchat/html/webchat.js
+ htmlmin html/index.html $(DESTDIR)/usr/lib/webchat/html/index.html
+ cleancss -o $(DESTDIR)/usr/lib/webchat/html/webchat.css html/webchat.css
mkdir -p $(DESTDIR)/etc
- cp whiteboard.conf $(DESTDIR)/etc
+ cp webchat.conf $(DESTDIR)/etc
# link
-whiteboard: $(OBJECTS) main.o
+webchat: $(OBJECTS) main.o
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
# .cpp -> .o
@@ -50,7 +50,7 @@ test:
clean:
-rm -f *.o $(TARGETS) *.gcov
- -rm -f html/libwhiteboard.wasm html/libwhiteboard.js
+ -rm -f html/libwebchat.wasm html/libwebchat.js
$(MAKE) -C tests clean
$(MAKE) -C webassembly clean
diff --git a/common.mk b/common.mk
index 5f4c77c..de649da 100644
--- a/common.mk
+++ b/common.mk
@@ -67,5 +67,5 @@ SRC_ROOT=.
endif
VERSION=$(shell dpkg-parsechangelog --show-field Version --file $(SRC_ROOT)/debian/changelog)
-CXXFLAGS+=-DWHITEBOARD_VERSION=\"$(VERSION)\"
+CXXFLAGS+=-DWEBCHAT_VERSION=\"$(VERSION)\"
diff --git a/config.cpp b/config.cpp
index afb5cd2..15159a3 100644
--- a/config.cpp
+++ b/config.cpp
@@ -10,7 +10,7 @@ namespace pt = boost::property_tree;
using namespace std::string_literals;
namespace {
- const std::string default_datapath {"/var/lib/whiteboard"};
+ const std::string default_datapath {"/var/lib/webchat"};
const uint64_t default_maxage{0}; // timeout in seconds; 0 = no timeout
const std::string default_listen {"::1:9000"};
const int default_threads{1};
diff --git a/config.h b/config.h
index ce2fceb..53d400a 100644
--- a/config.h
+++ b/config.h
@@ -2,7 +2,7 @@
#include <string>
-const std::string default_config_filename{"/etc/whiteboard.conf"};
+const std::string default_config_filename{"/etc/webchat.conf"};
class Config
{
diff --git a/connectionregistry.h b/connectionregistry.h
index c3c6884..e41e4f2 100644
--- a/connectionregistry.h
+++ b/connectionregistry.h
@@ -8,6 +8,8 @@
#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/websocket.hpp>
+// map connection <-> user id
+
class ConnectionRegistry
{
public:
diff --git a/debian/README.Debian b/debian/README.Debian
index 7450383..e683b0c 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -1,45 +1,45 @@
-whiteboard for Debian
-=====================
+webchat for Debian
+==================
-This package is the Debian version of whiteboard.
+This package is the Debian version of webchat.
It is a websocket application communicating to a webserver, e.g. Reichwein.IT webserver.
-Via cron or systemd, whiteboard data in /var/lib/whiteboard is cleaned up once a day.
-Data location and maximum data age can be configured via /etc/whiteboard.conf.
+Via cron or systemd, webchat data in /var/lib/webchat is cleaned up once a day.
+Data location and maximum data age can be configured via /etc/webchat.conf.
Configuration
-------------
-* You can add this to /etc/webserver.conf
+* You can add this to /etc/webchat.conf
- <path requested="/whiteboard">
+ <path requested="/webchat">
<plugin>static-files</plugin>
- <target>/usr/lib/whiteboard/html</target>
+ <target>/usr/lib/webchat/html</target>
</path>
- <path requested="/whiteboard/websocket">
+ <path requested="/webchat/websocket">
<plugin>websocket</plugin>
- <target>127.0.0.1:9014</target>
+ <target>127.0.0.1:9015</target>
</path>
-* Edit /etc/whiteboard.conf to adjust the whiteboard data path if different
- from /var/lib/whiteboard
+* Edit /etc/webchat.conf to adjust the webchat data path if different
+ from /var/lib/webchat
* Enable:
- # systemctl enable whiteboard.service
+ # systemctl enable webchat.service
* Start:
- # systemctl start whiteboard
+ # systemctl start webchat
* Stop:
- # systemctl stop whiteboard
+ # systemctl stop webchat
* Query Status:
- # systemctl status whiteboard
+ # systemctl status webchat
and observe /var/log/syslog
diff --git a/debian/changelog b/debian/changelog
index de01abe..5891085 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,75 +1,5 @@
-whiteboard (1.9) UNRELEASED; urgency=medium
-
- * Updated build environment
- * Added missing image files
-
- -- Roland Reichwein <mail@reichwein.it> Mon, 20 Feb 2023 10:10:27 +0100
-
-whiteboard (1.8) unstable; urgency=medium
-
- * Added config.maxconnections, defaults to 1000
- * Fixed package dependencies for PDF generation
- * Touch documents on read (i.e. reset timeout on read)
- * Validate id, server-side
-
- -- Roland Reichwein <mail@reichwein.it> Sun, 19 Feb 2023 18:42:32 +0100
-
-whiteboard (1.7) unstable; urgency=medium
-
- * Fix crash on stats.html page reload/close
- * Focus on reconnect button
- * Added Markdown to PDF download via pandoc
-
- -- Roland Reichwein <mail@reichwein.it> Fri, 10 Feb 2023 18:01:37 +0100
-
-whiteboard (1.6) unstable; urgency=medium
-
- * Added stats.html
- * Use boost strands instead of mutex
-
- -- Roland Reichwein <mail@reichwein.it> Mon, 06 Feb 2023 07:58:39 +0100
-
-whiteboard (1.5) unstable; urgency=medium
-
- * Move from FCGI to websocket interface
- * Position changes w/o file transmit
- * Print version on main page
- * Add reconnect button
- * Add diff handling
-
- -- Roland Reichwein <mail@reichwein.it> Mon, 30 Jan 2023 21:05:35 +0100
-
-whiteboard (1.4) unstable; urgency=medium
-
- * Move from filesystem based documents to sqlite
- * Add tests
- * Separated out libreichwein
-
- -- Roland Reichwein <mail@reichwein.it> Sat, 21 Jan 2023 12:20:20 +0100
-
-whiteboard (1.3) unstable; urgency=medium
-
- * Page design (center)
- * Follow editor's cursor
-
- -- Roland Reichwein <mail@reichwein.it> Mon, 05 Dec 2022 19:22:27 +0100
-
-whiteboard (1.2) unstable; urgency=medium
-
- * Fix build on Debian 11
- * UglifyJS on best-effort base
-
- -- Roland Reichwein <mail@reichwein.it> Sat, 03 Dec 2022 17:03:11 +0100
-
-whiteboard (1.1) unstable; urgency=medium
-
- * Compress Javascript
- * Add QR Code
-
- -- Roland Reichwein <mail@reichwein.it> Sat, 03 Dec 2022 16:10:06 +0100
-
-whiteboard (1.0) unstable; urgency=medium
+webchat (1.0) unstable; urgency=medium
* Initial release
- -- Roland Reichwein <mail@reichwein.it> Sat, 05 Nov 2022 13:34:57 +0100
+ -- Roland Reichwein <mail@reichwein.it> Fri, 03 Mar 2023 16:16:00 +0100
diff --git a/debian/control b/debian/control
index 9c75069..42fa7db 100644
--- a/debian/control
+++ b/debian/control
@@ -1,16 +1,17 @@
-Source: whiteboard
+Source: webchat
Section: web
Priority: optional
Maintainer: Roland Reichwein <mail@reichwein.it>
-Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, llvm | g++-9, lld | g++-9, uglifyjs, python3-pkg-resources, htmlmin, cleancss, libqrcodegencpp-dev, libgraphicsmagick++-dev, pkg-config, libfmt-dev, libsqlitecpp-dev, googletest, gcovr, libreichwein-dev, emscripten
+Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, llvm | g++-9, lld | g++-9, uglifyjs, python3-pkg-resources, htmlmin, cleancss, pkg-config, libfmt-dev, libsqlitecpp-dev, googletest, gcovr, libreichwein-dev, emscripten
Standards-Version: 4.5.0
Homepage: http://www.reichwein.it/whiteboard/
-Package: whiteboard
+Package: webchat
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libxml2-utils, pandoc, texlive-latex-recommended, texlive-latex-extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxml2-utils
Recommends: webserver
Homepage: http://www.reichwein.it/whiteboard/
-Description: Web application for an collaborative editor
- Whiteboard is a text editor running on an HTML5 webpage (including a server
- part) that enables collaborative editing and presenting.
+Description: Web application for chat
+ Webchat is a cat web application, running on a webserver (e.g. Reichwein.IT
+ webserver) via websockets interface. Client-wise, it is implemented with
+ plain HTML and JavaScript.
diff --git a/debian/rules b/debian/rules
index 72c5b8c..48012e3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,9 +5,9 @@
override_dh_fixperms:
dh_fixperms
- chmod a+rwx debian/whiteboard/var/lib/whiteboard
+ chmod a+rwx debian/webchat/var/lib/webchat
override_dh_auto_install:
dh_auto_install
- dh_installsystemd --name whiteboard
+ dh_installsystemd --name webchat
diff --git a/debian/whiteboard.conf b/debian/webchat.conf
index 6446d39..89645c0 100644
--- a/debian/whiteboard.conf
+++ b/debian/webchat.conf
@@ -1,19 +1,19 @@
<config>
<!--
- datapath: location in filesystem to store whiteboard data
- Example: /var/lib/whiteboard
+ datapath: location in filesystem to store webchat data
+ Example: /var/lib/webchat
-->
- <datapath>/var/lib/whiteboard</datapath>
+ <datapath>/var/lib/webchat</datapath>
<!--
port: socket to listen on for websocket
- Example: ::1:8765
+ Example: ::1:8767
-->
- <port>::1:8765</port>
+ <port>::1:8767</port>
<!--
- Maximum age of individual whiteboard pages in seconds.
- Older pages will be removed by whiteboard-cleanup and crond.
+ Maximum age of individual webchat pages in seconds.
+ Older pages will be removed by webchat-cleanup and crond.
Example: 2592000 (~30 days)
-->
<maxage>2592000</maxage>
diff --git a/debian/webchat.dirs b/debian/webchat.dirs
new file mode 100644
index 0000000..c681efe
--- /dev/null
+++ b/debian/webchat.dirs
@@ -0,0 +1 @@
+var/lib/webchat
diff --git a/debian/whiteboard.docs b/debian/webchat.docs
index 0812baa..0812baa 100644
--- a/debian/whiteboard.docs
+++ b/debian/webchat.docs
diff --git a/debian/whiteboard.whiteboard.service b/debian/webchat.webchat.service
index b41e655..b41e655 100644
--- a/debian/whiteboard.whiteboard.service
+++ b/debian/webchat.webchat.service
diff --git a/debian/whiteboard.dirs b/debian/whiteboard.dirs
deleted file mode 100644
index 7b03c85..0000000
--- a/debian/whiteboard.dirs
+++ /dev/null
@@ -1 +0,0 @@
-var/lib/whiteboard
diff --git a/diff.cpp b/diff.cpp
deleted file mode 100644
index 6ac24e7..0000000
--- a/diff.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-#include "diff.h"
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-
-#include <boost/property_tree/xml_parser.hpp>
-
-namespace pt = boost::property_tree;
-
-Diff::Diff()
-{
-}
-
-Diff::Diff(const std::string& old_version, const std::string& new_version)
-{
- create(old_version, new_version);
-}
-
-std::string Diff::apply(const std::string& old_version) const
-{
- std::string result{old_version};
-
- if (m_pos0 <= m_pos1 && m_pos1 <= old_version.size()) {
- result.erase(m_pos0, m_pos1 - m_pos0);
- result.insert(m_pos0, m_data);
- }
-
- return result;
-}
-
-void Diff::create(const std::string& old_version, const std::string& new_version)
-{
- auto front_mismatch{std::mismatch(old_version.cbegin(), old_version.cend(), new_version.cbegin(), new_version.cend())};
- std::string::difference_type old_pos0 {front_mismatch.first - old_version.cbegin()};
- auto& new_pos0 {old_pos0};
-
- // equal
- if (old_pos0 == old_version.size() && new_pos0 == new_version.size()) {
- m_pos0 = 0;
- m_pos1 = 0;
- m_data.clear();
- return;
- }
-
- // append at end
- if (old_pos0 == old_version.size()) {
- m_pos0 = old_pos0;
- m_pos1 = old_pos0;
- m_data = new_version.substr(new_pos0);
- return;
- }
-
- // remove from end
- if (new_pos0 == new_version.size()) {
- m_pos0 = old_pos0;
- m_pos1 = old_version.size();
- m_data.clear();
- return;
- }
-
- auto back_mismatch{std::mismatch(old_version.crbegin(), old_version.crend(), new_version.crbegin(), new_version.crend())};
- // i.e. the indices starting from which we can assume equality
- size_t old_pos1 {old_version.size() - (back_mismatch.first - old_version.crbegin())};
- size_t new_pos1 {new_version.size() - (back_mismatch.second - new_version.crbegin())};
-
- // complete equality is already handled above
-
- // insert at start
- if (old_pos1 == 0) {
- m_pos0 = 0;
- m_pos1 = 0;
- m_data = new_version.substr(0, new_pos1);
- return;
- }
-
- // remove from start
- if (new_pos1 == 0) {
- m_pos0 = 0;
- m_pos1 = old_pos1;
- m_data.clear();
- return;
- }
-
- // re-adjust if search crossed
- if (old_pos0 > old_pos1) {
- old_pos0 = old_pos1;
- new_pos0 = old_pos1;
- }
- if (new_pos0 > new_pos1) {
- old_pos0 = new_pos1;
- new_pos0 = new_pos1;
- }
-
- // insert in the middle
- if (old_pos0 == old_pos1) {
- m_pos0 = old_pos0;
- m_pos1 = old_pos0;
- m_data = new_version.substr(new_pos0, new_pos1 - new_pos0);
- return;
- }
-
- // remove from the middle
- if (new_pos0 == new_pos1) {
- m_pos0 = old_pos0;
- m_pos1 = old_pos1;
- m_data.clear();
- return;
- }
-
- // last resort: remove and add in the middle
- m_pos0 = old_pos0;
- m_pos1 = old_pos1;
- m_data = new_version.substr(old_pos0, new_pos1 - new_pos0);
-}
-
-Diff::Diff(const boost::property_tree::ptree& ptree)
-{
- create(ptree);
-}
-
-void Diff::create(const boost::property_tree::ptree& ptree)
-{
- m_pos0 = ptree.get<int>("diff.start");
- m_pos1 = ptree.get<int>("diff.end");
-
- if (m_pos0 > m_pos1)
- throw std::runtime_error("Bad range in diff");
-
- m_data = ptree.get<std::string>("diff.data");
-}
-
-Diff::Diff(const std::string& xml)
-{
- create(xml);
-}
-
-void Diff::create(const std::string& xml)
-{
- pt::ptree ptree;
- std::istringstream ss{xml};
- pt::read_xml(ss, ptree);
-
- create(ptree);
-}
-
-bool Diff::empty() const
-{
- return m_pos0 == m_pos1 && m_data.empty();
-}
-
-boost::property_tree::ptree Diff::get_structure() const
-{
- pt::ptree ptree;
- ptree.put("diff.start", std::to_string(m_pos0));
- ptree.put("diff.end", std::to_string(m_pos1));
- ptree.put("diff.data", m_data);
-
- return ptree;
-}
-
-std::string Diff::get_xml() const
-{
- pt::ptree ptree{get_structure()};
-
- std::ostringstream oss;
- // write_xml_element instead of write_xml to omit <!xml...> header
- //pt::xml_parser::write_xml(oss, xml);
- pt::xml_parser::write_xml_element(oss, {}, ptree, -1, boost::property_tree::xml_writer_settings<pt::ptree::key_type>{});
- return oss.str();
-}
-
-extern "C" {
-
- const char* diff_create(const char* old_version, const char* new_version)
- {
- Diff diff{old_version, new_version};
- return strdup(diff.get_xml().c_str());
- }
-
- const char* diff_apply(const char* old_version, const char* diff)
- {
- Diff d{diff};
-
- return strdup(d.apply(old_version).c_str());
- }
-
-}
diff --git a/diff.h b/diff.h
deleted file mode 100644
index 5c2c335..0000000
--- a/diff.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include <string>
-
-#include <boost/property_tree/ptree.hpp>
-
-class Diff
-{
-public:
- Diff();
- Diff(const std::string& old_version, const std::string& new_version);
- void create(const std::string& old_version, const std::string& new_version);
-
- Diff(const boost::property_tree::ptree& ptree);
- void create(const boost::property_tree::ptree& ptree);
-
- Diff(const std::string& xml);
- void create(const std::string& xml);
-
- std::string apply(const std::string& old_version) const;
-
- bool empty() const;
-
- boost::property_tree::ptree get_structure() const;
- std::string get_xml() const;
-
-private:
- // diff replaces space from m_pos0 (inclusive) to m_pos1 (exclusive) with m_data
- size_t m_pos0{};
- size_t m_pos1{};
- std::string m_data;
-};
-
-extern "C" {
- const char* diff_create(const char* old_version, const char* new_version);
- const char* diff_apply(const char* old_version, const char* diff);
-}
diff --git a/html/index.html b/html/index.html
index b72e23b..260b1a9 100644
--- a/html/index.html
+++ b/html/index.html
@@ -3,30 +3,27 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="keywords" content="Reichwein, Whiteboard">
- <title>Reichwein Whiteboard</title>
+ <meta name="keywords" content="Reichwein, Webchat">
+ <title>Reichwein.IT Webchat</title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
- <link rel="stylesheet" type="text/css" href="whiteboard.css"/>
- <script src="libwhiteboard.js"></script>
- <script src="whiteboard.js"></script>
+ <link rel="stylesheet" type="text/css" href="webchat.css"/>
+ <script src="libwebchat.js"></script>
+ <script src="webchat.js"></script>
</head>
<body onload="init();">
<div class="qrwindow" id="qrwindow" hidden>
<img class="qrcode" id="qrcode"></img>
</div>
<div class="page">
- <h1><img class="banner" src="banner256.png" alt="Reichwein.IT"/> Whiteboard</h1>
+ <h1><img class="banner" src="banner256.png" alt="Reichwein.IT"/> Webchat</h1>
<textarea id="board" name="board"></textarea>
<br/>
<br/>
- <button class="button" onclick="on_new_page();">New page</button>
- <button class="button" onclick="on_qrcode_click();">QR code</button>
<span id="status">Starting up...</span>
<button class="buttonred" id="reconnect" onclick="on_reconnect_click();" hidden>Reconnect</button>
- <span class="helper"></span><img class="center-img clickable" onclick="on_pdf_click();" src="pdf-icon-30.png" height="37" width="30"/></span>
<br/>
<br/>
- Reichwein.IT Whiteboard <span id="version"></span> by <a href="https://www.reichwein.it">https://www.reichwein.it</a><br/>
+ Reichwein.IT Webchat <span id="version"></span> by <a href="https://www.reichwein.it">https://www.reichwein.it</a><br/>
</div>
<a id="download-a" hidden></a>
diff --git a/html/pdf-icon-100.png b/html/pdf-icon-100.png
deleted file mode 100644
index 9a20387..0000000
--- a/html/pdf-icon-100.png
+++ /dev/null
Binary files differ
diff --git a/html/pdf-icon-30.png b/html/pdf-icon-30.png
deleted file mode 100644
index 5f60d2f..0000000
--- a/html/pdf-icon-30.png
+++ /dev/null
Binary files differ
diff --git a/html/pdf-icon-50.png b/html/pdf-icon-50.png
deleted file mode 100644
index 62873ea..0000000
--- a/html/pdf-icon-50.png
+++ /dev/null
Binary files differ
diff --git a/html/pdf-icon.svg b/html/pdf-icon.svg
deleted file mode 100644
index 8b30bbb..0000000
--- a/html/pdf-icon.svg
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="75.320129mm" height="92.604164mm" viewBox="0 0 75.320129 92.604164" version="1.1" id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="PDF file icon.svg">
- <title id="title2682">PDF file icon</title>
- <defs id="defs2">
- <clipPath clipPathUnits="userSpaceOnUse" id="clipPath839">
- <rect style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" id="rect841" width="68.688263" height="67.886459" x="-74.033661" y="141.44913"/>
- </clipPath>
- </defs>
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.98994949" inkscape:cx="122.12727" inkscape:cy="167.02823" inkscape:document-units="mm" inkscape:current-layer="g899" showgrid="false" inkscape:object-nodes="false" inkscape:window-width="1366" inkscape:window-height="705" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:snap-page="false" inkscape:snap-others="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0"/>
- <metadata id="metadata5">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- <dc:title>PDF file icon</dc:title>
- <dc:date>08/10/2018</dc:date>
- <dc:creator>
- <cc:Agent>
- <dc:title>Adobe Systems</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:publisher>
- <cc:Agent>
- <dc:title>CMetalCore</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:description>Fuente del texto "PDF":
-Franklin Gothic Medium Cond</dc:description>
- <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/"/>
- </cc:Work>
- <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
- <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/>
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Capa 1" inkscape:groupmode="layer" id="layer1" transform="translate(36.076172,-93.731774)">
- <g id="g899" transform="matrix(1.4843054,0,0,1.4843054,17.471885,-90.243502)">
- <g id="g876">
- <path inkscape:connector-curvature="0" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ff2116;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.11666656;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m -29.632812,123.94727 c -3.551967,0 -6.44336,2.89347 -6.44336,6.44531 v 49.49804 c 0,3.55185 2.891393,6.44532 6.44336,6.44532 H 8.2167969 c 3.5519661,0 6.4433591,-2.89335 6.4433591,-6.44532 v -40.70117 c 0,0 0.101353,-1.19181 -0.416015,-2.35156 -0.484969,-1.08711 -1.275391,-1.84375 -1.275391,-1.84375 a 1.0584391,1.0584391 0 0 0 -0.0059,-0.008 L 3.5722246,125.7752 a 1.0584391,1.0584391 0 0 0 -0.015625,-0.0156 c 0,0 -0.8017392,-0.76344 -1.9902344,-1.27344 -1.39939552,-0.6005 -2.8417968,-0.53711 -2.8417968,-0.53711 l 0.021484,-0.002 z" id="path890"/>
- <path inkscape:connector-curvature="0" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.11666656;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m -29.632812,126.06445 h 28.3789058 a 1.0584391,1.0584391 0 0 0 0.021484,0 c 0,0 1.13480448,0.011 1.96484378,0.36719 0.79889772,0.34282 1.36536982,0.86176 1.36914062,0.86524 1.25e-5,1e-5 0.00391,0.004 0.00391,0.004 l 9.3671868,9.18945 c 0,0 0.564354,0.59582 0.837891,1.20899 0.220779,0.49491 0.234375,1.40039 0.234375,1.40039 a 1.0584391,1.0584391 0 0 0 -0.002,0.0449 v 40.74609 c 0,2.41592 -1.910258,4.32813 -4.3261717,4.32813 H -29.632812 c -2.415914,0 -4.326172,-1.91209 -4.326172,-4.32813 v -49.49804 c 0,-2.41603 1.910258,-4.32813 4.326172,-4.32813 z" id="rect2684"/>
- <path sodipodi:nodetypes="scccscccscccccssscacccsccccccccccccccccccccaccccccccc" inkscape:connector-curvature="0" d="m -23.40766,161.09299 c -1.45669,-1.45669 0.11934,-3.45839 4.39648,-5.58397 l 2.69124,-1.33743 1.04845,-2.29399 c 0.57665,-1.26169 1.43729,-3.32036 1.91254,-4.5748 l 0.8641,-2.28082 -0.59546,-1.68793 c -0.73217,-2.07547 -0.99326,-5.19438 -0.52872,-6.31588 0.62923,-1.51909 2.69029,-1.36323 3.50626,0.26515 0.63727,1.27176 0.57212,3.57488 -0.18329,6.47946 l -0.6193,2.38125 0.5455,0.92604 c 0.30003,0.50932 1.1764,1.71867 1.9475,2.68743 l 1.44924,1.80272 1.8033728,-0.23533 c 5.72900399,-0.74758 7.6912472,0.523 7.6912472,2.34476 0,2.29921 -4.4984914,2.48899 -8.2760865,-0.16423 -0.8499666,-0.59698 -1.4336605,-1.19001 -1.4336605,-1.19001 0,0 -2.3665326,0.48178 -3.531704,0.79583 -1.202707,0.32417 -1.80274,0.52719 -3.564509,1.12186 0,0 -0.61814,0.89767 -1.02094,1.55026 -1.49858,2.4279 -3.24833,4.43998 -4.49793,5.1723 -1.3991,0.81993 -2.86584,0.87582 -3.60433,0.13733 z m 2.28605,-0.81668 c 0.81883,-0.50607 2.47616,-2.46625 3.62341,-4.28553 l 0.46449,-0.73658 -2.11497,1.06339 c -3.26655,1.64239 -4.76093,3.19033 -3.98386,4.12664 0.43653,0.52598 0.95874,0.48237 2.01093,-0.16792 z m 21.21809,-5.95578 c 0.80089,-0.56097 0.68463,-1.69142 -0.22082,-2.1472 -0.70466,-0.35471 -1.2726074,-0.42759 -3.1031574,-0.40057 -1.1249,0.0767 -2.9337647,0.3034 -3.2403347,0.37237 0,0 0.993716,0.68678 1.434896,0.93922 0.58731,0.33544 2.0145161,0.95811 3.0565161,1.27706 1.02785,0.31461 1.6224,0.28144 2.0729,-0.0409 z m -8.53152,-3.54594 c -0.4847,-0.50952 -1.30889,-1.57296 -1.83152,-2.3632 -0.68353,-0.89643 -1.02629,-1.52887 -1.02629,-1.52887 0,0 -0.4996,1.60694 -0.90948,2.57394 l -1.27876,3.16076 -0.37075,0.71695 c 0,0 1.971043,-0.64627 2.97389,-0.90822 1.0621668,-0.27744 3.21787,-0.70134 3.21787,-0.70134 z m -2.74938,-11.02573 c 0.12363,-1.0375 0.1761,-2.07346 -0.15724,-2.59587 -0.9246,-1.01077 -2.04057,-0.16787 -1.85154,2.23517 0.0636,0.8084 0.26443,2.19033 0.53292,3.04209 l 0.48817,1.54863 0.34358,-1.16638 c 0.18897,-0.64151 0.47882,-2.02015 0.64411,-3.06364 z" style="fill:#ff2116;fill-opacity:1;stroke-width:0.26458335" id="path2697"/>
- <g id="g858">
- <path inkscape:connector-curvature="0" id="path845" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:'Franklin Gothic Medium Cond';-inkscape-font-specification:'Franklin Gothic Medium Cond';letter-spacing:0px;word-spacing:4.26000023px;fill:#2c2c2c;fill-opacity:1;stroke:none;stroke-width:0.35824656px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m -20.930423,167.83862 h 2.364986 q 1.133514,0 1.840213,0.2169 0.706698,0.20991 1.189489,0.9446 0.482795,0.72769 0.482795,1.75625 0,0.94459 -0.391832,1.6233 -0.391833,0.67871 -1.056548,0.97958 -0.65772,0.30087 -2.02913,0.30087 h -0.818651 v 3.72941 h -1.581322 z m 1.581322,1.22447 v 3.33058 h 0.783664 q 1.049552,0 1.44838,-0.39184 0.405826,-0.39183 0.405826,-1.27345 0,-0.65772 -0.265887,-1.06355 -0.265884,-0.41282 -0.587747,-0.50378 -0.314866,-0.098 -1.000572,-0.098 z"/>
- <path inkscape:connector-curvature="0" id="path847" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:'Franklin Gothic Medium Cond';-inkscape-font-specification:'Franklin Gothic Medium Cond';letter-spacing:0px;word-spacing:4.26000023px;fill:#2c2c2c;fill-opacity:1;stroke:none;stroke-width:0.35824656px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m -13.842461,167.83862 h 2.148082 q 1.560333,0 2.4909318,0.55276 0.9375993,0.55276 1.4133973,1.6443 0.482791,1.09153 0.482791,2.42096 0,1.3994 -0.4338151,2.49793 -0.4268149,1.09153 -1.3154348,1.76324 -0.8816233,0.67172 -2.5189212,0.67172 h -2.267031 z m 1.581326,1.26645 v 7.018 h 0.657715 q 1.378411,0 2.001144,-0.9516 0.6227329,-0.95858 0.6227329,-2.5539 0,-3.5125 -2.6238769,-3.5125 z"/>
- <path inkscape:connector-curvature="0" id="path849" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:'Franklin Gothic Medium Cond';-inkscape-font-specification:'Franklin Gothic Medium Cond';letter-spacing:0px;word-spacing:4.26000023px;fill:#2c2c2c;fill-opacity:1;stroke:none;stroke-width:0.35824656px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m -5.7889096,167.83862 h 5.30372941 v 1.26645 H -4.2075842 v 2.85478 h 2.9807225 v 1.26646 h -2.9807225 v 4.16322 h -1.5813254 z"/>
- </g>
- </g>
- </g>
- </g>
-</svg> \ No newline at end of file
diff --git a/html/stats.html b/html/stats.html
index 3f7e141..9501c18 100644
--- a/html/stats.html
+++ b/html/stats.html
@@ -18,7 +18,7 @@
<h2>Statistics</h2>
<table>
<tr><td>Active Connections:</td><td id="numberofconnections" align="right"></td><td></td></tr>
- <tr><td>Number of Documents:</td><td id="numberofdocuments" align="right"></td><td></td></tr>
+ <tr><td>Number of Users:</td><td id="numberofusers" align="right"></td><td></td></tr>
<tr><td>Database Size (gross):</td><td id="dbsizegross" align="right"></td><td>Bytes</td></tr>
<tr><td>Database Size (net):</td><td id="dbsizenet" align="right"></td><td>Bytes</td></tr>
</table>
diff --git a/html/stats.js b/html/stats.js
index 89c674a..4174877 100644
--- a/html/stats.js
+++ b/html/stats.js
@@ -20,9 +20,9 @@ var websocket;
// Callbacks for websocket data of different types
//
-function on_stats(numberofdocuments, numberofconnections, dbsizegross, dbsizenet)
+function on_stats(numberofusers, numberofconnections, dbsizegross, dbsizenet)
{
- document.getElementById("numberofdocuments").textContent = numberofdocuments;
+ document.getElementById("numberofusers").textContent = numberofusers;
document.getElementById("numberofconnections").textContent = numberofconnections;
document.getElementById("dbsizegross").textContent = dbsizegross;
document.getElementById("dbsizenet").textContent = dbsizenet;
@@ -40,7 +40,7 @@ function on_message(e) {
var type = xmlDocument.getElementsByTagName("type")[0].textContent;
if (type == "stats") {
- on_stats(xmlDocument.getElementsByTagName("numberofdocuments")[0].textContent,
+ on_stats(xmlDocument.getElementsByTagName("numberofusers")[0].textContent,
xmlDocument.getElementsByTagName("numberofconnections")[0].textContent,
xmlDocument.getElementsByTagName("dbsizegross")[0].textContent,
xmlDocument.getElementsByTagName("dbsizenet")[0].textContent);
diff --git a/html/whiteboard.css b/html/webchat.css
index 2d222d5..2d222d5 100644
--- a/html/whiteboard.css
+++ b/html/webchat.css
diff --git a/html/whiteboard.js b/html/webchat.js
index 379c757..379c757 100644
--- a/html/whiteboard.js
+++ b/html/webchat.js
diff --git a/main.cpp b/main.cpp
index e1c1cf1..6a27658 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,8 +1,8 @@
-#include "whiteboard.h"
+#include "webchat.h"
int main(int argc, char* argv[])
{
- Whiteboard whiteboard;
- return whiteboard.run(argc, argv);
+ Webchat webchat;
+ return webchat.run(argc, argv);
}
diff --git a/qrcode.cpp b/qrcode.cpp
deleted file mode 100644
index da747a5..0000000
--- a/qrcode.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "qrcode.h"
-
-#include <fmt/format.h>
-
-#include <qrcodegen/QrCode.hpp>
-
-#include <Magick++.h>
-
-using namespace qrcodegen;
-using namespace Magick;
-
-void QRCode::init()
-{
- Magick::InitializeMagick(NULL);
-}
-
-std::string QRCode::getQRCode(const std::string& data)
-{
- QrCode qrc {QrCode::encodeText(data.c_str(), QrCode::Ecc::MEDIUM)};
-
- int size {qrc.getSize()};
-
- Image image(fmt::format("{0}x{0}", size).c_str(), "white");
- image.type(GrayscaleType);
-
- for (int x = 0; x < size; x++) {
- for (int y = 0; y < size; y++) {
- image.pixelColor(x, y, qrc.getModule(x, y) ? "black" : "white");
- }
- }
-
- image.magick("PNG");
-
- Blob blob;
- image.write(&blob);
- return std::string{(char*)blob.data(), blob.length()};
-}
diff --git a/qrcode.h b/qrcode.h
deleted file mode 100644
index f37c318..0000000
--- a/qrcode.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include <string>
-
-namespace QRCode
-{
- void init();
-
- // returns PNG file contents
- std::string getQRCode(const std::string& data);
-}
diff --git a/tests/Makefile b/tests/Makefile
index f3ec6c8..44c884a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -11,15 +11,13 @@ CXXFLAGS+=--coverage
LDFLAGS+=--coverage
endif
-UNITS=storage.cpp config.cpp compiledsql.cpp qrcode.cpp whiteboard.cpp connectionregistry.cpp diff.cpp
+UNITS=storage.cpp config.cpp compiledsql.cpp webchat.cpp connectionregistry.cpp
UNITTESTS=test-config.cpp \
test-storage.cpp \
test-connectionregistry.cpp \
test-compiledsql.cpp \
- test-qrcode.cpp \
- test-whiteboard.cpp \
- test-diff.cpp
+ test-webchat.cpp
CXXFLAGS+=\
-I/usr/src/googletest/googletest/include \
@@ -54,19 +52,13 @@ config.o: ../config.cpp
connectionregistry.o: ../connectionregistry.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
-diff.o: ../diff.cpp
- $(CXX) $(CXXFLAGS) -o $@ -c $<
-
storage.o: ../storage.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
compiledsql.o: ../compiledsql.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
-whiteboard.o: ../whiteboard.cpp
- $(CXX) $(CXXFLAGS) -o $@ -c $<
-
-qrcode.o: ../qrcode.cpp
+webchat.o: ../webchat.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
libgmock.a:
diff --git a/tests/test-diff.cpp b/tests/test-diff.cpp
deleted file mode 100644
index d09c58e..0000000
--- a/tests/test-diff.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-#include <gtest/gtest.h>
-
-#include <filesystem>
-#include <string>
-#include <system_error>
-
-#include <stdlib.h>
-
-#include <boost/property_tree/ptree.hpp>
-
-#include "libreichwein/file.h"
-
-#include "diff.h"
-
-namespace fs = std::filesystem;
-namespace pt = boost::property_tree;
-using namespace Reichwein;
-
-class DiffTest: public ::testing::Test
-{
-protected:
- DiffTest(){
- }
-
- ~DiffTest(){
- }
-};
-
-TEST_F(DiffTest, constructor)
-{
- // empty constructor
- {
- Diff d{};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data/></diff>");
- }
-
- // constructor via xml diff
- {
- EXPECT_THROW(Diff d{""}, std::exception);
- }
- {
- EXPECT_THROW(Diff d{"<diff><begin></begin></diff>"}, std::exception);
- EXPECT_THROW(Diff d{"<diff><end>0</end><data>abc</data></diff>"}, std::exception);
- EXPECT_THROW(Diff d{"<diff><start>0</start><data>abc</data></diff>"}, std::exception);
- EXPECT_THROW(Diff d{"<diff><start>0</start><end>0</end></diff>"}, std::exception);
- EXPECT_THROW(Diff d{"<diff><start>5</start><end>0</end><data>abc</data></diff>"}, std::exception);
- EXPECT_THROW(Diff d{"<diff><start></start><end>0</end><data>abc</data></diff>"}, std::exception);
- }
-
- {
- Diff d{"<diff><start>0</start><end>0</end><data>abc</data></diff>"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data>abc</data></diff>");
- }
-
- {
- Diff d{"<diff><start>5</start><end>5</end><data>abc</data></diff>"};
- EXPECT_EQ(d.get_xml(), "<diff><start>5</start><end>5</end><data>abc</data></diff>");
- }
-
- {
- Diff d{"<diff><start>5</start><end>50</end><data>abc</data></diff>"};
- EXPECT_EQ(d.get_xml(), "<diff><start>5</start><end>50</end><data>abc</data></diff>");
- }
-
- // constructor via ptree
- {
- pt::ptree ptree;
- EXPECT_THROW(Diff d{ptree}, std::exception);
-
- ptree.put("diff.start", 0);
- ptree.put("diff.end", 0);
- ptree.put("diff.data", "abc");
- Diff d{ptree};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data>abc</data></diff>");
- }
-
- // constructor via versions
- {
- Diff d{"", ""};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data/></diff>");
- }
- {
- Diff d{"a", "a"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data/></diff>");
- }
- {
- Diff d{"a", "b"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>1</end><data>b</data></diff>");
- }
- {
- Diff d{"0a1", "0b1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>2</end><data>b</data></diff>");
- }
- {
- Diff d{"0abc1", "00b01"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>4</end><data>0b0</data></diff>");
- }
- {
- Diff d{"0ab1", "00b01"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>3</end><data>0b0</data></diff>");
- }
- {
- Diff d{"0abc1", "00b1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>4</end><data>0b</data></diff>");
- }
- {
- Diff d{"0abc1", ""};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>5</end><data/></diff>");
- }
- {
- Diff d{"bc1", "0abc1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data>0a</data></diff>");
- }
- {
- Diff d{"0abc1", "0ab"};
- EXPECT_EQ(d.get_xml(), "<diff><start>3</start><end>5</end><data/></diff>");
- }
- {
- Diff d{"0abc1", "0abc123"};
- EXPECT_EQ(d.get_xml(), "<diff><start>5</start><end>5</end><data>23</data></diff>");
- }
- {
- Diff d{"0abc1", "010abc1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>0</end><data>01</data></diff>");
- }
- {
- Diff d{"0abc1", "0ac1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>2</start><end>3</end><data/></diff>");
- }
- {
- Diff d{"0abc1", "0abxc1"};
- EXPECT_EQ(d.get_xml(), "<diff><start>3</start><end>3</end><data>x</data></diff>");
- }
- {
- Diff d{"abc", "c"};
- EXPECT_EQ(d.get_xml(), "<diff><start>0</start><end>2</end><data/></diff>");
- }
- {
- Diff d{"aaaa", "aa"};
- EXPECT_EQ(d.get_xml(), "<diff><start>2</start><end>4</end><data/></diff>");
- }
- {
- Diff d{"baaaa", "baa"};
- EXPECT_EQ(d.get_xml(), "<diff><start>3</start><end>5</end><data/></diff>");
- }
- {
- Diff d{"baaaab", "baab"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>3</end><data/></diff>");
- }
- {
- Diff d{"baaaab", "baaaaaaab"};
- EXPECT_EQ(d.get_xml(), "<diff><start>1</start><end>1</end><data>aaa</data></diff>");
- }
-}
-
-TEST_F(DiffTest, empty)
-{
- {
- Diff d;
- EXPECT_TRUE(d.empty());
- }
-
- {
- Diff d{"<diff><start>1</start><end>3</end><data/></diff>"};
- EXPECT_FALSE(d.empty());
- }
-
- {
- Diff d{"<diff><start>1</start><end>1</end><data/></diff>"};
- EXPECT_TRUE(d.empty());
- }
-
- {
- Diff d{"<diff><start>1</start><end>1</end><data>abc</data></diff>"};
- EXPECT_FALSE(d.empty());
- }
-
- {
- Diff d{"<diff><start>0</start><end>0</end><data/></diff>"};
- EXPECT_TRUE(d.empty());
- }
-}
-
-TEST_F(DiffTest, diff_create)
-{
- const char* result {diff_create("0abc1", "0ab")};
-
- EXPECT_EQ(std::string(result), "<diff><start>3</start><end>5</end><data/></diff>");
- free((void*)result); // this will be done by javascript side in real scenario
-}
-
-TEST_F(DiffTest, diff_apply)
-{
- const char* result {diff_apply("0abc1", "<diff><start>3</start><end>5</end><data/></diff>")};
-
- EXPECT_EQ(std::string(result), "0ab");
- free((void*)result); // this will be done by javascript side in real scenario
-}
-
diff --git a/tests/test-qrcode.cpp b/tests/test-qrcode.cpp
deleted file mode 100644
index 96cfdb0..0000000
--- a/tests/test-qrcode.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-#include <gtest/gtest.h>
-
-#include <filesystem>
-#include <memory>
-#include <string>
-#include <system_error>
-
-#include "libreichwein/file.h"
-
-#include "qrcode.h"
-
-namespace fs = std::filesystem;
-
-class QRCodeTest: public ::testing::Test
-{
-protected:
- QRCodeTest(){
- }
-
- ~QRCodeTest() override{
- }
-
- void SetUp() override
- {
- QRCode::init();
- }
-
- void TearDown() override
- {
- }
-
-};
-
-TEST_F(QRCodeTest, empty)
-{
- unsigned char empty_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
- 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x15,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xec, 0x26, 0x09, 0x00, 0x00, 0x00,
- 0xa7, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x7d, 0x92, 0x4b, 0x12, 0xc3,
- 0x30, 0x08, 0x43, 0x79, 0x99, 0xde, 0xff, 0xca, 0xea, 0x82, 0x51, 0xf9,
- 0xc4, 0xae, 0x17, 0x89, 0x01, 0x03, 0x02, 0x89, 0x18, 0x47, 0x8a, 0x00,
- 0x29, 0x2d, 0xe8, 0xb1, 0x4f, 0x86, 0x7b, 0x48, 0x02, 0x7b, 0x57, 0xcc,
- 0xa6, 0xd4, 0x43, 0xd3, 0x96, 0x22, 0x9e, 0x38, 0x9e, 0x9e, 0xe2, 0xf3,
- 0x9c, 0x1f, 0x15, 0xde, 0x81, 0xf5, 0x5d, 0x43, 0x02, 0x3f, 0x3e, 0xd5,
- 0x1f, 0xf8, 0x36, 0xee, 0x88, 0x08, 0xae, 0x59, 0x37, 0xac, 0x00, 0xfe,
- 0xee, 0x9d, 0x76, 0x6f, 0x48, 0x52, 0xb5, 0xcc, 0x7b, 0xfd, 0xed, 0x1f,
- 0x1b, 0xa8, 0xec, 0x64, 0x6d, 0x51, 0x31, 0xab, 0x15, 0xf2, 0xb2, 0xdc,
- 0x91, 0x4e, 0x24, 0x48, 0x7d, 0xa3, 0x53, 0x03, 0xaf, 0x0d, 0x54, 0xd3,
- 0x9b, 0x6c, 0x16, 0xa1, 0x7b, 0x34, 0x29, 0x82, 0xa9, 0x9e, 0x84, 0x61,
- 0xc6, 0x66, 0xfd, 0xc7, 0x9b, 0x73, 0x93, 0x2d, 0xc0, 0xf4, 0xc3, 0x1f,
- 0x65, 0xf1, 0x1b, 0xd8, 0x30, 0xae, 0xca, 0x9a, 0x83, 0x02, 0x1c, 0x94,
- 0xe5, 0x4d, 0x27, 0x42, 0x57, 0x3e, 0x34, 0xde, 0x74, 0x16, 0xf2, 0x2f,
- 0x2f, 0xd5, 0xa5, 0xd0, 0x5a, 0x61, 0xde, 0x49, 0x00, 0x00, 0x00, 0x00,
- 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
- };
- // Test prepared with:
- //File::setFile("empty.png", QRCode::getQRCode(""));
- //then: xxd -i tests/empty.png >> tests/test-qrcode.cpp
-
- EXPECT_EQ(QRCode::getQRCode(""), std::string(reinterpret_cast<char*>(&empty_png[0]), sizeof(empty_png)));
-}
-
-TEST_F(QRCodeTest, simple)
-{
- unsigned char simple_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
- 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x15,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xec, 0x26, 0x09, 0x00, 0x00, 0x00,
- 0xa5, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x75, 0x52, 0xd1, 0x0e, 0xc0,
- 0x40, 0x04, 0x6b, 0x17, 0xff, 0xff, 0xcb, 0xf6, 0xe0, 0x4c, 0x39, 0x93,
- 0x6c, 0x09, 0x47, 0x55, 0x01, 0x9a, 0xb9, 0xbb, 0xbb, 0x03, 0xf9, 0xa9,
- 0x99, 0x86, 0x48, 0x80, 0x8c, 0xe4, 0x2c, 0xd5, 0xb7, 0xcf, 0x2d, 0xa4,
- 0xfa, 0xeb, 0x9b, 0x61, 0xb5, 0xd9, 0x1c, 0x00, 0x9e, 0x2d, 0x2d, 0x88,
- 0xcc, 0xb8, 0xdd, 0x18, 0xa4, 0x3b, 0xa9, 0xad, 0x7f, 0x1b, 0xff, 0x29,
- 0xc0, 0xbd, 0x8a, 0x5c, 0xf0, 0x52, 0xc7, 0x2e, 0x90, 0x2a, 0x91, 0x51,
- 0x4b, 0xfa, 0xc9, 0x2e, 0xfc, 0x40, 0x55, 0x6c, 0xb2, 0xe1, 0xf5, 0x4e,
- 0xd3, 0x7f, 0xaa, 0xf2, 0xa6, 0x52, 0x24, 0x48, 0x77, 0xd9, 0xfa, 0x9c,
- 0x7c, 0xae, 0xf7, 0x52, 0xa0, 0xab, 0xaa, 0x71, 0xeb, 0x5b, 0xa9, 0x21,
- 0xfa, 0x50, 0x67, 0x5b, 0xe3, 0x7a, 0xd0, 0x67, 0x8f, 0x0e, 0xe4, 0x59,
- 0x6c, 0xa4, 0x94, 0x96, 0xda, 0x29, 0xca, 0x80, 0xf5, 0x5c, 0x52, 0x53,
- 0x3d, 0x9a, 0xa3, 0xcb, 0x7d, 0xaf, 0x93, 0xf9, 0xa1, 0xd2, 0xb9, 0xea,
- 0xc6, 0x92, 0xf1, 0x7a, 0x0f, 0xaa, 0xee, 0x8c, 0x03, 0x2f, 0x88, 0x71,
- 0xb5, 0xba, 0xf0, 0x88, 0xba, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
- 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
- };
- // Test prepared with:
- //File::setFile("simple.png", QRCode::getQRCode("abc"));
- //then: xxd -i tests/simple.png >> tests/test-qrcode.cpp
- EXPECT_EQ(QRCode::getQRCode("abc"), std::string(reinterpret_cast<char*>(&simple_png[0]), sizeof(simple_png)));
-}
-
-TEST_F(QRCodeTest, url)
-{
- unsigned char url_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
- 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x23, 0x68, 0xe4, 0x90, 0x00, 0x00, 0x01,
- 0x1f, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x75, 0x54, 0xdb, 0x0e, 0xc5,
- 0x30, 0x08, 0x92, 0xa5, 0xff, 0xff, 0xcb, 0x9c, 0x07, 0xe7, 0x41, 0xb4,
- 0x6b, 0xb2, 0x64, 0x36, 0x5e, 0xa8, 0xa0, 0x11, 0x76, 0xc8, 0x08, 0x92,
- 0x24, 0xcb, 0xde, 0x7f, 0x75, 0x4e, 0xba, 0xe7, 0x01, 0x22, 0x48, 0x20,
- 0xbf, 0xb4, 0x2b, 0xe1, 0xfc, 0x03, 0x4e, 0x85, 0xd4, 0x75, 0x06, 0xe5,
- 0xbf, 0xc2, 0xf3, 0xd6, 0x7d, 0x9f, 0x58, 0x07, 0x50, 0xbd, 0xc2, 0x11,
- 0x97, 0xb3, 0x42, 0x3b, 0xd0, 0xb4, 0x33, 0x7c, 0x87, 0x1e, 0x7f, 0x81,
- 0xd7, 0x51, 0x0a, 0x01, 0xbe, 0x25, 0x69, 0x1d, 0xfe, 0xfe, 0xac, 0xea,
- 0x2d, 0x8b, 0x57, 0x50, 0xed, 0xe1, 0xbb, 0x73, 0x3a, 0xaf, 0x65, 0x7b,
- 0xba, 0xd7, 0xea, 0x64, 0x94, 0x93, 0x1c, 0x2a, 0xd8, 0xd3, 0x92, 0x7f,
- 0x95, 0xec, 0x90, 0xa9, 0x9f, 0xb2, 0x94, 0xee, 0x88, 0xf4, 0xba, 0x72,
- 0x4e, 0xf5, 0x5a, 0x69, 0x6b, 0xf0, 0xdc, 0x6b, 0xf8, 0x4b, 0x85, 0xac,
- 0x3f, 0x8a, 0x7c, 0xba, 0x0c, 0x66, 0x78, 0xe7, 0x55, 0xdc, 0x96, 0xda,
- 0x5e, 0x99, 0x2b, 0x38, 0xc5, 0x3f, 0x61, 0x6d, 0x0a, 0x81, 0xf0, 0x56,
- 0x4c, 0x4e, 0x7d, 0xe4, 0x7c, 0x24, 0x9f, 0x39, 0x74, 0xe5, 0x86, 0x86,
- 0x87, 0x04, 0x2e, 0x23, 0xd0, 0xdb, 0x20, 0x8a, 0xe6, 0x60, 0x4f, 0x91,
- 0x7c, 0x32, 0xe6, 0x2f, 0xdc, 0x12, 0x79, 0x31, 0x0a, 0x56, 0xe7, 0xb2,
- 0xef, 0x07, 0x98, 0x8f, 0x8d, 0xe0, 0x6c, 0xd4, 0x04, 0xb6, 0xe1, 0xbf,
- 0xc2, 0x98, 0x97, 0x5d, 0x43, 0xaa, 0x5f, 0xdb, 0xca, 0x6f, 0x57, 0xd3,
- 0xee, 0xe4, 0xec, 0x3e, 0x9c, 0x4d, 0x8e, 0x81, 0xc2, 0x2d, 0x5d, 0x56,
- 0x7e, 0x32, 0x44, 0xbc, 0xed, 0x6a, 0x1a, 0x87, 0xf4, 0x2a, 0xe8, 0x6b,
- 0xad, 0x75, 0x51, 0xfa, 0x66, 0xf4, 0x07, 0x01, 0x97, 0x8d, 0x08, 0x90,
- 0x09, 0xb5, 0xef, 0x64, 0xe7, 0xbf, 0x49, 0x62, 0x8e, 0xfa, 0xec, 0xfb,
- 0x26, 0xad, 0x8d, 0xba, 0x3b, 0xf5, 0xf6, 0xf8, 0x22, 0x95, 0xf7, 0x0f,
- 0x4c, 0x20, 0xaf, 0x2d, 0xca, 0xaf, 0x0d, 0xc5, 0x00, 0x00, 0x00, 0x00,
- 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
- };
- // Test prepared with:
- //File::setFile("url.png", QRCode::getQRCode("https://reichwein.it/whiteboard"));
- //then: xxd -i tests/url.png >> tests/test-qrcode.cpp
- EXPECT_EQ(QRCode::getQRCode("https://reichwein.it/whiteboard"), std::string(reinterpret_cast<char*>(&url_png[0]), sizeof(url_png)));
-}
-
-TEST_F(QRCodeTest, deterministic)
-{
- EXPECT_EQ(QRCode::getQRCode("data1"), QRCode::getQRCode("data1"));
-}
-
-TEST_F(QRCodeTest, different_data)
-{
- EXPECT_NE(QRCode::getQRCode("data1"), QRCode::getQRCode("data2"));
-}
diff --git a/tests/test-whiteboard.cpp b/tests/test-webchat.cpp
index 3f70bcf..3f70bcf 100644
--- a/tests/test-whiteboard.cpp
+++ b/tests/test-webchat.cpp
diff --git a/webassembly/Makefile b/webassembly/Makefile
index 0487d2a..33d16ea 100644
--- a/webassembly/Makefile
+++ b/webassembly/Makefile
@@ -1,4 +1,4 @@
-TARGET=libwhiteboard.wasm
+TARGET=libwebchat.wasm
TARGETJS=$(TARGET:.wasm=.js)
OBJS=diff.o
diff --git a/whiteboard.conf b/webchat.conf
index 4622db9..2a08527 100644
--- a/whiteboard.conf
+++ b/webchat.conf
@@ -1,19 +1,19 @@
<config>
<!--
- datapath: location in filesystem to store whiteboard data
- Example: /var/lib/whiteboard
+ datapath: location in filesystem to store webchat data
+ Example: /var/lib/webchat
-->
- <datapath>/var/lib/whiteboard</datapath>
+ <datapath>/var/lib/webchat</datapath>
<!--
port: socket to listen on for websocket
- Example: ::1:8765
+ Example: ::1:8767
-->
- <port>::1:9014</port>
+ <port>::1:9015</port>
<!--
- Maximum age of individual whiteboard pages in seconds.
- Older pages will be removed by whiteboard-cleanup and crond.
+ Maximum age of individual webchat pages in seconds.
+ Older pages will be removed by webchat-cleanup and crond.
Example: 2592000 (~30 days)
-->
<maxage>2592000</maxage>
diff --git a/whiteboard.cpp b/webchat.cpp
index 8fb5415..c752ae0 100644
--- a/whiteboard.cpp
+++ b/webchat.cpp
@@ -1,4 +1,4 @@
-#include "whiteboard.h"
+#include "webchat.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/whiteboard.h b/webchat.h
index 53036ac..cfec920 100644
--- a/whiteboard.h
+++ b/webchat.h
@@ -12,10 +12,10 @@
#include "connectionregistry.h"
#include "storage.h"
-class Whiteboard
+class Webchat
{
public:
- Whiteboard();
+ Webchat();
int run(int argc, char* argv[]);
private:
diff --git a/webserver.conf.example b/webserver.conf.example
index 9193a5b..2ddd679 100644
--- a/webserver.conf.example
+++ b/webserver.conf.example
@@ -1,8 +1,8 @@
- <path requested="/whiteboard">
+ <path requested="/webchat">
<plugin>static-files</plugin>
- <target>/usr/lib/whiteboard/html</target>
+ <target>/usr/lib/webchat/html</target>
</path>
- <path requested="/whiteboard/websocket">
+ <path requested="/webchat/websocket">
<plugin>websocket</plugin>
- <target>127.0.0.1:9014</target>
+ <target>127.0.0.1:9015</target>
</path>