mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-10 00:40:36 +01:00
retrieving pleroma remote statuses
This commit is contained in:
parent
ef4e9b7ff8
commit
9b03781c73
@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit, OnDestroy, Input, Output, EventEmitter, ViewChildren, QueryList, ViewChild, ElementRef } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Input, Output, EventEmitter, ViewChildren, QueryList, ViewChild, ElementRef } from '@angular/core';
|
||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse, HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { MastodonWrapperService } from '../../../services/mastodon-wrapper.service';
|
import { MastodonWrapperService } from '../../../services/mastodon-wrapper.service';
|
||||||
@ -51,6 +51,7 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||||||
private goToTopSubscription: Subscription;
|
private goToTopSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private readonly httpClient: HttpClient,
|
||||||
private readonly notificationService: NotificationService,
|
private readonly notificationService: NotificationService,
|
||||||
private readonly toolsService: ToolsService,
|
private readonly toolsService: ToolsService,
|
||||||
private readonly mastodonService: MastodonWrapperService) { }
|
private readonly mastodonService: MastodonWrapperService) { }
|
||||||
@ -199,19 +200,21 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private retrieveRemoteThread(status: Status) {
|
private async retrieveRemoteThread(status: Status) {
|
||||||
try {
|
try {
|
||||||
console.warn(status);
|
let url = status.url;
|
||||||
let splitUrl = status.url.replace('https://', '').split('/');
|
let splitUrl = url.replace('https://', '').split('/');
|
||||||
let id = splitUrl[splitUrl.length - 1];
|
let id = splitUrl[splitUrl.length - 1];
|
||||||
let instance = splitUrl[0];
|
let instance = splitUrl[0];
|
||||||
console.warn(id);
|
|
||||||
console.warn(instance);
|
//Pleroma
|
||||||
this.mastodonService.getRemoteStatusContext(instance, id)
|
if(url.includes('/objects/')){
|
||||||
.then((context: Context) => {
|
var webpage = await this.httpClient.get(url, { responseType: 'text' }).toPromise();
|
||||||
console.warn(context);
|
id = webpage.split(`<meta content="https://${instance}/notice/`)[1].split('" property="og:url"')[0];
|
||||||
})
|
}
|
||||||
.catch(() => { });
|
|
||||||
|
let statuses = await this.mastodonService.getRemoteStatusContext(instance, id);
|
||||||
|
console.warn(statuses);
|
||||||
} catch (err) { };
|
} catch (err) { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user