cleanup: trim trailing whitespace (#11136)

* cleanup: trim trailing whitespace

* update(`.editorconfig`)

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
okayurisotto 2023-07-08 07:08:16 +09:00 committed by GitHub
parent 4c879b3a33
commit d84796588c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 615 additions and 609 deletions

View file

@ -39,9 +39,9 @@ export class RelayService {
host: IsNull(),
username: ACTOR_USERNAME,
});
if (user) return user as LocalUser;
const created = await this.createSystemUserService.createSystemUser(ACTOR_USERNAME);
return created as LocalUser;
}
@ -53,12 +53,12 @@ export class RelayService {
inbox,
status: 'requesting',
}).then(x => this.relaysRepository.findOneByOrFail(x.identifiers[0]));
const relayActor = await this.getRelayActor();
const follow = await this.apRendererService.renderFollowRelay(relay, relayActor);
const activity = this.apRendererService.addContext(follow);
this.queueService.deliver(relayActor, activity, relay.inbox, false);
return relay;
}
@ -67,17 +67,17 @@ export class RelayService {
const relay = await this.relaysRepository.findOneBy({
inbox,
});
if (relay == null) {
throw new Error('relay not found');
}
const relayActor = await this.getRelayActor();
const follow = this.apRendererService.renderFollowRelay(relay, relayActor);
const undo = this.apRendererService.renderUndo(follow, relayActor);
const activity = this.apRendererService.addContext(undo);
this.queueService.deliver(relayActor, activity, relay.inbox, false);
await this.relaysRepository.delete(relay.id);
}
@ -86,13 +86,13 @@ export class RelayService {
const relays = await this.relaysRepository.find();
return relays;
}
@bindThis
public async relayAccepted(id: string): Promise<string> {
const result = await this.relaysRepository.update(id, {
status: 'accepted',
});
return JSON.stringify(result);
}
@ -101,24 +101,24 @@ export class RelayService {
const result = await this.relaysRepository.update(id, {
status: 'rejected',
});
return JSON.stringify(result);
}
@bindThis
public async deliverToRelays(user: { id: User['id']; host: null; }, activity: any): Promise<void> {
if (activity == null) return;
const relays = await this.relaysCache.fetch(() => this.relaysRepository.findBy({
status: 'accepted',
}));
if (relays.length === 0) return;
const copy = deepClone(activity);
if (!copy.to) copy.to = ['https://www.w3.org/ns/activitystreams#Public'];
const signed = await this.apRendererService.attachLdSignature(copy, user);
for (const relay of relays) {
this.queueService.deliver(user, signed, relay.inbox, false);
}