mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
Small Stuff
This commit is contained in:
@@ -23,7 +23,7 @@ Note that nodejs is used only as a build tool for css (and possibly in the futur
|
|||||||
|
|
||||||
## Development tools
|
## Development tools
|
||||||
|
|
||||||
Run
|
Set the `DOTNET_ENVIRONMENT` variable to `Development`. Run
|
||||||
|
|
||||||
`dotnet watch run` and
|
`dotnet watch run` and
|
||||||
|
|
||||||
@@ -47,6 +47,16 @@ For a Linux server run:
|
|||||||
|
|
||||||
`dotnet publish --runtime linux-x64 -c Release`
|
`dotnet publish --runtime linux-x64 -c Release`
|
||||||
|
|
||||||
|
In the appropriate settings (set the `DOTNET_ENVIRONMENT` variable on the server to `Staging` (development.hamann-ausgabe.de) or `Production` (hamann-ausgabe.de)) set the variables for
|
||||||
|
|
||||||
|
- HamannFileStoreLinux
|
||||||
|
- WorkingTreePathLinux
|
||||||
|
- BareRepositoryPathLinux
|
||||||
|
- RepositoryBranch
|
||||||
|
- RepositoryURL
|
||||||
|
|
||||||
|
Absolute paths, sadly, are reqired. Create Folders if neccessary. Reading rights are required for `HamannFileStoreLinux` (to save the state). The `BareRepositoryPath` usually is the `.git` Folder inside the Repo, where the Server gets the latest commit information from `refs/heads/<Branch-Name>`. To sync either you set up a git server and set the server as remote of the repository to push. Or use git webhooks to pull on pushes.
|
||||||
|
|
||||||
## Redesign der Hamann-Vebseite, drittes Update
|
## Redesign der Hamann-Vebseite, drittes Update
|
||||||
Veränderungenen in der Funktionalität für den Benutzer
|
Veränderungenen in der Funktionalität für den Benutzer
|
||||||
- Behutsames Redesign der Webseite:
|
- Behutsames Redesign der Webseite:
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
|
|
||||||
@* Global Scripts -- These are not inside .cshtml to not loose deferred execution posibility *@
|
@* Global Scripts -- These are not inside .cshtml to not loose deferred execution posibility *@
|
||||||
<feature name="Notifications">
|
|
||||||
<script defer src="/js/websocket.js" asp-append-version="true"></script>
|
|
||||||
</feature>
|
|
||||||
<script defer src="/js/marginals.js" asp-append-version="true"></script>
|
<script defer src="/js/marginals.js" asp-append-version="true"></script>
|
||||||
<script defer src="/js/theme.js" asp-append-version="true"></script>
|
<script defer src="/js/theme.js" asp-append-version="true"></script>
|
||||||
<script defer src="/js/active.js" asp-append-version="true"></script>
|
<script defer src="/js/active.js" asp-append-version="true"></script>
|
||||||
|
|||||||
@@ -7,3 +7,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script defer src="/js/websocket.js" asp-append-version="true"></script>
|
||||||
@@ -5,6 +5,7 @@ using HaWeb;
|
|||||||
using HaWeb.FileHelpers;
|
using HaWeb.FileHelpers;
|
||||||
using HaWeb.Models;
|
using HaWeb.Models;
|
||||||
using HaWeb.XMLParser;
|
using HaWeb.XMLParser;
|
||||||
|
using Microsoft.AspNetCore.Connections;
|
||||||
using Microsoft.FeatureManagement;
|
using Microsoft.FeatureManagement;
|
||||||
|
|
||||||
public class WebSocketMiddleware : IMiddleware {
|
public class WebSocketMiddleware : IMiddleware {
|
||||||
@@ -70,16 +71,24 @@ public class WebSocketMiddleware : IMiddleware {
|
|||||||
WebSocketReceiveResult result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
|
WebSocketReceiveResult result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
|
||||||
while (!result.CloseStatus.HasValue) {
|
while (!result.CloseStatus.HasValue) {
|
||||||
var msg = Encoding.UTF8.GetString(buffer,0,result.Count);
|
var msg = Encoding.UTF8.GetString(buffer,0,result.Count);
|
||||||
if (msg.ToLower() == "hello") {
|
try {
|
||||||
var state = _xmlProvider.GetGitState();
|
if (msg.ToLower() == "hello") {
|
||||||
await webSocket.SendAsync(_SerializeToBytes(state), WebSocketMessageType.Text, true, CancellationToken.None);
|
var state = _xmlProvider.GetGitState();
|
||||||
await webSocket.SendAsync(_SerializeToBytes(new FileState(_xmlService.GetState())), WebSocketMessageType.Text, true, CancellationToken.None);
|
await webSocket.SendAsync(_SerializeToBytes(state), WebSocketMessageType.Text, true, CancellationToken.None);
|
||||||
} else if (msg.ToLower() == "ping" ) {
|
await webSocket.SendAsync(_SerializeToBytes(new FileState(_xmlService.GetState())), WebSocketMessageType.Text, true, CancellationToken.None);
|
||||||
await webSocket.SendAsync(_SerializeToBytes(new { Ping = true}), 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);
|
||||||
|
} catch (ConnectionAbortedException ex) {
|
||||||
|
_openSockets!.Remove(webSocket);
|
||||||
}
|
}
|
||||||
result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
|
|
||||||
}
|
}
|
||||||
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
|
try {
|
||||||
|
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
|
||||||
|
} catch (ConnectionAbortedException ex) {
|
||||||
|
_openSockets.Remove(webSocket);
|
||||||
|
}
|
||||||
_openSockets!.Remove(webSocket);
|
_openSockets!.Remove(webSocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +125,11 @@ public class WebSocketMiddleware : IMiddleware {
|
|||||||
private async Task _SendToAll<T>(T msg) {
|
private async Task _SendToAll<T>(T msg) {
|
||||||
if (_openSockets == null) return;
|
if (_openSockets == null) return;
|
||||||
foreach (var socket in _openSockets) {
|
foreach (var socket in _openSockets) {
|
||||||
await socket.SendAsync(_SerializeToBytes(msg), WebSocketMessageType.Text, true, CancellationToken.None);
|
try {
|
||||||
|
await socket.SendAsync(_SerializeToBytes(msg), WebSocketMessageType.Text, true, CancellationToken.None);
|
||||||
|
} catch (ConnectionAbortedException ex) {
|
||||||
|
_openSockets.Remove(socket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ socket.onopen = function (event) {
|
|||||||
socket.send("Hello");
|
socket.send("Hello");
|
||||||
wsPingInterval = setInterval(() => {
|
wsPingInterval = setInterval(() => {
|
||||||
socket.send("Ping");
|
socket.send("Ping");
|
||||||
}, 4500);
|
}, 30000);
|
||||||
updateMessage();
|
updateMessage();
|
||||||
};
|
};
|
||||||
socket.onclose = function (event) {
|
socket.onclose = function (event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user