Skip to content

Commit

Permalink
fix: disable image optimizations for logo to prevent caching issues w…
Browse files Browse the repository at this point in the history
…ith custom logos
  • Loading branch information
stonith404 committed Oct 9, 2023
1 parent f15a8dc commit 3891900
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions backend/src/config/logo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const IMAGES_PATH = "../frontend/public/img";
@Injectable()
export class LogoService {
async create(file: Buffer) {
fs.writeFileSync(`${IMAGES_PATH}/logo.png`, file, "binary");
const resized = await sharp(file).resize(900).toBuffer();
fs.writeFileSync(`${IMAGES_PATH}/logo.png`, resized, "binary");
this.createFavicon(file);
this.createPWAIcons(file);
}
Expand All @@ -25,7 +26,7 @@ export class LogoService {
fs.promises.writeFile(
`${IMAGES_PATH}/icons/icon-${size}x${size}.png`,
resized,
"binary",
"binary"
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"react-hooks/exhaustive-deps": ["off"],
"import/no-anonymous-default-export": ["off"],
"no-unused-vars": ["warn"],
"react/no-unescaped-entities": ["off"]
"react/no-unescaped-entities": ["off"],
"@next/next/no-img-element": ["off"]
}
}
Binary file modified frontend/public/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/src/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Image from "next/image";

const Logo = ({ height, width }: { height: number; width: number }) => {
return <Image src="/img/logo.png" alt="logo" height={height} width={width} />;
return <img src="/img/logo.png" alt="logo" height={height} width={width} />;
};
export default Logo;

0 comments on commit 3891900

Please sign in to comment.