add source files

This commit is contained in:
mx2 2023-06-21 15:33:47 +00:00
parent b317d31277
commit 1123374718
14 changed files with 2049 additions and 0 deletions

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
# custom
*.zip
*(copy*
zarch*
# ---> Node
# Logs
logs

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

290
www/index.html Normal file
View File

@ -0,0 +1,290 @@
<!doctype HTML>
<head>
<title>Rendezvous | Linky IO</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/rendezvous-icon.png" />
<style>
* {
padding:0;
margin:0;
}
video {
display: block;
xopacity: 0.3;
width: 100%;
height: 100%;
object-fit: cover;
xborder-radius: 5px;
}
.preview video {transform: rotateY(180deg);}
.display .video-wrapper {
xbackground: rgba(0,0,0,0.97);
width: 100%;
height: 100%;
box-sizing: border-box;
xpadding: 3px;
xborder-radius: 5px;
}
.display .status-prompt {
font-size: 18px;
display: grid; justify-content: center; opacity: 0.65;
grid-row-gap: 25px;
justify-items: center;
}
.display .status-prompt svg {height: 22px; animation: rotate 7s infinite; animation-timing-function: linear;}
.display .text-log {
margin-left: 25px;
filter: drop-shadow(0.5px 0.5px 0.75px #000000aa);
}
body.has-peer-video .display .text-log {
position: absolute; z-index: 900; top:150px; left:0;
}
.text-log .from-me {
font-weight: bold;
}
.display .text-log .item {
margin-bottom: 5px;
}
.display .text-log .item .meta {
font-size: 12px;
font-weight: bold;
opacity: 0.53;
}
@keyframes rotate {
0% {
transform: rotate(0deg)
}
100% {
transform: rotate(360deg)
}
}
.preview .video-wrapper {
width: 100%;
height: 100%;
border: solid 2px rgba(0,0,0,0.3);
}
body .video-wrapper-4 {
max-width: 25vw;
max-height: 25vh;
}
body .video-wrapper-8 {
max-width: 12.5vw;
max-height: 12.5vh;
}
.preview {
position: absolute;
bottom: 25px;
right: 25px;
width: 15vw;
height: 15vh;
}
svg {
height: 24px;
filter: drop-shadow(0.5px 0.5px 1.25px #00000077);
display: block;
}
footer {position: fixed; bottom: 0; left: 0; right: 0;}
footer .status {padding: 5px; display:flex; justify-content: center; column-gap:5px; font-size: 12px; align-items: center;}
footer .status svg {height: 16px;}
footer .input {
display: flex;
flex-wrap: wrap;
margin-left: 50px;
margin-right: 50px;
margin-bottom: 7px;
}
footer .input input {background: none; outline: none; border: none; color: #fafafaEE; font-size: 16px; width: 100%;
filter: drop-shadow(0.5px 0.5px 1.00px #000000CC);
}
header .display .peers .x, header .display .peers .peer-count { /* or? */
filter: drop-shadow(0.5px 0.5px 1.25px #00000077);
}
html {
}
body {
font: normal 16px arial;
background-color: #7c156b;
color: #d5d5d5;
}
body:not(.has-peers) {background-color: #37062f;}
header {
position: relative;
padding: 15px;
z-index: 100;
display: grid;
grid-template-columns: 1fr auto;
opacity: 0.95;
gap: 15px;
}
header .input {
display: flex;
gap: 15px;
}
header .button.highlight-me {
border-bottom: solid 3px #cccccc33;
}
body.cam-on header .cam.button {border-bottom-color: #ccccccCC;}
body.mic-on header .mic.button {border-bottom-color: #ccccccCC;}
body.cam-on header .mic.button {border-bottom-color: #cccccc00;}
body.mic-on header .cam.button {border-bottom-color: #cccccc00;}
body > .display {
position: absolute;
top: 0px; right:0px; bottom:0px; left: 0px;
xborder: solid 3px yellow;
xbackground: #333;
display: flex;
flex-wrap: wrap;
xjustg: 23;
align-content: center;
xflex-direction: column;
justify-content: center;
z-index: 0;
}
body > .display > * {
flex-grow: 1;
xflex-shrink: 1;
xmin-height: 0;
xmin-width: 0;
}
.log {display: none;}
.button {cursor: pointer;}
.hide-always {display: none;}
body.has-interacted .hide-when-interacted {display: none;}
body.is-muted .hide-when-muted {display: none;}
body:not(.is-muted) .hide-when-not-muted {display: none;}
body:not(.wakelock-active) .hide-when-not-wakelock-active {display: none;}
body:not(.wakelock-not-supported) .hide-when-wakelock-is-supported {display: none;}
body.audio-is-live .hide-when-mic-is-on {display: none;}
body:not(.audio-is-live) .hide-when-mic-is-off {display: none;}
body.video-is-live .hide-when-cam-is-on {display: none;}
body:not(.video-is-live) .hide-when-cam-is-off {display: none;}
body.has-peers .hide-if-has-peers {display: none;}
body:not(.has-peers) .hide-if-has-no-peers {display: none;}
</style>
</head>
<body class='is-muted'>
<header>
<div class='input'>
<div class='mic button highlight-me'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mic hide-when-mic-is-off"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mic-off hide-when-mic-is-on"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"></path><path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>
</div>
<div class='cam button highlight-me'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video hide-when-cam-is-off"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off hide-when-cam-is-on"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>
</div>
</div>
<div class='display'>
<div class='peers button'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg> <span class='x'>x</span> <span class='peer-count'>1</span>
</div>
</div>
</header>
<main class='display'>
<div class='debug' style='xwhite-space: pre; width:100vw; display: none;'></div>
<div class='text-log hide-if-has-no-peers'></div>
<div class='status-prompt hide-if-has-peers'>
<!-- Waiting for others --><!-- to join -->
Peering..
<div class='reload-button button'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-refresh-cw"><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>
</div>
</div>
</main>
<div class='preview'>
<!--
upg: show live or preview -- tap to toggle live and/or?
<div class='live'>Live</div>
<div class='video'></div>
-->
</div>
<div class='log'></div>
<footer>
<div class='input'>
<input>
</div>
<div class='status'>
<div class='indicator hide-when-not-wakelock-active'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
</div>
<div class='indicator hide-when-wakelock-is-supported'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
</div>
<div class='mute button'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-x hide-when-interacted"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><line x1="23" y1="9" x2="17" y2="15"></line><line x1="17" y1="9" x2="23" y2="15"></line></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-2 hide-always xhide-when-muted"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>
</div>
<div class='version'></div>
</div>
</footer>
<script type='module' src='./main.js'></script>
</body>

14
www/lib/b64-to-blob.js Normal file
View File

@ -0,0 +1,14 @@
export default async function b64toBlob(b,type){
// https://ionic.io/blog/converting-a-base64-string-to-a-blob-in-javascript
// https://github.com/jeremyBanks/b64-to-blob/blob/master/b64toBlob.js
// size limit?
//console.log({b,type})
const u = `data:${type};base64,${b}`
//console.log({u})
const f = await fetch(u) // this always works?
const blob = await f.blob()
//console.log({blob})
return blob
}//func

6
www/lib/bin2hex.js Normal file
View File

@ -0,0 +1,6 @@
// ------------------------------
export default function bin2hex(n){
const a = new Uint8Array(n)
return Array.from(a).map(v=>v.toString(16).padStart(2,'0')).join('')
}

29
www/lib/blob-to-b64.js Normal file
View File

@ -0,0 +1,29 @@
//
// 2023.01.10
//
export default async function blobToB64(b,type){
// https://ionic.io/blog/converting-a-base64-string-to-a-blob-in-javascript
// https://github.com/jeremyBanks/b64-to-blob/blob/master/b64toBlob.js
//
// upg: to b64url and/or data urls?
// size limit?
//console.log({b,type}) // upg: type to override blob type or?
let p = new Promise((res, rej) => {
const r = new FileReader
r.onerror = rej
r.onload = e=>{
const {result} = r
const x = result.split(',') // and/or? 'data:image/jpeg;base64'
res(x[1])
}
r.readAsDataURL(b)
})
let rr = await p
return p
}//func

2
www/lib/bundle.js Normal file

File diff suppressed because one or more lines are too long

5
www/lib/hash.js Normal file
View File

@ -0,0 +1,5 @@
export default async function hash(n,name){
n = n || false
name = name || 'SHA-256'
return await window.crypto.subtle.digest({name},n)
}

53
www/lib/hex2bin.js Normal file
View File

@ -0,0 +1,53 @@
//
// 2022.08.09
//
// ------------------------------
export default function bin2hex(n){
n = n || ''
// \\
// ! \\ lossy on bad data
/////
const l = n.length
const c = l>>1
const a = new Uint8Array(c)
for(let i=0;i<c;i++){
const p = i<<1
const s = n.substring(p,p+2)
console.log({i,p,s})
a[i] = parseInt(s,16)
}
return a
}
//console.log(bin2hex('aabbcc'))
//console.log(bin2hex('000102'))
//console.log(bin2hex('FDFEFF'))
/*
https://github.com/LinusU/hex-to-array-buffer/blob/master/index.js
export default function hexToArrayBuffer (input) {
if (typeof input !== 'string') {
throw new TypeError('Expected input to be a string')
}
if ((input.length % 2) !== 0) {
throw new RangeError('Expected string to be an even number of characters')
}
const view = new Uint8Array(input.length / 2)
for (let i = 0; i < input.length; i += 2) {
view[i / 2] = parseInt(input.substring(i, i + 2), 16)
}
return view.buffer
}
*/

265
www/lib/nosleep.js Normal file

File diff suppressed because one or more lines are too long

38
www/lib/random-string.js Normal file
View File

@ -0,0 +1,38 @@
function randomString(n,s){
//
// review..
try{
n = n || 16
let b = new Uint8Array(n+1) // +1 for extra random value for initial start position
crypto.getRandomValues(b)
s = s || 'ABCDEFGHIJKLMNOPQRSTUWXYZabcdefghijklmnopqrstuvwxyz01234567890' //-_'
let aa = []
let ii = 0
let len = s.length
// note: this might be biased? or might be bad to add seq random numbers?
for(let i = 0;i< b.length;i++){ // first value (index 0) to start in a random location.
let v = b[i]
ii += v
if(i > 0){
let iii = ii%len
let vv = s[iii]
if(!vv)
conole.log('out of range?',iii)
aa.push(vv)
}
}//for
let r = aa.join('')
return r
}
catch(e){
//
console.log('crypto not supported?')
return Math.random().toString(36).substring(7) // till crypto bug fix?
}
}
export default randomString

1341
www/main.js Normal file

File diff suppressed because it is too large Load Diff

BIN
www/rendezvous-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

1
www/rendvz Normal file
View File

@ -0,0 +1 @@
2023-June