From 10c274fdd453419936684a603b152d445745bef9 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Mon, 16 Sep 2024 11:38:55 +0000 Subject: [PATCH] configured fallback ISO url --- com/isoterminal.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/com/isoterminal.js b/com/isoterminal.js index 77dd088..d8af0f5 100644 --- a/com/isoterminal.js +++ b/com/isoterminal.js @@ -32,7 +32,7 @@ if( typeof AFRAME != 'undefined '){ AFRAME.registerComponent('isoterminal', { schema: { - iso: { type:"string", "default":"com/isoterminal/images/buildroot-bzimage.bin" }, + iso: { type:"string", "default":"https://forgejo.isvery.ninja/assets/xrsh-buildroot/main/xrsh.iso" }, overlayfs: { type:"string"}, cols: { type: 'number',"default": 120 }, rows: { type: 'number',"default": 30 }, @@ -45,7 +45,16 @@ if( typeof AFRAME != 'undefined '){ init: async function(){ this.el.object3D.visible = false - this.initTerminal(true) + fetch(this.data.iso,{method: 'HEAD'}) + .then( (res) => { + if( res.status != 200 ) throw 'not found' + }) + .catch( (e) => { + console.warn(this.data.iso+" could not be loaded, loading fallback ISO URL:") + console.warn(this.schema.iso.default) + this.data.iso = this.schema.iso.default + }) + .finally( () => this.initTerminal(true) ) }, requires:{