The extensions that were in Toolshed's own repository, a folder each: brreg, dashboard-icons, databricks, docker, github, homebrew, norway, projects, scripts, secrets, wikipedia and yr. Toolshed installs them from here, in Settings → Extensions → From a repository, and the README says how
This commit is contained in:
44 files changed
+7978
-1
No files matched your search
@@ -0,0 +1,93 @@
|
||||
-- Search secrets with lazysecrets (https://github.com/karleinarb/lazysecrets): "s db-password".
|
||||
-- Lists only what lazysecrets has cached, so typing never waits on Azure or Databricks;
|
||||
-- open lazysecrets now and then to refresh it.
|
||||
|
||||
-- Running lazysecrets on every keystroke would be wasteful, so the list is kept briefly.
|
||||
local cache_seconds = 30
|
||||
local cached, cached_at = nil, 0
|
||||
|
||||
local function secrets()
|
||||
if cached and os.time() - cached_at < cache_seconds then
|
||||
return cached
|
||||
end
|
||||
local list = {}
|
||||
local output = toolshed.exec({ "lazysecrets", "list", "--kind", "secret", "--cached", "--format", "json" })
|
||||
for line in output:gmatch("[^\n]+") do
|
||||
local s = toolshed.json.decode(line)
|
||||
if s.link and not s.error then
|
||||
table.insert(list, {
|
||||
name = table.concat(s.path, " / "),
|
||||
account = s.account or "",
|
||||
starred = s.starred == true,
|
||||
link = s.link,
|
||||
})
|
||||
end
|
||||
end
|
||||
cached, cached_at = list, os.time()
|
||||
return list
|
||||
end
|
||||
|
||||
return toolshed.toolbox {
|
||||
key = "secrets",
|
||||
title = "i18n:toolbox.title",
|
||||
description = "i18n:toolbox.description",
|
||||
icon = "key-round",
|
||||
tint = "purple",
|
||||
requires = { { command = "lazysecrets" } },
|
||||
|
||||
tools = { {
|
||||
key = "search",
|
||||
title = "i18n:tool.search.title",
|
||||
words = { "s" },
|
||||
keywords = { "hemmeligheter", "passord" },
|
||||
items = true,
|
||||
|
||||
search = function(rest)
|
||||
local matches = {}
|
||||
for _, s in ipairs(secrets()) do
|
||||
local score = toolshed.match(rest, s.name)
|
||||
if score > 0 then
|
||||
table.insert(matches, { score = score + (s.starred and 0.05 or 0), secret = s })
|
||||
end
|
||||
end
|
||||
table.sort(matches, function(a, b) return a.score > b.score end)
|
||||
|
||||
local items = {}
|
||||
for i = 1, math.min(#matches, 30) do
|
||||
local s = matches[i].secret
|
||||
table.insert(items, {
|
||||
title = (s.starred and "★ " or "") .. s.name,
|
||||
subtitle = s.account,
|
||||
data = { link = s.link },
|
||||
})
|
||||
end
|
||||
return items
|
||||
end,
|
||||
|
||||
actions = {
|
||||
{
|
||||
key = "open",
|
||||
title = "i18n:action.search.open",
|
||||
run = function(ctx)
|
||||
toolshed.exec({ "lazysecrets", "launch", ctx.data.link })
|
||||
end,
|
||||
},
|
||||
{
|
||||
key = "copy-value",
|
||||
title = "i18n:action.search.copy-value",
|
||||
run = function(ctx)
|
||||
toolshed.clipboard.copy_secret(toolshed.exec({ "lazysecrets", "get", ctx.data.link }))
|
||||
return toolshed.t("value-copied")
|
||||
end,
|
||||
},
|
||||
{
|
||||
key = "copy-link",
|
||||
title = "i18n:action.search.copy-link",
|
||||
run = function(ctx)
|
||||
toolshed.clipboard.copy(ctx.data.link)
|
||||
return toolshed.t("link-copied")
|
||||
end,
|
||||
},
|
||||
},
|
||||
} },
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
[toolbox.title]
|
||||
other = "Secrets"
|
||||
|
||||
[toolbox.description]
|
||||
other = "Find secrets from Azure Key Vault, Databricks and your repos through lazysecrets."
|
||||
|
||||
[tool.search.title]
|
||||
other = "Secrets"
|
||||
|
||||
[action.search.open]
|
||||
other = "Open in lazysecrets"
|
||||
|
||||
[action.search.copy-value]
|
||||
other = "Copy Value"
|
||||
|
||||
[action.search.copy-link]
|
||||
other = "Copy Link"
|
||||
|
||||
[value-copied]
|
||||
other = "Copied — clears in 30 seconds"
|
||||
|
||||
[link-copied]
|
||||
other = "Link copied"
|
||||
@@ -0,0 +1,23 @@
|
||||
[toolbox.title]
|
||||
other = "Hemmeligheter"
|
||||
|
||||
[toolbox.description]
|
||||
other = "Finn hemmeligheter fra Azure Key Vault, Databricks og repoene dine med lazysecrets."
|
||||
|
||||
[tool.search.title]
|
||||
other = "Hemmeligheter"
|
||||
|
||||
[action.search.open]
|
||||
other = "Åpne i lazysecrets"
|
||||
|
||||
[action.search.copy-value]
|
||||
other = "Kopier verdi"
|
||||
|
||||
[action.search.copy-link]
|
||||
other = "Kopier lenke"
|
||||
|
||||
[value-copied]
|
||||
other = "Kopiert – tømmes om 30 sekunder"
|
||||
|
||||
[link-copied]
|
||||
other = "Lenke kopiert"
|
||||
Reference in new issue
Block a user