From 53d17b21f3279e557f3d988e7143ee5ac4ee603e Mon Sep 17 00:00:00 2001 From: Marie Date: Thu, 12 Sep 2024 00:41:56 +0200 Subject: [PATCH] upd: add required boolean, hide timelines on required ID Blocks guest timeline on sidebar and on welcome page if ID Verification is required Blocks guests from going to timeline view, channels, antennas and lists --- .config/ci.yml | 10 +++++---- .config/docker_example.yml | 1 + .config/example.yml | 1 + packages/backend/src/config.ts | 4 +++- .../src/core/entities/MetaEntityService.ts | 1 + .../backend/src/models/json-schema/meta.ts | 4 ++++ .../src/components/MkVisitorDashboard.vue | 2 +- .../frontend/src/pages/welcome.entrance.a.vue | 2 +- packages/frontend/src/router/definition.ts | 21 +++++++++---------- packages/frontend/src/scripts/confirm-id.ts | 16 ++++++++++++++ packages/misskey-js/src/autogen/types.ts | 1 + 11 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.config/ci.yml b/.config/ci.yml index fcf15a293d..180b16cbb1 100644 --- a/.config/ci.yml +++ b/.config/ci.yml @@ -222,10 +222,12 @@ checkActivityPubGetSignature: false # downloadTimeout: 30 # maxFileSize: 262144000 -# enable stripe identity for ID verification -# stripeVerify: true -# stripeKey: sk_ -# stripeHookKey: whsec_ +# Stripe identity for ID verification +stripeAgeCheck: + enabled: false + required: false + key: sk_ + hookKey: whsec_ # Upload or download file size limits (bytes) #maxFileSize: 262144000 diff --git a/.config/docker_example.yml b/.config/docker_example.yml index 3604361083..363a465a01 100644 --- a/.config/docker_example.yml +++ b/.config/docker_example.yml @@ -300,6 +300,7 @@ checkActivityPubGetSignature: false # Stripe identity for ID verification stripeAgeCheck: enabled: false + required: false key: sk_ hookKey: whsec_ diff --git a/.config/example.yml b/.config/example.yml index b58cd53429..62bcc1939c 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -315,6 +315,7 @@ checkActivityPubGetSignature: false # Stripe identity for ID verification stripeAgeCheck: enabled: false + required: false key: sk_ hookKey: whsec_ diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index 837817dc7c..629a4815f8 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -110,6 +110,7 @@ type Source = { stripeAgeCheck: { enabled: boolean; + required: boolean; key: string; hookKey: string; }; @@ -205,6 +206,7 @@ export type Config = { stripeAgeCheck: { enabled: boolean | undefined; + required: boolean | undefined; key: string; hookKey: string; }; @@ -478,6 +480,6 @@ function applyEnvOverrides(config: Source) { _apply_top([['outgoingAddress', 'outgoingAddressFamily', 'proxy', 'proxySmtp', 'mediaProxy', 'proxyRemoteFiles', 'videoThumbnailGenerator']]); _apply_top([['maxFileSize', 'maxNoteLength', 'pidFile']]); _apply_top(['import', ['downloadTimeout', 'maxFileSize']]); - _apply_top(['stripeAgeCheck', ['enabled', 'key', 'hookKey']]); + _apply_top(['stripeAgeCheck', ['enabled', 'required', 'key', 'hookKey']]); _apply_top([['signToActivityPubGet', 'checkActivityPubGetSignature']]); } diff --git a/packages/backend/src/core/entities/MetaEntityService.ts b/packages/backend/src/core/entities/MetaEntityService.ts index 3128b762f4..08583361c8 100644 --- a/packages/backend/src/core/entities/MetaEntityService.ts +++ b/packages/backend/src/core/entities/MetaEntityService.ts @@ -165,6 +165,7 @@ export class MetaEntityService { turnstile: instance.enableTurnstile, objectStorage: instance.useObjectStorage, serviceWorker: instance.enableServiceWorker, + idRequired: this.config.stripeAgeCheck.enabled && this.config.stripeAgeCheck.required ? true : false, miauth: true, }, }; diff --git a/packages/backend/src/models/json-schema/meta.ts b/packages/backend/src/models/json-schema/meta.ts index 1d620f16fd..2ae33c5a8c 100644 --- a/packages/backend/src/models/json-schema/meta.ts +++ b/packages/backend/src/models/json-schema/meta.ts @@ -316,6 +316,10 @@ export const packedMetaDetailedOnlySchema = { type: 'boolean', optional: false, nullable: false, }, + idRequired: { + type: 'boolean', + optional: false, nullable: false, + }, miauth: { type: 'boolean', optional: true, nullable: false, diff --git a/packages/frontend/src/components/MkVisitorDashboard.vue b/packages/frontend/src/components/MkVisitorDashboard.vue index 6fb3304468..94c58e3c27 100644 --- a/packages/frontend/src/components/MkVisitorDashboard.vue +++ b/packages/frontend/src/components/MkVisitorDashboard.vue @@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-
+
{{ i18n.ts.letsLookAtTimeline }}
diff --git a/packages/frontend/src/pages/welcome.entrance.a.vue b/packages/frontend/src/pages/welcome.entrance.a.vue index 0d132e6a86..83496882ef 100644 --- a/packages/frontend/src/pages/welcome.entrance.a.vue +++ b/packages/frontend/src/pages/welcome.entrance.a.vue @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only