fix: copy stream url bug (#69)
This commit is contained in:
Generated
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodecast-tv",
|
"name": "nodecast-tv",
|
||||||
"version": "2.0.0",
|
"version": "2.1.4",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ffprobe-installer/ffprobe": "^2.1.2",
|
"@ffprobe-installer/ffprobe": "^2.1.2",
|
||||||
@@ -1866,4 +1866,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -476,20 +476,30 @@ class VideoPlayer {
|
|||||||
streamUrl = window.location.origin + streamUrl;
|
streamUrl = window.location.origin + streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.clipboard.writeText(streamUrl).then(() => {
|
const showPromptFallback = () => {
|
||||||
// Show brief feedback
|
|
||||||
const btn = document.getElementById('btn-copy-url');
|
|
||||||
if (btn) {
|
|
||||||
const originalText = btn.textContent;
|
|
||||||
btn.textContent = '✓ Copied!';
|
|
||||||
setTimeout(() => {
|
|
||||||
btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg> Copy Stream URL`;
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
console.log('[Player] Stream URL copied:', streamUrl);
|
|
||||||
}).catch(() => {
|
|
||||||
prompt('Copy this URL:', streamUrl);
|
prompt('Copy this URL:', streamUrl);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// navigator.clipboard is only available in secure contexts (HTTPS/localhost)
|
||||||
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
|
navigator.clipboard.writeText(streamUrl).then(() => {
|
||||||
|
// Show brief feedback
|
||||||
|
const btn = document.getElementById('btn-copy-url');
|
||||||
|
if (btn) {
|
||||||
|
const originalText = btn.textContent;
|
||||||
|
btn.textContent = '✓ Copied!';
|
||||||
|
setTimeout(() => {
|
||||||
|
btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg> Copy Stream URL`;
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
console.log('[Player] Stream URL copied:', streamUrl);
|
||||||
|
}).catch(() => {
|
||||||
|
showPromptFallback();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback for insecure contexts (HTTP)
|
||||||
|
showPromptFallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -740,19 +740,29 @@ class WatchPage {
|
|||||||
streamUrl = window.location.origin + streamUrl;
|
streamUrl = window.location.origin + streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.clipboard.writeText(streamUrl).then(() => {
|
const showPromptFallback = () => {
|
||||||
// Show brief feedback
|
|
||||||
const btn = document.getElementById('watch-copy-url');
|
|
||||||
if (btn) {
|
|
||||||
btn.textContent = '✓ Copied!';
|
|
||||||
setTimeout(() => {
|
|
||||||
btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg> Copy Stream URL`;
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
console.log('[WatchPage] Stream URL copied:', streamUrl);
|
|
||||||
}).catch(() => {
|
|
||||||
prompt('Copy this URL:', streamUrl);
|
prompt('Copy this URL:', streamUrl);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// navigator.clipboard is only available in secure contexts (HTTPS/localhost)
|
||||||
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
|
navigator.clipboard.writeText(streamUrl).then(() => {
|
||||||
|
// Show brief feedback
|
||||||
|
const btn = document.getElementById('watch-copy-url');
|
||||||
|
if (btn) {
|
||||||
|
btn.textContent = '✓ Copied!';
|
||||||
|
setTimeout(() => {
|
||||||
|
btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg> Copy Stream URL`;
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
console.log('[WatchPage] Stream URL copied:', streamUrl);
|
||||||
|
}).catch(() => {
|
||||||
|
showPromptFallback();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback for insecure contexts (HTTP)
|
||||||
|
showPromptFallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === UI Updates ===
|
// === UI Updates ===
|
||||||
|
|||||||
Reference in New Issue
Block a user