new build

This commit is contained in:
Leon van Kammen 2024-04-16 16:44:55 +00:00
parent bab44bc785
commit 2f867ab93d
12 changed files with 79 additions and 3182 deletions

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Apr 16 12:47:01 PM UTC 2024
* v0.5.1 generated at Tue Apr 16 04:44:21 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -1215,6 +1215,7 @@ xrfragment_URI.parse = function(stringUrl,flags) {
if(url.directory == null && url.host != null) {
url.file = url.host;
}
url.host = "";
}
url.hash = { };
if(url.fragment != null && url.fragment.length > 0) {
@ -1393,6 +1394,8 @@ xrfragment_URI.toAbsolute = function(url,newUrl) {
resultURI.directory = directory;
if(newURI.file != null) {
resultURI.file = newURI.file;
} else {
resultURI.file = url.file;
}
resultURI.path = resultURI.directory + resultURI.file;
if(newURI.query != null) {
@ -1999,7 +2002,15 @@ xrf.hasNoMaterial = (mesh) => {
const hasMaterialName = mesh.material && mesh.material.name.length > 0
return mesh.geometry && !hasMaterialName && !hasTexture
}
xrf.navigator = {URI:{}}
xrf.navigator = {
URI:{
scheme: document.location.protocol.replace(/:$/,''),
directory: document.location.pathname,
host: document.location.hostname,
port: document.location.port,
file: 'index.glb'
}
}
xrf.navigator.to = (url,flags,loader,data) => {
if( !url ) throw 'xrf.navigator.to(..) no url given'
@ -2111,7 +2122,6 @@ xrf.navigator.init = () => {
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
//xrf.navigator.to( document.location.search.substr(1) + document.location.hash )
xrf.navigator.to( document.location.href.replace(/\?/,'') )
}
})
@ -2183,7 +2193,7 @@ xrf.navigator.reactifyHash = ( obj ) => {
toString(me){
let parts = []
Object.keys(me).map( (k) => {
parts.push( me[k] ? `${k}=${encodeURIComponent(me[k])}` : k )
parts.push( me[k] ? `${k}=${me[k]}` : k )
})
return parts.join('&')
}

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Apr 16 12:47:01 PM UTC 2024
* v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -1213,6 +1213,7 @@ xrfragment_URI.parse = function(stringUrl,flags) {
if(url.directory == null && url.host != null) {
url.file = url.host;
}
url.host = "";
}
url.hash = { };
if(url.fragment != null && url.fragment.length > 0) {
@ -1391,6 +1392,8 @@ xrfragment_URI.toAbsolute = function(url,newUrl) {
resultURI.directory = directory;
if(newURI.file != null) {
resultURI.file = newURI.file;
} else {
resultURI.file = url.file;
}
resultURI.path = resultURI.directory + resultURI.file;
if(newURI.query != null) {
@ -1997,7 +2000,15 @@ xrf.hasNoMaterial = (mesh) => {
const hasMaterialName = mesh.material && mesh.material.name.length > 0
return mesh.geometry && !hasMaterialName && !hasTexture
}
xrf.navigator = {URI:{}}
xrf.navigator = {
URI:{
scheme: document.location.protocol.replace(/:$/,''),
directory: document.location.pathname,
host: document.location.hostname,
port: document.location.port,
file: 'index.glb'
}
}
xrf.navigator.to = (url,flags,loader,data) => {
if( !url ) throw 'xrf.navigator.to(..) no url given'
@ -2109,7 +2120,6 @@ xrf.navigator.init = () => {
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
//xrf.navigator.to( document.location.search.substr(1) + document.location.hash )
xrf.navigator.to( document.location.href.replace(/\?/,'') )
}
})
@ -2181,7 +2191,7 @@ xrf.navigator.reactifyHash = ( obj ) => {
toString(me){
let parts = []
Object.keys(me).map( (k) => {
parts.push( me[k] ? `${k}=${encodeURIComponent(me[k])}` : k )
parts.push( me[k] ? `${k}=${me[k]}` : k )
})
return parts.join('&')
}

3
dist/xrfragment.js vendored
View File

@ -1208,6 +1208,7 @@ xrfragment_URI.parse = function(stringUrl,flags) {
if(url.directory == null && url.host != null) {
url.file = url.host;
}
url.host = "";
}
url.hash = { };
if(url.fragment != null && url.fragment.length > 0) {
@ -1386,6 +1387,8 @@ xrfragment_URI.toAbsolute = function(url,newUrl) {
resultURI.directory = directory;
if(newURI.file != null) {
resultURI.file = newURI.file;
} else {
resultURI.file = url.file;
}
resultURI.path = resultURI.directory + resultURI.file;
if(newURI.query != null) {

3
dist/xrfragment.lua vendored
View File

@ -3103,6 +3103,7 @@ __xrfragment_URI.parse = function(stringUrl,flags)
if ((url.directory == nil) and (url.host ~= nil)) then
url.file = url.host;
end;
url.host = "";
end;
url.hash = _hx_e();
if ((url.fragment ~= nil) and (__lua_lib_luautf8_Utf8.len(url.fragment) > 0)) then
@ -3406,6 +3407,8 @@ __xrfragment_URI.toAbsolute = function(url,newUrl)
resultURI.directory = directory;
if (newURI.file ~= nil) then
resultURI.file = newURI.file;
else
resultURI.file = url.file;
end;
resultURI.path = Std.string(resultURI.directory) .. Std.string(resultURI.file);
if (newURI.query ~= nil) then

File diff suppressed because it is too large Load Diff

View File

@ -777,10 +777,10 @@ window.frontend = (opts) => new Proxy({
share(opts){
opts = opts || {notify:true,qr:true,share:true,linkonly:false}
if( network.meetingLink && !document.location.hash.match(/meet=/) ){
document.location.hash += `&meet=${network.meetingLink}`
if( network.meetingLink && !xrf.navigator.URI.hash.meet ){
xrf.navigator.URI.hash.meet = network.meetingLink
}
if( !document.location.hash.match(/pos=/) && (network.posName || network.pos) ){
if( !xrf.navigator.URI.hash.pos && (network.posName || network.pos) ){
xrf.navigator.URI.hash.pos = network.posName || network.pos
}else frontend.updateHashPosition()

View File

@ -295,12 +295,11 @@
},
createLink(opts){
let hash = document.location.hash
if( !this.link ){
const meeting = network.getMeetingFromUrl(document.location.href)
this.link = network.meetingLink = meeting.match("matrix://") ? meeting : ''
}
if( !hash.match('meet=') ) document.location.hash += `${hash.length > 1 ? '&' : '#'}meet=${this.link}`
if( !xrf.navigator.URI.hash.meet ) xrf.navigator.URI.hash.meet = this.link
},
reactToConnectionHrefs(){

View File

@ -349,7 +349,7 @@ connectionsComponent = {
}
// reactify component!
document.addEventListener('$menu:ready', (opts) => {
document.addEventListener('$chat:ready', (opts) => {
opts = opts.detail
document.head.innerHTML += connectionsComponent.css
window.$connections = document.createElement('div')
@ -488,7 +488,7 @@ chatComponent = {
br.classList.add.apply(br.classList, opts.class)
div.classList.add.apply(div.classList, opts.class.concat(["envelope"]))
}
if( !msg.className.match(/(info|guide|ui)/) ){
if( msg.className.match(/(info|guide|ui)/) || !opts.from ){
let frag = xrf.URI.parse(document.location.hash).XRF
opts.from = 'you'
if( frag.pos ) opts.pos = frag.pos.string
@ -570,7 +570,7 @@ chatComponent.css = `
bottom: 0;
right: 0;
margin: 15px;
z-index:1500;
z-index:1000;
}
#videos > video{
border-radius:7px;

View File

@ -53,14 +53,10 @@ window.trystero = (opts) => new Proxy({
$connections.webcam = $connections.webcam.concat([this])
$connections.chatnetwork = $connections.chatnetwork.concat([this])
$connections.scene = $connections.scene.concat([this])
if( localStorage.getItem("selfId") ){
this.selfId = localStorage.getItem("selfId")
}else{
this.selfId = String(Math.random()).substr(2)
localStorage.setItem("selfId",this.selfId)
}
this.selfId = selfId // selfId is a trystero global (unique per session)
this.reactToConnectionHrefs()
this.nickname = localStorage.getItem("nickname") || `human${String(Math.random()).substr(5,4)}`
this.names[ this.selfId ] = this.nickname
document.addEventListener('network.connect', (e) => this.connect(e.detail) )
document.addEventListener('network.init', () => {
let meeting = network.getMeetingFromUrl(document.location.href)
@ -74,7 +70,6 @@ window.trystero = (opts) => new Proxy({
if( !this.connected ){
this.connected = true
frontend.emit('network.connected',{plugin:this,username: this.nickname})
this.names[ this.selfId ] = this.nickname
}
},
@ -210,12 +205,11 @@ window.trystero = (opts) => new Proxy({
send(opts){ $chat.send({...opts, source: 'trystero'}) },
createLink(opts){
let hash = document.location.hash
if( !this.link ){
const meeting = network.getMeetingFromUrl(document.location.href)
this.link = network.meetingLink = meeting.match("trystero://") ? meeting : `trystero://r/${network.randomRoom()}:bittorrent`
}
if( !hash.match('meet=') ) document.location.hash += `${hash.length > 1 ? '&' : '#'}meet=${this.link}`
if( !xrf.navigator.URI.hash.meet ) xrf.navigator.URI.hash.meet = this.link
},
config(opts){

3
dist/xrfragment.py vendored
View File

@ -2404,6 +2404,7 @@ class xrfragment_URI:
if (xrfragment_URI.isRelative(url) == True):
if ((url.directory is None) and ((url.host is not None))):
url.file = url.host
url.host = ""
url.hash = _hx_AnonObject({})
if ((url.fragment is not None) and ((len(url.fragment) > 0))):
url.XRF = xrfragment_URI.parseFragment(("#" + HxOverrides.stringOrNull(url.fragment)),flags)
@ -2579,6 +2580,8 @@ class xrfragment_URI:
resultURI.directory = directory
if (newURI.file is not None):
resultURI.file = newURI.file
else:
resultURI.file = url.file
resultURI.path = (HxOverrides.stringOrNull(resultURI.directory) + HxOverrides.stringOrNull(resultURI.file))
if (newURI.query is not None):
resultURI.query = newURI.query

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Apr 16 12:47:01 PM UTC 2024
* v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -1213,6 +1213,7 @@ xrfragment_URI.parse = function(stringUrl,flags) {
if(url.directory == null && url.host != null) {
url.file = url.host;
}
url.host = "";
}
url.hash = { };
if(url.fragment != null && url.fragment.length > 0) {
@ -1391,6 +1392,8 @@ xrfragment_URI.toAbsolute = function(url,newUrl) {
resultURI.directory = directory;
if(newURI.file != null) {
resultURI.file = newURI.file;
} else {
resultURI.file = url.file;
}
resultURI.path = resultURI.directory + resultURI.file;
if(newURI.query != null) {
@ -1997,7 +2000,15 @@ xrf.hasNoMaterial = (mesh) => {
const hasMaterialName = mesh.material && mesh.material.name.length > 0
return mesh.geometry && !hasMaterialName && !hasTexture
}
xrf.navigator = {URI:{}}
xrf.navigator = {
URI:{
scheme: document.location.protocol.replace(/:$/,''),
directory: document.location.pathname,
host: document.location.hostname,
port: document.location.port,
file: 'index.glb'
}
}
xrf.navigator.to = (url,flags,loader,data) => {
if( !url ) throw 'xrf.navigator.to(..) no url given'
@ -2109,7 +2120,6 @@ xrf.navigator.init = () => {
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
//xrf.navigator.to( document.location.search.substr(1) + document.location.hash )
xrf.navigator.to( document.location.href.replace(/\?/,'') )
}
})
@ -2181,7 +2191,7 @@ xrf.navigator.reactifyHash = ( obj ) => {
toString(me){
let parts = []
Object.keys(me).map( (k) => {
parts.push( me[k] ? `${k}=${encodeURIComponent(me[k])}` : k )
parts.push( me[k] ? `${k}=${me[k]}` : k )
})
return parts.join('&')
}

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Apr 16 12:47:01 PM UTC 2024
* v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -1213,6 +1213,7 @@ xrfragment_URI.parse = function(stringUrl,flags) {
if(url.directory == null && url.host != null) {
url.file = url.host;
}
url.host = "";
}
url.hash = { };
if(url.fragment != null && url.fragment.length > 0) {
@ -1391,6 +1392,8 @@ xrfragment_URI.toAbsolute = function(url,newUrl) {
resultURI.directory = directory;
if(newURI.file != null) {
resultURI.file = newURI.file;
} else {
resultURI.file = url.file;
}
resultURI.path = resultURI.directory + resultURI.file;
if(newURI.query != null) {
@ -1997,7 +2000,15 @@ xrf.hasNoMaterial = (mesh) => {
const hasMaterialName = mesh.material && mesh.material.name.length > 0
return mesh.geometry && !hasMaterialName && !hasTexture
}
xrf.navigator = {URI:{}}
xrf.navigator = {
URI:{
scheme: document.location.protocol.replace(/:$/,''),
directory: document.location.pathname,
host: document.location.hostname,
port: document.location.port,
file: 'index.glb'
}
}
xrf.navigator.to = (url,flags,loader,data) => {
if( !url ) throw 'xrf.navigator.to(..) no url given'
@ -2109,7 +2120,6 @@ xrf.navigator.init = () => {
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
//xrf.navigator.to( document.location.search.substr(1) + document.location.hash )
xrf.navigator.to( document.location.href.replace(/\?/,'') )
}
})
@ -2181,7 +2191,7 @@ xrf.navigator.reactifyHash = ( obj ) => {
toString(me){
let parts = []
Object.keys(me).map( (k) => {
parts.push( me[k] ? `${k}=${encodeURIComponent(me[k])}` : k )
parts.push( me[k] ? `${k}=${me[k]}` : k )
})
return parts.join('&')
}