fix: 🔒 Remove timeline source if not logged in and guest tl isn't enabled

This commit is contained in:
ThatOneCalculator 2022-08-09 16:12:20 -07:00
parent 59e37b6124
commit 0e49dd6066
2 changed files with 13 additions and 12 deletions

View file

@ -38,6 +38,7 @@ const XTutorial = defineAsyncComponent(() => import('./timeline.tutorial.vue'));
const isLocalTimelineAvailable = !instance.disableLocalTimeline || ($i != null && ($i.isModerator || $i.isAdmin));
const isRecommendedTimelineAvailable = !instance.disableRecommendedTimeline || ($i != null && ($i.isModerator || $i.isAdmin));
const isGlobalTimelineAvailable = !instance.disableGlobalTimeline || ($i != null && ($i.isModerator || $i.isAdmin));
const enableGuestTimeline = instance.enableGuestTimeline;
const keymap = {
't': focus,
};
@ -47,7 +48,10 @@ const rootEl = $ref<HTMLElement>();
let queue = $ref(0);
let srcWhenNotSignin = $ref(isLocalTimelineAvailable ? 'local' : 'global');
const src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin), set: (x) => saveSrc(x) });
let src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin), set: (x) => saveSrc(x) });
if (!enableGuestTimeline) {
src = $computed({});
}
watch ($$(src), () => queue = 0);

View file

@ -6,18 +6,15 @@ import MkError from '@/pages/_error_.vue';
import { api } from '@/os';
import { ui } from '@/config';
const meta = api('meta', {
detail: false
}).then((meta) => {
console.log(meta);
console.log(meta[0]);
console.log(meta[1]);
console.log(meta[0][0]);
// const guestTimeline = meta.enableGuestTimeline;
// console.log(guestTimeline);
});
function getGuestTimelineStatus() {
api('meta', {
detail: false
}).then((meta) => {
return meta.enableGuestTimeline;
});
}
const guestTimeline = true;
const guestTimeline = getGuestTimelineStatus();
const page = (loader: AsyncComponentLoader<any>) => defineAsyncComponent({
loader: loader,