-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
22 additions
and
589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export class DropRelay1737502355121 { | ||
constructor() { | ||
this.name = 'DropRelay1737502355121'; | ||
} | ||
|
||
async up(queryRunner) { | ||
await queryRunner.query(`DROP INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab"`); | ||
await queryRunner.query(`DROP TABLE "relay" CASCADE `); | ||
await queryRunner.query(`DROP TYPE "relay_status_enum"`); | ||
} | ||
|
||
async down(queryRunner) { | ||
await queryRunner.query(`CREATE TYPE "relay_status_enum" AS ENUM('requesting', 'accepted', 'rejected')`); | ||
await queryRunner.query(`CREATE TABLE "relay" ("id" character varying(32) NOT NULL, "inbox" character varying(512) NOT NULL, "status" "relay_status_enum" NOT NULL, CONSTRAINT "PK_78ebc9cfddf4292633b7ba57aee" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab" ON "relay" ("inbox") `); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 0 additions & 142 deletions
142
packages/backend/src/remote/activitypub/misc/ld-signature.ts
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/backend/src/remote/activitypub/renderer/follow-relay.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,14 @@ | ||
import { v4 as uuid } from "uuid"; | ||
import config from "@/config/index.js"; | ||
import { getUserKeypair } from "@/misc/keypair-store.js"; | ||
import { User } from "@/models/entities/user.js"; | ||
import { WellKnownContext } from "@/remote/activitypub/misc/contexts.js"; | ||
import { IActivity } from "../type.js"; | ||
import { LdSignature } from "../misc/ld-signature.js"; | ||
|
||
export const renderActivity = (x: any): IActivity | null => { | ||
if (x == null) return null; | ||
|
||
if (typeof x === "object" && x.id == null) { | ||
x.id = `${config.url}/${uuid()}`; | ||
} | ||
|
||
return Object.assign({}, WellKnownContext, x); | ||
}; | ||
|
||
export const attachLdSignature = async (activity: any, user: { id: User["id"]; host: null; }): Promise<IActivity | null> => { | ||
if (activity == null) return null; | ||
|
||
const keypair = await getUserKeypair(user.id); | ||
|
||
const ldSignature = new LdSignature(); | ||
ldSignature.debug = false; | ||
activity = await ldSignature.signRsaSignature2017(activity, keypair.privateKey, `${config.url}/users/${user.id}#main-key`); | ||
|
||
return activity; | ||
return Object.assign({}, WellKnownContext, x); | ||
}; |
Oops, something went wrong.