mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-01 16:28:06 +09:00
Merge branch 'develop' of codeberg.org:calckey/calckey into develop
This commit is contained in:
commit
2a8fd82cac
@ -1,27 +1,44 @@
|
|||||||
# 🚚 Migrating from Misskey to Calckey
|
# 🚚 Migrating from Misskey to Calckey
|
||||||
|
|
||||||
|
The following procedure may not work depending on your environment and version of Misskey.
|
||||||
|
|
||||||
|
**Make sure you**
|
||||||
|
- **stopped all master and worker processes of Misskey.**
|
||||||
|
- **have backups of the database before performing any commands.**
|
||||||
|
|
||||||
## Misskey v13 and above
|
## Misskey v13 and above
|
||||||
|
|
||||||
|
Tested with Misskey v13.11.3.
|
||||||
|
|
||||||
|
If your Misskey v13 is older, we recommend updating your Misskey to v13.11.3.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget -O mkv13.patch https://codeberg.org/calckey/calckey/raw/branch/develop/docs/mkv13.patch
|
wget -O mkv13.patch https://codeberg.org/calckey/calckey/raw/branch/develop/docs/mkv13.patch
|
||||||
git apply mkv13.patch
|
wget -O mkv13_restore.patch https://codeberg.org/calckey/calckey/raw/branch/develop/docs/mkv13_restore.patch
|
||||||
|
git apply mkv13.patch mkv13_restore.patch
|
||||||
|
|
||||||
cd packages/backend
|
cd packages/backend
|
||||||
|
|
||||||
LINE_NUM="$(npx typeorm migration:show -d ormconfig.js | grep -n activeEmailValidation1657346559800 | cut -d ':' -f 1)"
|
LINE_NUM="$(pnpm typeorm migration:show -d ormconfig.js | grep -n activeEmailValidation1657346559800 | cut -d ':' -f 1)"
|
||||||
NUM_MIGRATIONS="$(npx typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | nl)"
|
NUM_MIGRATIONS="$(pnpm typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | wc -l)"
|
||||||
|
|
||||||
for i in $(seq 1 $NUM_MIGRAIONS); do
|
for i in $(seq 1 $NUM_MIGRATIONS); do pnpm typeorm migration:revert -d ormconfig.js; done
|
||||||
npx typeorm migration:revert -d ormconfig.js
|
|
||||||
done
|
cd ../../
|
||||||
|
|
||||||
git remote set-url origin https://codeberg.org/calckey/calckey.git
|
git remote set-url origin https://codeberg.org/calckey/calckey.git
|
||||||
git fetch
|
git fetch origin
|
||||||
git checkout main # or beta or develop
|
git stash push
|
||||||
|
rm -rf fluent-emojis misskey-assets
|
||||||
|
git switch main # or beta or develop
|
||||||
git pull --ff
|
git pull --ff
|
||||||
|
wget -O renote_muting.patch https://codeberg.org/calckey/calckey/raw/branch/develop/docs/renote_muting.patch
|
||||||
|
git apply renote_muting.patch
|
||||||
|
|
||||||
NODE_ENV=production pnpm run migrate
|
pnpm install
|
||||||
# build using prefered method
|
NODE_ENV=production pnpm run build
|
||||||
|
pnpm run migrate
|
||||||
|
git stash push
|
||||||
```
|
```
|
||||||
|
|
||||||
Depending on the version you're migrating from, you may have to open Postgres with `psql -d your_database` and run the following commands:
|
Depending on the version you're migrating from, you may have to open Postgres with `psql -d your_database` and run the following commands:
|
||||||
@ -44,6 +61,10 @@ ALTER TABLE "instance" ADD COLUMN "lastCommunicatedAt" date;
|
|||||||
|
|
||||||
then quit with `\q`, and restart Calckey.
|
then quit with `\q`, and restart Calckey.
|
||||||
|
|
||||||
|
Note: Ignore errors of `column "xxx" of relation "xxx" already exists`.
|
||||||
|
|
||||||
|
If no other errors happened, your Calckey is ready to launch!
|
||||||
|
|
||||||
## Misskey v12.119 and before
|
## Misskey v12.119 and before
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
127
docs/mkv13_restore.patch
Normal file
127
docs/mkv13_restore.patch
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
diff --git a/packages/backend/migration/1680491187535-cleanup.js b/packages/backend/migration/1680491187535-cleanup.js
|
||||||
|
index 1e609ca06..0e6accf3e 100644
|
||||||
|
--- a/packages/backend/migration/1680491187535-cleanup.js
|
||||||
|
+++ b/packages/backend/migration/1680491187535-cleanup.js
|
||||||
|
@@ -1,10 +1,40 @@
|
||||||
|
export class cleanup1680491187535 {
|
||||||
|
- name = 'cleanup1680491187535'
|
||||||
|
+ name = "cleanup1680491187535";
|
||||||
|
|
||||||
|
- async up(queryRunner) {
|
||||||
|
- await queryRunner.query(`DROP TABLE "antenna_note" `);
|
||||||
|
- }
|
||||||
|
+ async up(queryRunner) {
|
||||||
|
+ await queryRunner.query(`DROP TABLE "antenna_note" `);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- async down(queryRunner) {
|
||||||
|
- }
|
||||||
|
+ async down(queryRunner) {
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE TABLE antenna_note ( id character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "antennaId" character varying(32) NOT NULL, read boolean DEFAULT false NOT NULL)`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN antenna_note."noteId" IS 'The note ID.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN antenna_note."antennaId" IS 'The antenna ID.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY antenna_note ADD CONSTRAINT "PK_fb28d94d0989a3872df19fd6ef8" PRIMARY KEY (id)`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_0d775946662d2575dfd2068a5f" ON antenna_note USING btree ("antennaId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE UNIQUE INDEX "IDX_335a0bf3f904406f9ef3dd51c2" ON antenna_note USING btree ("noteId", "antennaId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_9937ea48d7ae97ffb4f3f063a4" ON antenna_note USING btree (read)`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_bd0397be22147e17210940e125" ON antenna_note USING btree ("noteId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY antenna_note ADD CONSTRAINT "FK_0d775946662d2575dfd2068a5f5" FOREIGN KEY ("antennaId") REFERENCES antenna(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY antenna_note ADD CONSTRAINT "FK_bd0397be22147e17210940e125b" FOREIGN KEY ("noteId") REFERENCES note(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
diff --git a/packages/backend/migration/1680582195041-cleanup.js b/packages/backend/migration/1680582195041-cleanup.js
|
||||||
|
index c587e456a..a91d6ff3c 100644
|
||||||
|
--- a/packages/backend/migration/1680582195041-cleanup.js
|
||||||
|
+++ b/packages/backend/migration/1680582195041-cleanup.js
|
||||||
|
@@ -1,11 +1,64 @@
|
||||||
|
export class cleanup1680582195041 {
|
||||||
|
- name = 'cleanup1680582195041'
|
||||||
|
+ name = "cleanup1680582195041";
|
||||||
|
|
||||||
|
- async up(queryRunner) {
|
||||||
|
- await queryRunner.query(`DROP TABLE "notification" `);
|
||||||
|
- }
|
||||||
|
+ async up(queryRunner) {
|
||||||
|
+ await queryRunner.query(`DROP TABLE "notification"`);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- async down(queryRunner) {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
+ async down(queryRunner) {
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE TABLE notification ( id character varying(32) NOT NULL, "createdAt" timestamp with time zone NOT NULL, "notifieeId" character varying(32) NOT NULL, "notifierId" character varying(32), "isRead" boolean DEFAULT false NOT NULL, "noteId" character varying(32), reaction character varying(128), choice integer, "followRequestId" character varying(32), type notification_type_enum NOT NULL, "customBody" character varying(2048), "customHeader" character varying(256), "customIcon" character varying(1024), "appAccessTokenId" character varying(32), achievement character varying(128))`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN notification."createdAt" IS 'The created date of the Notification.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN notification."notifieeId" IS 'The ID of recipient user of the Notification.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN notification."notifierId" IS 'The ID of sender user of the Notification.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN notification."isRead" IS 'Whether the Notification is read.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `COMMENT ON COLUMN notification.type IS 'The type of the Notification.'`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY (id)`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_080ab397c379af09b9d2169e5b" ON notification USING btree ("isRead")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_33f33cc8ef29d805a97ff4628b" ON notification USING btree (type)`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71" ON notification USING btree ("notifierId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_3c601b70a1066d2c8b517094cb" ON notification USING btree ("notifieeId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_b11a5e627c41d4dc3170f1d370" ON notification USING btree ("createdAt")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `CREATE INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c" ON notification USING btree ("appAccessTokenId")`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9" FOREIGN KEY ("notifieeId") REFERENCES "user"(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453" FOREIGN KEY ("noteId") REFERENCES note(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "FK_bd7fab507621e635b32cd31892c" FOREIGN KEY ("followRequestId") REFERENCES follow_request(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ await queryRunner.query(
|
||||||
|
+ `ALTER TABLE ONLY notification ADD CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9" FOREIGN KEY ("appAccessTokenId") REFERENCES access_token(id) ON DELETE CASCADE`,
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
}
|
23
docs/renote_muting.patch
Normal file
23
docs/renote_muting.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
diff --git a/packages/backend/migration/1665091090561-add-renote-muting.js b/packages/backend/migration/1665091090561-add-renote-muting.js
|
||||||
|
index 2c76aaff5..f8541c818 100644
|
||||||
|
--- a/packages/backend/migration/1665091090561-add-renote-muting.js
|
||||||
|
+++ b/packages/backend/migration/1665091090561-add-renote-muting.js
|
||||||
|
@@ -4,18 +4,6 @@ export class addRenoteMuting1665091090561 {
|
||||||
|
}
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
- await queryRunner.query(
|
||||||
|
- `CREATE TABLE "renote_muting" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "muteeId" character varying(32) NOT NULL, "muterId" character varying(32) NOT NULL, CONSTRAINT "PK_renoteMuting_id" PRIMARY KEY ("id"))`,
|
||||||
|
- );
|
||||||
|
- await queryRunner.query(
|
||||||
|
- `CREATE INDEX "IDX_renote_muting_createdAt" ON "muting" ("createdAt") `,
|
||||||
|
- );
|
||||||
|
- await queryRunner.query(
|
||||||
|
- `CREATE INDEX "IDX_renote_muting_muteeId" ON "muting" ("muteeId") `,
|
||||||
|
- );
|
||||||
|
- await queryRunner.query(
|
||||||
|
- `CREATE INDEX "IDX_renote_muting_muterId" ON "muting" ("muterId") `,
|
||||||
|
- );
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {}
|
@ -191,7 +191,7 @@ export async function createPerson(
|
|||||||
.map((tag) => normalizeForSearch(tag))
|
.map((tag) => normalizeForSearch(tag))
|
||||||
.splice(0, 32);
|
.splice(0, 32);
|
||||||
|
|
||||||
const isBot = getApType(object) === "Service";
|
const isBot = getApType(object) !== "Person";
|
||||||
|
|
||||||
const bday = person["vcard:bday"]?.match(/^\d{4}-\d{2}-\d{2}/);
|
const bday = person["vcard:bday"]?.match(/^\d{4}-\d{2}-\d{2}/);
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ export async function updatePerson(
|
|||||||
emojis: emojiNames,
|
emojis: emojiNames,
|
||||||
name: truncate(person.name, nameLength),
|
name: truncate(person.name, nameLength),
|
||||||
tags,
|
tags,
|
||||||
isBot: getApType(object) === "Service",
|
isBot: getApType(object) !== "Person",
|
||||||
isCat: (person as any).isCat === true,
|
isCat: (person as any).isCat === true,
|
||||||
isLocked: !!person.manuallyApprovesFollowers,
|
isLocked: !!person.manuallyApprovesFollowers,
|
||||||
movedToUri: person.movedTo || null,
|
movedToUri: person.movedTo || null,
|
||||||
|
@ -30,7 +30,11 @@ export default class NotesChart extends Chart<typeof schema> {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async update(note: Note, isAdditional: boolean): Promise<void> {
|
public async update(
|
||||||
|
note: Note,
|
||||||
|
isAdditional: boolean,
|
||||||
|
byBot = false,
|
||||||
|
): Promise<void> {
|
||||||
const prefix = note.userHost === null ? "local" : "remote";
|
const prefix = note.userHost === null ? "local" : "remote";
|
||||||
|
|
||||||
await this.commit({
|
await this.commit({
|
||||||
@ -44,7 +48,7 @@ export default class NotesChart extends Chart<typeof schema> {
|
|||||||
: -1
|
: -1
|
||||||
: 0,
|
: 0,
|
||||||
[`${prefix}.diffs.renote`]:
|
[`${prefix}.diffs.renote`]:
|
||||||
note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
note.renoteId != null && !byBot ? (isAdditional ? 1 : -1) : 0,
|
||||||
[`${prefix}.diffs.reply`]:
|
[`${prefix}.diffs.reply`]:
|
||||||
note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
[`${prefix}.diffs.withFile`]:
|
[`${prefix}.diffs.withFile`]:
|
||||||
|
@ -32,6 +32,7 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
|||||||
user: { id: User["id"] },
|
user: { id: User["id"] },
|
||||||
note: Note,
|
note: Note,
|
||||||
isAdditional: boolean,
|
isAdditional: boolean,
|
||||||
|
byBot = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this.commit(
|
await this.commit(
|
||||||
{
|
{
|
||||||
@ -44,7 +45,8 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
|||||||
? 1
|
? 1
|
||||||
: -1
|
: -1
|
||||||
: 0,
|
: 0,
|
||||||
"diffs.renote": note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
"diffs.renote":
|
||||||
|
note.renoteId != null && !byBot ? (isAdditional ? 1 : -1) : 0,
|
||||||
"diffs.reply": note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
"diffs.reply": note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
"diffs.withFile": note.fileIds.length > 0 ? (isAdditional ? 1 : -1) : 0,
|
"diffs.withFile": note.fileIds.length > 0 ? (isAdditional ? 1 : -1) : 0,
|
||||||
},
|
},
|
||||||
|
@ -163,6 +163,7 @@ export default async (
|
|||||||
host: User["host"];
|
host: User["host"];
|
||||||
isSilenced: User["isSilenced"];
|
isSilenced: User["isSilenced"];
|
||||||
createdAt: User["createdAt"];
|
createdAt: User["createdAt"];
|
||||||
|
isBot: User["isBot"];
|
||||||
},
|
},
|
||||||
data: Option,
|
data: Option,
|
||||||
silent = false,
|
silent = false,
|
||||||
@ -323,8 +324,8 @@ export default async (
|
|||||||
res(note);
|
res(note);
|
||||||
|
|
||||||
// 統計を更新
|
// 統計を更新
|
||||||
notesChart.update(note, true);
|
notesChart.update(note, true, user.isBot);
|
||||||
perUserNotesChart.update(user, note, true);
|
perUserNotesChart.update(user, note, true, user.isBot);
|
||||||
|
|
||||||
// Register host
|
// Register host
|
||||||
if (Users.isRemoteUser(user)) {
|
if (Users.isRemoteUser(user)) {
|
||||||
@ -399,6 +400,7 @@ export default async (
|
|||||||
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
|
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
|
||||||
if (
|
if (
|
||||||
data.renote &&
|
data.renote &&
|
||||||
|
!user.isBot &&
|
||||||
(await countSameRenotes(user.id, data.renote.id, note.id)) === 0
|
(await countSameRenotes(user.id, data.renote.id, note.id)) === 0
|
||||||
) {
|
) {
|
||||||
incRenoteCount(data.renote);
|
incRenoteCount(data.renote);
|
||||||
|
Loading…
Reference in New Issue
Block a user