[source:revert] remove support for alias arrays
May re-add in the future.
This commit is contained in:
parent
4cae733ff4
commit
6464f04fed
4
keys.js
4
keys.js
|
@ -763,14 +763,14 @@ const maps = {
|
||||||
{
|
{
|
||||||
path: "/thermostat/DEVICE_.*",
|
path: "/thermostat/DEVICE_.*",
|
||||||
leader: "",
|
leader: "",
|
||||||
alias: ["+", "="],
|
alias: "=",
|
||||||
description: "Increment temperature",
|
description: "Increment temperature",
|
||||||
callback: actions.nt.adjustTemp(1),
|
callback: actions.nt.adjustTemp(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/thermostat/DEVICE_.*",
|
path: "/thermostat/DEVICE_.*",
|
||||||
leader: "",
|
leader: "",
|
||||||
alias: ["-", "_"],
|
alias: "-",
|
||||||
description: "Decrement temperature",
|
description: "Decrement temperature",
|
||||||
callback: actions.nt.adjustTemp(-1),
|
callback: actions.nt.adjustTemp(-1),
|
||||||
},
|
},
|
||||||
|
|
14
util.js
14
util.js
|
@ -120,26 +120,24 @@ util.processMaps = (maps, aliases, siteleader) => {
|
||||||
leader = (domain === "global") ? "" : siteleader,
|
leader = (domain === "global") ? "" : siteleader,
|
||||||
category = categories.misc,
|
category = categories.misc,
|
||||||
description = "",
|
description = "",
|
||||||
path = "(/.*)?",
|
} = mapObj
|
||||||
} = mapObj;
|
|
||||||
(Array.isArray(alias) ? alias : [alias]).forEach((a) => {
|
|
||||||
const opts = {}
|
const opts = {}
|
||||||
const key = `${leader}${a}`
|
|
||||||
|
const key = `${leader}${alias}`
|
||||||
|
|
||||||
// Determine if it's a site-specific mapping
|
// Determine if it's a site-specific mapping
|
||||||
if (domain !== "global") {
|
if (domain !== "global") {
|
||||||
const d = util.escapeRegExp(domain)
|
const d = domain.replace(".", "\\.")
|
||||||
opts.domain = new RegExp(`^http(s)?://(([a-zA-Z0-9-_]+\\.)*)(${d})${path}`)
|
opts.domain = new RegExp(`^http(s)?://(([a-zA-Z0-9-_]+\\.)*)(${d})(/.*)?`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullDescription = `#${category} ${description}`
|
const fullDescription = `#${category} ${description}`
|
||||||
|
|
||||||
if (mapObj.map !== undefined) {
|
if (mapObj.map !== undefined) {
|
||||||
map(a, mapObj.map)
|
map(alias, mapObj.map)
|
||||||
} else {
|
} else {
|
||||||
mapkey(key, fullDescription, callback, opts)
|
mapkey(key, fullDescription, callback, opts)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue