Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

Fix: Markdow Copy now works over non-secure HTTP

hooli40f3edce688d
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 069ecb6..1ba82eb 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -442,8 +442,27 @@ export default function App() {
const handleExportMd = useCallback(async () => {
const md = generateMarkdownTable(nodes)
if (!md) { toast.error('No nodes to export'); return }
- await navigator.clipboard.writeText(md)
- toast.success('Markdown table copied to clipboard')
+ if (navigator.clipboard && window.isSecureContext) {
+ await navigator.clipboard.writeText(md)
+ toast.success('Markdown table copied to clipboard')
+ } else {
+ // Only allowed access to navigator.clipboard over HTTPS not HTTP
+ // Use the temporary 'hidden text area for alternative copy method
+ const textArea = document.createElement("textarea");
+ textArea.value = md;
+ textArea.style.position = "absolute";
+ textArea.style.left = "-999999px";
+ document.body.prepend(textArea);
+ textArea.select();
+ try {
+ document.execCommand('copy');
+ toast.success("Markdown table copied to clipboard")
+ } catch (err) {
+ toast.error(`Markdown copy failed: ${err instanceof Error ? err.message : String(err)}`)
+ } finally {
+ textArea.remove();
+ }
+ }
}, [nodes])
const handleExportYaml = useCallback(() => {