diff --git a/README.md b/README.md index cbfee2f8..12c52c06 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ ## 主要な変更点 +- 非ログインユーザーにもローカルタイムラインとグローバルタイムラインを公開できるように変更 + - コントロールパネルから設定すると `https://server.example.com/timeline` で公開されます - 検索フィルターを強化中 - `from:me` を検索クエリの末尾につけると自分の投稿のみを検索できるように変更 - 検索クエリの例: `予定 from:me` diff --git a/locales/en-US.yml b/locales/en-US.yml index 6c3734d7..e08a7c54 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2201,3 +2201,5 @@ moreUrls: "Pinned pages" moreUrlsDescription: "Enter the pages you want to pin to the help menu in the lower left corner using this notation:\n\"Display name\": https://example.com/" enablePullToRefresh: "Enable \"Pull down to refresh\"" pullToRefreshThreshold: "Pull distance for reloading" +publishTimelines: "Publish timelines for visitors" +publishTimelinesDescription: "If enabled, the Local and Global timeline will be shown on {url} even when signed out." diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 26bdad6c..c40363a5 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2043,3 +2043,5 @@ pullDownToReload: "下に引っ張って再読み込み" enableTimelineStreaming: "タイムラインを自動で更新する" enablePullToRefresh: "「下に引っ張って再読み込み」を有効にする" pullToRefreshThreshold: "再読み込みするために引っ張る距離" +publishTimelines: "非ログインユーザーにもタイムラインを公開する" +publishTimelinesDescription: "有効にすると、{url} でローカルタイムラインとグローバルタイムラインが公開されます。" diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 25112ed4..5f0f36a4 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -61,6 +61,11 @@ export class Meta { }) public disableGlobalTimeline: boolean; + @Column("boolean", { + default: false, + }) + public enableGuestTimeline: boolean; + @Column("varchar", { length: 256, default: "⭐", diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 6f23ef18..d168c345 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -460,7 +460,7 @@ export const paramDef = { required: [], } as const; -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const instance = await fetchMeta(true); return { @@ -479,6 +479,7 @@ export default define(meta, paramDef, async (ps, me) => { disableLocalTimeline: instance.disableLocalTimeline, disableRecommendedTimeline: instance.disableRecommendedTimeline, disableGlobalTimeline: instance.disableGlobalTimeline, + enableGuestTimeline: instance.enableGuestTimeline, driveCapacityPerLocalUserMb: instance.localDriveCapacityMb, driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb, emailRequiredForSignup: instance.emailRequiredForSignup, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 422cf49f..d4034215 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -17,6 +17,7 @@ export const paramDef = { disableLocalTimeline: { type: "boolean", nullable: true }, disableRecommendedTimeline: { type: "boolean", nullable: true }, disableGlobalTimeline: { type: "boolean", nullable: true }, + enableGuestTimeline: { type: "boolean", nullable: true }, defaultReaction: { type: "string", nullable: true }, recommendedInstances: { type: "array", @@ -216,6 +217,10 @@ export default define(meta, paramDef, async (ps, me) => { set.disableGlobalTimeline = ps.disableGlobalTimeline; } + if (typeof ps.enableGuestTimeline === "boolean") { + set.enableGuestTimeline = ps.enableGuestTimeline; + } + if (typeof ps.defaultReaction === "string") { set.defaultReaction = ps.defaultReaction; } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 16e046e0..68e5643e 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -111,6 +111,11 @@ export const meta = { optional: false, nullable: false, }, + enableGuestTimeline: { + type: "boolean", + optional: false, + nullable: false, + }, driveCapacityPerLocalUserMb: { type: "number", optional: false, @@ -432,6 +437,7 @@ export default define(meta, paramDef, async (ps, me) => { disableLocalTimeline: instance.disableLocalTimeline, disableRecommendedTimeline: instance.disableRecommendedTimeline, disableGlobalTimeline: instance.disableGlobalTimeline, + enableGuestTimeline: instance.enableGuestTimeline, driveCapacityPerLocalUserMb: instance.localDriveCapacityMb, driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb, emailRequiredForSignup: instance.emailRequiredForSignup, @@ -506,6 +512,7 @@ export default define(meta, paramDef, async (ps, me) => { localTimeLine: !instance.disableLocalTimeline, recommendedTimeline: !instance.disableRecommendedTimeline, globalTimeLine: !instance.disableGlobalTimeline, + gusstTimeline: instance.enableGuestTimeline, emailRequiredForSignup: instance.emailRequiredForSignup, searchFilters: false, // TODO: implement search filters hcaptcha: instance.enableHcaptcha, diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 3562bd83..01250768 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -23,6 +23,8 @@ export default class extends Channel { return; } + if (!meta.enableGuestTimeline && this.user == null) return; + this.withReplies = params != null ? !!params.withReplies : true; // Subscribe events diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index d859b107..9362bc45 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -22,6 +22,8 @@ export default class extends Channel { return; } + if (!meta.enableGuestTimeline && this.user == null) return; + this.withReplies = params != null ? !!params.withReplies : true; // Subscribe events diff --git a/packages/client/src/components/MkTimeline.vue b/packages/client/src/components/MkTimeline.vue index 532fe940..d069547f 100644 --- a/packages/client/src/components/MkTimeline.vue +++ b/packages/client/src/components/MkTimeline.vue @@ -1,6 +1,6 @@