From bcd0488cf14b202e458663d6862233ea0aaa96b2 Mon Sep 17 00:00:00 2001 From: Free Date: Tue, 21 Mar 2023 04:41:50 +0000 Subject: [PATCH 01/14] note-improvements (#9742) Increases the limit of the replies loaded above the focused post from 10 to 30 Co-authored-by: Freeplay Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9742 Co-authored-by: Free Co-committed-by: Free --- packages/client/src/components/MkNoteDetailed.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/MkNoteDetailed.vue b/packages/client/src/components/MkNoteDetailed.vue index 260886ff2d..a06bac3705 100644 --- a/packages/client/src/components/MkNoteDetailed.vue +++ b/packages/client/src/components/MkNoteDetailed.vue @@ -304,6 +304,7 @@ os.api('notes/children', { if (appearNote.replyId) { os.api('notes/conversation', { noteId: appearNote.replyId, + limit: 30, }).then(res => { conversation.value = res.reverse(); focus(); From 1f840aa7b9d7943b0c085a173ae0138629422895 Mon Sep 17 00:00:00 2001 From: amy bones Date: Wed, 22 Mar 2023 02:10:43 -0700 Subject: [PATCH 02/14] fix: max user profile length to db field length Resolves: #9749 --- packages/backend/src/models/repositories/user.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index aa224b6674..0bf31b1b33 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -66,7 +66,7 @@ const nameSchema = { type: "string", minLength: 1, maxLength: 50 } as const; const descriptionSchema = { type: "string", minLength: 1, - maxLength: 500, + maxLength: 2048, } as const; const locationSchema = { type: "string", minLength: 1, maxLength: 50 } as const; const birthdaySchema = { From 30bc16dabae9a4edb1cb56430a352c363323bb71 Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Wed, 22 Mar 2023 14:40:50 +0100 Subject: [PATCH 03/14] allow client credentials not just for tapbots --- packages/backend/src/server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 174aaf222f..3f7f7c03cb 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -174,7 +174,7 @@ mastoRouter.post("/oauth/token", async (ctx) => { const body: any = ctx.request.body || ctx.request.query; console.log('token-request', body); console.log('token-query', ctx.request.query); - if (body.redirect_uri.startsWith('com.tapbots') && body.grant_type === 'client_credentials') { + if (body.grant_type === 'client_credentials') { const ret = { access_token: uuid(), token_type: "Bearer", From 4714e966f1143e7d8abe2e9a9eaaef85f01356fc Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Wed, 22 Mar 2023 17:43:05 +0100 Subject: [PATCH 04/14] Masto api :) --- .../mastodon/ApiMastodonCompatibleService.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts index 9a690e19f0..48eeec79cc 100644 --- a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts +++ b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts @@ -61,4 +61,49 @@ export function apiMastodonCompatible(router: Router): void { ctx.body = e.response.data; } }); + + router.get("/v1/filters", async (ctx) => { + const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; + const accessTokens = ctx.request.headers.authorization; + const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt + // displayed without being logged in + try { + const data = await client.getFilters(); + ctx.body = data.data; + } catch (e: any) { + console.error(e); + ctx.status = 401; + ctx.body = e.response.data; + } + }); + + router.get("/v1/trends", async (ctx) => { + const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; + const accessTokens = ctx.request.headers.authorization; + const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt + // displayed without being logged in + try { + const data = await client.getInstanceTrends(); + ctx.body = data.data; + } catch (e: any) { + console.error(e); + ctx.status = 401; + ctx.body = e.response.data; + } + }); + + router.get("/v1/preferences", async (ctx) => { + const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; + const accessTokens = ctx.request.headers.authorization; + const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt + // displayed without being logged in + try { + const data = await client.getPreferences(); + ctx.body = data.data; + } catch (e: any) { + console.error(e); + ctx.status = 401; + ctx.body = e.response.data; + } + }); } From 4b1af35b3946fc0ffcec360ecc1e69d9ebfb74d8 Mon Sep 17 00:00:00 2001 From: Free Date: Wed, 22 Mar 2023 18:50:30 +0000 Subject: [PATCH 05/14] Allows ctrl+clicking internal links (#9603) (#9743) Co-authored-by: Freeplay Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9743 Co-authored-by: Free Co-committed-by: Free --- packages/client/src/components/global/MkA.vue | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/client/src/components/global/MkA.vue b/packages/client/src/components/global/MkA.vue index a75cd34299..6619827876 100644 --- a/packages/client/src/components/global/MkA.vue +++ b/packages/client/src/components/global/MkA.vue @@ -1,5 +1,5 @@ @@ -80,23 +80,27 @@ function popout() { } function nav(ev: MouseEvent) { - if (props.behavior === 'browser') { - location.href = props.to; - return; - } + if (!ev.ctrlKey) { + ev.preventDefault(); - if (props.behavior) { - if (props.behavior === 'window') { - return openWindow(); - } else if (props.behavior === 'modalWindow') { - return modalWindow(); + if (props.behavior === 'browser') { + location.href = props.to; + return; } - } - if (ev.shiftKey) { - return openWindow(); - } + if (props.behavior) { + if (props.behavior === 'window') { + return openWindow(); + } else if (props.behavior === 'modalWindow') { + return modalWindow(); + } + } - router.push(props.to, ev.ctrlKey ? 'forcePage' : null); + if (ev.shiftKey) { + return openWindow(); + } + + router.push(props.to, ev.ctrlKey ? 'forcePage' : null); + } } From 3a412b955d081d4a11664305d05cb533907fea8d Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 22 Mar 2023 11:54:09 -0700 Subject: [PATCH 06/14] fix: :bug: no nyaizing undefined text Closes #9752 --- packages/client/src/components/MkPostForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index f72423d13e..e9d3de02f7 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -583,7 +583,7 @@ async function post() { } } - if ($i?.isCat) { + if ($i?.isCat && (postData.text != null || postData.text!.length === 0)) { postData.text = nyaize(`${postData.text}`); } From 25c72943c7e07b11f1c8319a67fb1bb03bc3ca36 Mon Sep 17 00:00:00 2001 From: yawhn Date: Tue, 21 Mar 2023 22:55:21 +0200 Subject: [PATCH 07/14] fix: a bug in ads --- .../client/src/components/global/MkAd.vue | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/client/src/components/global/MkAd.vue b/packages/client/src/components/global/MkAd.vue index bab9549ebf..29639ca8dc 100644 --- a/packages/client/src/components/global/MkAd.vue +++ b/packages/client/src/components/global/MkAd.vue @@ -1,21 +1,28 @@