Skip to content

Commit

Permalink
Merge pull request #399 from RyanCoulsonCA/fix-245
Browse files Browse the repository at this point in the history
fix logo not displaying when configFileStructure is provided
  • Loading branch information
yileifeng authored Mar 7, 2024
2 parents 41b15ea + 0ed3372 commit 3f75c10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/story/introduction.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<template>
<div class="py-24 mx-auto text-center max-w-9xl" id="intro">
<img
v-if="config.logo && config.logo.src"
class="inline-block"
:src="config.logo.src"
:alt="config.logo.altText"
/>
<img v-if="!!state.logo" class="inline-block" :src="state.logo" :alt="config.logo.altText" />

<h1 class="m-10 text-5xl font-bold text-gray-800">
{{ config.title }}
Expand Down Expand Up @@ -75,7 +70,7 @@

<script setup lang="ts">
import type { PropType } from 'vue';
import { getCurrentInstance, onMounted } from 'vue';
import { reactive, onMounted } from 'vue';
import { ConfigFileStructure, Intro } from '@storylines/definitions';
const props = defineProps({
Expand All @@ -91,7 +86,13 @@ const props = defineProps({
}
});
const state = reactive({
logo: ''
});
onMounted(() => {
state.logo = props.config.logo ? props.config.logo.src : '';
// obtain logo from ZIP file if it exists
if (props.configFileStructure) {
const logo = props.config.logo?.src;
Expand All @@ -101,8 +102,7 @@ onMounted(() => {
const logoFile = props.configFileStructure.zip.file(logoSrc);
if (logoFile) {
logoFile.async('blob').then((res: Blob) => {
props.config.logo.src = URL.createObjectURL(res);
getCurrentInstance()?.proxy?.$forceUpdate();
state.logo = props.config.logo.src = URL.createObjectURL(res);
});
}
}
Expand Down
15 changes: 15 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
const path = require('path');
const crypto = require('crypto');

/**
* The MD4 algorithm is not available anymore in Node.js 17+ (because of library SSL 3).
* In that case, silently replace MD4 by the MD5 algorithm.
*/
try {
crypto.createHash('md4');
} catch (e) {
console.warn('Crypto "MD4" is not supported anymore by this Node.js version');
const origCreateHash = crypto.createHash;
crypto.createHash = (alg, opts) => {
return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
};
}

module.exports = {
pages: {
Expand Down

0 comments on commit 3f75c10

Please sign in to comment.