Show author and license information in web view

This commit is contained in:
Travis Ralston 2019-03-23 18:20:50 -06:00
parent f895decda2
commit 7e13170b5c
2 changed files with 12 additions and 2 deletions

View file

@ -106,6 +106,7 @@ export default class Webserver {
}
const renderVars = JSON.parse(JSON.stringify(pack));
renderVars['authorIsCreator'] = pack.authorName === pack.creatorId;
renderVars.stickers = renderVars.stickers.map(s => Object.assign({
contentUrl: `${config.appservice.homeserverUrl}/_matrix/media/r0/download/${s.contentUri.substring("mxc://".length)}`,
}, s));

View file

@ -43,7 +43,11 @@
{{#if pack}}
<meta property="og:title" content="{{pack.name}}" />
<meta property="og:description" content="A sticker pack by {{pack.creatorId}} for Matrix" />
{{#if pack.authorIsCreator}}
<meta property="og:description" content="A sticker pack by {{pack.creatorId}} for Matrix under {{pack.license}}" />
{{else}}
<meta property="og:description" content="A sticker pack by {{pack.authorName}} ({{pack.authorUrl}}) for Matrix under {{pack.license}}. Uploaded by {{pack.creatorId}}" />
{{/if}}
<meta property="og:image" content="{{pack.stickers.0.contentUrl}}" />
{{/if}}
</head>
@ -53,7 +57,12 @@
<div>
{{#if pack}}
Matrix Stickerpack: {{pack.name}}
<small>Created by {{pack.creatorId}}</small>
{{#if pack.authorIsCreator}}
<small>Created by {{pack.creatorId}} under {{pack.license}}</small>
{{else}}
<small>Authored by <a href="{{pack.authorUrl}}" target="_blank" rel="noopener">{{pack.authorName}}</a> under {{pack.license}}</small>
<small>Uploaded by {{pack.creatorId}}</small>
{{/if}}
{{else}}
Matrix Stickerpacks
{{/if}}