mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 09:44:01 +00:00
fix: accept string values for bars and correctly canonicalise comparison path for encoder layouts (#372)
This commit is contained in:
1 parent
d8a788c358
commit
f528f3e8ea
4 files changed
+12
-6
No files matched your search
Generated
+1
-1
@@ -5394,7 +5394,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||
[[package]]
|
||||
name = "streamdeck-strip-render"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/FrostyCoolSlug/streamdeck-strip-render?rev=73e66d23#73e66d236b073c8eea5840ab2480498cdaab1b5a"
|
||||
source = "git+https://github.com/FrostyCoolSlug/streamdeck-strip-render?rev=5a18406c#5a18406c3f7560f4f4220756e7da459d76559946"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"anyhow",
|
||||
|
||||
@@ -23,7 +23,7 @@ tiny_http = "0.12"
|
||||
elgato-streamdeck = { version = "0.12", default-features = false, features = ["async"] }
|
||||
hidapi = "2.6"
|
||||
image = { version = "0.25", default-features = false, features = ["bmp", "jpeg"] }
|
||||
streamdeck-strip-render = { git = "https://github.com/FrostyCoolSlug/streamdeck-strip-render", rev = "73e66d23" }
|
||||
streamdeck-strip-render = { git = "https://github.com/FrostyCoolSlug/streamdeck-strip-render", rev = "5a18406c" }
|
||||
|
||||
# Smaller utility libraries
|
||||
dashmap = { version = "6.1", features = ["serde"] }
|
||||
|
||||
@@ -161,11 +161,13 @@ pub async fn set_feedback(event: ContextAndPayloadEvent<Value>) -> Result<(), an
|
||||
|
||||
"bar" | "gbar" => {
|
||||
if let Value::Number(value) = payload_value {
|
||||
if key == "value" {
|
||||
item["value"] = Value::Number(value.clone());
|
||||
item["value"] = Value::Number(value.clone());
|
||||
} else if let Value::String(value) = payload_value {
|
||||
if let Ok(value) = value.parse() {
|
||||
item["value"] = Value::Number(value);
|
||||
} else {
|
||||
trace!("setFeedback: bar/gbar unexpected value for key '{key}' - {value}");
|
||||
}
|
||||
} else {
|
||||
trace!("setFeedback: bar/gbar expected number for key '{key}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,6 +267,10 @@ pub fn initialise_encoder_layout(action: &mut Action, layout: Option<String>) ->
|
||||
let plugin_dir = config_dir().join("plugins").join(&action.plugin);
|
||||
let layout_file = plugin_dir.join(&load_layout);
|
||||
|
||||
let Ok(plugin_dir) = plugin_dir.canonicalize() else {
|
||||
bail!("Failed to canonicalize plugin directory: {}", plugin_dir.display());
|
||||
};
|
||||
|
||||
match layout_file.canonicalize() {
|
||||
Ok(resolved) if resolved.starts_with(&plugin_dir) => resolved.to_string_lossy().into_owned(),
|
||||
Ok(_) => {
|
||||
|
||||
Reference in new issue
Block a user