Add files via upload

This commit is contained in:
Steve Seguin 2022-04-01 04:23:48 -04:00 committed by GitHub
parent f68ae33cad
commit b975115e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 686 additions and 499 deletions

View File

@ -163,7 +163,7 @@ function generateInvite(){
var href = window.location.href;
var dir = href.substring(0, href.lastIndexOf('/')) + "/";
var salt = location.hostname; // "obs.ninja" is the expected default. You will want to change this if hosting dock.html locally.
var salt = location.hostname; // "vdo.ninja" is the expected default. You will want to change this if hosting dock.html locally.
if (getById("invite_password").value.trim().length){
generateHash(getById("invite_password").value.trim().replace(/[\W]+/g,"_")+salt,4).then(function(hash){

View File

@ -79,7 +79,7 @@
<link itemprop="url" href="./media/vdoNinja_logo_full.png" />
</span>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=37"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=390"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=396"></script>
<input id="zoomSlider" type="range" style="display: none;" />
<div id="header">
@ -149,7 +149,7 @@
<div id="mutespeakerbutton" onmousedown="event.preventDefault(); event.stopPropagation();" title="Mute the Speaker" onclick="toggleSpeakerMute()" tabindex="17" role="button" aria-pressed="false" onkeyup="enterPressedClick(event,this);" class="advanced float" style="cursor: pointer;" alt="Toggle the speaker output.">
<i id="mutespeakertoggle" class="toggleSize las la-volume-up my-float" style="position: relative; top: 0.5px;"></i>
</div>
<div id="mutebutton" onmousedown="event.preventDefault(); event.stopPropagation();" title="Mute the Mic" onclick="toggleMute()" tabindex="18" role="button" aria-pressed="false" onkeyup="enterPressedClick(event,this);" class="advanced float" style="cursor: pointer;" alt="Toggle the mic">
<div id="mutebutton" onmousedown="toggleMute(false, event);event.preventDefault(); event.stopPropagation();" title="Mute the Mic" ontouchstart="toggleMute(false, event);event.preventDefault(); event.stopPropagation();" tabindex="18" role="button" aria-pressed="false" onkeyup="enterPressedClick(event,this);" class="advanced float" style="cursor: pointer;" alt="Toggle the mic">
<i id="mutetoggle" class="toggleSize las la-microphone my-float" style="position: relative; top: 0.5px;"></i>
</div>
<div id="mutevideobutton" onmousedown="event.preventDefault(); event.stopPropagation();" title="Disable the Camera" alt="Disable the Camera" onclick="toggleVideoMute()" tabindex="19" role="button" aria-pressed="false" onkeyup="enterPressedClick(event,this);" class="advanced float" style="cursor: pointer;">
@ -272,7 +272,7 @@
<span data-translate="password-input-field">Password</span>:
</b>
</div>
<input type="text" autocorrect="off" autocapitalize="none" id="passwordRoom" placeholder="Optional room password here" onkeydown="checkStrengthRoom(event, 'securityLevelRoom');" onchange="checkStrengthRoom(event, 'securityLevelRoom');" onkeyup="enterPressed(event, createRoom);" maxlength="50" style="max-width: 431px;width: 100%;font-size: 110%; padding: 5px;" />
<input type="text" autocorrect="off" autocapitalize="none" id="passwordRoom" placeholder="Optional room password here" onkeydown="checkStrengthRoom(event, 'securityLevelRoom');" onchange="checkStrengthRoom(event, 'securityLevelRoom');" onkeyup="enterPressed(event, createRoom);" style="max-width: 431px;width: 100%;font-size: 110%; padding: 5px;" />
</th>
</tr><tr >
@ -704,13 +704,13 @@
<h1>Warning</h1>
<p>Media file streaming is still quite experimental. Please do not rely on it heavily for your productions. Feedback welcome.</p>
</div>
<div class='warning message-card'>
<h1>Chrome users</h1>
<p>Keep this tab visible if using Chrome, else the video playback will stop</p>
<div class='warning message-card advanced' id='chrome_warning_fileshare'>
<h1>Chrome/Edge users</h1>
<p>Keep this tab visible, else the video playback will stop</p>
</div>
<div class='info message-card'>
<h1>File Sharing seems to be broken on Chrome v88.</h1>
<p>Try <a href="https://github.com/aws/amazon-chime-sdk-js/issues/1031">turning off hardware-accleration</a> in Chrome/Edge to fix the issue, or maybe use a different browser.</p>
<div class='warning message-card advanced' id='safari_warning_fileshare'>
<h1>Safari Users</h1>
<p>Safari does not support this feature. Consider Chrome or Firefox instead.</p>
</div>
<br /><br />
To host a file for download, rather than for streaming, try the following instead:
@ -1863,7 +1863,7 @@
<source src="./media/tone.mp3" type="audio/mpeg">
<source src="./media/tone.ogg" type="audio/ogg">
</audio>
<div class="gone" >
<div class="gone advanced" >
<!-- This image is used when dragging elements -->
<img src="./media/favicon-32x32.png" id="dragImage" loading="lazy" />
</div>
@ -1928,7 +1928,7 @@
var session = WebRTC.Media; // session is a required global variable if configuring manually. Run before loading main.js but after webrtc.js.
session.version = "21.2";
session.version = "21.3";
session.streamID = session.generateStreamID(); // randomly generates a streamID for this session. You can set your own programmatically if needed
session.defaultPassword = "someEncryptionKey123"; // Change this password if self-deploying for added security/privacy
@ -1992,13 +1992,14 @@
// session.title // "zzzz" ; sets the title of the browser page.
// session.introOnClean = true; // this will load the page with the webcam selection screen if &push or &room is in the URL; no need to use &webcam.
// session.lowBitrateCutoff = 300; // Set a minimum bitrate (in kbps) before the stream is hidden. Useful for IRL streams maybe
// session.apiserver = "wss://api.vdo.ninja:443"; // specifiy a custom websocket API URL.
</script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=264"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=279"></script>
<!--
// If you wish to change branding, blank offers a good clean start.
<script type="text/javascript" id="main-js" src="./main.js" data-translation="blank"></script>
-->
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=302"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=313"></script>
</body>
</html>

1030
lib.js

File diff suppressed because it is too large Load Diff

69
main.js
View File

@ -414,6 +414,17 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
} else if (urlParams.has('forceportrait') || urlParams.has('forcedportrait')|| urlParams.has('fp')){
session.orientation = "portrait";
}
if (session.orientation && session.mobile){
document.addEventListener('fullscreenchange', event => {
if (document.fullscreenElement) {
document.exitFullscreen();
}
alert(JSON.stringify(event));
});
}
if (urlParams.has('midi') || urlParams.has('hotkeys')) {
session.midiHotkeys = urlParams.get('midi') || urlParams.get ('hotkeys') || 1;
@ -486,6 +497,13 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
getById("container-5").classList.remove('advanced');
getById("container-5").classList.add("skip-animation");
getById("container-5").classList.remove('pointer');
if (SafariVersion){
getById("safari_warning_fileshare").classList.remove('advanced');
} else if (!Firefox){
getById("chrome_warning_fileshare").classList.remove('advanced');
}
} else if (directorLanding) {
getById("container-1").classList.remove('advanced');
getById("container-1").classList.add("skip-animation");
@ -888,13 +906,14 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.showlabels = urlParams.get('showlabels') || urlParams.get('showlabel') || urlParams.get('sl') || "";
session.showlabels = sanitizeLabel(session.showlabels.replace(/[\W]+/g, "_").replace(/_+/g, '_'));
//session.style = 6;
session.showlabels = true;
if (session.showlabels == "") {
session.labelstyle = false;
} else {
session.labelstyle = session.showlabels;
}
session.showlabels = true;
}
if (urlParams.has('sizelabel') || urlParams.has('labelsize') || urlParams.has('fontsize')) {
@ -2603,6 +2622,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
}
if (urlParams.has('wss')) {
session.customWSS = true;
if (urlParams.get('wss')) {
session.wss = "wss://" + urlParams.get('wss');
}
@ -4057,7 +4077,8 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
});
document.addEventListener("keydown", event => {
if ((event.ctrlKey) || (event.metaKey)) { // detect if CTRL is pressed
CtrlPressed = true;
} else {
@ -4069,19 +4090,29 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
AltPressed = false;
}
if (KeyPressedTimeout){
event.preventDefault(); event.stopPropagation();
return;
}
if (CtrlPressed && event.keyCode) {
if (event.keyCode == 77) { // M
if (event.metaKey) {
if (AltPressed) {
toggleMute(); // macOS
if (!KeyPressedTimeout){
toggleMute(); // macOS
KeyPressedTimeout = Date.now();
}
}
} else {
toggleMute(); // Windows
if (!KeyPressedTimeout){
toggleMute(); // Windows
KeyPressedTimeout = Date.now();
}
}
// } else if (event.keyCode == 69) { // E
// hangup();
} else if (event.keyCode == 66) { // B
toggleVideoMute();
}
@ -4099,7 +4130,8 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
});
document.addEventListener("keyup", event => {
if (!((event.ctrlKey) || (event.metaKey))) {
if (!(event.ctrlKey || event.metaKey)) {
if (CtrlPressed) {
CtrlPressed = false;
for (var i in Callbacks) {
@ -4117,12 +4149,33 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
if (event.altKey && event.shiftKey && event.keyCode === 67 /* C */) {
toggleControlBar();
}
if (KeyPressedTimeout && ((event.keyCode == 77) || (!(event.ctrlKey || event.metaKey)))) {
if (Date.now() - KeyPressedTimeout>300){
toggleMute();
}
if (event.keyCode == 77){
KeyPressedTimeout = 0;
}
}
});
}
main(); // asyncronous load
try {
navigator.serviceWorker.getRegistrations().then(registrations => { // getting rid of old service workers.
try {
log(registrations);
for(let registration of registrations) {
if (registration.scope != "https://"+window.location.hostname+window.location.pathname+"thirdparty/"){
registration.unregister();
}
}
} catch(e){}
}).catch(errorlog);
} catch(e){}
setTimeout(function(){ // lazy load
var script = document.createElement('script');
document.head.appendChild(script);

View File

@ -96,6 +96,43 @@
ev.preventDefault();
}
(function(w) {
w.URLSearchParams = w.URLSearchParams || function(searchString) {
var self = this;
searchString = searchString.replace("??", "?");
self.searchString = searchString;
self.get = function(name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(self.searchString);
if (results == null) {
return null;
} else {
return decodeURI(results[1]) || 0;
}
};
};
})(window);
var urlEdited = window.location.search.replace(/\?\?/g, "?");
urlEdited = urlEdited.replace(/\?/g, "&");
urlEdited = urlEdited.replace(/\&/, "?");
if (urlEdited !== window.location.search){
warnlog(window.location.search + " changed to " + urlEdited);
window.history.pushState({path: urlEdited.toString()}, '', urlEdited.toString());
}
var urlParams = new URLSearchParams(urlEdited);
var password = false;
if (urlParams.has("password")){
password = urlParams.get("password");
}
var roomname = false;
if (urlParams.has("room") || urlParams.has("dir") || urlParams.has("director")){
roomname = urlParams.get("room") || urlParams.get("dir") || urlParams.get("director");
}
function swapNodes(n1, n2) {
var p1 = n1.parentNode;
var p2 = n2.parentNode;
@ -256,12 +293,20 @@
var iframeContainer = document.createElement("div");
iframe.allow = "autoplay;camera;microphone;fullscreen;picture-in-picture;display-capture;";
var promptRoom = prompt("Enter a room name to use");
var additional = "";
if (password){
additional = "&password="+password;
}
if (roomname){
var promptRoom = roomname;
} else {
var promptRoom = prompt("Enter a room name to use");
}
if (promptRoom){
var iframesrc = "./?transparent&cleanoutput&director="+promptRoom;
var iframesrc = "./?transparent&cleanoutput&director="+promptRoom+additional;
} else {
promptRoom = "testroom123312";
var iframesrc = "./?transparent&cleanoutput&director="+promptRoom;
var iframesrc = "./?transparent&cleanoutput&director="+promptRoom+additional;
}
function remoteActivate(){
@ -303,13 +348,13 @@
var a = document.createElement("a");
a.innerHTML = "Invite Guest Link";
a.href = "./?room="+promptRoom+"&broadcast";
a.href = "./?room="+promptRoom+"&broadcast"+additional;
a.target = "_blank";
document.getElementById("sources").appendChild(a);
var a = document.createElement("a");
a.innerHTML = "Scene View Link";
a.href = "./?scene=0&room="+promptRoom;
a.href = "./?scene=0&room="+promptRoom+additional;
a.target = "_blank";
document.getElementById("sources").appendChild(a);

File diff suppressed because one or more lines are too long