From 0cb8918778d86217c86922c75a37d1be3e82b3aa Mon Sep 17 00:00:00 2001 From: Freeplay Date: Thu, 16 Feb 2023 17:06:36 -0500 Subject: [PATCH 001/111] Add URL previews to subnote --- packages/client/src/components/MkSubNoteContent.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/MkSubNoteContent.vue b/packages/client/src/components/MkSubNoteContent.vue index b575fcc0ae..2139cffb24 100644 --- a/packages/client/src/components/MkSubNoteContent.vue +++ b/packages/client/src/components/MkSubNoteContent.vue @@ -5,9 +5,9 @@ {{ i18n.ts.quoteAttached }}: ... +
- ({{ i18n.t('withNFiles', { n: note.files.length }) }})
@@ -26,8 +26,11 @@ diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index c0766ec5f5..a0277d86ec 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -16,10 +16,14 @@
+ From 4cabd725a0309b428dc3432bf8f3baa2bcb17b6d Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 15 Mar 2023 19:18:26 -0400 Subject: [PATCH 060/111] fix line in boosted text --- packages/client/src/components/MkNote.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index a7c8cdcbce..08075e5314 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -324,9 +324,9 @@ function readPromo() { content: ""; display: block; margin-bottom: -10px; - width: 2px; - background-color: var(--divider); - margin-inline: auto; + margin-top: 16px; + border-left: 2px solid var(--divider); + margin-left: calc((var(--avatarSize) / 2) - 1px); } } } From 4b391424aee0d8752ffb3db5dfb03037939c8f28 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 15 Mar 2023 19:53:22 -0400 Subject: [PATCH 061/111] fix line alignment in smaller windows --- packages/client/src/components/MkNoteSub.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index 14bcf58266..e90c3da14d 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -286,14 +286,14 @@ const replies: misskey.entities.Note[] = props.conversation?.filter(item => item --avatarSize: 24px; --indent: calc(var(--avatarSize) - 4px); } - &.firstColumn { - > .main, > .line, > .children:not(.single) > .line { - --avatarSize: 35px; - --indent: 35px; - } - > .children:not(.single) { - padding-left: 28px !important; - } + } + .firstColumn { + > .main, > .line, > .children:not(.single) > .line { + --avatarSize: 35px; + --indent: 35px; + } + > .children:not(.single) { + padding-left: 28px !important; } } } From 1be55c9685017c858bf32fe34c449bfc3077d870 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 15 Mar 2023 20:26:13 -0400 Subject: [PATCH 062/111] *actually* fix the line alignment --- packages/client/src/components/MkNoteSub.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index e90c3da14d..c204cb2f9f 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -287,7 +287,7 @@ const replies: misskey.entities.Note[] = props.conversation?.filter(item => item --indent: calc(var(--avatarSize) - 4px); } } - .firstColumn { + &.firstColumn { > .main, > .line, > .children:not(.single) > .line { --avatarSize: 35px; --indent: 35px; From f79ac3d361102b86cb297ed9e99016f8d160a9a0 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 15 Mar 2023 21:24:12 -0400 Subject: [PATCH 063/111] Change reply icon (also align the icon in the posting form) --- packages/client/src/components/MkNoteFooter.vue | 2 +- packages/client/src/components/MkPostForm.vue | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/MkNoteFooter.vue b/packages/client/src/components/MkNoteFooter.vue index cd0709b793..579cfcb077 100644 --- a/packages/client/src/components/MkNoteFooter.vue +++ b/packages/client/src/components/MkNoteFooter.vue @@ -2,7 +2,7 @@
- +
@@ -796,6 +796,8 @@ onMounted(() => { } > .submit { + display: inline-flex; + align-items: center; margin: 16px 16px 16px 0; padding: 0 12px; line-height: 34px; From ef509b5138e4eb84c4bac66809406191b45e3577 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 15 Mar 2023 18:28:53 -0700 Subject: [PATCH 064/111] docs: :memo: accurate update instructions Closes #9709 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4fdcf5c65..99144809f9 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,8 @@ For migrating from Misskey v13, Misskey v12, and Foundkey, read [this document]( ```sh # git pull -NODE_ENV=production pnpm install && pnpm run build && pnpm run migrate +pnpm install +NODE_ENV=production pnpm run build && pnpm run migrate pm2 start "NODE_ENV=production pnpm run start" --name Calckey ``` From bca45c5868e28bcf86008f86b35abee9fcb13a73 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 15 Mar 2023 22:29:48 -0400 Subject: [PATCH 065/111] fix deck view margins --- packages/client/src/pages/note.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/client/src/pages/note.vue b/packages/client/src/pages/note.vue index 65fda4699e..1b0380cc20 100644 --- a/packages/client/src/pages/note.vue +++ b/packages/client/src/pages/note.vue @@ -202,11 +202,13 @@ definePageMetadata(computed(() => note ? { } } } - &.max-width_500px > .note { - margin-inline: -24px; - } - &.max-width_350px > .note { - margin-inline: -12px; + #calckey_app > :not(.mk-deck) { + &.max-width_500px > .note { + margin-inline: -24px; + } + &.max-width_350px > .note { + margin-inline: -12px; + } } } From 4c263cfbcc7ef4e2693a8599412439d2ab2a7309 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 16 Mar 2023 15:37:49 -0700 Subject: [PATCH 066/111] better border color --- packages/client/src/components/MkCwButton.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/MkCwButton.vue b/packages/client/src/components/MkCwButton.vue index 4e38b16b0f..d3172c4bcf 100644 --- a/packages/client/src/components/MkCwButton.vue +++ b/packages/client/src/components/MkCwButton.vue @@ -44,6 +44,7 @@ const toggle = () => { padding: 6px 10px; width: 90%; border-radius: 10px; + border: 1px solid var(--divider); margin-top: 10px; margin-bottom: 10px; transition: background-color 0.25s ease-in-out; From 36281ec413d4250221595d2a173c19dc15d0480a Mon Sep 17 00:00:00 2001 From: s1idewhist1e Date: Fri, 17 Mar 2023 01:16:31 +0000 Subject: [PATCH 067/111] feat: Make follower counts for remote users correct (#9705) #9293 Not sure if this is the right approach for this Co-authored-by: s1idewhist1e Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9705 Co-authored-by: s1idewhist1e Co-committed-by: s1idewhist1e --- .../backend/src/models/repositories/user.ts | 4 +- .../src/remote/activitypub/models/person.ts | 78 ++++++++++++++++++- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index aa224b6674..0455b9a5f7 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -488,8 +488,8 @@ export const UserRepository = db.getRepository(User).extend({ birthday: profile!.birthday, lang: profile!.lang, fields: profile!.fields, - followersCount: followersCount || 0, - followingCount: followingCount || 0, + followersCount: followersCount || '?', + followingCount: followingCount || '?', notesCount: user.notesCount, pinnedNoteIds: pins.map((pin) => pin.noteId), pinnedNotes: Notes.packMany( diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 16b265b0b3..f4f792df15 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -198,9 +198,36 @@ export async function createPerson( const url = getOneApHrefNullable(person.url); if (url && !url.startsWith("https://")) { - throw new Error(`unexpected shcema of person url: ${url}`); + throw new Error(`unexpected schema of person url: ${url}`); } + let followersCount: number | undefined; + + if (typeof person.followers === "string") { + try { + let data = await fetch(person.followers, { headers: { "Accept": "application/json" } }); + let json_data = JSON.parse(await data.text()); + + followersCount = json_data.totalItems; + } catch { + followersCount = undefined; + } + } + + let followingCount: number | undefined; + + if (typeof person.following === "string") { + try { + let data = await fetch(person.following, { headers: { "Accept": "application/json" } }); + let json_data = JSON.parse(await data.text()); + + followingCount = json_data.totalItems; + } catch (e) { + followingCount = undefined; + } + } + + // Create user let user: IRemoteUser; try { @@ -228,6 +255,16 @@ export async function createPerson( followersUri: person.followers ? getApId(person.followers) : undefined, + followersCount: followersCount !== undefined + ? followersCount + : person.followers && typeof person.followers !== "string" && isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, + followingCount: followingCount !== undefined + ? followingCount + : person.following && typeof person.following !== "string" && isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, featured: person.featured ? getApId(person.featured) : undefined, uri: person.id, tags, @@ -396,7 +433,34 @@ export async function updatePerson( const url = getOneApHrefNullable(person.url); if (url && !url.startsWith("https://")) { - throw new Error(`unexpected shcema of person url: ${url}`); + throw new Error(`unexpected schema of person url: ${url}`); + } + + let followersCount: number | undefined; + + if (typeof person.followers === "string") { + try { + let data = await fetch(person.followers, { headers: { "Accept": "application/json" } } ); + let json_data = JSON.parse(await data.text()); + + followersCount = json_data.totalItems; + } catch { + followersCount = undefined; + } + } + + + let followingCount: number | undefined; + + if (typeof person.following === "string") { + try { + let data = await fetch(person.following, { headers: { "Accept": "application/json" } } ); + let json_data = JSON.parse(await data.text()); + + followingCount = json_data.totalItems; + } catch { + followingCount = undefined; + } } const updates = { @@ -406,6 +470,16 @@ export async function updatePerson( person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined), followersUri: person.followers ? getApId(person.followers) : undefined, + followersCount: followersCount !== undefined + ? followersCount + : person.followers && typeof person.followers !== "string" && isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, + followingCount: followingCount !== undefined + ? followingCount + : person.following && typeof person.following !== "string" && isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, featured: person.featured, emojis: emojiNames, name: truncate(person.name, nameLength), From c438d2bcb05984c7fd3c1a9cc7fbde40299f8943 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 16 Mar 2023 18:17:53 -0700 Subject: [PATCH 068/111] docs: changes --- CALCKEY.md | 4 ++++ README.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CALCKEY.md b/CALCKEY.md index 015232f700..110aaf2644 100644 --- a/CALCKEY.md +++ b/CALCKEY.md @@ -108,6 +108,10 @@ - Allows custom emoji - Fix lint errors - Use Rome instead of ESLint +- Mastodon API support +- More antenna options +- New dashboard +- Backfill follower counts - MissV: [fix Misskey Forkbomb](https://code.vtopia.live/Vtopia/MissV/commit/40b23c070bd4adbb3188c73546c6c625138fb3c1) - [Make showing ads optional](https://github.com/misskey-dev/misskey/pull/8996) - [Tapping avatar in mobile opens account modal](https://github.com/misskey-dev/misskey/pull/9056) diff --git a/README.md b/README.md index 99144809f9..2b5a80b0d8 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ - OCR image captioning - New and improved Groups - Better intro tutorial + - Compatibility with Mastodon clients/apps + - Backfill user information - Many more user and admin settings - [So much more!](./CALCKEY.md) From 1239db9ac8e100c88ffe3a04c8881aba965bd0bf Mon Sep 17 00:00:00 2001 From: fruye Date: Fri, 17 Mar 2023 13:58:01 +0000 Subject: [PATCH 069/111] fix: Parse mastoAPI `limit` argument in more places & Improve converting arguments to boolean (#9716) Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9716 Authored-by: fruye Signed-off-by: Cleo John Co-authored-by: fruye Co-committed-by: fruye --- .../backend/src/server/api/mastodon/endpoints/account.ts | 8 ++++---- .../backend/src/server/api/mastodon/endpoints/status.ts | 4 +++- .../backend/src/server/api/mastodon/endpoints/timeline.ts | 7 +++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 1c5e31fe8d..bd1a2e6485 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -359,7 +359,7 @@ export function apiAccountMastodon(router: Router): void { const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = (await client.getBookmarks(ctx.query as any)) as any; + const data = (await client.getBookmarks(limitToInt(ctx.query as any))) as any; let resp = data.data; for (let statIdx = 0; statIdx < resp.length; statIdx++) { resp[statIdx].id = convertId(resp[statIdx].id, IdType.MastodonId); @@ -383,7 +383,7 @@ export function apiAccountMastodon(router: Router): void { const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getFavourites(ctx.query as any); + const data = await client.getFavourites(limitToInt(ctx.query as any)); let resp = data.data; for (let statIdx = 0; statIdx < resp.length; statIdx++) { resp[statIdx].id = convertId(resp[statIdx].id, IdType.MastodonId); @@ -407,7 +407,7 @@ export function apiAccountMastodon(router: Router): void { const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getMutes(ctx.query as any); + const data = await client.getMutes(limitToInt(ctx.query as any)); let resp = data.data; for (let acctIdx = 0; acctIdx < resp.length; acctIdx++) { resp[acctIdx].id = convertId(resp[acctIdx].id, IdType.MastodonId); @@ -425,7 +425,7 @@ export function apiAccountMastodon(router: Router): void { const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getBlocks(ctx.query as any); + const data = await client.getBlocks(limitToInt(ctx.query as any)); let resp = data.data; for (let acctIdx = 0; acctIdx < resp.length; acctIdx++) { resp[acctIdx].id = convertId(resp[acctIdx].id, IdType.MastodonId); diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index d04b7a8b95..0128201400 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -4,6 +4,8 @@ import { emojiRegexAtStartToEnd } from "@/misc/emoji-regex.js"; import axios from "axios"; import querystring from 'node:querystring' import qs from 'qs' +import { limitToInt } from "./timeline.js"; + function normalizeQuery(data: any) { const str = querystring.stringify(data); return qs.parse(str); @@ -101,7 +103,7 @@ export function apiStatusMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); try { const id = ctx.params.id; - const data = await client.getStatusContext(id, ctx.query as any); + const data = await client.getStatusContext(id, limitToInt(ctx.query as any)); const status = await client.getStatus(id); const reactionsAxios = await axios.get( `${BASE_URL}/api/notes/reactions?noteId=${id}`, diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 58ca8d6771..23729e4804 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts @@ -15,13 +15,16 @@ export function limitToInt(q: ParsedUrlQuery) { } export function argsToBools(q: ParsedUrlQuery) { + // Values taken from https://docs.joinmastodon.org/client/intro/#boolean + const toBoolean = (value: string) => !['0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF'].includes(value); + let object: any = q; if (q.only_media) if (typeof q.only_media === "string") - object.only_media = q.only_media.toLowerCase() === "true"; + object.only_media = toBoolean(q.only_media); if (q.exclude_replies) if (typeof q.exclude_replies === "string") - object.exclude_replies = q.exclude_replies.toLowerCase() === "true"; + object.exclude_replies = toBoolean(q.exclude_replies); return q; } From d3d21aa8ea8ba1e67ca50b78412cc9ec6409b53c Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 17 Mar 2023 09:31:39 -0700 Subject: [PATCH 070/111] fix: send button --- packages/client/src/pages/messaging/messaging-room.form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 4fe3722776..18f2ba7a31 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -18,7 +18,7 @@
From 9e1fdeaf3928b52abf0f8c0c8ddba12a1ebd3d6d Mon Sep 17 00:00:00 2001 From: Free Date: Sat, 18 Mar 2023 00:44:00 +0000 Subject: [PATCH 071/111] note-improvements (#9720) Co-authored-by: Free Co-committed-by: Free --- .../client/src/components/MkNoteDetailed.vue | 2 +- packages/client/src/components/MkNoteSub.vue | 14 +++++++++---- .../src/components/MkSubNoteContent.vue | 20 +++++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/packages/client/src/components/MkNoteDetailed.vue b/packages/client/src/components/MkNoteDetailed.vue index ac948b8ce1..f29129f87d 100644 --- a/packages/client/src/components/MkNoteDetailed.vue +++ b/packages/client/src/components/MkNoteDetailed.vue @@ -301,7 +301,7 @@ if (appearNote.replyId) { os.api('notes/conversation', { noteId: appearNote.replyId, }).then(res => { - conversation.value = res; + conversation.value = res.reverse(); }); } diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index c204cb2f9f..48e9866d8d 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -10,11 +10,13 @@

+ +

- +
@@ -22,10 +24,10 @@