fix: copy stream url bug (#69)
This commit is contained in:
Generated
+1
-1
@@ -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",
|
||||||
|
|||||||
@@ -476,6 +476,12 @@ class VideoPlayer {
|
|||||||
streamUrl = window.location.origin + streamUrl;
|
streamUrl = window.location.origin + streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showPromptFallback = () => {
|
||||||
|
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(() => {
|
navigator.clipboard.writeText(streamUrl).then(() => {
|
||||||
// Show brief feedback
|
// Show brief feedback
|
||||||
const btn = document.getElementById('btn-copy-url');
|
const btn = document.getElementById('btn-copy-url');
|
||||||
@@ -488,8 +494,12 @@ class VideoPlayer {
|
|||||||
}
|
}
|
||||||
console.log('[Player] Stream URL copied:', streamUrl);
|
console.log('[Player] Stream URL copied:', streamUrl);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
prompt('Copy this URL:', streamUrl);
|
showPromptFallback();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback for insecure contexts (HTTP)
|
||||||
|
showPromptFallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -740,6 +740,12 @@ class WatchPage {
|
|||||||
streamUrl = window.location.origin + streamUrl;
|
streamUrl = window.location.origin + streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showPromptFallback = () => {
|
||||||
|
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(() => {
|
navigator.clipboard.writeText(streamUrl).then(() => {
|
||||||
// Show brief feedback
|
// Show brief feedback
|
||||||
const btn = document.getElementById('watch-copy-url');
|
const btn = document.getElementById('watch-copy-url');
|
||||||
@@ -751,8 +757,12 @@ class WatchPage {
|
|||||||
}
|
}
|
||||||
console.log('[WatchPage] Stream URL copied:', streamUrl);
|
console.log('[WatchPage] Stream URL copied:', streamUrl);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
prompt('Copy this URL:', streamUrl);
|
showPromptFallback();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback for insecure contexts (HTTP)
|
||||||
|
showPromptFallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === UI Updates ===
|
// === UI Updates ===
|
||||||
|
|||||||
Reference in New Issue
Block a user