Skip to content

Commit

Permalink
fix: simplified Discord embed viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Moore committed Sep 25, 2023
1 parent e4c2197 commit 9ecf600
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,8 @@ export const buildHtml = (url: string, type: string, embed?: DiscordEmbed) =>
`
<!DOCTYPE HTML>
<html>
<!-- cheek Discord viewer page -->
<head>
<!-- cheek Discord viewer page -->
<meta name="viewport" content="width=device-width; height=device-height;">
<title>${url}</title>
<style>
/* CSS "borrowed" from Firefox image viewer */
body {
margin: 0;
background-color: #222;
}
img {
display: block;
image-orientation: from-image;
text-align: center;
position: absolute;
inset: 0;
margin: auto;
}
</style>
${ /* Title */ embed && embed.title ?
`<meta property="og:title" content="${embed.title}">` : ''}
Expand All @@ -46,8 +27,5 @@ export const buildHtml = (url: string, type: string, embed?: DiscordEmbed) =>
${ /* Resource URL */ embed ?
`<meta name="og:${type.includes('video') ? 'video' : 'image'}" content="${url}">` : ''}
</head>
<body>
<img src="${url}" alt="Discord viewer for resource: ${url}"></img>
</body>
</html>
`;

0 comments on commit 9ecf600

Please sign in to comment.