Home Assistant v2.0.1 (#50)
* fix(*): Added a function to remove trailing slashes from URLs. * feat(panel): Added a home assistant icon alongsite the panel tile. * chore(plugin): Bump the version to 2.0.1 * fix(panel): Fixed wrong glyph syntax.
This commit is contained in:
+9
-3
@@ -1,6 +1,6 @@
|
||||
--!nonstrict
|
||||
|
||||
local haUrl = noctalia.getConfig("ha_url")
|
||||
local haUrlRaw = noctalia.getConfig("ha_url")
|
||||
local showEntityCount = noctalia.getConfig("show_entity_count")
|
||||
|
||||
local status = "unconfigured"
|
||||
@@ -8,6 +8,11 @@ local entityCount = 0
|
||||
|
||||
local render
|
||||
|
||||
local function getCleanUrl()
|
||||
if type(haUrlRaw) ~= "string" then return "" end
|
||||
return (haUrlRaw:gsub("/$", ""))
|
||||
end
|
||||
|
||||
local function tr(key, subst)
|
||||
return noctalia.tr("widget." .. key, subst)
|
||||
end
|
||||
@@ -83,8 +88,9 @@ function onClick()
|
||||
end
|
||||
|
||||
function onRightClick()
|
||||
if haUrl and haUrl ~= "" then
|
||||
noctalia.runAsync("xdg-open " .. ("'" .. haUrl:gsub("'", "'\\''") .. "'"))
|
||||
local url = getCleanUrl()
|
||||
if url and url ~= "" then
|
||||
noctalia.runAsync("xdg-open " .. ("'" .. url:gsub("'", "'\\''") .. "'"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user