|
|
|
@ -1,22 +1,33 @@
|
|
|
|
|
import {Maybe, ModelBuilder, ORMUser, Related} from '@extollo/lib'
|
|
|
|
|
import {Inject, Injectable, Maybe, ModelBuilder, ORMUser, Related, Routing} from '@extollo/lib'
|
|
|
|
|
import {Pub} from '../../pub/types'
|
|
|
|
|
import {Certificate} from './pub/Certificate.model'
|
|
|
|
|
import * as child_process from 'child_process'
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class User extends ORMUser {
|
|
|
|
|
@Inject()
|
|
|
|
|
protected readonly routing!: Routing
|
|
|
|
|
|
|
|
|
|
get pubUrl(): string {
|
|
|
|
|
return `https://garrettmills.dev/pub/${this.username}`
|
|
|
|
|
return `${this.routing.getAppUrl().toRemote}/pub/${this.username}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async toWebfinger(): Promise<Pub.Webfinger> {
|
|
|
|
|
const host = new URL(this.routing.getAppUrl().toRemote).host
|
|
|
|
|
return {
|
|
|
|
|
subject: `acct:${this.username}@garrettmills.dev`, // fixme
|
|
|
|
|
subject: `acct:${this.username}@${host}`,
|
|
|
|
|
aliases: [],
|
|
|
|
|
links: [
|
|
|
|
|
{
|
|
|
|
|
rel: 'self',
|
|
|
|
|
type: 'application/activity+json',
|
|
|
|
|
href: this.pubUrl,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
rel: 'http://webfinger.net/rel/profile-page',
|
|
|
|
|
type: 'text/html',
|
|
|
|
|
href: `${this.pubUrl}/web`,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -29,7 +40,15 @@ export class User extends ORMUser {
|
|
|
|
|
],
|
|
|
|
|
id: this.pubUrl,
|
|
|
|
|
type: 'Person',
|
|
|
|
|
name: `${this.firstName ? this.firstName + ' ' : ''}${this.lastName || ''}`.trim() || this.username,
|
|
|
|
|
url: `${this.pubUrl}/web`,
|
|
|
|
|
discoverable: true,
|
|
|
|
|
indexable: false,
|
|
|
|
|
published: '2023-11-06T00:00:00.000Z', // FIXME
|
|
|
|
|
// icon: '', // FIXME
|
|
|
|
|
// image: '', // FIXME
|
|
|
|
|
preferredUsername: this.username,
|
|
|
|
|
manuallyApprovesFollowers: false,
|
|
|
|
|
inbox: `${this.pubUrl}/inbox`,
|
|
|
|
|
publicKey: {
|
|
|
|
|
id: `${this.pubUrl}#main-key`,
|
|
|
|
|