🚨 Clean up eslint issues

This commit is contained in:
2025-11-08 12:20:58 +08:00
parent 05f8cabb33
commit 063faf4b8e
17 changed files with 145 additions and 171 deletions

View File

@@ -74,18 +74,18 @@
<v-btn
color="primary"
:loading="isAuthorizing"
@click="handleAuthorize"
class="flex-grow-1"
size="large"
@click="handleAuthorize"
>
Authorize
</v-btn>
<v-btn
variant="outlined"
:disabled="isAuthorizing"
@click="handleDeny"
class="flex-grow-1"
size="large"
@click="handleDeny"
>
Deny
</v-btn>
@@ -140,9 +140,10 @@ async function fetchClientInfo() {
const queryString = window.location.search.slice(1)
clientInfo.value = await api(`/id/auth/open/authorize?${queryString}`)
checkIfNewApp()
} catch (err: any) {
} catch (err) {
error.value =
err.message || "An error occurred while loading the authorization request"
(err instanceof Error ? err.message : String(err)) ||
"An error occurred while loading the authorization request"
} finally {
isLoading.value = false
}
@@ -171,8 +172,10 @@ async function handleAuthorize(authorize = true) {
if (data.redirectUri) {
window.location.href = data.redirectUri
}
} catch (err: any) {
error.value = err.message || "An error occurred during authorization"
} catch (err) {
error.value =
(err instanceof Error ? err.message : String(err)) ||
"An error occurred during authorization"
} finally {
isAuthorizing.value = false
}

View File

@@ -439,7 +439,7 @@ function handleTouchMove(event: TouchEvent) {
zoomLevel.value = Math.max(0.1, Math.min(5, scale))
}
function handleTouchEnd(event: TouchEvent) {
function handleTouchEnd(_event: TouchEvent) {
if (fileType.value !== "image") return
isPinching.value = false

View File

@@ -47,8 +47,6 @@ import type { SnVersion, SnActivity } from "~/types/api"
import PostEditor from "~/components/Post/PostEditor.vue"
import PostItem from "~/components/Post/PostItem.vue"
import IconLight from "~/assets/images/cloudy-lamb.png"
const router = useRouter()
useHead({

View File

@@ -7,13 +7,13 @@
class="pa-2"
>
<v-card-text>
<v-alert type="success" v-if="done" class="mb-4">
<v-alert v-if="done" type="success" class="mb-4">
The order has been paid successfully. Now you can close this tab and
back to the Solar Network!
</v-alert>
<v-alert
type="error"
v-else-if="!!error"
type="error"
title="Something went wrong"
class="mb-4"
>{{ error }}</v-alert
@@ -31,7 +31,7 @@
<span>Amount</span>
<strong>{{ order.amount }} {{ order.currency }}</strong>
</div>
<div class="d-flex align-center gap-2 mb-4" v-if="order.expiredAt">
<div v-if="order.expiredAt" class="d-flex align-center gap-2 mb-4">
<v-icon size="18">mdi-calendar</v-icon>
<span>Until</span>
<strong>{{ new Date(order.expiredAt).toLocaleString() }}</strong>
@@ -47,8 +47,8 @@
<v-btn
color="primary"
:loading="submitting"
@click="pay"
class="mt-4"
@click="pay"
>
<v-icon left>mdi-check</v-icon>
Pay

View File

@@ -68,7 +68,10 @@
</article>
<!-- Attachments within Content Section -->
<attachment-list v-if="post.type != 1" :attachments="post.attachments || []" />
<attachment-list
v-if="post.type != 1"
:attachments="post.attachments || []"
/>
</v-card>
<v-card
@@ -141,7 +144,8 @@ import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
import type { SnPost } from "~/types/api"
const route = useRoute()
const id = route.params.id as string
const slugParts = route.params.slug as string[]
const id = slugParts.join("/")
const { render } = useMarkdownProcessor()
@@ -168,6 +172,16 @@ const {
}
})
if (postData.value?.post) {
const p = postData.value.post
if (p.publisher?.name && p.slug) {
const slugUrl = `/posts/${p.publisher.name}/${p.slug}`
if (route.path !== slugUrl) {
await navigateTo(slugUrl, { redirectCode: 301 })
}
}
}
const post = computed(() => postData.value?.post || null)
const htmlContent = computed(() => postData.value?.html || "")
@@ -189,6 +203,13 @@ useHead({
return [{ name: "description", content: description }]
}
return []
}),
link: computed(() => {
if (post.value && post.value.publisher?.name && post.value.slug) {
const slugUrl = `/posts/${post.value.publisher.name}/${post.value.slug}`
return [{ rel: "canonical", href: slugUrl }]
}
return []
})
})
@@ -205,7 +226,9 @@ const userBackground = computed(() => {
)
return firstImageAttachment
? `${apiBase}/drive/files/${firstImageAttachment.id}`
: undefined
: post.value?.publisher.background
? `${apiBase}/drive/files/${post.value?.publisher.background.id}`
: undefined
})
defineOgImage({
@@ -260,18 +283,18 @@ onMounted(() => {
function makeEmbedImageClickable() {
const elements = document.getElementsByClassName("prose-img-solar-network")
let count = 0;
let count = 0
for (const element of elements) {
if (element instanceof HTMLImageElement) {
count += 1;
count += 1
element.addEventListener("click", (evt) => {
const targetImg = evt.target as HTMLImageElement
window.open("/files/" + targetImg.src.split("/").findLast((_) => true))
})
element.style['cursor'] = 'pointer';
element.style["cursor"] = "pointer"
}
}
console.log(`[Article] Made ${count} image(s) clickable in the article.`);
console.log(`[Article] Made ${count} image(s) clickable in the article.`)
}
</script>

View File

@@ -2,13 +2,13 @@
<div class="d-flex align-center justify-center fill-height">
<v-card max-width="400" title="Magic Spell" prepend-icon="mdi-magic-staff" class="pa-2">
<v-card-text>
<v-alert type="success" v-if="done" class="mb-4">
<v-alert v-if="done" type="success" class="mb-4">
The magic spell has been applied successfully. Now you can close this
tab and back to the Solar Network!
</v-alert>
<v-alert
type="error"
v-else-if="!!error"
type="error"
title="Something went wrong"
class="mb-4"
>{{ error }}</v-alert
@@ -28,7 +28,7 @@
new Date(spell.createdAt ?? spell.affectedAt).toLocaleString()
}}</strong>
</div>
<div class="d-flex align-center gap-2 mb-4" v-if="spell.expiredAt">
<div v-if="spell.expiredAt" class="d-flex align-center gap-2 mb-4">
<v-icon size="18">mdi-calendar</v-icon>
<span>Until</span>
<strong>{{ spell.expiredAt.toString() }}</strong>
@@ -68,7 +68,16 @@ const spellWord: string =
typeof route.params.word === "string"
? route.params.word
: route.params.word?.join("/") || ""
const spell = ref<any>(null)
interface SnSpell {
type: number
account: {
name: string
}
createdAt: string
affectedAt: string
expiredAt?: string
}
const spell = ref<SnSpell | null>(null)
const error = ref<string | null>(null)
const newPassword = ref<string>()