remove use of v1 api in item edit modal, which caused a prompt for http basic auth

This commit is contained in:
jedi 2024-01-23 19:05:20 +01:00
parent 41d983ccbb
commit b3c2233454

View file

@ -3,7 +3,7 @@
<img <img
v-if="!capturing" v-if="!capturing"
class="img-fluid rounded mx-auto d-block mb-3 img-preview" class="img-fluid rounded mx-auto d-block mb-3 img-preview"
:src="dataImage || `https://c3lf.de/api/1/thumbs/${model[field]}`" :src="dataImage"
alt="Image not available." alt="Image not available."
/> />
<video <video
@ -108,11 +108,23 @@ export default {
}); });
console.log('Error: ', error); console.log('Error: ', error);
}; };
},
loadImage() {
this.fetchImage('/media/2/' + this.model[this.field] + '/').then((response) => {
const mime_type = response.headers.get("content-type");
response.arrayBuffer().then((buf) => {
const base64 = btoa(new Uint8Array(buf)
.reduce((data, byte) => data + String.fromCharCode(byte), ""));
this.dataImage = "data:" + mime_type + ";base64," + base64;
});
})
} }
}, },
mounted() { mounted() {
if (!this.model[this.field]) if (!this.model[this.field])
this.openStream(); this.openStream();
else
this.loadImage();
}, },
beforeDestroy() { beforeDestroy() {
this.closeStream(); this.closeStream();