@64mb/freelens-power 2.20.3 → 2.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,7 +45,9 @@ Real extension components with synthetic websites, prompts, conversations, and d
45
45
  - 📜 **Secret certificates:** PEM chain identities, issuers, serial numbers, validity dates, and expiration details
46
46
  - 🎨 **Accent themes:** eight colors for controls, links, and the welcome logo
47
47
  - 🏷️ **Cluster icons:** searchable grid, SVG icons, editable labels and colors, and live previews
48
- - 🧩 **Power Dashboard:** reorderable website cards, focused page elements, shared sessions, pinned windows, and optional automatic refresh
48
+ - 🧭 **Catalog:** pinnable Clusters shortcut, compact Web Link favicons, action icons, hotbar labels, keyboard selection and confirmed disconnect-all
49
+ - 📝 **Kubeconfig:** built-in YAML editing from cluster settings and menus with explicit saves and external-change checks
50
+ - 🧩 **Power Dashboard:** reorderable website cards, focused page elements, shared sessions, pinned windows, automatic Web Links, and optional automatic refresh
49
51
  - 📈 **Monitoring:** CPU and memory trends, allocation rings, pinned tooltips, and node/pod charts
50
52
  - 🩺 **Resource diagnostics:** resource consumers, warning timelines, Pending/readiness triage, Service/HPA checks, and incident summaries
51
53
  - ⚓ **Helm:** fast release lists, revision history, YAML comparisons, background rollback, and confirmed values editing and deletion
@@ -58,6 +60,8 @@ Real extension components with synthetic websites, prompts, conversations, and d
58
60
  - 🛡️ **Read-only UI:** hides common mutation actions without changing Kubernetes permissions
59
61
  - 🪟 **Interface:** reclaims the bottom status bar space; the master switch restores the native interface and preserves settings
60
62
  - ⚙️ **Settings:** native switches, compact dashboard editors, and JSON backup/restore of cards and prompt shortcuts
63
+
64
+ Select hotbars with Cmd+1-9 on macOS or Ctrl+1-9 on Windows and Linux. Disable these shortcuts under Other.
61
65
  - 🍎 **macOS Dock icon:** follows your accent, with a separate restore toggle
62
66
 
63
67
  ---
package/dist/main.js CHANGED
@@ -5,10 +5,10 @@ import { createRequire } from "node:module";
5
5
  import { X509Certificate, createHash, randomUUID } from "node:crypto";
6
6
  import { BrowserWindow, View, WebContentsView, app, dialog, nativeImage, nativeTheme, session, shell, utilityProcess } from "electron";
7
7
  import { execFile, spawn } from "node:child_process";
8
- import { chmod, mkdir, mkdtemp, open, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
8
+ import { chmod, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
9
9
  import { homedir, tmpdir, userInfo } from "node:os";
10
10
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
11
- import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
11
+ import { chmodSync, constants, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
12
12
  import { promisify } from "node:util";
13
13
  import { gunzipSync, gzipSync } from "node:zlib";
14
14
  import { Worker } from "node:worker_threads";
@@ -7527,6 +7527,44 @@ function clusterIconDataUrl(input) {
7527
7527
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="15" fill="#292d38" stroke="${design.outlineColor}" stroke-width="3"/><g fill="none" stroke="${design.iconColor}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">${glyph.body}</g><rect x="15" y="46" width="34" height="12" rx="6" fill="${design.labelColor}"/><text x="32" y="55.2" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-size="9.5" font-weight="800" fill="#292d38">${escapeXml(design.label)}</text></svg>`;
7528
7528
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
7529
7529
  }
7530
+ function clusterIconDesignFromDataUrl(value) {
7531
+ if (typeof value !== "string" || value.length > 32768) return void 0;
7532
+ const match = /^data:image\/svg\+xml(?:;charset=utf-8)?(;base64)?,(.*)$/is.exec(value);
7533
+ if (!match) return void 0;
7534
+ try {
7535
+ const svg = match[1] ? new TextDecoder().decode(Uint8Array.from(atob(match[2]), (char) => char.charCodeAt(0))) : decodeURIComponent(match[2]);
7536
+ const outlineColor = /<rect x="2"[^>]* stroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7537
+ const iconColor = /<g\b[^>]*\bstroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7538
+ const labelColor = /<rect x="15"[^>]* fill="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7539
+ const text = /<text\b[^>]*>([^<]*)<\/text>/.exec(svg)?.[1];
7540
+ if (text === void 0 || /\bon[a-z]+\s*=|(?:href|style)\s*=/i.test(svg)) return void 0;
7541
+ const label = text.replace(/&(amp|lt|gt|quot|apos);/g, (entity) => ({
7542
+ "&amp;": "&",
7543
+ "&lt;": "<",
7544
+ "&gt;": ">",
7545
+ "&quot;": "\"",
7546
+ "&apos;": "'"
7547
+ })[entity]);
7548
+ const signature = (value) => {
7549
+ const transforms = [...value.matchAll(/<g\b[^>]*\btransform="([^"]+)"/g)].map((match) => match[1]);
7550
+ return JSON.stringify(transforms) + value.replace(/<\/?g\b[^>]*>/g, "");
7551
+ };
7552
+ const original = signature(svg);
7553
+ for (const glyph of GLYPHS) {
7554
+ const design = normalizeClusterIconDesign({
7555
+ outlineColor,
7556
+ iconColor,
7557
+ labelColor,
7558
+ label,
7559
+ glyph: glyph.id
7560
+ });
7561
+ if (signature(decodeURIComponent(clusterIconDataUrl(design).split(",")[1])) === original) return design;
7562
+ }
7563
+ return;
7564
+ } catch {
7565
+ return;
7566
+ }
7567
+ }
7530
7568
  // src/common/store/cluster-icons-store.ts
7531
7569
  var ClusterIconsStore = class extends Common.Store.ExtensionStore {
7532
7570
  icons = {};
@@ -7855,31 +7893,36 @@ var PowerPreferencesStore = class extends Common.Store.ExtensionStore {
7855
7893
  enabled = true;
7856
7894
  checkUpdates = true;
7857
7895
  nodeBulkActions = true;
7896
+ hotbarShortcuts = true;
7858
7897
  constructor() {
7859
7898
  super({
7860
7899
  configName: "power-preferences",
7861
7900
  defaults: {
7862
7901
  enabled: true,
7863
7902
  checkUpdates: true,
7864
- nodeBulkActions: true
7903
+ nodeBulkActions: true,
7904
+ hotbarShortcuts: true
7865
7905
  }
7866
7906
  });
7867
7907
  makeObservable(this, {
7868
7908
  enabled: observable,
7869
7909
  checkUpdates: observable,
7870
- nodeBulkActions: observable
7910
+ nodeBulkActions: observable,
7911
+ hotbarShortcuts: observable
7871
7912
  });
7872
7913
  }
7873
7914
  fromStore(data) {
7874
7915
  this.enabled = data.enabled !== false;
7875
7916
  this.checkUpdates = data.checkUpdates !== false;
7876
7917
  this.nodeBulkActions = data.nodeBulkActions !== false;
7918
+ this.hotbarShortcuts = data.hotbarShortcuts !== false;
7877
7919
  }
7878
7920
  toJSON() {
7879
7921
  return {
7880
7922
  enabled: this.enabled,
7881
7923
  checkUpdates: this.checkUpdates,
7882
- nodeBulkActions: this.nodeBulkActions
7924
+ nodeBulkActions: this.nodeBulkActions,
7925
+ hotbarShortcuts: this.hotbarShortcuts
7883
7926
  };
7884
7927
  }
7885
7928
  };
@@ -10237,12 +10280,13 @@ function trustedClusterIconsSender(event) {
10237
10280
  function createClusterIconsService(host, store) {
10238
10281
  const list = () => host.clusters().map((cluster) => {
10239
10282
  const saved = Object.hasOwn(store.icons, cluster.id) ? store.icons[cluster.id] : void 0;
10240
- const customized = !!saved;
10283
+ const design = saved?.design ?? clusterIconDesignFromDataUrl(cluster.preferences.icon);
10284
+ const customized = !!design;
10241
10285
  return {
10242
10286
  id: cluster.id,
10243
10287
  name: cluster.name,
10244
10288
  icon: saved ? clusterIconDataUrl(saved.design) : cluster.preferences.icon ?? void 0,
10245
- design: saved ? { ...saved.design } : void 0,
10289
+ design: design ? { ...design } : void 0,
10246
10290
  customized
10247
10291
  };
10248
10292
  });
@@ -10313,6 +10357,39 @@ function registerClusterIconsCatalog(extension) {
10313
10357
  })]));
10314
10358
  return () => extension.removeCatalogSource(source);
10315
10359
  }
10360
+ // src/main/clusters-catalog.ts
10361
+ function registerClustersCatalog(extension) {
10362
+ const source = "clusters";
10363
+ const svg = Common.Catalog.kubernetesClusterCategory.metadata.icon.replace(/viewBox="([^"]+)"/, (attribute, value) => {
10364
+ const [x, y, width, height] = value.trim().split(/\s+/).map(Number);
10365
+ if (![
10366
+ x,
10367
+ y,
10368
+ width,
10369
+ height
10370
+ ].every(Number.isFinite) || width <= 0 || height <= 0) return attribute;
10371
+ const size = Math.max(width, height) * 4 / 3;
10372
+ return `viewBox="${x - (size - width) / 2} ${y - (size - height) / 2} ${size} ${size}"`;
10373
+ });
10374
+ const icon = {
10375
+ src: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`,
10376
+ background: "var(--primary)"
10377
+ };
10378
+ extension.addCatalogSource(source, observable.array([new Common.Catalog.GeneralEntity({
10379
+ metadata: {
10380
+ uid: "freelens-power-clusters",
10381
+ name: "Clusters",
10382
+ source: EXTENSION_ID,
10383
+ labels: {}
10384
+ },
10385
+ spec: {
10386
+ path: "/catalog/entity.k8slens.dev/KubernetesCluster",
10387
+ icon
10388
+ },
10389
+ status: { phase: "active" }
10390
+ })]));
10391
+ return () => extension.removeCatalogSource(source);
10392
+ }
10316
10393
  // src/main/dashboard-catalog.ts
10317
10394
  var DASHBOARD_CATALOG_SOURCE_ID = "dashboard";
10318
10395
  function registerDashboardCatalog(extension) {
@@ -10335,6 +10412,48 @@ function registerDashboardCatalog(extension) {
10335
10412
  extension.addCatalogSource(DASHBOARD_CATALOG_SOURCE_ID, entities);
10336
10413
  return () => extension.removeCatalogSource(DASHBOARD_CATALOG_SOURCE_ID);
10337
10414
  }
10415
+ // src/main/dashboard-links-catalog.ts
10416
+ function registerDashboardLinksCatalog(extension, icons) {
10417
+ const source = "dashboard-links";
10418
+ const entities = observable.array([]);
10419
+ const store = DashboardPreferencesStore.getInstanceOrCreate();
10420
+ const stop = reaction(() => ({
10421
+ cards: sanitizeDashboardCards(store.cards),
10422
+ icons: icons.map((icon) => ({ ...icon }))
10423
+ }), ({ cards, icons }) => {
10424
+ const seen = /* @__PURE__ */ new Set();
10425
+ entities.replace(cards.flatMap((card) => {
10426
+ if (seen.has(card.url)) return [];
10427
+ seen.add(card.url);
10428
+ const favicon = icons.find((icon) => icon.pageUrl === card.url);
10429
+ const spec = {
10430
+ url: card.url,
10431
+ icon: favicon ? {
10432
+ src: favicon.dataUrl,
10433
+ background: "transparent"
10434
+ } : {
10435
+ material: "public",
10436
+ background: "var(--primary)"
10437
+ }
10438
+ };
10439
+ return [new Common.Catalog.WebLink({
10440
+ metadata: {
10441
+ uid: `freelens-power-dashboard-link-${createHash("sha256").update(card.url).digest("hex")}`,
10442
+ name: card.title,
10443
+ source: EXTENSION_ID,
10444
+ labels: {}
10445
+ },
10446
+ spec,
10447
+ status: { phase: "available" }
10448
+ })];
10449
+ }));
10450
+ }, { fireImmediately: true });
10451
+ extension.addCatalogSource(source, entities);
10452
+ return () => {
10453
+ stop();
10454
+ extension.removeCatalogSource(source);
10455
+ };
10456
+ }
10338
10457
  // src/browser/dashboard-picker.ts?browser-script
10339
10458
  var dashboard_picker_default = "function dashboardPickerAdapter() {\n return new Promise((resolve) => {\n const overlay = document.createElement(\"div\");\n overlay.style.cssText = \"all:initial!important;position:fixed!important;inset:0!important;z-index:2147483647!important;pointer-events:auto!important\";\n const shadow = overlay.attachShadow({ mode: \"open\" });\n const outline = document.createElement(\"div\");\n outline.style.cssText = \"position:fixed;box-sizing:border-box;border:2px solid #00e5ff;border-radius:6px;box-shadow:0 0 0 1px #111,inset 0 0 0 1px #111;background:rgba(0,229,255,0.08);pointer-events:none;display:none\";\n const toolbar = document.createElement(\"div\");\n toolbar.style.cssText = \"position:fixed;bottom:20px;left:50%;transform:translateX(-50%);padding:12px 16px;background:#202124;color:#fff;border-radius:8px;font:13px system-ui;pointer-events:auto;display:flex;gap:16px;align-items:center\";\n const hint = document.createElement(\"span\");\n hint.textContent = \"Hover an element, then click to select \\xB7 Esc to cancel\";\n const cancel = document.createElement(\"button\");\n cancel.textContent = \"Cancel\";\n cancel.style.cssText = \"font:inherit;color:inherit;background:transparent;border:1px solid #888;border-radius:4px;padding:4px 10px;cursor:pointer\";\n toolbar.append(hint, cancel);\n shadow.append(outline, toolbar);\n document.documentElement.append(overlay);\n let hovered;\n const escape = (value) => CSS.escape(value);\n function selectorFor(target) {\n const matches = (selector) => {\n try {\n return selector.length <= 512 && document.querySelectorAll(selector).length === 1 && document.querySelector(selector) === target;\n } catch {\n return false;\n }\n };\n if (target.id) {\n const id = `#${escape(target.id)}`;\n if (matches(id)) return id;\n }\n const path = [];\n let element = target;\n for (let depth = 0; element && depth < 64; depth++, element = element.parentElement) {\n const tag = escape(element.localName);\n const siblings = element.parentElement ? Array.from(element.parentElement.children) : [element];\n path.unshift(`${tag}:nth-child(${siblings.indexOf(element) + 1})`);\n const selector = path.join(\" > \");\n if (selector.length > 512) return;\n if (matches(selector)) return selector;\n }\n return void 0;\n }\n function finish(value) {\n window.removeEventListener(\"pointermove\", move, true);\n window.removeEventListener(\"pointerdown\", block, true);\n window.removeEventListener(\"pointerup\", block, true);\n window.removeEventListener(\"click\", click, true);\n window.removeEventListener(\"auxclick\", block, true);\n window.removeEventListener(\"dblclick\", block, true);\n window.removeEventListener(\"keydown\", key, true);\n window.removeEventListener(\"pagehide\", cancelSelection, true);\n window.removeEventListener(\"scroll\", draw, true);\n window.removeEventListener(\"resize\", draw, true);\n overlay.remove();\n resolve(value);\n }\n function block(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n function hit(event) {\n if (event.composedPath().includes(toolbar)) return;\n let target = event.composedPath().find((node) => node instanceof Element);\n if (event.composedPath().includes(overlay) && event instanceof MouseEvent) {\n overlay.style.setProperty(\"pointer-events\", \"none\", \"important\");\n target = document.elementFromPoint(event.clientX, event.clientY) ?? void 0;\n overlay.style.setProperty(\"pointer-events\", \"auto\", \"important\");\n }\n return target instanceof Element && target.getRootNode() === document ? target : void 0;\n }\n function draw() {\n if (!hovered?.isConnected) {\n outline.style.display = \"none\";\n return;\n }\n const rect = hovered.getBoundingClientRect();\n Object.assign(outline.style, {\n display: \"block\",\n left: `${rect.left}px`,\n top: `${rect.top}px`,\n width: `${rect.width}px`,\n height: `${rect.height}px`\n });\n }\n function move(event) {\n hovered = hit(event);\n draw();\n }\n function click(event) {\n const isCancel = event.composedPath().includes(cancel);\n block(event);\n if (isCancel) {\n finish(null);\n return;\n }\n const target = hit(event);\n if (!target) return;\n const selector = selectorFor(target);\n if (selector) finish(selector);\n else hint.textContent = \"This element cannot be selected. Choose a containing element or cancel.\";\n }\n function key(event) {\n if (event.key === \"Escape\") {\n block(event);\n finish(null);\n } else block(event);\n }\n function cancelSelection() {\n finish(null);\n }\n window.addEventListener(\"pointermove\", move, true);\n window.addEventListener(\"pointerdown\", block, true);\n window.addEventListener(\"pointerup\", block, true);\n window.addEventListener(\"click\", click, true);\n window.addEventListener(\"auxclick\", block, true);\n window.addEventListener(\"dblclick\", block, true);\n window.addEventListener(\"keydown\", key, true);\n window.addEventListener(\"pagehide\", cancelSelection, true);\n window.addEventListener(\"scroll\", draw, true);\n window.addEventListener(\"resize\", draw, true);\n });\n}\n";
10340
10459
  // src/common/dashboard-picker.ts
@@ -10777,7 +10896,7 @@ function releaseDashboardPage(contents) {
10777
10896
  if (contents.isDestroyed()) return Promise.resolve();
10778
10897
  return contents.mainFrame.executeJavaScript("document.dispatchEvent(new Event(\"freelens-power:dashboard:prepared\"))").catch(() => {});
10779
10898
  }
10780
- function startDashboardViews() {
10899
+ function startDashboardViews(onIconsChanged = () => {}) {
10781
10900
  const websiteSession = session.fromPartition("persist:freelens-power-websites");
10782
10901
  websiteSession.setPermissionRequestHandler((_contents, _permission, callback) => callback(false));
10783
10902
  websiteSession.setPermissionCheckHandler(() => false);
@@ -10883,6 +11002,7 @@ function startDashboardViews() {
10883
11002
  const bounded = boundedDashboardIcons([...icons.values()].filter((icon) => configured.some((card) => card.id === icon.id && card.url === icon.pageUrl)));
10884
11003
  icons.clear();
10885
11004
  for (const icon of bounded) icons.set(icon.id, icon);
11005
+ onIconsChanged(bounded);
10886
11006
  await saveDashboardIcons(cachePath, bounded);
10887
11007
  }).catch(() => {});
10888
11008
  };
@@ -11653,7 +11773,7 @@ function startDockIconOverride() {
11653
11773
  };
11654
11774
  }
11655
11775
  // package.json
11656
- var version = "2.20.3";
11776
+ var version = "2.21.1";
11657
11777
  // src/common/extension-updates.ts
11658
11778
  var EXTENSION_UPDATES_CHANNEL = "freelens-power:extension-updates";
11659
11779
  var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
@@ -13488,6 +13608,134 @@ function startPowerHelm() {
13488
13608
  powerIpc.removeHandler(HELM_CHANNEL);
13489
13609
  };
13490
13610
  }
13611
+ // src/common/kubeconfig-editor.ts
13612
+ var KUBECONFIG_EDITOR_CHANNEL = "freelens-power:kubeconfig-editor";
13613
+ var KUBECONFIG_EDITOR_MAX_BYTES = 2097152;
13614
+ // src/main/kubeconfig-editor.ts
13615
+ var revisionOf = (bytes) => createHash("sha256").update(bytes).digest("hex");
13616
+ var failure = () => /* @__PURE__ */ new Error("Kubeconfig editor request could not be completed");
13617
+ function validateKubeconfigShape(value) {
13618
+ const mapping = (entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry);
13619
+ if (!mapping(value)) throw failure();
13620
+ for (const [list, property] of [
13621
+ ["clusters", "cluster"],
13622
+ ["contexts", "context"],
13623
+ ["users", "user"]
13624
+ ]) {
13625
+ if (!Object.hasOwn(value, list)) continue;
13626
+ const entries = value[list];
13627
+ if (entries === null) continue;
13628
+ if (!Array.isArray(entries)) throw failure();
13629
+ const names = /* @__PURE__ */ new Set();
13630
+ for (const entry of entries) {
13631
+ if (!mapping(entry) || typeof entry.name !== "string" || !entry.name.trim() || names.has(entry.name) || entry[property] !== null && !mapping(entry[property])) throw failure();
13632
+ names.add(entry.name);
13633
+ }
13634
+ }
13635
+ if (Object.hasOwn(value, "current-context") && value["current-context"] !== null && typeof value["current-context"] !== "string") throw failure();
13636
+ if (Object.hasOwn(value, "preferences") && value.preferences !== null && !mapping(value.preferences)) throw failure();
13637
+ }
13638
+ async function readFile$1(path) {
13639
+ const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
13640
+ try {
13641
+ const stat = await handle.stat();
13642
+ if (!stat.isFile() || stat.size > 2097152) throw failure();
13643
+ const bytes = Buffer.alloc(KUBECONFIG_EDITOR_MAX_BYTES + 1);
13644
+ let size = 0;
13645
+ while (size < bytes.length) {
13646
+ const result = await handle.read(bytes, size, bytes.length - size, null);
13647
+ if (!result.bytesRead) break;
13648
+ size += result.bytesRead;
13649
+ }
13650
+ if (size > 2097152) throw failure();
13651
+ const data = bytes.subarray(0, size);
13652
+ const current = await handle.stat();
13653
+ if (current.size !== size || current.mtimeMs !== stat.mtimeMs || current.ctimeMs !== stat.ctimeMs) throw failure();
13654
+ return {
13655
+ text: data.toString("utf8"),
13656
+ revision: revisionOf(data),
13657
+ stat: current
13658
+ };
13659
+ } finally {
13660
+ await handle.close();
13661
+ }
13662
+ }
13663
+ function startKubeconfigEditor() {
13664
+ let active = true;
13665
+ const saving = /* @__PURE__ */ new Set();
13666
+ powerIpc.handle(KUBECONFIG_EDITOR_CHANNEL, async (event, payload) => {
13667
+ const available = () => {
13668
+ if (!active || !PowerPreferencesStore.getInstanceOrCreate().enabled || !trustedClusterIconsSender(event)) throw failure();
13669
+ };
13670
+ const readOnly = () => ReadOnlyPreferencesStore.getInstanceOrCreate().enabled;
13671
+ let temporary;
13672
+ let locked;
13673
+ try {
13674
+ available();
13675
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) throw failure();
13676
+ const input = payload;
13677
+ if (typeof input.clusterId !== "string" || !input.clusterId || input.clusterId.length > 1024) throw failure();
13678
+ const clusterId = input.clusterId;
13679
+ const clusterPath = () => Main.Catalog.getClusterById(clusterId)?.kubeConfigPath;
13680
+ const selectedPath = clusterPath();
13681
+ if (!selectedPath) throw failure();
13682
+ const path = resolve(selectedPath);
13683
+ const check = () => {
13684
+ available();
13685
+ if (clusterPath() !== selectedPath) throw failure();
13686
+ };
13687
+ if (input.operation === "read") {
13688
+ const result = await readFile$1(path);
13689
+ check();
13690
+ return {
13691
+ text: result.text,
13692
+ revision: result.revision,
13693
+ readOnly: readOnly()
13694
+ };
13695
+ }
13696
+ if (input.operation !== "save" || readOnly() || typeof input.text !== "string" || typeof input.revision !== "string" || !/^[a-f0-9]{64}$/.test(input.revision)) throw failure();
13697
+ const bytes = Buffer.from(input.text, "utf8");
13698
+ if (bytes.length > 2097152) throw failure();
13699
+ const document = (0, import_dist.parseDocument)(input.text, { uniqueKeys: true });
13700
+ if (document.errors.length || !(0, import_dist.isMap)(document.contents) || document.get("apiVersion") !== "v1" || document.get("kind") !== "Config") throw failure();
13701
+ validateKubeconfigShape(document.toJS({ maxAliasCount: 100 }));
13702
+ if (saving.has(path)) throw failure();
13703
+ saving.add(path);
13704
+ locked = path;
13705
+ const previous = await readFile$1(path);
13706
+ if (previous.revision !== input.revision) throw failure();
13707
+ temporary = join(dirname(path), `.freelens-power-${randomUUID()}.tmp`);
13708
+ const handle = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 384);
13709
+ try {
13710
+ await handle.writeFile(bytes);
13711
+ await handle.chmod(previous.stat.mode & 511);
13712
+ await handle.sync();
13713
+ } finally {
13714
+ await handle.close();
13715
+ }
13716
+ const current = await readFile$1(path);
13717
+ const target = await lstat(path);
13718
+ check();
13719
+ if (readOnly() || current.revision !== previous.revision || target.isSymbolicLink() || target.dev !== previous.stat.dev || target.ino !== previous.stat.ino || current.stat.ino !== previous.stat.ino || current.stat.dev !== previous.stat.dev) throw failure();
13720
+ await rename(temporary, path);
13721
+ temporary = void 0;
13722
+ return {
13723
+ text: input.text,
13724
+ revision: revisionOf(bytes),
13725
+ readOnly: readOnly()
13726
+ };
13727
+ } catch {
13728
+ throw failure();
13729
+ } finally {
13730
+ if (temporary) await unlink(temporary).catch(() => {});
13731
+ if (locked) saving.delete(locked);
13732
+ }
13733
+ });
13734
+ return () => {
13735
+ active = false;
13736
+ powerIpc.removeHandler(KUBECONFIG_EDITOR_CHANNEL);
13737
+ };
13738
+ }
13491
13739
  // src/main/monitoring-history-database.ts
13492
13740
  var require$1 = createRequire(import.meta.url);
13493
13741
  var MonitoringHistoryDatabase = class {
@@ -14525,6 +14773,26 @@ function startPowerLogs() {
14525
14773
  worker = void 0;
14526
14774
  };
14527
14775
  }
14776
+ // src/main/hotbar-count.ts
14777
+ async function readHotbarCount(path) {
14778
+ let file;
14779
+ try {
14780
+ file = await open(path, "r");
14781
+ const limit = 2097152;
14782
+ const size = (await file.stat()).size;
14783
+ if (size > limit) return 1;
14784
+ const buffer = Buffer.alloc(size + 1);
14785
+ const { bytesRead } = await file.read(buffer, 0, buffer.length, 0);
14786
+ if (bytesRead > limit) return 1;
14787
+ const data = JSON.parse(buffer.subarray(0, bytesRead).toString("utf8"));
14788
+ if (!Array.isArray(data?.hotbars)) return 1;
14789
+ return new Set(data.hotbars.filter((bar) => bar && typeof bar === "object" && "id" in bar && typeof bar.id === "string").map((bar) => bar.id)).size;
14790
+ } catch {
14791
+ return 1;
14792
+ } finally {
14793
+ await file?.close();
14794
+ }
14795
+ }
14528
14796
  // src/main/secret-certificates.ts
14529
14797
  function commonName(distinguishedName) {
14530
14798
  return /^CN=(.*)$/m.exec(distinguishedName)?.[1] ?? distinguishedName;
@@ -14582,6 +14850,10 @@ function trustedRenderer(event) {
14582
14850
  }
14583
14851
  }
14584
14852
  function startRendererServices() {
14853
+ powerIpc.handle("freelens-power:hotbar-count", (event) => {
14854
+ if (!trustedRenderer(event)) throw new Error("Untrusted renderer");
14855
+ return readHotbarCount(join(app.getPath("userData"), "lens-hotbar-store.json"));
14856
+ });
14585
14857
  powerIpc.handle("freelens-power:secret-certificates", (event, input) => {
14586
14858
  if (!trustedRenderer(event)) throw new Error("Untrusted renderer");
14587
14859
  return parseSecretCertificates(validateCertificateData(input));
@@ -14593,6 +14865,7 @@ function startRendererServices() {
14593
14865
  await shell.openExternal(url.href);
14594
14866
  });
14595
14867
  return () => {
14868
+ powerIpc.removeHandler("freelens-power:hotbar-count");
14596
14869
  powerIpc.removeHandler("freelens-power:secret-certificates");
14597
14870
  powerIpc.removeHandler("freelens-power:open-external");
14598
14871
  };
@@ -14910,6 +15183,7 @@ var FreelensPowerMain = class extends Main.LensExtension {
14910
15183
  const stopRendererServices = startRendererServices();
14911
15184
  let disposers = [];
14912
15185
  const stop = reaction(() => power.enabled, (enabled) => {
15186
+ const dashboardIcons = observable.array([]);
14913
15187
  for (const dispose of disposers) dispose();
14914
15188
  disposers = enabled ? [
14915
15189
  startExtensionUpdates(this),
@@ -14922,11 +15196,14 @@ var FreelensPowerMain = class extends Main.LensExtension {
14922
15196
  startAiModels(),
14923
15197
  startDockIconOverride(),
14924
15198
  startSplashAccentOverride(),
14925
- startDashboardViews(),
15199
+ startDashboardViews((icons) => runInAction(() => dashboardIcons.replace(icons))),
14926
15200
  startDashboardPicker(),
14927
15201
  registerDashboardCatalog(this),
15202
+ registerDashboardLinksCatalog(this, dashboardIcons),
14928
15203
  registerClusterIconsCatalog(this),
14929
- startClusterIcons()
15204
+ registerClustersCatalog(this),
15205
+ startClusterIcons(),
15206
+ startKubeconfigEditor()
14930
15207
  ] : [];
14931
15208
  }, { fireImmediately: true });
14932
15209
  this.stopFeatures = () => {