Neuer Stuff

This commit is contained in:
Simon Martens
2023-09-12 11:33:54 +02:00
parent c26a0c7267
commit 27200a80a6
8 changed files with 87 additions and 14 deletions

View File

@@ -8,7 +8,7 @@
<div class="ha-static-right-margin">
<h1>Mitwirkende</h1>
<h3>Herausgeber</h3>
Dr. Janina Reiblod<br>
Dr. Janina Reibold<br>
Leonard Keidel
<h3>Philologische Mitarbeit</h3>

View File

@@ -69,9 +69,14 @@ public class WebSocketMiddleware : IMiddleware {
_openSockets!.Add(webSocket);
WebSocketReceiveResult result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
while (!result.CloseStatus.HasValue) {
var msg = Encoding.UTF8.GetString(buffer,0,result.Count);
if (msg.ToLower() == "hello") {
var state = _xmlProvider.GetGitState();
await webSocket.SendAsync(_SerializeToBytes(state), WebSocketMessageType.Text, true, CancellationToken.None);
await webSocket.SendAsync(_SerializeToBytes(new FileState(_xmlService.GetState())), result.MessageType, true, CancellationToken.None);
await webSocket.SendAsync(_SerializeToBytes(new FileState(_xmlService.GetState())), WebSocketMessageType.Text, true, CancellationToken.None);
} else if (msg.ToLower() == "ping" ) {
await webSocket.SendAsync(_SerializeToBytes(new { Ping = true}), WebSocketMessageType.Text, true, CancellationToken.None);
}
result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
}
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);

View File

@@ -0,0 +1,31 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"FeatureManagement": {
"AdminService": true,
"LocalPublishService": true,
"SyntaxCheck": true,
"Notifications": true
},
"AllowedWebSocketConnections": "*",
"AllowedHosts": "*",
"HamannFileStoreLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Hamann/",
"HamannFileStoreWindows": "C:/Users/simon/Downloads/test/",
"BareRepositoryPathLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Bare/",
"BareRepositoryPathWindows": "C:/Users/simon/source/hamann-xml/.git/",
"WorkingTreePathLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Repo/",
"WorkingTreePathWindows": "C:/Users/simon/source/hamann-xml/",
"RepositoryBranch": "testdata",
"RepositoryURL": "https://github.com/Theodor-Springmann-Stiftung/hamann-xml",
"StoredPDFPathWindows": "",
"StoredPDFPathLinux": "",
"FileSizeLimit": 52428800,
"AvailableStartYear": 1700,
"AvailableEndYear": 1800,
"LettersOnPage": 80
}

View File

@@ -0,0 +1,29 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"FeatureManagement": {
"AdminService": true,
"LocalPublishService": true,
"SyntaxCheck": true,
"Notifications": true
},
"AllowedWebSocketConnections": "*",
"AllowedHosts": "*",
"HamannFileStoreLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Hamann/",
"BareRepositoryPathLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Bare/",
"BareRepositoryPathWindows": "C:/Users/simon/source/hamann-xml/.git/",
"WorkingTreePathLinux": "/var/www/vhosts/development.hamann-ausgabe.de/httpdocs/Repo/",
"RepositoryBranch": "main",
"RepositoryURL": "https://github.com/Theodor-Springmann-Stiftung/hamann-xml",
"StoredPDFPathWindows": "",
"StoredPDFPathLinux": "",
"FileSizeLimit": 52428800,
"AvailableStartYear": 1700,
"AvailableEndYear": 1800,
"LettersOnPage": 80
}

View File

@@ -13,13 +13,11 @@
},
"AllowedWebSocketConnections": "*",
"AllowedHosts": "*",
"HamannFileStoreLinux": "/var/www/vhosts/test.hamann-ausgabe.de/httpdocs/Hamann/",
"HamannFileStoreWindows": "C:/Users/simon/Downloads/test/",
"BareRepositoryPathLinux": "/var/www/vhosts/test.hamann-ausgabe.de/httpdocs/Bare/",
"HamannFileStoreLinux": "/var/www/vhosts/hamann-ausgabe.de/httpdocs/Hamann/",
"BareRepositoryPathLinux": "/var/www/vhosts/hamann-ausgabe.de/httpdocs/Bare/",
"BareRepositoryPathWindows": "C:/Users/simon/source/hamann-xml/.git/",
"WorkingTreePathLinux": "/var/www/vhosts/test.hamann-ausgabe.de/httpdocs/Repo/",
"WorkingTreePathWindows": "C:/Users/simon/source/hamann-xml/",
"RepositoryBranch": "testdata",
"WorkingTreePathLinux": "/var/www/vhosts/hamann-ausgabe.de/httpdocs/Repo/",
"RepositoryBranch": "Release",
"RepositoryURL": "https://github.com/Theodor-Springmann-Stiftung/hamann-xml",
"StoredPDFPathWindows": "",
"StoredPDFPathLinux": "",

2
HaWeb/commands.txt Normal file
View File

@@ -0,0 +1,2 @@
rm .\bin\Release\net6.0\linux-x64\publish\appsettings.json
scp -r -i C:\Users\simon\.ssh\id_tss .\bin\Release\net6.0\linux-x64\publish\* admin@astra.tss-hd.de:~/publish/

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,7 @@ var stateSC = null;
var stateValidation = null;
var stateReload = null;
var stateCommit = null;
var statePing = false;
var firstMessage = true;
var commsLog = document.getElementById("commsLog");
var commsNot = document.getElementById("comm-notifications");
@@ -9,7 +10,7 @@ var socket;
var scheme = document.location.protocol === "https:" ? "wss" : "ws";
var port = document.location.port ? (":" + document.location.port) : "";
var wsPingInterval;
var connectionUrl = scheme + "://" + document.location.hostname + port + "/WS" ;
function htmlEscape(str) {
@@ -25,9 +26,13 @@ function htmlEscape(str) {
socket = new WebSocket(connectionUrl);
socket.onopen = function (event) {
socket.send("Hello");
wsPingInterval = setInterval(() => {
socket.send("Ping");
}, 4500);
updateMessage();
};
socket.onclose = function (event) {
clearInterval(wsPingInterval);
updateMessage();
};
socket.onerror = updateMessage;
@@ -66,15 +71,18 @@ socket.onmessage = function (event) {
} else if (msg.reload != null) {
stateReload = msg.reload;
if (msg.reload) {
commsLog.innerHTML = 'Seite wird neu geladen.';
commsNot.classList.add("imp");
setTimeout(() => {
commsNot.remove();
socket.close(1000, "bye");
location.reload();
}, 1500);
}, 2000);
}
} else if (msg.SC != null) {
stateSC = msg.SC;
} else if (msg.Ping != null) {
statePing = true;
} else {
commsLog.innerHTML = htmlEscape(event.data);
}