feat: togglable guest timeline

default false

rc 9

no async

welcome explore button to `/explore`

fix: 🔥 Remove meta implementation in routing for now
This commit is contained in:
ThatOneCalculator 2022-08-09 13:07:17 -07:00
parent b49dd35907
commit 4fcf5b1081
15 changed files with 41 additions and 4 deletions

View file

@ -68,6 +68,7 @@
- 👍 also triggers generic like/favorite - 👍 also triggers generic like/favorite
- [Add additional background for acrylic popups if backdrop-filter is unsupported](https://github.com/misskey-dev/misskey/pull/8671) - [Add additional background for acrylic popups if backdrop-filter is unsupported](https://github.com/misskey-dev/misskey/pull/8671)
- [Timeline page for non-login users](https://github.com/misskey-dev/misskey/pull/8927) - [Timeline page for non-login users](https://github.com/misskey-dev/misskey/pull/8927)
- Made toggleable by instance admins, off by default
- [Add parameters to MFM rotate](https://github.com/misskey-dev/misskey/pull/8549) - [Add parameters to MFM rotate](https://github.com/misskey-dev/misskey/pull/8549)
- Many changes from [Foundkey](https://akkoma.dev/FoundKeyGang/Foundkey) - Many changes from [Foundkey](https://akkoma.dev/FoundKeyGang/Foundkey)
- 0ece67b04c3f0365057624c1068808276ccab981: refactor pages/auth.form.vue to composition API - 0ece67b04c3f0365057624c1068808276ccab981: refactor pages/auth.form.vue to composition API

View file

@ -324,6 +324,7 @@ disconnectService: "Disconnect"
enableLocalTimeline: "Enable local timeline" enableLocalTimeline: "Enable local timeline"
enableGlobalTimeline: "Enable global timeline" enableGlobalTimeline: "Enable global timeline"
enableRecommendedTimeline: "Enable recommended timeline" enableRecommendedTimeline: "Enable recommended timeline"
enableGuestTimeline: "Enable timelines for non-logged in users"
disablingTimelinesInfo: "Adminstrators and Moderators will always have access to all timelines, even if they are not enabled." disablingTimelinesInfo: "Adminstrators and Moderators will always have access to all timelines, even if they are not enabled."
registration: "Register" registration: "Register"
enableRegistration: "Enable new user registration" enableRegistration: "Enable new user registration"

View file

@ -324,6 +324,7 @@ disconnectService: "切断する"
enableLocalTimeline: "ローカルタイムラインを有効にする" enableLocalTimeline: "ローカルタイムラインを有効にする"
enableGlobalTimeline: "グローバルタイムラインを有効にする" enableGlobalTimeline: "グローバルタイムラインを有効にする"
enableRecommendedTimeline: "推奨されるタイムラインを有効にする" enableRecommendedTimeline: "推奨されるタイムラインを有効にする"
enableGuestTimeline: "非ログインユーザーのタイムラインを有効にする"
disablingTimelinesInfo: "これらのタイムラインを無効化しても、利便性のため管理者およびモデレーターは引き続き利用することができます。" disablingTimelinesInfo: "これらのタイムラインを無効化しても、利便性のため管理者およびモデレーターは引き続き利用することができます。"
registration: "登録" registration: "登録"
enableRegistration: "誰でも新規登録できるようにする" enableRegistration: "誰でも新規登録できるようにする"

View file

@ -1,6 +1,6 @@
{ {
"name": "misskey", "name": "misskey",
"version": "12.118.1-calc.rc.8", "version": "12.118.1-calc.rc.9",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -0,0 +1,9 @@
export class GuestTimeline1660068273737 {
name = 'GuestTimeline1660068273737'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "enableGuestTimeline" boolean NOT NULL DEFAULT false`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableGuestTimeline"`);
}
}

View file

@ -57,6 +57,11 @@ export class Meta {
}) })
public disableGlobalTimeline: boolean; public disableGlobalTimeline: boolean;
@Column('boolean', {
default: false,
})
public enableGuestTimeline: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
}) })

View file

@ -398,6 +398,7 @@ export default define(meta, paramDef, async (ps, me) => {
disableLocalTimeline: instance.disableLocalTimeline, disableLocalTimeline: instance.disableLocalTimeline,
disableRecommendedTimeline: instance.disableRecommendedTimeline, disableRecommendedTimeline: instance.disableRecommendedTimeline,
disableGlobalTimeline: instance.disableGlobalTimeline, disableGlobalTimeline: instance.disableGlobalTimeline,
enableGuestTimeline: instance.enableGuestTimeline,
driveCapacityPerLocalUserMb: instance.localDriveCapacityMb, driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb, driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
emailRequiredForSignup: instance.emailRequiredForSignup, emailRequiredForSignup: instance.emailRequiredForSignup,

View file

@ -18,6 +18,7 @@ export const paramDef = {
disableLocalTimeline: { type: 'boolean', nullable: true }, disableLocalTimeline: { type: 'boolean', nullable: true },
disableRecommendedTimeline: { type: 'boolean', nullable: true }, disableRecommendedTimeline: { type: 'boolean', nullable: true },
disableGlobalTimeline: { type: 'boolean', nullable: true }, disableGlobalTimeline: { type: 'boolean', nullable: true },
enableGuestTimeline: { type: 'boolean', nullable: true },
useStarForReactionFallback: { type: 'boolean', nullable: true }, useStarForReactionFallback: { type: 'boolean', nullable: true },
recommendedInstances: { type: 'array', nullable: true, items: { recommendedInstances: { type: 'array', nullable: true, items: {
type: 'string', type: 'string',
@ -141,6 +142,10 @@ export default define(meta, paramDef, async (ps, me) => {
set.disableGlobalTimeline = ps.disableGlobalTimeline; set.disableGlobalTimeline = ps.disableGlobalTimeline;
} }
if (typeof ps.enableGuestTimeline === 'boolean') {
set.enableGuestTimeline = ps.enableGuestTimeline;
}
if (typeof ps.useStarForReactionFallback === 'boolean') { if (typeof ps.useStarForReactionFallback === 'boolean') {
set.useStarForReactionFallback = ps.useStarForReactionFallback; set.useStarForReactionFallback = ps.useStarForReactionFallback;
} }

View file

@ -88,6 +88,10 @@ export const meta = {
type: 'boolean', type: 'boolean',
optional: false, nullable: false, optional: false, nullable: false,
}, },
enableGuestTimeline: {
type: 'boolean',
optional: false, nullable: false,
},
driveCapacityPerLocalUserMb: { driveCapacityPerLocalUserMb: {
type: 'number', type: 'number',
optional: false, nullable: false, optional: false, nullable: false,
@ -366,6 +370,7 @@ export default define(meta, paramDef, async (ps, me) => {
disableLocalTimeline: instance.disableLocalTimeline, disableLocalTimeline: instance.disableLocalTimeline,
disableRecommendedTimeline: instance.disableRecommendedTimeline, disableRecommendedTimeline: instance.disableRecommendedTimeline,
disableGlobalTimeline: instance.disableGlobalTimeline, disableGlobalTimeline: instance.disableGlobalTimeline,
enableGuestTimeline: instance.enableGuestTimeline,
driveCapacityPerLocalUserMb: instance.localDriveCapacityMb, driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb, driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
emailRequiredForSignup: instance.emailRequiredForSignup, emailRequiredForSignup: instance.emailRequiredForSignup,
@ -423,6 +428,7 @@ export default define(meta, paramDef, async (ps, me) => {
localTimeLine: !instance.disableLocalTimeline, localTimeLine: !instance.disableLocalTimeline,
recommendedTimeline: !instance.disableRecommendedTimeline, recommendedTimeline: !instance.disableRecommendedTimeline,
globalTimeLine: !instance.disableGlobalTimeline, globalTimeLine: !instance.disableGlobalTimeline,
guestTimeline: instance.enableGuestTimeline,
emailRequiredForSignup: instance.emailRequiredForSignup, emailRequiredForSignup: instance.emailRequiredForSignup,
elasticsearch: config.elasticsearch ? true : false, elasticsearch: config.elasticsearch ? true : false,
hcaptcha: instance.enableHcaptcha, hcaptcha: instance.enableHcaptcha,

View file

@ -69,6 +69,7 @@ const nodeinfo2 = async () => {
disableLocalTimeline: meta.disableLocalTimeline, disableLocalTimeline: meta.disableLocalTimeline,
disableRecommendedTimeline: meta.disableRecommendedTimeline, disableRecommendedTimeline: meta.disableRecommendedTimeline,
disableGlobalTimeline: meta.disableGlobalTimeline, disableGlobalTimeline: meta.disableGlobalTimeline,
enableGuestTimeline: meta.enableGuestTimeline,
emailRequiredForSignup: meta.emailRequiredForSignup, emailRequiredForSignup: meta.emailRequiredForSignup,
enableHcaptcha: meta.enableHcaptcha, enableHcaptcha: meta.enableHcaptcha,
enableRecaptcha: meta.enableRecaptcha, enableRecaptcha: meta.enableRecaptcha,

View file

@ -55,6 +55,7 @@
<FormSection> <FormSection>
<FormSwitch v-model="enableLocalTimeline" class="_formBlock">{{ i18n.ts.enableLocalTimeline }}</FormSwitch> <FormSwitch v-model="enableLocalTimeline" class="_formBlock">{{ i18n.ts.enableLocalTimeline }}</FormSwitch>
<FormSwitch v-model="enableGlobalTimeline" class="_formBlock">{{ i18n.ts.enableGlobalTimeline }}</FormSwitch> <FormSwitch v-model="enableGlobalTimeline" class="_formBlock">{{ i18n.ts.enableGlobalTimeline }}</FormSwitch>
<FormSwitch v-model="enableGuestTimeline" class="_formBlock">{{ i18n.ts.enableGuestTimeline }}</FormSwitch>
<FormInfo class="_formBlock">{{ i18n.ts.disablingTimelinesInfo }}</FormInfo> <FormInfo class="_formBlock">{{ i18n.ts.disablingTimelinesInfo }}</FormInfo>
</FormSection> </FormSection>
@ -198,6 +199,7 @@ let defaultDarkTheme: any = $ref(null);
let enableLocalTimeline: boolean = $ref(false); let enableLocalTimeline: boolean = $ref(false);
let enableGlobalTimeline: boolean = $ref(false); let enableGlobalTimeline: boolean = $ref(false);
let enableRecommendedTimeline: boolean = $ref(false); let enableRecommendedTimeline: boolean = $ref(false);
let enableGuestTimeline: boolean = $ref(false);
let pinnedUsers: string = $ref(''); let pinnedUsers: string = $ref('');
let customMOTD: string = $ref(''); let customMOTD: string = $ref('');
let recommendedInstances: string = $ref(''); let recommendedInstances: string = $ref('');
@ -229,6 +231,7 @@ async function init() {
enableLocalTimeline = !meta.disableLocalTimeline; enableLocalTimeline = !meta.disableLocalTimeline;
enableGlobalTimeline = !meta.disableGlobalTimeline; enableGlobalTimeline = !meta.disableGlobalTimeline;
enableRecommendedTimeline = !meta.disableRecommendedTimeline; enableRecommendedTimeline = !meta.disableRecommendedTimeline;
enableGuestTimeline = meta.enableGuestTimeline;
pinnedUsers = meta.pinnedUsers.join('\n'); pinnedUsers = meta.pinnedUsers.join('\n');
customMOTD = meta.customMOTD.join('\n'); customMOTD = meta.customMOTD.join('\n');
customSplashIcons = meta.customSplashIcons.join('\n'); customSplashIcons = meta.customSplashIcons.join('\n');
@ -261,6 +264,7 @@ function save() {
disableLocalTimeline: !enableLocalTimeline, disableLocalTimeline: !enableLocalTimeline,
disableGlobalTimeline: !enableGlobalTimeline, disableGlobalTimeline: !enableGlobalTimeline,
disableRecommendedTimeline: !enableRecommendedTimeline, disableRecommendedTimeline: !enableRecommendedTimeline,
enableGuestTimeline: enableGuestTimeline,
pinnedUsers: pinnedUsers.split('\n'), pinnedUsers: pinnedUsers.split('\n'),
customMOTD: customMOTD.split('\n'), customMOTD: customMOTD.split('\n'),
customSplashIcons: customSplashIcons.split('\n'), customSplashIcons: customSplashIcons.split('\n'),

View file

@ -35,7 +35,7 @@
<div class="action"> <div class="action">
<MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton> <MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton>
<MkButton inline rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton> <MkButton inline rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton>
<MkButton inline rounded style="margin-left: 12px;" onclick="window.location.href='/timeline'">Explore</MkButton> <MkButton inline rounded style="margin-left: 12px;" onclick="window.location.href='/explore'">Explore</MkButton>
</div> </div>
</div> </div>
</div> </div>

View file

@ -5,6 +5,8 @@ import MkLoading from '@/pages/_loading_.vue';
import MkError from '@/pages/_error_.vue'; import MkError from '@/pages/_error_.vue';
import { ui } from '@/config'; import { ui } from '@/config';
// const guestTimeline = nodeinfo.meta.enableGuestTimeline;
const page = (loader: AsyncComponentLoader<any>) => defineAsyncComponent({ const page = (loader: AsyncComponentLoader<any>) => defineAsyncComponent({
loader: loader, loader: loader,
loadingComponent: MkLoading, loadingComponent: MkLoading,
@ -456,6 +458,7 @@ export const routes = [{
}, { }, {
path: '/timeline', path: '/timeline',
component: page(() => import('./pages/timeline.vue')), component: page(() => import('./pages/timeline.vue')),
// loginRequired: guestTimeline,
}, { }, {
name: 'index', name: 'index',
path: '/', path: '/',

View file

@ -77,7 +77,7 @@ const announcements = {
endpoint: 'announcements', endpoint: 'announcements',
limit: 10, limit: 10,
}; };
const isTimelineAvailable = !instance.disableLocalTimeline || !instance.disableRecommendedTimeline || !instance.disableGlobalTimeline; const isTimelineAvailable = instance.enableGuestTimeline && (!instance.disableLocalTimeline || !instance.disableRecommendedTimeline || !instance.disableGlobalTimeline);
let showMenu = $ref(false); let showMenu = $ref(false);
let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD); let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
let narrow = $ref(window.innerWidth < 1280); let narrow = $ref(window.innerWidth < 1280);

View file

@ -60,7 +60,7 @@ export default defineComponent({
return { return {
narrow: null, narrow: null,
showMenu: false, showMenu: false,
isTimelineAvailable: !instance.disableLocalTimeline || !instance.disableRecommendedTimeline || !instance.disableGlobalTimeline, isTimelineAvailable: instance.enableGuestTimeline && (!instance.disableLocalTimeline || !instance.disableRecommendedTimeline || !instance.disableGlobalTimeline),
}; };
}, },