Accessibility settings without login 2/2

This commit is contained in:
Crimekillz 2024-04-18 00:55:03 +02:00
parent 97a407b3bf
commit 2ff535286a
2 changed files with 245 additions and 164 deletions

View File

@ -89,7 +89,41 @@ const ro = new ResizeObserver((entries, observer) => {
narrow = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD; narrow = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD;
}); });
const menuDef = computed(() => [ let menuDef = computed(() => [
{
title: i18n.ts.clientSettings,
items: [
{
icon: "ph-gear-six ph-bold ph-lg",
text: i18n.ts.general,
to: "/settings/general",
active: currentPage?.route.name === "general",
},
{
icon: "ph-palette ph-bold ph-lg",
text: i18n.ts.theme,
to: "/settings/theme",
active: currentPage?.route.name === "theme",
},
{
icon: "ph-speaker-high ph-bold ph-lg",
text: i18n.ts.sounds,
to: "/settings/sounds",
active: currentPage?.route.name === "sounds",
},
{
icon: "ph-heart ph-bold ph-lg",
text: i18n.ts._wellness.name,
to: "/settings/wellness",
active: currentPage?.route.name === "wellness",
},
],
},
]);
// If logged in, give more options...
if ($i) {
menuDef = computed(() => [
{ {
title: i18n.ts.basicSettings, title: i18n.ts.basicSettings,
items: [ items: [
@ -278,6 +312,7 @@ const menuDef = computed(() => [
], ],
}, },
]); ]);
}
watch($$(narrow), () => {}); watch($$(narrow), () => {});
@ -287,7 +322,11 @@ onMounted(() => {
narrow = el.value.offsetWidth < NARROW_THRESHOLD; narrow = el.value.offsetWidth < NARROW_THRESHOLD;
if (!narrow && currentPage?.route.name == null) { if (!narrow && currentPage?.route.name == null) {
// Check if logged in...
if ($i)
router.replace("/settings/profile"); router.replace("/settings/profile");
else
router.replace("/settings/general");
} }
}); });
@ -295,7 +334,11 @@ onActivated(() => {
narrow = el.value.offsetWidth < NARROW_THRESHOLD; narrow = el.value.offsetWidth < NARROW_THRESHOLD;
if (!narrow && currentPage?.route.name == null) { if (!narrow && currentPage?.route.name == null) {
// Check if logged in...
if ($i)
router.replace("/settings/profile"); router.replace("/settings/profile");
else
router.replace("/settings/general");
} }
}); });
@ -309,12 +352,16 @@ watch(router.currentRef, (to) => {
to.child?.route.name == null && to.child?.route.name == null &&
!narrow !narrow
) { ) {
// Check if logged in...
if ($i)
router.replace("/settings/profile"); router.replace("/settings/profile");
else
router.replace("/settings/general");
} }
}); });
const emailNotConfigured = computed( const emailNotConfigured = computed(
() => instance.enableEmail && ($i.email == null || !$i.emailVerified), () => instance.enableEmail && ($i) && ($i.email == null || !$i.emailVerified),
); );
provideMetadataReceiver((info) => { provideMetadataReceiver((info) => {

View File

@ -58,47 +58,54 @@ export const routes = [
name: "settings", name: "settings",
path: "/settings", path: "/settings",
component: page(() => import("./pages/settings/index.vue")), component: page(() => import("./pages/settings/index.vue")),
loginRequired: true,
children: [ children: [
{ {
path: "/profile", path: "/profile",
name: "profile", name: "profile",
component: page(() => import("./pages/settings/profile.vue")), component: page(() => import("./pages/settings/profile.vue")),
loginRequired: true,
}, },
{ {
path: "/privacy", path: "/privacy",
name: "privacy", name: "privacy",
component: page(() => import("./pages/settings/privacy.vue")), component: page(() => import("./pages/settings/privacy.vue")),
loginRequired: true,
}, },
{ {
path: "/reaction", path: "/reaction",
name: "reaction", name: "reaction",
component: page(() => import("./pages/settings/reaction.vue")), component: page(() => import("./pages/settings/reaction.vue")),
loginRequired: true,
}, },
{ {
path: "/drive", path: "/drive",
name: "drive", name: "drive",
component: page(() => import("./pages/settings/drive.vue")), component: page(() => import("./pages/settings/drive.vue")),
loginRequired: true,
}, },
{ {
path: "/notifications", path: "/notifications",
name: "notifications", name: "notifications",
component: page(() => import("./pages/settings/notifications.vue")), component: page(() => import("./pages/settings/notifications.vue")),
loginRequired: true,
}, },
{ {
path: "/email", path: "/email",
name: "email", name: "email",
component: page(() => import("./pages/settings/email.vue")), component: page(() => import("./pages/settings/email.vue")),
loginRequired: true,
}, },
{ {
path: "/integration", path: "/integration",
name: "integration", name: "integration",
component: page(() => import("./pages/settings/integration.vue")), component: page(() => import("./pages/settings/integration.vue")),
loginRequired: true,
}, },
{ {
path: "/security", path: "/security",
name: "security", name: "security",
component: page(() => import("./pages/settings/security.vue")), component: page(() => import("./pages/settings/security.vue")),
loginRequired: true,
}, },
{ {
path: "/general", path: "/general",
@ -109,11 +116,13 @@ export const routes = [
path: "/theme/install", path: "/theme/install",
name: "theme", name: "theme",
component: page(() => import("./pages/settings/theme.install.vue")), component: page(() => import("./pages/settings/theme.install.vue")),
loginRequired: true,
}, },
{ {
path: "/theme/manage", path: "/theme/manage",
name: "theme", name: "theme",
component: page(() => import("./pages/settings/theme.manage.vue")), component: page(() => import("./pages/settings/theme.manage.vue")),
loginRequired: true,
}, },
{ {
path: "/theme", path: "/theme",
@ -124,6 +133,7 @@ export const routes = [
path: "/custom-css", path: "/custom-css",
name: "custom-css", name: "custom-css",
component: page(() => import("./pages/settings/custom-css.vue")), component: page(() => import("./pages/settings/custom-css.vue")),
loginRequired: true,
}, },
{ {
path: "/custom-katex-macro", path: "/custom-katex-macro",
@ -131,21 +141,25 @@ export const routes = [
component: page( component: page(
() => import("./pages/settings/custom-katex-macro.vue"), () => import("./pages/settings/custom-katex-macro.vue"),
), ),
loginRequired: true,
}, },
{ {
path: "/account-info", path: "/account-info",
name: "account-info", name: "account-info",
component: page(() => import("./pages/settings/account-info.vue")), component: page(() => import("./pages/settings/account-info.vue")),
loginRequired: true,
}, },
{ {
path: "/navbar", path: "/navbar",
name: "navbar", name: "navbar",
component: page(() => import("./pages/settings/navbar.vue")), component: page(() => import("./pages/settings/navbar.vue")),
loginRequired: true,
}, },
{ {
path: "/statusbar", path: "/statusbar",
name: "statusbar", name: "statusbar",
component: page(() => import("./pages/settings/statusbar.vue")), component: page(() => import("./pages/settings/statusbar.vue")),
loginRequired: true,
}, },
{ {
path: "/sounds", path: "/sounds",
@ -156,56 +170,67 @@ export const routes = [
path: "/plugin/install", path: "/plugin/install",
name: "plugin", name: "plugin",
component: page(() => import("./pages/settings/plugin.install.vue")), component: page(() => import("./pages/settings/plugin.install.vue")),
loginRequired: true,
}, },
{ {
path: "/plugin", path: "/plugin",
name: "plugin", name: "plugin",
component: page(() => import("./pages/settings/plugin.vue")), component: page(() => import("./pages/settings/plugin.vue")),
loginRequired: true,
}, },
{ {
path: "/import-export", path: "/import-export",
name: "import-export", name: "import-export",
component: page(() => import("./pages/settings/import-export.vue")), component: page(() => import("./pages/settings/import-export.vue")),
loginRequired: true,
}, },
{ {
path: "/instance-mute", path: "/instance-mute",
name: "instance-mute", name: "instance-mute",
component: page(() => import("./pages/settings/instance-mute.vue")), component: page(() => import("./pages/settings/instance-mute.vue")),
loginRequired: true,
}, },
{ {
path: "/mute-block", path: "/mute-block",
name: "mute-block", name: "mute-block",
component: page(() => import("./pages/settings/mute-block.vue")), component: page(() => import("./pages/settings/mute-block.vue")),
loginRequired: true,
}, },
{ {
path: "/word-mute", path: "/word-mute",
name: "word-mute", name: "word-mute",
component: page(() => import("./pages/settings/word-mute.vue")), component: page(() => import("./pages/settings/word-mute.vue")),
loginRequired: true,
}, },
{ {
path: "/api", path: "/api",
name: "api", name: "api",
component: page(() => import("./pages/settings/api.vue")), component: page(() => import("./pages/settings/api.vue")),
loginRequired: true,
}, },
{ {
path: "/apps", path: "/apps",
name: "apps", name: "apps",
component: page(() => import("./pages/settings/apps.vue")), component: page(() => import("./pages/settings/apps.vue")),
loginRequired: true,
}, },
{ {
path: "/webhook/edit/:webhookId", path: "/webhook/edit/:webhookId",
name: "webhook", name: "webhook",
component: page(() => import("./pages/settings/webhook.edit.vue")), component: page(() => import("./pages/settings/webhook.edit.vue")),
loginRequired: true,
}, },
{ {
path: "/webhook/new", path: "/webhook/new",
name: "webhook", name: "webhook",
component: page(() => import("./pages/settings/webhook.new.vue")), component: page(() => import("./pages/settings/webhook.new.vue")),
loginRequired: true,
}, },
{ {
path: "/webhook", path: "/webhook",
name: "webhook", name: "webhook",
component: page(() => import("./pages/settings/webhook.vue")), component: page(() => import("./pages/settings/webhook.vue")),
loginRequired: true,
}, },
{ {
path: "/deck", path: "/deck",
@ -216,6 +241,7 @@ export const routes = [
path: "/delete-account", path: "/delete-account",
name: "delete-account", name: "delete-account",
component: page(() => import("./pages/settings/delete-account.vue")), component: page(() => import("./pages/settings/delete-account.vue")),
loginRequired: true,
}, },
{ {
path: "/preferences-backups", path: "/preferences-backups",
@ -223,16 +249,19 @@ export const routes = [
component: page( component: page(
() => import("./pages/settings/preferences-backups.vue"), () => import("./pages/settings/preferences-backups.vue"),
), ),
loginRequired: true,
}, },
{ {
path: "/migration", path: "/migration",
name: "migration", name: "migration",
component: page(() => import("./pages/settings/migration.vue")), component: page(() => import("./pages/settings/migration.vue")),
loginRequired: true,
}, },
{ {
path: "/custom-css", path: "/custom-css",
name: "general", name: "general",
component: page(() => import("./pages/settings/custom-css.vue")), component: page(() => import("./pages/settings/custom-css.vue")),
loginRequired: true,
}, },
{ {
path: "/custom-katex-macro", path: "/custom-katex-macro",
@ -240,26 +269,31 @@ export const routes = [
component: page( component: page(
() => import("./pages/settings/custom-katex-macro.vue"), () => import("./pages/settings/custom-katex-macro.vue"),
), ),
loginRequired: true,
}, },
{ {
path: "/accounts", path: "/accounts",
name: "profile", name: "profile",
component: page(() => import("./pages/settings/accounts.vue")), component: page(() => import("./pages/settings/accounts.vue")),
loginRequired: true,
}, },
{ {
path: "/account-info", path: "/account-info",
name: "other", name: "other",
component: page(() => import("./pages/settings/account-info.vue")), component: page(() => import("./pages/settings/account-info.vue")),
loginRequired: true,
}, },
{ {
path: "/delete-account", path: "/delete-account",
name: "other", name: "other",
component: page(() => import("./pages/settings/delete-account.vue")), component: page(() => import("./pages/settings/delete-account.vue")),
loginRequired: true,
}, },
{ {
path: "/other", path: "/other",
name: "other", name: "other",
component: page(() => import("./pages/settings/other.vue")), component: page(() => import("./pages/settings/other.vue")),
loginRequired: true,
}, },
{ {
path: "/wellness", path: "/wellness",