mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-10 16:21:51 +00:00
fix(logs): handle missing clipboard API in non-HTTPS contexts
navigator.clipboard is undefined in insecure contexts (HTTP), causing a silent TypeError when clicking the copy logs button. Added a secure context check and proper Promise chaining so failures surface as user- visible error messages instead of silent crashes. Affects deployment log view and shared get-logs component.
This commit is contained in:
@@ -212,8 +212,15 @@
|
||||
<button
|
||||
x-on:click="
|
||||
$wire.copyLogs().then(logs => {
|
||||
navigator.clipboard.writeText(logs);
|
||||
Livewire.dispatch('success', ['Logs copied to clipboard.']);
|
||||
if (!navigator.clipboard) {
|
||||
Livewire.dispatch('error', ['Clipboard is not available. Please use HTTPS.']);
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(logs).then(() => {
|
||||
Livewire.dispatch('success', ['Logs copied to clipboard.']);
|
||||
}).catch(() => {
|
||||
Livewire.dispatch('error', ['Failed to copy logs to clipboard.']);
|
||||
});
|
||||
});
|
||||
"
|
||||
title="Copy Logs"
|
||||
|
||||
@@ -314,8 +314,15 @@
|
||||
<button
|
||||
x-on:click="
|
||||
$wire.copyLogs().then(logs => {
|
||||
navigator.clipboard.writeText(logs);
|
||||
Livewire.dispatch('success', ['Logs copied to clipboard.']);
|
||||
if (!navigator.clipboard) {
|
||||
Livewire.dispatch('error', ['Clipboard is not available. Please use HTTPS.']);
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(logs).then(() => {
|
||||
Livewire.dispatch('success', ['Logs copied to clipboard.']);
|
||||
}).catch(() => {
|
||||
Livewire.dispatch('error', ['Failed to copy logs to clipboard.']);
|
||||
});
|
||||
});
|
||||
"
|
||||
title="Copy Logs"
|
||||
|
||||
Reference in New Issue
Block a user