From f132339316d11a7f2a1018c50073f2b7e2083bc1 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 2 Apr 2023 01:59:18 -0700 Subject: [PATCH 01/20] fix: dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 53734b0691..c0a654654d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,8 @@ COPY packages/backend/package.json packages/backend/package.json COPY packages/client/package.json packages/client/package.json COPY packages/sw/package.json packages/sw/package.json COPY packages/backend/native-utils/package.json packages/backend/native-utils/package.json -COPY packages/backend/native-utils/**/*/package.json packages/backend/native-utils/**/*/package.json +COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json +COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json # Configure corepack and pnpm RUN corepack enable From b9cb64a5d15f79a69efbabcfb275cc2b51e8853d Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 2 Apr 2023 02:07:02 -0700 Subject: [PATCH 02/20] fix: add copy for build from native-utils --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c0a654654d..3378f1e612 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,8 @@ COPY --from=build /calckey/packages/client/node_modules /calckey/packages/client COPY --from=build /calckey/built /calckey/built COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built COPY --from=build /calckey/packages/backend/assets/instance.css /calckey/packages/backend/assets/instance.css +COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built +COPY --from=build /calckey/packages/backend/native-utils/target /calckey/packages/backend/native-utils/target RUN corepack enable ENTRYPOINT [ "/sbin/tini", "--" ] From e119554f2baef28b5fec015f7e29bf052711df41 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 2 Apr 2023 02:09:49 -0700 Subject: [PATCH 03/20] add VIPS to dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3378f1e612..1a1a0aac64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM node:19-alpine as build WORKDIR /calckey # Install compilation dependencies -RUN apk add --no-cache --no-progress git alpine-sdk python3 rust cargo +RUN apk add --no-cache --no-progress git alpine-sdk python3 rust cargo vips # Copy only the dependency-related files first, to cache efficiently COPY package.json pnpm*.yaml ./ From 5b150ddab04164a41fbd4816db3e9f1658c878be Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 2 Apr 2023 02:17:54 -0700 Subject: [PATCH 04/20] ci: :construction_worker: add beta to commit --- .woodpecker/commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/commit.yml b/.woodpecker/commit.yml index 386484ce22..6bb1b2d814 100644 --- a/.woodpecker/commit.yml +++ b/.woodpecker/commit.yml @@ -18,4 +18,4 @@ services: image: redis branches: - include: [ main, develop, feature/* ] + include: [ main, beta, develop, feature/* ] From a66eac0e5b8aca6a4a8c3c3d7b2acb6b22f311da Mon Sep 17 00:00:00 2001 From: Kaity A Date: Sun, 2 Apr 2023 21:24:12 +1000 Subject: [PATCH 05/20] Separate cat-avatar mode and speak-as-cat nyanification --- locales/en-US.yml | 2 ++ .../migration/1680426269172-SpeakAsCat.js | 20 +++++++++++++++++++ packages/backend/src/models/entities/user.ts | 6 ++++++ .../backend/src/models/repositories/note.ts | 2 +- .../backend/src/models/repositories/user.ts | 1 + packages/backend/src/models/schema/user.ts | 5 +++++ .../src/server/api/endpoints/i/update.ts | 2 ++ .../client/src/pages/settings/profile.vue | 3 +++ 8 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 packages/backend/migration/1680426269172-SpeakAsCat.js diff --git a/locales/en-US.yml b/locales/en-US.yml index 8802039220..3649e97011 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -146,6 +146,8 @@ flagAsBot: "Mark this account as a bot" flagAsBotDescription: "Enable this option if this account is controlled by a program. If enabled, it will act as a flag for other developers to prevent endless interaction chains with other bots and adjust Calckey's internal systems to treat this account as a bot." flagAsCat: "Are you a cat? 😺" flagAsCatDescription: "You'll get cat ears and speak like a cat!" +flagSpeakAsCat: "Speak as a cat" +flagSpeakAsCatDescription: "Your posts will get nyanified when in cat mode" flagShowTimelineReplies: "Show replies in timeline" flagShowTimelineRepliesDescription: "Shows replies of users to posts of other users in the timeline if turned on." autoAcceptFollowed: "Automatically approve follow requests from users you're following" diff --git a/packages/backend/migration/1680426269172-SpeakAsCat.js b/packages/backend/migration/1680426269172-SpeakAsCat.js new file mode 100644 index 0000000000..3655e27265 --- /dev/null +++ b/packages/backend/migration/1680426269172-SpeakAsCat.js @@ -0,0 +1,20 @@ +export class SpeakAsCat1680426269172 { + name = 'SpeakAsCat1680426269172' + + async up(queryRunner) { + await queryRunner.query(` + ALTER TABLE "user" + ADD "speakAsCat" boolean NOT NULL DEFAULT true + `); + await queryRunner.query(` + COMMENT ON COLUMN "user"."speakAsCat" + IS 'Whether to speak as a cat if isCat.' + `); + } + + async down(queryRunner) { + await queryRunner.query(` + ALTER TABLE "user" DROP COLUMN "speakAsCat" + `); + } +} diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index c57ad916c9..c23f4f28d7 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -156,6 +156,12 @@ export class User { }) public isCat: boolean; + @Column('boolean', { + default: true, + comment: 'Whether to speak as a cat if isCat.', + }) + public speakAsCat: boolean; + @Column('boolean', { default: false, comment: 'Whether the User is the admin.', diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index b99ce16350..5e56a817bc 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -263,7 +263,7 @@ export const NoteRepository = db.getRepository(Note).extend({ : {}), }); - if (packed.user.isCat && packed.text) { + if (packed.user.isCat && packed.user.speakAsCat && packed.text) { const tokens = packed.text ? mfm.parse(packed.text) : []; function nyaizeNode(node: mfm.MfmNode) { if (node.type === "quote") return; diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 0bf31b1b33..27b0c78d6e 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -438,6 +438,7 @@ export const UserRepository = db.getRepository(User).extend({ isModerator: user.isModerator || falsy, isBot: user.isBot || falsy, isCat: user.isCat || falsy, + speakAsCat: user.speakAsCat || falsy, instance: user.host ? userInstanceCache .fetch( diff --git a/packages/backend/src/models/schema/user.ts b/packages/backend/src/models/schema/user.ts index 9fb5aa8f3b..7f76891650 100644 --- a/packages/backend/src/models/schema/user.ts +++ b/packages/backend/src/models/schema/user.ts @@ -66,6 +66,11 @@ export const packedUserLiteSchema = { nullable: false, optional: true, }, + speakAsCat: { + type: "boolean", + nullable: false, + optional: true, + }, emojis: { type: "array", nullable: false, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 48868de37e..56ed64296b 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -104,6 +104,7 @@ export const paramDef = { noCrawle: { type: "boolean" }, isBot: { type: "boolean" }, isCat: { type: "boolean" }, + speakAsCat: { type: "boolean" }, showTimelineReplies: { type: "boolean" }, injectFeaturedNote: { type: "boolean" }, receiveAnnouncementEmail: { type: "boolean" }, @@ -191,6 +192,7 @@ export default define(meta, paramDef, async (ps, _user, token) => { profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed; if (typeof ps.noCrawle === "boolean") profileUpdates.noCrawle = ps.noCrawle; if (typeof ps.isCat === "boolean") updates.isCat = ps.isCat; + if (typeof ps.speakAsCat === "boolean") updates.speakAsCat = ps.speakAsCat; if (typeof ps.injectFeaturedNote === "boolean") profileUpdates.injectFeaturedNote = ps.injectFeaturedNote; if (typeof ps.receiveAnnouncementEmail === "boolean") diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index a2ed6fd41f..4e51a339b7 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -59,6 +59,7 @@ {{ i18n.ts.flagAsCat }} + {{ i18n.ts.flagSpeakAsCat }} {{ i18n.ts.flagShowTimelineReplies }} {{ i18n.ts.flagAsBot }}
@@ -92,6 +93,7 @@ const profile = reactive({ lang: $i?.lang, isBot: $i?.isBot, isCat: $i?.isCat, + speakAsCat: $i?.speakAsCat, showTimelineReplies: $i?.showTimelineReplies, }); @@ -135,6 +137,7 @@ function save() { lang: profile.lang || null, isBot: !!profile.isBot, isCat: !!profile.isCat, + speakAsCat: !!profile.speakAsCat, showTimelineReplies: !!profile.showTimelineReplies, }); } From 8bd64c89a42f1be52a2a4c19556fd1a5189547ef Mon Sep 17 00:00:00 2001 From: Free Date: Sun, 2 Apr 2023 21:39:25 +0000 Subject: [PATCH 06/20] note-improvements (#9799) Boop! Co-authored-by: Freeplay Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9799 Co-authored-by: Free Co-committed-by: Free --- locales/en-US.yml | 14 +++---- packages/client/src/components/MkNote.vue | 14 ++++--- .../client/src/components/MkNoteDetailed.vue | 3 +- packages/client/src/components/MkNoteSub.vue | 39 ++++++++++++++----- .../src/components/MkSubNoteContent.vue | 2 +- packages/client/src/ui/universal.vue | 8 +++- 6 files changed, 53 insertions(+), 27 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 3649e97011..f4913e9041 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1230,13 +1230,13 @@ _sfx: _ago: future: "Future" justNow: "Just now" - secondsAgo: "{n} second(s) ago" - minutesAgo: "{n} minute(s) ago" - hoursAgo: "{n} hour(s) ago" - daysAgo: "{n} day(s) ago" - weeksAgo: "{n} week(s) ago" - monthsAgo: "{n} month(s) ago" - yearsAgo: "{n} year(s) ago" + secondsAgo: "{n}s ago" + minutesAgo: "{n}m ago" + hoursAgo: "{n}h ago" + daysAgo: "{n}d ago" + weeksAgo: "{n}w ago" + monthsAgo: "{n}mo ago" + yearsAgo: "{n}y ago" _time: second: "Second(s)" minute: "Minute(s)" diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index c02e79d005..f80aabbc92 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -10,16 +10,16 @@ :class="{ renote: isRenote }" > -
+
-
{{ i18n.ts.promotion }}
+
{{ i18n.ts.promotion }}
{{ i18n.ts.featured }}
{{ i18n.ts.pinnedNote }}
@@ -93,7 +93,6 @@ -
@@ -418,8 +417,8 @@ function readPromo() { align-items: center; white-space: pre; color: var(--renote); + cursor: pointer; - > i { margin-right: 4px; } @@ -504,7 +503,7 @@ function readPromo() { width: 100%; margin-top: 1em; position: sticky; - bottom: 1em; + bottom: var(--stickyBottom); > span { display: inline-block; @@ -663,6 +662,9 @@ function readPromo() { } > .line { margin-right: 10px; + &::before { + margin-top: 8px; + } } } > .article { diff --git a/packages/client/src/components/MkNoteDetailed.vue b/packages/client/src/components/MkNoteDetailed.vue index a06bac3705..4eed184e22 100644 --- a/packages/client/src/components/MkNoteDetailed.vue +++ b/packages/client/src/components/MkNoteDetailed.vue @@ -352,6 +352,7 @@ onUnmounted(() => {