forked from mirrored/github-readme-stats
make image_preview optional
This commit is contained in:
@@ -24,6 +24,7 @@ export default async (req, res) => {
|
||||
locale,
|
||||
border_radius,
|
||||
border_color,
|
||||
show_image,
|
||||
} = req.query;
|
||||
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
@@ -80,6 +81,7 @@ export default async (req, res) => {
|
||||
border_color,
|
||||
show_owner: parseBoolean(show_owner),
|
||||
locale: locale ? locale.toLowerCase() : null,
|
||||
show_image: parseBoolean(show_image),
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
|
||||
@@ -74,6 +74,7 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
border_radius,
|
||||
border_color,
|
||||
locale,
|
||||
show_image = false,
|
||||
} = options;
|
||||
|
||||
const lineHeight = 10;
|
||||
@@ -142,7 +143,7 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
height,
|
||||
border_radius,
|
||||
colors,
|
||||
imageUrl: openGraphImageUrl,
|
||||
imageUrl: show_image ? openGraphImageUrl : "",
|
||||
});
|
||||
|
||||
card.disableAnimations();
|
||||
|
||||
Vendored
+1
@@ -32,6 +32,7 @@ export type StatCardOptions = CommonOptions & {
|
||||
|
||||
export type RepoCardOptions = CommonOptions & {
|
||||
show_owner: boolean;
|
||||
show_image: boolean;
|
||||
};
|
||||
|
||||
export type TopLangOptions = CommonOptions & {
|
||||
|
||||
@@ -209,6 +209,9 @@ class Card {
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string} Renders social preview image
|
||||
*/
|
||||
renderImage = () => {
|
||||
if (!this.imageUrl) {
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user