This commit is contained in:
j3d1 2023-11-01 03:17:25 +01:00
parent 0b46fb152c
commit a7515d366c
3 changed files with 8 additions and 17 deletions

View file

@ -1,11 +1,5 @@
<template>
<div>
<!--img src=""-->
data:{{ image_data }}<br>
owner:{{ owner }}<br>
src:{{ src }}<br>
servers:{{ servers }}
</div>
<img :src="image_data" :alt="owner + '/' + src"/>
</template>
<style scoped>
@ -46,7 +40,9 @@ export default {
async mounted() {
try {
this.servers = await this.getFriendServers({username: this.owner});
this.image_data = await this.servers.get(this.signAuth, this.src);
const response = await this.servers.getRaw(this.signAuth, this.src);
const mime_type = response.headers.get("content-type");
this.image_data = "data:" + mime_type + ";base64," + btoa(String.fromCharCode(...new Uint8Array(await response.arrayBuffer())));
} catch (e) {
console.log(e);
}

View file

@ -34,14 +34,9 @@
</div-->
<div class="mb-3">
<label for="image" class="form-label">Image</label>
<div>
<img v-for="file in files" :key="file.id" :alt="file.name"
:src="'https://toolshed.j3d1.de'+file.name" class="img-thumbnail border-info">
<!-- TODO replace dirty hack with proper solution -->
</div>
<div>
<authenticated-image v-for="file in files" :key="file.id" :src="file.name"
:owner="file.owner"></authenticated-image>
:owner="file.owner" class="img-thumbnail border-info"></authenticated-image>
</div>
</div>

View file

@ -22,8 +22,8 @@ export default defineConfig({
'Content-Security-Policy': 'default-src \'self\';'
+ ' script-src \'self\' \'wasm-unsafe-eval\';'
+ ' style-src \'self\' \'unsafe-inline\';'
+ ' img-src \'self\' data:; '
+ ' connect-src * data:', // TODO: change * to https://* for production (probably in nginx config not here)
+ ' img-src \'self\' https://* data:;'
+ ' connect-src * data:', // TODO: change * to https://* for production
},
/*https: {
key: fs.readFileSync('privkey.pem'),
@ -52,7 +52,7 @@ export default defineConfig({
'^/livereload/': {
target: "http://127.0.0.1:8080/",
}
},
}
},
test: {
include: ['src/tests/**/*.js'],