diff --git a/biome.json b/biome.json
index b089938..d3ce946 100644
--- a/biome.json
+++ b/biome.json
@@ -1,5 +1,5 @@
{
- "$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
+ "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
"organizeImports": {
"enabled": true,
"ignore": ["node_modules/**/*", "dist/**/*", ".output", ".nuxt"]
@@ -7,7 +7,65 @@
"linter": {
"enabled": true,
"rules": {
- "recommended": true
+ "all": true,
+ "correctness": {
+ "noNodejsModules": "off",
+ "noUndeclaredVariables": "off",
+ "useHookAtTopLevel": "off",
+ "noUnusedVariables": "off",
+ "noUnusedImports": "off"
+ },
+ "complexity": {
+ "noExcessiveCognitiveComplexity": "off"
+ },
+ "style": {
+ "noDefaultExport": "off",
+ "noParameterProperties": "off",
+ "noNamespaceImport": "off",
+ "useFilenamingConvention": "off",
+ "useNamingConvention": {
+ "level": "warn",
+ "options": {
+ "requireAscii": false,
+ "strictCase": false,
+ "conventions": [
+ {
+ "selector": {
+ "kind": "typeProperty"
+ },
+ "formats": [
+ "camelCase",
+ "CONSTANT_CASE",
+ "PascalCase",
+ "snake_case"
+ ]
+ },
+ {
+ "selector": {
+ "kind": "objectLiteralProperty",
+ "scope": "any"
+ },
+ "formats": [
+ "camelCase",
+ "CONSTANT_CASE",
+ "PascalCase",
+ "snake_case"
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "nursery": {
+ "noDuplicateElseIf": "warn",
+ "noDuplicateJsonKeys": "warn",
+ "noEvolvingTypes": "warn",
+ "noYodaExpression": "warn",
+ "useConsistentBuiltinInstantiation": "warn",
+ "useErrorMessage": "warn",
+ "useImportExtensions": "off",
+ "useThrowNewError": "warn"
+ }
},
"ignore": ["node_modules/**/*", "dist/**/*", ".output", ".nuxt"]
},
diff --git a/components/composer/composer.vue b/components/composer/composer.vue
index 390ab22..b721abb 100644
--- a/components/composer/composer.vue
+++ b/components/composer/composer.vue
@@ -121,15 +121,17 @@ onMounted(() => {
useListen("composer:reply", (note: Status) => {
respondingTo.value = note;
respondingType.value = "reply";
- if (note.account.id !== identity.value?.account.id)
+ if (note.account.id !== identity.value?.account.id) {
content.value = `@${note.account.acct} `;
+ }
});
useListen("composer:quote", (note: Status) => {
respondingTo.value = note;
respondingType.value = "quote";
- if (note.account.id !== identity.value?.account.id)
+ if (note.account.id !== identity.value?.account.id) {
content.value = `@${note.account.acct} `;
+ }
});
useListen("composer:edit", async (note: Status) => {
@@ -176,7 +178,7 @@ const client = useClient();
const send = async () => {
loading.value = true;
- if (!identity.value || !client.value) {
+ if (!(identity.value && client.value)) {
throw new Error("Not authenticated");
}
diff --git a/components/composer/emoji-suggestbox.vue b/components/composer/emoji-suggestbox.vue
index bee48d5..5fa73c6 100644
--- a/components/composer/emoji-suggestbox.vue
+++ b/components/composer/emoji-suggestbox.vue
@@ -25,8 +25,9 @@ const { Tab, ArrowRight, ArrowLeft, Enter } = useMagicKeys({
if (
["Tab", "Enter", "ArrowRight", "ArrowLeft"].includes(e.key) &&
topEmojis.value !== null
- )
+ ) {
e.preventDefault();
+ }
},
});
const identity = useCurrentIdentity();
@@ -34,9 +35,11 @@ const topEmojis = ref(null);
const selectedEmojiIndex = ref(null);
watchEffect(() => {
- if (!identity.value) return;
+ if (!identity.value) {
+ return;
+ }
- if (props.currentlyTypingEmoji !== null)
+ if (props.currentlyTypingEmoji !== null) {
topEmojis.value = identity.value.emojis
.map((emoji) => ({
...emoji,
@@ -47,7 +50,9 @@ watchEffect(() => {
}))
.sort((a, b) => a.distance - b.distance)
.slice(0, 20);
- else topEmojis.value = null;
+ } else {
+ topEmojis.value = null;
+ }
if (ArrowRight?.value && topEmojis.value !== null) {
selectedEmojiIndex.value = (selectedEmojiIndex.value ?? -1) + 1;
@@ -74,7 +79,9 @@ watchEffect(() => {
if ((Tab?.value || Enter?.value) && topEmojis.value !== null) {
const emoji = topEmojis.value[selectedEmojiIndex.value ?? 0];
- if (emoji) emit("autocomplete", emoji.shortcode);
+ if (emoji) {
+ emit("autocomplete", emoji.shortcode);
+ }
}
});
diff --git a/components/composer/file-uploader.vue b/components/composer/file-uploader.vue
index 86b273c..3d8a657 100644
--- a/components/composer/file-uploader.vue
+++ b/components/composer/file-uploader.vue
@@ -104,7 +104,9 @@ watch(
files,
(newFiles) => {
for (const data of newFiles) {
- if (data.progress === 0) uploadFile(data.file);
+ if (data.progress === 0) {
+ uploadFile(data.file);
+ }
}
},
{
@@ -137,14 +139,22 @@ const updateAltText = (id: string, altText?: string) => {
};
const getIcon = (mimeType: string) => {
- if (mimeType.startsWith("image/")) return "tabler:photo";
- if (mimeType.startsWith("video/")) return "tabler:video";
- if (mimeType.startsWith("audio/")) return "tabler:music";
+ if (mimeType.startsWith("image/")) {
+ return "tabler:photo";
+ }
+ if (mimeType.startsWith("video/")) {
+ return "tabler:video";
+ }
+ if (mimeType.startsWith("audio/")) {
+ return "tabler:music";
+ }
return "tabler:file";
};
const formatBytes = (bytes: number) => {
- if (bytes === 0) return "0 Bytes";
+ if (bytes === 0) {
+ return "0 Bytes";
+ }
const k = 1000;
const dm = 2;
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
diff --git a/components/composer/mention-suggestbox.vue b/components/composer/mention-suggestbox.vue
index 2edd33f..6da0074 100644
--- a/components/composer/mention-suggestbox.vue
+++ b/components/composer/mention-suggestbox.vue
@@ -24,8 +24,9 @@ const { Tab, ArrowRight, ArrowLeft, Enter } = useMagicKeys({
if (
["Tab", "Enter", "ArrowRight", "ArrowLeft"].includes(e.key) &&
topUsers.value !== null
- )
+ ) {
e.preventDefault();
+ }
},
});
const topUsers = ref(null);
@@ -79,7 +80,9 @@ watch(
if ((Tab?.value || Enter?.value) && topUsers.value !== null) {
const user = topUsers.value[selectedUserIndex.value ?? 0];
- if (user) emit("autocomplete", user.username);
+ if (user) {
+ emit("autocomplete", user.username);
+ }
}
},
);
diff --git a/components/composer/modal.client.vue b/components/composer/modal.client.vue
index f248186..037dc07 100644
--- a/components/composer/modal.client.vue
+++ b/components/composer/modal.client.vue
@@ -50,7 +50,9 @@ useListen("note:edit", async (note) => {
useEvent("composer:edit", note);
});
useListen("composer:open", () => {
- if (identity.value) open.value = true;
+ if (identity.value) {
+ open.value = true;
+ }
});
useListen("composer:close", () => {
open.value = false;
diff --git a/components/settings/profile-editor.vue b/components/settings/profile-editor.vue
index 292bb77..bd8b6d6 100644
--- a/components/settings/profile-editor.vue
+++ b/components/settings/profile-editor.vue
@@ -104,7 +104,9 @@ const save = async () => {
type: "success",
});
- if (identity.value) identity.value.account = data;
+ if (identity.value) {
+ identity.value.account = data;
+ }
} catch (e) {
const error = e as ResponseError<{ error: string }>;
diff --git a/components/sidebars/navigation.vue b/components/sidebars/navigation.vue
index ec20ea0..79b6df9 100644
--- a/components/sidebars/navigation.vue
+++ b/components/sidebars/navigation.vue
@@ -187,7 +187,7 @@ const signIn = async () => {
const signOut = async (id?: string) => {
loadingAuth.value = true;
- if (!appData.value || !identity.value) {
+ if (!(appData.value && identity.value)) {
console.error("No app or identity data to sign out");
return;
}
@@ -208,7 +208,9 @@ const signOut = async (id?: string) => {
identityToRevoke.tokens.access_token,
identityToRevoke.tokens.access_token,
)
- .catch(() => {});
+ .catch(() => {
+ // Do nothing
+ });
if (id === identity.value.id) {
identity.value = null;
diff --git a/components/skeleton/Skeleton.vue b/components/skeleton/Skeleton.vue
index 7be5b22..bcbbf75 100644
--- a/components/skeleton/Skeleton.vue
+++ b/components/skeleton/Skeleton.vue
@@ -41,10 +41,11 @@ const calculatedWidth = computed(
const getWidth = (index: number, lines: number) => {
if (isWidthSpecified.value) {
- if (isContent.value)
+ if (isContent.value) {
return index === lines
? `${calculatedWidth.value}${props.widthUnit}`
: "100%";
+ }
return `${calculatedWidth.value}${props.widthUnit}`;
}
return undefined;
diff --git a/components/social-elements/notes/attachment.vue b/components/social-elements/notes/attachment.vue
index abcfd63..4f4693d 100644
--- a/components/social-elements/notes/attachment.vue
+++ b/components/social-elements/notes/attachment.vue
@@ -50,7 +50,9 @@ const openLightbox = () => {
};
const formatBytes = (bytes: number) => {
- if (bytes === 0) return "0 Bytes";
+ if (bytes === 0) {
+ return "0 Bytes";
+ }
const k = 1000;
const dm = 2;
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
diff --git a/components/social-elements/notes/note.vue b/components/social-elements/notes/note.vue
index 4c6f823..e46aa55 100644
--- a/components/social-elements/notes/note.vue
+++ b/components/social-elements/notes/note.vue
@@ -206,7 +206,9 @@ const numberFormat = (number = 0) =>
}).format(number);
const likeFn = async () => {
- if (!outputtedNote.value) return;
+ if (!outputtedNote.value) {
+ return;
+ }
if (outputtedNote.value.favourited) {
const output = await client.value.unfavouriteStatus(
outputtedNote.value.id,
@@ -227,7 +229,9 @@ const likeFn = async () => {
};
const reblogFn = async () => {
- if (!outputtedNote.value) return;
+ if (!outputtedNote.value) {
+ return;
+ }
if (outputtedNote.value?.reblogged) {
const output = await client.value.unreblogStatus(
outputtedNote.value.id,
diff --git a/components/social-elements/notifications/notif.vue b/components/social-elements/notifications/notif.vue
index 74464c4..8ffde3c 100644
--- a/components/social-elements/notifications/notif.vue
+++ b/components/social-elements/notifications/notif.vue
@@ -43,7 +43,9 @@ const { relationship } = useRelationship(
);
const acceptFollowRequest = async () => {
- if (!props.notification?.account) return;
+ if (!props.notification?.account) {
+ return;
+ }
isWorkingOnFollowRequest.value = true;
const { data } = await client.value.acceptFollowRequest(
props.notification.account.id,
@@ -53,7 +55,9 @@ const acceptFollowRequest = async () => {
};
const rejectFollowRequest = async () => {
- if (!props.notification?.account) return;
+ if (!props.notification?.account) {
+ return;
+ }
isWorkingOnFollowRequest.value = true;
const { data } = await client.value.rejectFollowRequest(
props.notification.account.id,
@@ -69,7 +73,9 @@ const { display_name } = useParsedAccount(
);
const text = computed(() => {
- if (!props.notification) return "";
+ if (!props.notification) {
+ return "";
+ }
switch (props.notification.type) {
case "mention":
@@ -82,13 +88,16 @@ const text = computed(() => {
return "followed you";
case "follow_request":
return "requested to follow you";
- default:
+ default: {
console.error("Unknown notification type", props.notification.type);
return "";
+ }
}
});
const icon = computed(() => {
- if (!props.notification) return "";
+ if (!props.notification) {
+ return "";
+ }
switch (props.notification.type) {
case "mention":
diff --git a/components/social-elements/users/Account.vue b/components/social-elements/users/Account.vue
index 3b594e3..3f8739a 100644
--- a/components/social-elements/users/Account.vue
+++ b/components/social-elements/users/Account.vue
@@ -112,7 +112,9 @@ const accountId = computed(() => props.account?.id ?? null);
const { relationship, isLoading } = useRelationship(client, accountId);
const follow = () => {
- if (!identity.value || !props.account || !relationship.value) return;
+ if (!(identity.value && props.account && relationship.value)) {
+ return;
+ }
relationship.value = {
...relationship.value,
following: true,
@@ -120,7 +122,9 @@ const follow = () => {
};
const unfollow = () => {
- if (!identity.value || !props.account || !relationship.value) return;
+ if (!(identity.value && props.account && relationship.value)) {
+ return;
+ }
relationship.value = {
...relationship.value,
following: false,
diff --git a/components/timelines/timeline.vue b/components/timelines/timeline.vue
index a34c886..56fb91e 100644
--- a/components/timelines/timeline.vue
+++ b/components/timelines/timeline.vue
@@ -52,7 +52,9 @@ watch(
() => props.timeline,
(newTimeline, oldTimeline) => {
// If posts are deleted, don't start loading more posts
- if (newTimeline.length === oldTimeline.length - 1) return;
+ if (newTimeline.length === oldTimeline.length - 1) {
+ return;
+ }
isLoading.value = false;
// If less than NOTES_PER_PAGE statuses are returned, we have reached the end
if (
diff --git a/composables/Account.ts b/composables/Account.ts
index c71b321..e21fc81 100644
--- a/composables/Account.ts
+++ b/composables/Account.ts
@@ -12,12 +12,13 @@ export const useAccount = (
const output = ref(null as Account | null);
watchEffect(() => {
- if (toValue(accountId))
+ if (toValue(accountId)) {
toValue(client)
?.getAccount(toValue(accountId) ?? "")
.then((res) => {
output.value = res.data;
});
+ }
});
return output;
diff --git a/composables/CacheRefresh.ts b/composables/CacheRefresh.ts
index 82ff478..0fa89de 100644
--- a/composables/CacheRefresh.ts
+++ b/composables/CacheRefresh.ts
@@ -3,7 +3,9 @@ import type { RolePermission } from "@lysand-org/client/types";
import { useCurrentIdentity } from "./Identities";
export const useCacheRefresh = (client: MaybeRef) => {
- if (import.meta.server) return;
+ if (import.meta.server) {
+ return;
+ }
const identity = useCurrentIdentity();
@@ -14,7 +16,9 @@ export const useCacheRefresh = (client: MaybeRef) => {
toValue(client)
?.verifyAccountCredentials()
.then((res) => {
- if (identity.value) identity.value.account = res.data;
+ if (identity.value) {
+ identity.value.account = res.data;
+ }
})
.catch((err) => {
const code = err.response.status;
@@ -34,7 +38,9 @@ export const useCacheRefresh = (client: MaybeRef) => {
toValue(client)
?.getInstanceCustomEmojis()
.then((res) => {
- if (identity.value) identity.value.emojis = res.data;
+ if (identity.value) {
+ identity.value.emojis = res.data;
+ }
});
toValue(client)
@@ -47,16 +53,19 @@ export const useCacheRefresh = (client: MaybeRef) => {
.flatMap((r) => r.permissions)
.filter((p, i, arr) => arr.indexOf(p) === i);
- if (identity.value)
+ if (identity.value) {
identity.value.permissions =
permissions as unknown as RolePermission[];
+ }
});
}
toValue(client)
?.getInstance()
.then((res) => {
- if (identity.value) identity.value.instance = res.data;
+ if (identity.value) {
+ identity.value.instance = res.data;
+ }
});
});
};
diff --git a/composables/Identities.ts b/composables/Identities.ts
index 5bc2633..f8acd3a 100644
--- a/composables/Identities.ts
+++ b/composables/Identities.ts
@@ -45,12 +45,15 @@ export const useCurrentIdentity = (): Ref => {
if (newCurrent) {
currentId.value = newCurrent.id;
// If the identity is updated, update the identity in the list
- if (identities.value.find((i) => i.id === newCurrent.id))
+ if (identities.value.find((i) => i.id === newCurrent.id)) {
identities.value = identities.value.map((i) =>
i.id === newCurrent.id ? newCurrent : i,
);
+ }
// If the identity is not in the list, add it
- else identities.value.push(newCurrent);
+ else {
+ identities.value.push(newCurrent);
+ }
// Force update the identities
identities.value = [...identities.value];
diff --git a/composables/LocalTimeline.ts b/composables/LocalTimeline.ts
index 2846672..01c76e3 100644
--- a/composables/LocalTimeline.ts
+++ b/composables/LocalTimeline.ts
@@ -3,84 +3,21 @@ import type { Status } from "@lysand-org/client/types";
export const useLocalTimeline = (
client: LysandClient | null,
- options: MaybeRef<
- Partial<{
- only_media: boolean;
- max_id: string;
- since_id: string;
- min_id: string;
- limit: number;
- }>
- >,
+ options: MaybeRef<{
+ only_media: boolean;
+ max_id: string;
+ since_id: string;
+ min_id: string;
+ limit: number;
+ }>,
): {
timeline: Ref;
loadNext: () => Promise;
loadPrev: () => Promise;
} => {
- if (!client) {
- return {
- timeline: ref([]),
- loadNext: async () => {},
- loadPrev: async () => {},
- };
- }
-
- const fetchedNotes = ref([]);
- const fetchedNoteIds = new Set();
- let nextMaxId: string | undefined = undefined;
- let prevMinId: string | undefined = undefined;
-
- const loadNext = async () => {
- const response = await client.getLocalTimeline({
- ...ref(options).value,
- max_id: nextMaxId,
- limit: useConfig().NOTES_PER_PAGE,
- });
-
- const newNotes = response.data.filter(
- (note) => !fetchedNoteIds.has(note.id),
- );
- if (newNotes.length > 0) {
- fetchedNotes.value = [...fetchedNotes.value, ...newNotes];
- nextMaxId = newNotes[newNotes.length - 1]?.id;
- for (const note of newNotes) {
- fetchedNoteIds.add(note.id);
- }
- } else {
- nextMaxId = undefined;
- }
- };
-
- const loadPrev = async () => {
- const response = await client.getLocalTimeline({
- ...ref(options).value,
- min_id: prevMinId,
- limit: useConfig().NOTES_PER_PAGE,
- });
-
- const newNotes = response.data.filter(
- (note) => !fetchedNoteIds.has(note.id),
- );
- if (newNotes.length > 0) {
- fetchedNotes.value = [...newNotes, ...fetchedNotes.value];
- prevMinId = newNotes[0]?.id;
- for (const note of newNotes) {
- fetchedNoteIds.add(note.id);
- }
- } else {
- prevMinId = undefined;
- }
- };
-
- watch(
- () => ref(options).value,
- async ({ max_id, min_id }) => {
- nextMaxId = max_id;
- prevMinId = min_id;
- await loadNext();
- },
- { immediate: true },
+ return useTimeline(
+ client,
+ (client, options) => client?.getLocalTimeline(options),
+ options,
);
-
- return { timeline: fetchedNotes, loadNext, loadPrev };
};
diff --git a/composables/NoteContext.ts b/composables/NoteContext.ts
index 6c0e437..e31d543 100644
--- a/composables/NoteContext.ts
+++ b/composables/NoteContext.ts
@@ -12,12 +12,13 @@ export const useNoteContext = (
const output = ref(null as Context | null);
watchEffect(() => {
- if (toValue(noteId))
+ if (toValue(noteId)) {
ref(client)
.value?.getStatusContext(toValue(noteId) ?? "")
.then((res) => {
output.value = res.data;
});
+ }
});
return output;
diff --git a/composables/NoteData.ts b/composables/NoteData.ts
index e5bb08d..2c9541c 100644
--- a/composables/NoteData.ts
+++ b/composables/NoteData.ts
@@ -21,8 +21,7 @@ export const useNoteData = (
const shouldHide = computed(
() =>
(renderedNote.value?.sensitive ||
- !!renderedNote.value?.spoiler_text ||
- false) &&
+ !!renderedNote.value?.spoiler_text) &&
(showContentWarning.value.value as boolean),
);
const mentions = useResolveMentions(
diff --git a/composables/ParsedContent.ts b/composables/ParsedContent.ts
index 26d4ce6..7eca3bb 100644
--- a/composables/ParsedContent.ts
+++ b/composables/ParsedContent.ts
@@ -89,13 +89,13 @@ export const useParsedAccount = (
account: MaybeRef,
settings: MaybeRef,
) => {
- const display_name = computed(() => toValue(account)?.display_name ?? "");
+ const displayName = computed(() => toValue(account)?.display_name ?? "");
const note = computed(() => toValue(account)?.note ?? "");
const fields = computed(() => toValue(account)?.fields ?? []);
const emojis = computed(() => toValue(account)?.emojis ?? []);
const parsedDisplayName = useParsedContent(
- display_name,
+ displayName,
emojis,
undefined,
settings,
diff --git a/composables/Relationship.ts b/composables/Relationship.ts
index 4366c3a..429dfc9 100644
--- a/composables/Relationship.ts
+++ b/composables/Relationship.ts
@@ -14,12 +14,13 @@ export const useRelationship = (
}
watchEffect(() => {
- if (toValue(accountId))
+ if (toValue(accountId)) {
toValue(client)
?.getRelationship(toValue(accountId) ?? "")
.then((res) => {
relationship.value = res.data;
});
+ }
});
watch(relationship, (newOutput, oldOutput) => {
diff --git a/composables/Timeline.ts b/composables/Timeline.ts
index ba087af..1a639a5 100644
--- a/composables/Timeline.ts
+++ b/composables/Timeline.ts
@@ -24,11 +24,15 @@ export const useTimeline = <
loadNext: () => Promise;
loadPrev: () => Promise;
} => {
- if (!client || !fetchTimeline) {
+ if (!(client && fetchTimeline)) {
return {
timeline: ref([]),
- loadNext: async () => {},
- loadPrev: async () => {},
+ loadNext: async () => {
+ // ...
+ },
+ loadPrev: async () => {
+ // ...
+ },
};
}
@@ -107,11 +111,15 @@ export const useIdTimeline = <
loadNext: () => Promise;
loadPrev: () => Promise;
} => {
- if (!client || !fetchTimeline) {
+ if (!(client && fetchTimeline)) {
return {
timeline: ref([]),
- loadNext: async () => {},
- loadPrev: async () => {},
+ loadNext: async () => {
+ // ...
+ },
+ loadPrev: async () => {
+ // ...
+ },
};
}
diff --git a/pages/[username]/[uuid].vue b/pages/[username]/[uuid].vue
index e3e5bd9..6b9c888 100644
--- a/pages/[username]/[uuid].vue
+++ b/pages/[username]/[uuid].vue
@@ -30,8 +30,12 @@ const loaded = computed(() => note.value !== null && context.value !== null);
watch(
[() => context.value?.ancestors, loaded],
async () => {
- if (context.value?.ancestors.length === 0) return;
- if (!loaded.value) return;
+ if (context.value?.ancestors.length === 0) {
+ return;
+ }
+ if (!loaded.value) {
+ return;
+ }
await nextTick();
// Wait for 200ms
await new Promise((resolve) => setTimeout(resolve, 200));
diff --git a/pages/oauth/authorize.vue b/pages/oauth/authorize.vue
index 11fb06b..e24edde 100644
--- a/pages/oauth/authorize.vue
+++ b/pages/oauth/authorize.vue
@@ -111,14 +111,14 @@ const hostname = useRequestURL().hostname;
const query = new URLSearchParams(
window?.location.search ?? useRequestURL().search,
);
-const redirect_uri = query.get("redirect_uri");
-const response_type = query.get("response_type");
-const client_id = query.get("client_id");
+const redirectUri = query.get("redirect_uri");
+const responseType = query.get("response_type");
+const clientId = query.get("client_id");
const scope = query.get("scope");
const error = query.get("error");
-const error_description = query.get("error_description");
+const errorDescription = query.get("error_description");
-const validUrlParameters = redirect_uri && response_type && client_id && scope;
+const validUrlParameters = redirectUri && responseType && clientId && scope;
const ssoConfig = useSSOConfig();
\ No newline at end of file
diff --git a/pages/oauth/consent.vue b/pages/oauth/consent.vue
index f2e8b98..3f96b5b 100644
--- a/pages/oauth/consent.vue
+++ b/pages/oauth/consent.vue
@@ -92,11 +92,11 @@ const application = query.application;
const website = query.website
? decodeURIComponent(query.website as string)
: null;
-const redirect_uri = query.redirect_uri as string;
-const client_id = query.client_id;
+const redirectUri = query.redirect_uri as string;
+const clientId = query.client_id;
const scope = query.scope ? decodeURIComponent(query.scope as string) : "";
-const validUrlParameters = application && redirect_uri && client_id && scope;
+const validUrlParameters = application && redirectUri && clientId && scope;
const oauthScopeText: Record = {
"rw:accounts": "$VERB your account information",
@@ -123,7 +123,7 @@ const scopes = scope.split(" ");
// Return an array of strings to display
// "read write:accounts" returns all the fields with $VERB as read, plus the accounts field with $VERB as write
const getScopeText = (fullScopes: string[]) => {
- const scopeTexts = [];
+ const scopeTexts: string[][] = [];
const readScopes = fullScopes.filter((scope) => scope.includes("read"));
const writeScopes = fullScopes.filter((scope) => scope.includes("write"));
@@ -138,12 +138,14 @@ const getScopeText = (fullScopes: string[]) => {
(writeScopes.includes(`write:${scopeName}`) ||
writeScopes.find((scope) => scope === "write"))
) {
- if (oauthScopeText[possibleScope]?.includes("$VERB"))
+ if (oauthScopeText[possibleScope]?.includes("$VERB")) {
scopeTexts.push([
"Read and write",
- oauthScopeText[possibleScope]?.replace("$VERB", ""),
+ oauthScopeText[possibleScope]?.replace("$VERB", "") ?? "",
]);
- else scopeTexts.push(["", oauthScopeText[possibleScope]]);
+ } else {
+ scopeTexts.push(["", oauthScopeText[possibleScope] ?? ""]);
+ }
continue;
}
@@ -152,12 +154,14 @@ const getScopeText = (fullScopes: string[]) => {
(readScopes.includes(`read:${scopeName}`) ||
readScopes.find((scope) => scope === "read"))
) {
- if (oauthScopeText[possibleScope]?.includes("$VERB"))
+ if (oauthScopeText[possibleScope]?.includes("$VERB")) {
scopeTexts.push([
"Read",
- oauthScopeText[possibleScope]?.replace("$VERB", ""),
+ oauthScopeText[possibleScope]?.replace("$VERB", "") ?? "",
]);
- else scopeTexts.push(["", oauthScopeText[possibleScope]]);
+ } else {
+ scopeTexts.push(["", oauthScopeText[possibleScope] ?? ""]);
+ }
}
if (
@@ -165,12 +169,14 @@ const getScopeText = (fullScopes: string[]) => {
(writeScopes.includes(`write:${scopeName}`) ||
writeScopes.find((scope) => scope === "write"))
) {
- if (oauthScopeText[possibleScope]?.includes("$VERB"))
+ if (oauthScopeText[possibleScope]?.includes("$VERB")) {
scopeTexts.push([
"Write",
- oauthScopeText[possibleScope]?.replace("$VERB", ""),
+ oauthScopeText[possibleScope]?.replace("$VERB", "") ?? "",
]);
- else scopeTexts.push(["", oauthScopeText[possibleScope]]);
+ } else {
+ scopeTexts.push(["", oauthScopeText[possibleScope] ?? ""]);
+ }
}
}
return scopeTexts;
diff --git a/pages/oauth/reset.vue b/pages/oauth/reset.vue
index 5f7416c..91e02be 100644
--- a/pages/oauth/reset.vue
+++ b/pages/oauth/reset.vue
@@ -99,14 +99,14 @@ const query = new URLSearchParams(
window?.location.search ?? useRequestURL().search,
);
const token = query.get("token");
-const login_reset = query.get("login_reset") === "true";
+const loginReset = query.get("login_reset") === "true";
const success = query.get("success") === "true";
let error = query.get("error");
-let error_description = query.get("error_description");
+let errorDescription = query.get("error_description");
-if (login_reset) {
+if (loginReset) {
error = "Login reset";
- error_description =
+ errorDescription =
"Your password has been reset by an administrator. Please change it here.";
}
diff --git a/pages/register/index.vue b/pages/register/index.vue
index 2834af2..a15d777 100644
--- a/pages/register/index.vue
+++ b/pages/register/index.vue
@@ -86,7 +86,7 @@
{{ isLoading ? "Registering..." :
- "Register" }}
+ "Register" }}
@@ -158,10 +158,10 @@ const register = (result: {
"en",
result.reason || "Empty reason",
)
- .then(async () => {
+ .then(() => {
navigateTo("/register/success");
})
- .catch(async (e) => {
+ .catch((e) => {
const error = e as ResponseError<{
error: string;
}>;
diff --git a/settings.ts b/settings.ts
index 118df87..144b891 100644
--- a/settings.ts
+++ b/settings.ts
@@ -59,7 +59,7 @@ export const parseFromJson = (json: Record) => {
};
export enum SettingIds {
- MFM = "mfm",
+ Mfm = "mfm",
CustomCSS = "custom-css",
Theme = "theme",
CustomEmojis = "custom-emojis",
@@ -73,7 +73,7 @@ export enum SettingIds {
export const settings = [
{
- id: SettingIds.MFM,
+ id: SettingIds.Mfm,
title: "Render MFM",
description: "Render Misskey-Flavoured Markdown",
type: SettingType.Boolean,
diff --git a/utils/auth.ts b/utils/auth.ts
index 4d65269..7f8a87f 100644
--- a/utils/auth.ts
+++ b/utils/auth.ts
@@ -26,7 +26,7 @@ export const signInWithCode = (code: string, appData: ApplicationData) => {
!identities.value.find(
(i) => i.account.id === accountOutput.data.id,
)
- )
+ ) {
identity.value = {
id: nanoid(),
tokens: res.data,
@@ -35,6 +35,7 @@ export const signInWithCode = (code: string, appData: ApplicationData) => {
permissions: [],
emojis: [],
};
+ }
// Remove code from URL
window.history.replaceState(