Add better handling for first/last name, profile photo, tagline to activitypub implementation
This commit is contained in:
parent
d4d10af972
commit
a6e1819d2d
@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@atao60/fse-cli": "^0.1.7",
|
"@atao60/fse-cli": "^0.1.7",
|
||||||
"@extollo/lib": "^0.14.10",
|
"@extollo/lib": "^0.14.14",
|
||||||
"@types/marked": "^4.0.8",
|
"@types/marked": "^4.0.8",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/xml2js": "^0.4.11",
|
"@types/xml2js": "^0.4.11",
|
||||||
@ -18,6 +18,7 @@
|
|||||||
"feed": "^4.2.2",
|
"feed": "^4.2.2",
|
||||||
"gotify": "^1.1.0",
|
"gotify": "^1.1.0",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
|
"lib": "link:@extollo/lib:../extollo/lib",
|
||||||
"marked": "^4.2.12",
|
"marked": "^4.2.12",
|
||||||
"ts-expose-internals": "^4.5.4",
|
"ts-expose-internals": "^4.5.4",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
574
pnpm-lock.yaml
574
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@ import {
|
|||||||
} from '@extollo/lib'
|
} from '@extollo/lib'
|
||||||
import {AppUnit} from './app/AppUnit'
|
import {AppUnit} from './app/AppUnit'
|
||||||
import {CobaltUnit} from './app/services/CobaltUnit'
|
import {CobaltUnit} from './app/services/CobaltUnit'
|
||||||
|
import {MigrateUnit} from './app/MigrateUnit'
|
||||||
|
|
||||||
Error.stackTraceLimit = 500
|
Error.stackTraceLimit = 500
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ export const Units = [
|
|||||||
Internationalization,
|
Internationalization,
|
||||||
Authentication,
|
Authentication,
|
||||||
|
|
||||||
|
MigrateUnit,
|
||||||
AppUnit,
|
AppUnit,
|
||||||
|
|
||||||
Routing,
|
Routing,
|
||||||
|
13
src/app/MigrateUnit.ts
Normal file
13
src/app/MigrateUnit.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import {Unit, Singleton, MigrateDirective} from '@extollo/lib'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply migrations when the application starts up.
|
||||||
|
* This is way more convenient than `./ex migrate` for Kubernetes deployments.
|
||||||
|
*/
|
||||||
|
@Singleton()
|
||||||
|
export class MigrateUnit extends Unit {
|
||||||
|
async up() {
|
||||||
|
const directive = this.make<MigrateDirective>(MigrateDirective)
|
||||||
|
await directive.invoke([])
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
import {Injectable, Migration, Inject, DatabaseService, FieldType} from '@extollo/lib'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AddCoreidColumnsToUsersTableMigration
|
||||||
|
* ----------------------------------
|
||||||
|
* Put some description here.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export default class AddCoreidColumnsToUsersTableMigration extends Migration {
|
||||||
|
@Inject()
|
||||||
|
protected readonly db!: DatabaseService
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the migration.
|
||||||
|
*/
|
||||||
|
async up(): Promise<void> {
|
||||||
|
const schema = this.db.get().schema()
|
||||||
|
const table = await schema.table('users')
|
||||||
|
|
||||||
|
table.column('tagline')
|
||||||
|
.type(FieldType.varchar)
|
||||||
|
.nullable()
|
||||||
|
|
||||||
|
table.column('photo_url')
|
||||||
|
.type(FieldType.varchar)
|
||||||
|
.nullable()
|
||||||
|
|
||||||
|
await schema.commit(table)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undo the migration.
|
||||||
|
*/
|
||||||
|
async down(): Promise<void> {
|
||||||
|
const schema = this.db.get().schema()
|
||||||
|
const table = await schema.table('users')
|
||||||
|
|
||||||
|
table.dropColumn('tagline')
|
||||||
|
table.dropColumn('photo_url')
|
||||||
|
|
||||||
|
await schema.commit(table)
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import {Inject, Injectable, Maybe, ModelBuilder, ORMUser, Related, Routing} from '@extollo/lib'
|
import {Inject, Injectable, Maybe, Field, ORMUser, FieldType, Routing} from '@extollo/lib'
|
||||||
import {Pub} from '../../pub/types'
|
import {Pub} from '../../pub/types'
|
||||||
import {Certificate} from './pub/Certificate.model'
|
import {Certificate} from './pub/Certificate.model'
|
||||||
import * as child_process from 'child_process'
|
import * as child_process from 'child_process'
|
||||||
@ -8,6 +8,12 @@ export class User extends ORMUser {
|
|||||||
@Inject()
|
@Inject()
|
||||||
protected readonly routing!: Routing
|
protected readonly routing!: Routing
|
||||||
|
|
||||||
|
@Field(FieldType.varchar)
|
||||||
|
public tagline?: string
|
||||||
|
|
||||||
|
@Field(FieldType.varchar, 'photo_url')
|
||||||
|
public photoUrl?: string
|
||||||
|
|
||||||
get pubUrl(): string {
|
get pubUrl(): string {
|
||||||
return `${this.routing.getAppUrl().toRemote}/pub/${this.username}`
|
return `${this.routing.getAppUrl().toRemote}/pub/${this.username}`
|
||||||
}
|
}
|
||||||
@ -45,7 +51,8 @@ export class User extends ORMUser {
|
|||||||
discoverable: true,
|
discoverable: true,
|
||||||
indexable: false,
|
indexable: false,
|
||||||
published: '2023-11-06T00:00:00.000Z', // FIXME
|
published: '2023-11-06T00:00:00.000Z', // FIXME
|
||||||
// icon: '', // FIXME
|
...(this.tagline ? {summary: this.tagline} : {}),
|
||||||
|
...(this.photoUrl ? {icon: this.photoUrl} : {}),
|
||||||
// image: '', // FIXME
|
// image: '', // FIXME
|
||||||
preferredUsername: this.username,
|
preferredUsername: this.username,
|
||||||
manuallyApprovesFollowers: false,
|
manuallyApprovesFollowers: false,
|
||||||
|
@ -19,6 +19,7 @@ export namespace Pub {
|
|||||||
type: 'Person',
|
type: 'Person',
|
||||||
name: string,
|
name: string,
|
||||||
url: string,
|
url: string,
|
||||||
|
summary?: string,
|
||||||
icon?: string,
|
icon?: string,
|
||||||
image?: string,
|
image?: string,
|
||||||
discoverable: boolean,
|
discoverable: boolean,
|
||||||
|
Loading…
Reference in New Issue
Block a user