image embed with og protocol updated
This commit is contained in:
parent
45d1abccfe
commit
3c922d1cf5
@ -17,6 +17,7 @@ import {Button} from 'primeng/button';
|
|||||||
import {DialogModule} from 'primeng/dialog';
|
import {DialogModule} from 'primeng/dialog';
|
||||||
import {AuthService} from '../../auth.service';
|
import {AuthService} from '../../auth.service';
|
||||||
import {Role} from '../../models/role';
|
import {Role} from '../../models/role';
|
||||||
|
import {Meta} from '@angular/platform-browser';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-post',
|
selector: 'app-post',
|
||||||
@ -46,7 +47,8 @@ export class PostComponent {
|
|||||||
private postService: PostService,
|
private postService: PostService,
|
||||||
private commentService: CommentService,
|
private commentService: CommentService,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
private authService: AuthService,) {
|
private authService: AuthService,
|
||||||
|
private meta: Meta) {
|
||||||
this.route.paramMap.subscribe(params => {
|
this.route.paramMap.subscribe(params => {
|
||||||
if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
|
if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
|
||||||
const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
|
const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
|
||||||
@ -71,6 +73,9 @@ export class PostComponent {
|
|||||||
this.comments = res.comment
|
this.comments = res.comment
|
||||||
this.sortCommentList()
|
this.sortCommentList()
|
||||||
this.comments.forEach(comment => this.commentDeleteDialogMap.set(comment.id, false));
|
this.comments.forEach(comment => this.commentDeleteDialogMap.set(comment.id, false));
|
||||||
|
this.meta.updateTag({property: 'og:title', content: res.post.title});
|
||||||
|
this.meta.updateTag({property: 'og:description', content: this.cutDesc(res.post.description)});
|
||||||
|
this.meta.updateTag({property: 'og:image', content: `data:image/jpeg;base64,${res.post.illustration}`});
|
||||||
},
|
},
|
||||||
error: err => this.failureMessage("Erreur", err.error.message)
|
error: err => this.failureMessage("Erreur", err.error.message)
|
||||||
}));
|
}));
|
||||||
@ -81,6 +86,14 @@ export class PostComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cutDesc(desc: string): string {
|
||||||
|
let output: string = '';
|
||||||
|
for (let i = 0; i < 256; i++) {
|
||||||
|
output += desc[i];
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
addNewCommentToList(comment: Comment) {
|
addNewCommentToList(comment: Comment) {
|
||||||
this.comments.push(comment);
|
this.comments.push(comment);
|
||||||
console.log(this.comments)
|
console.log(this.comments)
|
||||||
|
Loading…
Reference in New Issue
Block a user