refactor: introduce bindThis decorator to bind this automaticaly
This commit is contained in:
parent
e73581f715
commit
bbb49457f9
199 changed files with 969 additions and 96 deletions
|
|
@ -14,6 +14,7 @@ type IWebFinger = {
|
|||
links: ILink[];
|
||||
subject: string;
|
||||
};
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
@Injectable()
|
||||
export class WebfingerService {
|
||||
|
|
@ -25,12 +26,14 @@ export class WebfingerService {
|
|||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async webfinger(query: string): Promise<IWebFinger> {
|
||||
const url = this.genUrl(query);
|
||||
|
||||
return await this.httpRequestService.getJson(url, 'application/jrd+json, application/json') as IWebFinger;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private genUrl(query: string): string {
|
||||
if (query.match(/^https?:\/\//)) {
|
||||
const u = new URL(query);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue