summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2021-09-13 14:20:54 +0200
committerJannik Schönartz2021-09-13 14:20:54 +0200
commit7de45d5587eb91b7a033f7238fc61a8c817946c0 (patch)
tree8544462e8874853e5007058261d4d5c91f09d0ae
parentMore size fixing crap (diff)
downloadslxgreeter-7de45d5587eb91b7a033f7238fc61a8c817946c0.tar.gz
slxgreeter-7de45d5587eb91b7a033f7238fc61a8c817946c0.tar.xz
slxgreeter-7de45d5587eb91b7a033f7238fc61a8c817946c0.zip
If lectureID was sent, create an override config file to autostart the lecture
-rw-r--r--src/loginrpc.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/loginrpc.cpp b/src/loginrpc.cpp
index a4e61fc..320cdfd 100644
--- a/src/loginrpc.cpp
+++ b/src/loginrpc.cpp
@@ -7,6 +7,11 @@
#include <QProcess>
#include <QRegularExpression>
+#include <QDir>
+#include <QFile>
+#include <QTextStream>
+#include <QIODevice>
+
LoginRpc::LoginRpc(int port, QObject *parent)
: QObject(parent)
{
@@ -41,7 +46,7 @@ void LoginRpc::handleIncoming(QTcpSocket *sock) {
void LoginRpc::handleCommandV1(const QString &command)
{
QStringList lines = command.split('\n');
- while (lines.count() < 3) {
+ while (lines.count() < 4) {
lines.append(QString());
}
QString res = lines[2];
@@ -129,5 +134,23 @@ void LoginRpc::handleCommandV1(const QString &command)
}
}
}
+
+ // If lectureId was sent, create a file that overrides the SLX_AUTOSTART_UUID
+ if (lines[3] != "") {
+ // File will be created at /var/lib/lightdm/config_overrides/SLX_AUTOSTART_UUID
+ QString path = "config_override/";
+ QFile file(path + "SLX_AUTOSTART_UUID");
+
+ QDir dir;
+ if (!dir.exists(path)) {
+ dir.mkdir(path);
+ }
+ if (file.open(QIODevice::ReadWrite)) {
+ QTextStream stream(&file);
+ stream << lines[3] << "\n";
+ file.close();
+ }
+ }
+
emit loginRequest(lines[0], lines[1], lines[2]);
}