Skip to content

Commit 99edbd1

Browse files
Merge pull request #83 from GoXLR-on-Linux/dev-1.0.0
Dev 0.12.1
2 parents b13dc27 + 109ffe2 commit 99edbd1

File tree

23 files changed

+66
-27
lines changed

23 files changed

+66
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Support Server](https://img.shields.io/discord/828348446775574548.svg?label=Discord&logo=Discord&colorB=7289da&style=flat)](https://discord.gg/Wbp3UxkX2j)
1+
[![Support Server](https://img.shields.io/discord/1124010710138106017.svg?label=Discord&logo=Discord&colorB=7289da&style=flat)](https://discord.gg/BRBjkkbvmZ)
22
[![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/goxlr-on-linux/goxlr-utility?label=Latest)](http://github.com/goxlr-on-linux/goxlr-utility/releases/latest)
33
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/goxlr-on-linux/goxlr-utility/build.yml)
44

audio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "goxlr-audio"
3-
version = "0.12.0"
3+
version = "0.12.1"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

ci/goxlr-utility.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Setup]
44
AppName=GoXLR Utility
5-
AppVersion=0.12.0
5+
AppVersion=0.12.1
66
WizardStyle=modern
77
DefaultDirName={autopf}\GoXLR Utility
88
DefaultGroupName=GoXLR Utility

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "goxlr-client"
3-
version = "0.12.0"
3+
version = "0.12.1"
44
edition = "2021"
55
build = "build.rs"
66
authors = ["Nathan Adams <[email protected]>", "Craig McLure <[email protected]>", "Lars Mühlbauer <[email protected]>"]

daemon/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "goxlr-daemon"
3-
version = "0.12.0"
3+
version = "0.12.1"
44
edition = "2021"
55
authors = ["Nathan Adams <[email protected]>", "Craig McLure <[email protected]>", "Lars Mühlbauer <[email protected]>"]
66
description = "Allows control of a TC-Helicon GoXLR or GoXLR Mini, by maintaining an interaction with it over USB in the background."

daemon/src/servers/http_server.rs

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ use actix_web::middleware::Condition;
1414
use actix_web::web::Data;
1515
use actix_web::{get, post, web, App, HttpRequest, HttpResponse, HttpServer};
1616
use actix_web_actors::ws;
17-
use actix_web_actors::ws::CloseCode;
17+
use actix_web_actors::ws::{CloseCode, CloseReason};
1818
use anyhow::{anyhow, Result};
1919
use include_dir::{include_dir, Dir};
2020
use jsonpath_rust::JsonPathQuery;
2121
use log::{debug, error, info, warn};
2222
use mime_guess::MimeGuess;
23+
use serde_json::Value;
2324
use tokio::sync::broadcast::Sender as BroadcastSender;
2425
use tokio::sync::oneshot::Sender;
2526
use tokio::sync::Mutex;
@@ -54,7 +55,7 @@ impl Actor for Websocket {
5455
if let Ok(event) = broadcast_rx.recv().await {
5556
// We've received a message, attempt to trigger the WsMessage Handle..
5657
if let Err(error) = address.clone().try_send(WsResponse(WebsocketResponse {
57-
id: u32::MAX,
58+
id: u64::MAX,
5859
data: DaemonResponse::Patch(event.data),
5960
})) {
6061
error!(
@@ -132,17 +133,55 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for Websocket {
132133
future.into_actor(self).spawn(ctx);
133134
}
134135
Err(error) => {
135-
warn!("HTTP Error: {}", error);
136-
warn!("Request: {}", text);
137-
ctx.close(Some(CloseCode::Invalid.into()));
138-
ctx.stop();
136+
// Ok, we weren't able to deserialise the request into a proper object, we
137+
// now need to confirm whether it was at least valid JSON with a request id
138+
warn!("Error Deserialising Request to Object: {}", error);
139+
warn!("Original Request: {}", text);
140+
141+
debug!("Attempting Low Level request Id Extraction..");
142+
let request: serde_json::Result<Value> =
143+
serde_json::from_str(text.as_ref());
144+
match request {
145+
Ok(value) => {
146+
if let Some(request_id) = value["id"].as_u64() {
147+
let recipient = ctx.address().recipient();
148+
recipient.do_send(WsResponse(WebsocketResponse {
149+
id: request_id,
150+
data: DaemonResponse::Error(error.to_string()),
151+
}));
152+
} else {
153+
warn!("id missing, Cannot continue. Closing connection");
154+
let error = CloseReason {
155+
code: CloseCode::Invalid,
156+
description: Some(String::from(
157+
"Missing or invalid Request ID",
158+
)),
159+
};
160+
ctx.close(Some(error));
161+
ctx.stop();
162+
}
163+
}
164+
Err(error) => {
165+
warn!("JSON structure is invalid, closing connection.");
166+
let error = CloseReason {
167+
code: CloseCode::Invalid,
168+
description: Some(error.to_string()),
169+
};
170+
ctx.close(Some(error));
171+
ctx.stop();
172+
}
173+
}
139174
}
140175
}
141176
}
142177
Ok(ws::Message::Binary(_bin)) => {
143178
ctx.close(Some(CloseCode::Unsupported.into()));
144179
ctx.stop();
145180
}
181+
Ok(ws::Message::Close(reason)) => {
182+
ctx.close(reason);
183+
ctx.stop();
184+
}
146185
_ => (),
147186
}
148187
}

daemon/web-content/css/app.4380d8e8.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

daemon/web-content/css/app.dbf86015.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

daemon/web-content/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>GoXLR Utility</title><script defer="defer" src="/js/chunk-vendors.83231974.js"></script><script defer="defer" src="/js/app.017c2267.js"></script><link href="/css/app.4380d8e8.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but goxlr-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><canvas id="wheelCanvas" style="position: absolute; top: -1000px; left: -1000px; width: 130px; height: 130px"></canvas><div id="colourHover" style="position: absolute; top: -1000px; left: -1000px; width: 20px; height: 20px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 5px 10px rgba(0,0,0,0.5); background-color: #fff; pointer-events: none;"></div><div id="app"></div><script>window.onload = function(){
1+
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>GoXLR Utility</title><script defer="defer" src="/js/chunk-vendors.83231974.js"></script><script defer="defer" src="/js/app.bf28b91b.js"></script><link href="/css/app.dbf86015.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but goxlr-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><canvas id="wheelCanvas" style="position: absolute; top: -1000px; left: -1000px; width: 130px; height: 130px"></canvas><div id="colourHover" style="position: absolute; top: -1000px; left: -1000px; width: 20px; height: 20px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 5px 10px rgba(0,0,0,0.5); background-color: #fff; pointer-events: none;"></div><div id="app"></div><script>window.onload = function(){
22
let canvas = document.getElementById('wheelCanvas');
33
let context = canvas.getContext('2d');
44
let img = new Image();

daemon/web-content/js/app.017c2267.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)