-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add image metadata for URL previews (#224)
- Default to a nice `[matrix]` banner - There is room for improvement here when the Matrix Public Archive gets it's own logo (#94) and maybe says "Matrix Public Archive" somewhere in the banner. - This is good enough for now (and certainly better than downstream previews using the first image on the page). - For rooms, it will use the room avatar Part of #202 Image is sized to 1200x630 to match conventions of `og:image`. Crafted the banner image by modifying the header on the room directory homepage and taking a node screenshot. Page zoom @ 175%
- Loading branch information
1 parent
bf8040f
commit 16323df
Showing
7 changed files
with
70 additions
and
35 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
const path = require('path').posix; | ||
|
||
function getAssetUrl(inputAssetPath) { | ||
// Lazy-load the manifest so we only require it on first call hopefully after the Vite | ||
// client build completes. `require(...)` calls are cached so it should be fine to | ||
// look this up over and over. | ||
// | ||
// We have to disable the `no-missing-require` because the file is built via the Vite client build. | ||
// eslint-disable-next-line n/no-missing-require, n/no-unpublished-require | ||
const manfiest = require('../../dist/manifest.json'); | ||
|
||
const assetEntry = manfiest[inputAssetPath]; | ||
if (!assetEntry) { | ||
throw new Error(`Could not find asset with path "${inputAssetPath}" in \`dist/manifest.json\``); | ||
} | ||
|
||
const outputAssetPath = path.join('/', assetEntry.file); | ||
|
||
return outputAssetPath; | ||
} | ||
|
||
module.exports = getAssetUrl; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters