-
- Welcome :)
-
+ Welcome :)
@@ -33,8 +31,11 @@
/>
{{ passwordError }}
-
-
+
- 验证邮箱
@@ -44,17 +45,18 @@
已经有账号? 登录
+
+ 已经有账号? 登录
+
-
-
+
+
注册
@@ -112,7 +114,7 @@ export default {
passwordError: '',
code: '',
isWaitingForEmailSent: false,
- isWaitingForEmailVerified: false
+ isWaitingForEmailVerified: false,
}
},
async mounted() {
@@ -123,7 +125,9 @@ export default {
const data = await res.json()
this.registerMode = data.registerMode
}
- } catch {/* ignore */}
+ } catch {
+ /* ignore */
+ }
if (this.$route.query.verify) {
this.emailStep = 1
}
@@ -157,8 +161,8 @@ export default {
body: JSON.stringify({
username: this.username,
email: this.email,
- password: this.password
- })
+ password: this.password,
+ }),
})
this.isWaitingForEmailSent = false
const data = await res.json()
@@ -184,8 +188,8 @@ export default {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
code: this.code,
- username: this.username
- })
+ username: this.username,
+ }),
})
const data = await res.json()
if (res.ok) {
@@ -212,8 +216,8 @@ export default {
},
signupWithTwitter() {
twitterAuthorize()
- }
- }
+ },
+ },
}
@@ -410,4 +414,4 @@ export default {
width: calc(100% - 40px);
}
}
-
\ No newline at end of file
+
diff --git a/frontend_nuxt/pages/twitter-callback.vue b/frontend_nuxt/pages/twitter-callback.vue
index 940d49d53..a5fddd509 100644
--- a/frontend_nuxt/pages/twitter-callback.vue
+++ b/frontend_nuxt/pages/twitter-callback.vue
@@ -20,7 +20,6 @@ export default {
} else {
this.$router.push('/')
}
- }
+ },
}
-
diff --git a/frontend_nuxt/pages/users/[id].vue b/frontend_nuxt/pages/users/[id].vue
index 760204293..e2d2d1561 100644
--- a/frontend_nuxt/pages/users/[id].vue
+++ b/frontend_nuxt/pages/users/[id].vue
@@ -12,18 +12,33 @@
{{ user.username }}
{{ user.introduction }}
-
+
@@ -39,8 +54,8 @@
关注
-
+
+
取消关注
-
目标 Lv.{{ levelInfo.currentLevel + 1 }}
-
+
最后评论时间:
- {{ user.lastCommentTime != null ? formatDate(user.lastCommentTime) :
- "暂无评论" }}
+
+ {{ user.lastCommentTime != null ? formatDate(user.lastCommentTime) : '暂无评论' }}
@@ -50,21 +65,31 @@
-
+
-
总结
+
-
时间线
+
-
关注
+
@@ -108,17 +133,19 @@
下对
-
+
{{ stripMarkdownLength(item.comment.parentComment.content, 200) }}
回复了
-
- 下评论了
-
-
+ 下评论了
+
{{ stripMarkdownLength(item.comment.content, 200) }}
勋章
@@ -177,7 +204,11 @@
-
+
@@ -193,7 +224,10 @@
{{ item.comment.post.title }}
下评论了
-
+
{{ stripMarkdownLength(item.comment.content, 200) }}
下对
-
+
{{ stripMarkdownLength(item.comment.parentComment.content, 200) }}
回复了
-
+
{{ stripMarkdownLength(item.comment.content, 200) }}
{{ formatDate(item.createdAt) }}
@@ -204,12 +238,17 @@
{{ item.comment.post.title }}
{{ formatDate(item.createdAt) }}
@@ -230,10 +269,16 @@
-
+
@${u.username}`
+ html: `
@${u.username}`,
}))
},
},
@@ -93,7 +91,7 @@ export function createVditor(editorId, options = {}) {
vditor.disabled()
const res = await fetch(
`${API_BASE_URL}/api/upload/presign?filename=${encodeURIComponent(file.name)}`,
- { headers: { Authorization: `Bearer ${getToken()}` } }
+ { headers: { Authorization: `Bearer ${getToken()}` } },
)
if (!res.ok) {
vditor.enable()
@@ -122,7 +120,7 @@ export function createVditor(editorId, options = {}) {
'pjpeg',
'png',
'svg',
- 'webp'
+ 'webp',
]
const audioExts = ['wav', 'mp3', 'ogg']
let md
@@ -137,7 +135,7 @@ export function createVditor(editorId, options = {}) {
vditor.enable()
vditor.tip('上传成功')
return null
- }
+ },
},
// upload: {
// fieldName: 'file',
@@ -168,7 +166,7 @@ export function createVditor(editorId, options = {}) {
toolbarConfig: { pin: true },
cache: { enable: false },
input,
- after
+ after,
})
return vditor
关注者
-
+
@@ -266,7 +311,7 @@ import { prevLevelExp } from '../utils/level'
import AchievementList from '../components/AchievementList.vue'
definePageMeta({
- alias: ['/users/:id/']
+ alias: ['/users/:id/'],
})
export default {
@@ -291,7 +336,7 @@ export default {
const selectedTab = ref(
['summary', 'timeline', 'following', 'achievements'].includes(route.query.tab)
? route.query.tab
- : 'summary'
+ : 'summary',
)
const followTab = ref('followers')
@@ -306,7 +351,7 @@ export default {
return { exp, currentLevel, nextExp, percent }
})
- const isMine = computed(function() {
+ const isMine = computed(function () {
const mine = authState.username === username || String(authState.userId) === username
console.log(mine)
return mine
@@ -334,19 +379,19 @@ export default {
const postsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-posts`)
if (postsRes.ok) {
const data = await postsRes.json()
- hotPosts.value = data.map(p => ({ icon: 'fas fa-book', post: p }))
+ hotPosts.value = data.map((p) => ({ icon: 'fas fa-book', post: p }))
}
const repliesRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-replies`)
if (repliesRes.ok) {
const data = await repliesRes.json()
- hotReplies.value = data.map(c => ({ icon: 'fas fa-comment', comment: c }))
+ hotReplies.value = data.map((c) => ({ icon: 'fas fa-comment', comment: c }))
}
const tagsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-tags`)
if (tagsRes.ok) {
const data = await tagsRes.json()
- hotTags.value = data.map(t => ({ icon: 'fas fa-tag', tag: t }))
+ hotTags.value = data.map((t) => ({ icon: 'fas fa-tag', tag: t }))
}
}
@@ -354,30 +399,30 @@ export default {
const [postsRes, repliesRes, tagsRes] = await Promise.all([
fetch(`${API_BASE_URL}/api/users/${username}/posts?limit=50`),
fetch(`${API_BASE_URL}/api/users/${username}/replies?limit=50`),
- fetch(`${API_BASE_URL}/api/users/${username}/tags?limit=50`)
+ fetch(`${API_BASE_URL}/api/users/${username}/tags?limit=50`),
])
const posts = postsRes.ok ? await postsRes.json() : []
const replies = repliesRes.ok ? await repliesRes.json() : []
const tags = tagsRes.ok ? await tagsRes.json() : []
const mapped = [
- ...posts.map(p => ({
+ ...posts.map((p) => ({
type: 'post',
icon: 'fas fa-book',
post: p,
- createdAt: p.createdAt
+ createdAt: p.createdAt,
})),
- ...replies.map(r => ({
+ ...replies.map((r) => ({
type: r.parentComment ? 'reply' : 'comment',
icon: 'fas fa-comment',
comment: r,
- createdAt: r.createdAt
+ createdAt: r.createdAt,
})),
- ...tags.map(t => ({
+ ...tags.map((t) => ({
type: 'tag',
icon: 'fas fa-tag',
tag: t,
- createdAt: t.createdAt
- }))
+ createdAt: t.createdAt,
+ })),
]
mapped.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt))
timelineItems.value = mapped
@@ -386,7 +431,7 @@ export default {
const fetchFollowUsers = async () => {
const [followerRes, followingRes] = await Promise.all([
fetch(`${API_BASE_URL}/api/users/${username}/followers`),
- fetch(`${API_BASE_URL}/api/users/${username}/following`)
+ fetch(`${API_BASE_URL}/api/users/${username}/following`),
])
followers.value = followerRes.ok ? await followerRes.json() : []
followings.value = followingRes.ok ? await followingRes.json() : []
@@ -434,7 +479,7 @@ export default {
}
const res = await fetch(`${API_BASE_URL}/api/subscriptions/users/${username}`, {
method: 'POST',
- headers: { Authorization: `Bearer ${token}` }
+ headers: { Authorization: `Bearer ${token}` },
})
if (res.ok) {
subscribed.value = true
@@ -452,7 +497,7 @@ export default {
}
const res = await fetch(`${API_BASE_URL}/api/subscriptions/users/${username}`, {
method: 'DELETE',
- headers: { Authorization: `Bearer ${token}` }
+ headers: { Authorization: `Bearer ${token}` },
})
if (res.ok) {
subscribed.value = false
@@ -462,7 +507,7 @@ export default {
}
}
- const gotoTag = tag => {
+ const gotoTag = (tag) => {
const value = encodeURIComponent(tag.id ?? tag.name)
router.push({ path: '/', query: { tags: value } })
}
@@ -488,11 +533,15 @@ export default {
onMounted(init)
- watch(selectedTab, async val => {
+ watch(selectedTab, async (val) => {
// router.replace({ query: { ...route.query, tab: val } })
if (val === 'timeline' && timelineItems.value.length === 0) {
await loadTimeline()
- } else if (val === 'following' && followers.value.length === 0 && followings.value.length === 0) {
+ } else if (
+ val === 'following' &&
+ followers.value.length === 0 &&
+ followings.value.length === 0
+ ) {
await loadFollow()
} else if (val === 'achievements' && medals.value.length === 0) {
await loadAchievements()
@@ -524,9 +573,9 @@ export default {
unsubscribeUser,
gotoTag,
hotTags,
- levelInfo
+ levelInfo,
}
- }
+ },
}
@@ -808,7 +857,8 @@ export default {
padding: 40px 0;
}
-.follow-container {}
+.follow-container {
+}
.follow-tabs {
display: flex;
diff --git a/frontend_nuxt/plugins/theme.client.ts b/frontend_nuxt/plugins/theme.client.ts
index 23a11e45c..5f971d2f0 100644
--- a/frontend_nuxt/plugins/theme.client.ts
+++ b/frontend_nuxt/plugins/theme.client.ts
@@ -4,4 +4,3 @@ import { initTheme } from '~/utils/theme'
export default defineNuxtPlugin(() => {
initTheme()
})
-
diff --git a/frontend_nuxt/plugins/toastification.client.ts b/frontend_nuxt/plugins/toastification.client.ts
index f03c0ad60..acd0fe2af 100644
--- a/frontend_nuxt/plugins/toastification.client.ts
+++ b/frontend_nuxt/plugins/toastification.client.ts
@@ -8,7 +8,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
try {
// 使用动态导入来避免 CommonJS 模块问题
const { default: Toast, POSITION } = await import('vue-toastification')
-
+
nuxtApp.vueApp.use(Toast, {
position: POSITION.TOP_RIGHT,
containerClassName: 'open-isle-toast-style-v1',
diff --git a/frontend_nuxt/router/index.js b/frontend_nuxt/router/index.js
index 91b18fb46..c40fc5eec 100644
--- a/frontend_nuxt/router/index.js
+++ b/frontend_nuxt/router/index.js
@@ -3,5 +3,5 @@ export default {
if (process.client) {
window.location.href = path
}
- }
+ },
}
diff --git a/frontend_nuxt/utils/auth.js b/frontend_nuxt/utils/auth.js
index d70b21961..a5dec2019 100644
--- a/frontend_nuxt/utils/auth.js
+++ b/frontend_nuxt/utils/auth.js
@@ -10,11 +10,12 @@ export const authState = reactive({
loggedIn: false,
userId: null,
username: null,
- role: null
+ role: null,
})
if (process.client) {
- authState.loggedIn = localStorage.getItem(TOKEN_KEY) !== null && localStorage.getItem(TOKEN_KEY) !== ''
+ authState.loggedIn =
+ localStorage.getItem(TOKEN_KEY) !== null && localStorage.getItem(TOKEN_KEY) !== ''
authState.userId = localStorage.getItem(USER_ID_KEY)
authState.username = localStorage.getItem(USERNAME_KEY)
authState.role = localStorage.getItem(ROLE_KEY)
@@ -68,7 +69,7 @@ export async function fetchCurrentUser() {
if (!token) return null
try {
const res = await fetch(`${API_BASE_URL}/api/users/me`, {
- headers: { Authorization: `Bearer ${token}` }
+ headers: { Authorization: `Bearer ${token}` },
})
if (!res.ok) return null
return await res.json()
@@ -94,7 +95,7 @@ export async function checkToken() {
if (!token) return false
try {
const res = await fetch(`${API_BASE_URL}/api/auth/check`, {
- headers: { Authorization: `Bearer ${token}` }
+ headers: { Authorization: `Bearer ${token}` },
})
authState.loggedIn = res.ok
return res.ok
diff --git a/frontend_nuxt/utils/clearVditorStorage.js b/frontend_nuxt/utils/clearVditorStorage.js
index 41c42f9e3..4733d87d8 100644
--- a/frontend_nuxt/utils/clearVditorStorage.js
+++ b/frontend_nuxt/utils/clearVditorStorage.js
@@ -1,5 +1,5 @@
export function clearVditorStorage() {
- Object.keys(localStorage).forEach(key => {
+ Object.keys(localStorage).forEach((key) => {
if (key.startsWith('vditoreditor-') || key === 'vditor') {
localStorage.removeItem(key)
}
diff --git a/frontend_nuxt/utils/discord.js b/frontend_nuxt/utils/discord.js
index 521ecc8fa..880671a05 100644
--- a/frontend_nuxt/utils/discord.js
+++ b/frontend_nuxt/utils/discord.js
@@ -18,7 +18,12 @@ export async function discordExchange(code, state, reason) {
const res = await fetch(`${API_BASE_URL}/api/auth/discord`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ code, redirectUri: `${window.location.origin}/discord-callback`, reason, state })
+ body: JSON.stringify({
+ code,
+ redirectUri: `${window.location.origin}/discord-callback`,
+ reason,
+ state,
+ }),
})
const data = await res.json()
if (res.ok && data.token) {
@@ -28,27 +33,27 @@ export async function discordExchange(code, state, reason) {
registerPush()
return {
success: true,
- needReason: false
+ needReason: false,
}
} else if (data.reason_code === 'NOT_APPROVED') {
toast.info('当前为注册审核模式,请填写注册理由')
return {
success: false,
needReason: true,
- token: data.token
+ token: data.token,
}
} else if (data.reason_code === 'IS_APPROVING') {
toast.info('您的注册理由正在审批中')
return {
success: true,
- needReason: false
+ needReason: false,
}
} else {
toast.error(data.error || '登录失败')
return {
success: false,
needReason: false,
- error: data.error || '登录失败'
+ error: data.error || '登录失败',
}
}
} catch (e) {
@@ -56,7 +61,7 @@ export async function discordExchange(code, state, reason) {
return {
success: false,
needReason: false,
- error: '登录失败'
+ error: '登录失败',
}
}
}
diff --git a/frontend_nuxt/utils/github.js b/frontend_nuxt/utils/github.js
index cca908654..e978d6e07 100644
--- a/frontend_nuxt/utils/github.js
+++ b/frontend_nuxt/utils/github.js
@@ -18,7 +18,12 @@ export async function githubExchange(code, state, reason) {
const res = await fetch(`${API_BASE_URL}/api/auth/github`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ code, redirectUri: `${window.location.origin}/github-callback`, reason, state })
+ body: JSON.stringify({
+ code,
+ redirectUri: `${window.location.origin}/github-callback`,
+ reason,
+ state,
+ }),
})
const data = await res.json()
if (res.ok && data.token) {
@@ -28,27 +33,27 @@ export async function githubExchange(code, state, reason) {
registerPush()
return {
success: true,
- needReason: false
+ needReason: false,
}
} else if (data.reason_code === 'NOT_APPROVED') {
toast.info('当前为注册审核模式,请填写注册理由')
return {
success: false,
needReason: true,
- token: data.token
+ token: data.token,
}
} else if (data.reason_code === 'IS_APPROVING') {
toast.info('您的注册理由正在审批中')
return {
success: true,
- needReason: false
+ needReason: false,
}
} else {
toast.error(data.error || '登录失败')
return {
success: false,
needReason: false,
- error: data.error || '登录失败'
+ error: data.error || '登录失败',
}
}
} catch (e) {
@@ -56,7 +61,7 @@ export async function githubExchange(code, state, reason) {
return {
success: false,
needReason: false,
- error: '登录失败'
+ error: '登录失败',
}
}
}
diff --git a/frontend_nuxt/utils/google.js b/frontend_nuxt/utils/google.js
index 61ae67ccb..c641fb374 100644
--- a/frontend_nuxt/utils/google.js
+++ b/frontend_nuxt/utils/google.js
@@ -13,7 +13,7 @@ export async function googleGetIdToken() {
window.google.accounts.id.initialize({
client_id: GOOGLE_CLIENT_ID,
callback: ({ credential }) => resolve(credential),
- use_fedcm: true
+ use_fedcm: true,
})
window.google.accounts.id.prompt()
})
@@ -35,7 +35,7 @@ export async function googleAuthWithToken(idToken, redirect_success, redirect_no
const res = await fetch(`${API_BASE_URL}/api/auth/google`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ idToken })
+ body: JSON.stringify({ idToken }),
})
const data = await res.json()
if (res.ok && data.token) {
@@ -72,8 +72,8 @@ export function loginWithGoogle() {
() => {
router.push('/')
},
- token => {
+ (token) => {
router.push('/signup-reason?token=' + token)
- }
+ },
)
-}
\ No newline at end of file
+}
diff --git a/frontend_nuxt/utils/level.js b/frontend_nuxt/utils/level.js
index 6f1b88daa..fdd2e9c9f 100644
--- a/frontend_nuxt/utils/level.js
+++ b/frontend_nuxt/utils/level.js
@@ -1,6 +1,6 @@
export const LEVEL_EXP = [100, 200, 300, 600, 1200, 10000]
-export const prevLevelExp = level => {
+export const prevLevelExp = (level) => {
if (level <= 0) return 0
if (level - 1 < LEVEL_EXP.length) return LEVEL_EXP[level - 1]
return LEVEL_EXP[LEVEL_EXP.length - 1]
diff --git a/frontend_nuxt/utils/markdown.js b/frontend_nuxt/utils/markdown.js
index 71de58a16..4c2b586bd 100644
--- a/frontend_nuxt/utils/markdown.js
+++ b/frontend_nuxt/utils/markdown.js
@@ -16,7 +16,7 @@ function mentionPlugin(md) {
tokenOpen.attrs = [
['href', `/users/${match[1]}`],
['target', '_blank'],
- ['class', 'mention-link']
+ ['class', 'mention-link'],
]
const text = state.push('text', '', 0)
text.content = `@${match[1]}`
@@ -62,7 +62,7 @@ const md = new MarkdownIt({
code = hljs.highlightAuto(str).value
}
return `
正在关注
${code}`
- }
+ },
})
md.use(mentionPlugin)
@@ -89,7 +89,10 @@ export function stripMarkdown(text) {
// SSR 环境下没有 document
if (typeof window === 'undefined') {
// 用正则去除 HTML 标签
- return html.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim()
+ return html
+ .replace(/<[^>]+>/g, '')
+ .replace(/\s+/g, ' ')
+ .trim()
} else {
const el = document.createElement('div')
el.innerHTML = html
diff --git a/frontend_nuxt/utils/medal.js b/frontend_nuxt/utils/medal.js
index a10f6e665..7406693c3 100644
--- a/frontend_nuxt/utils/medal.js
+++ b/frontend_nuxt/utils/medal.js
@@ -2,7 +2,7 @@ export const medalTitles = {
COMMENT: '评论达人',
POST: '发帖达人',
SEED: '种子用户',
- CONTRIBUTOR: '贡献者'
+ CONTRIBUTOR: '贡献者',
}
export function getMedalTitle(type) {
diff --git a/frontend_nuxt/utils/notification.js b/frontend_nuxt/utils/notification.js
index d5fe7e866..2e117cbac 100644
--- a/frontend_nuxt/utils/notification.js
+++ b/frontend_nuxt/utils/notification.js
@@ -3,7 +3,7 @@ import { getToken } from './auth'
import { reactive } from 'vue'
export const notificationState = reactive({
- unreadCount: 0
+ unreadCount: 0,
})
export async function fetchUnreadCount() {
@@ -14,7 +14,7 @@ export async function fetchUnreadCount() {
return 0
}
const res = await fetch(`${API_BASE_URL}/api/notifications/unread-count`, {
- headers: { Authorization: `Bearer ${token}` }
+ headers: { Authorization: `Bearer ${token}` },
})
if (!res.ok) {
notificationState.unreadCount = 0
@@ -37,9 +37,9 @@ export async function markNotificationsRead(ids) {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json',
},
- body: JSON.stringify({ ids })
+ body: JSON.stringify({ ids }),
})
return res.ok
} catch (e) {
diff --git a/frontend_nuxt/utils/push.js b/frontend_nuxt/utils/push.js
index 201b8cc60..b80fd366d 100644
--- a/frontend_nuxt/utils/push.js
+++ b/frontend_nuxt/utils/push.js
@@ -2,7 +2,7 @@ import { API_BASE_URL } from '../main'
import { getToken } from './auth'
function urlBase64ToUint8Array(base64String) {
- const padding = '='.repeat((4 - base64String.length % 4) % 4)
+ const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/')
const rawData = atob(base64)
const outputArray = new Uint8Array(rawData.length)
@@ -28,19 +28,19 @@ export async function registerPush() {
const { key } = await res.json()
const sub = await reg.pushManager.subscribe({
userVisibleOnly: true,
- applicationServerKey: urlBase64ToUint8Array(key)
+ applicationServerKey: urlBase64ToUint8Array(key),
})
await fetch(`${API_BASE_URL}/api/push/subscribe`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- Authorization: `Bearer ${getToken()}`
+ Authorization: `Bearer ${getToken()}`,
},
body: JSON.stringify({
endpoint: sub.endpoint,
p256dh: arrayBufferToBase64(sub.getKey('p256dh')),
- auth: arrayBufferToBase64(sub.getKey('auth'))
- })
+ auth: arrayBufferToBase64(sub.getKey('auth')),
+ }),
})
} catch (e) {
// ignore
diff --git a/frontend_nuxt/utils/reactions.js b/frontend_nuxt/utils/reactions.js
index 7fa967de7..15d59cadd 100644
--- a/frontend_nuxt/utils/reactions.js
+++ b/frontend_nuxt/utils/reactions.js
@@ -21,5 +21,5 @@ export const reactionEmojiMap = {
CHINA: '🇨🇳',
USA: '🇺🇸',
JAPAN: '🇯🇵',
- KOREA: '🇰🇷'
+ KOREA: '🇰🇷',
}
diff --git a/frontend_nuxt/utils/screen.js b/frontend_nuxt/utils/screen.js
index f74afd03e..d21e74e09 100644
--- a/frontend_nuxt/utils/screen.js
+++ b/frontend_nuxt/utils/screen.js
@@ -16,11 +16,19 @@ export const useIsMobile = () => {
}
const mobileKeywords = [
- 'android', 'iphone', 'ipad', 'ipod', 'blackberry', 'windows phone',
- 'mobile', 'tablet', 'opera mini', 'iemobile'
+ 'android',
+ 'iphone',
+ 'ipad',
+ 'ipod',
+ 'blackberry',
+ 'windows phone',
+ 'mobile',
+ 'tablet',
+ 'opera mini',
+ 'iemobile',
]
- return mobileKeywords.some(keyword => userAgent.includes(keyword))
+ return mobileKeywords.some((keyword) => userAgent.includes(keyword))
}
if (typeof window !== 'undefined') {
@@ -43,4 +51,3 @@ export const useIsMobile = () => {
return isMobileUserAgent()
})
}
-
diff --git a/frontend_nuxt/utils/theme.js b/frontend_nuxt/utils/theme.js
index 3bab98c49..0bdeb146e 100644
--- a/frontend_nuxt/utils/theme.js
+++ b/frontend_nuxt/utils/theme.js
@@ -4,20 +4,22 @@ import { toast } from '~/main'
export const ThemeMode = {
SYSTEM: 'system',
LIGHT: 'light',
- DARK: 'dark'
+ DARK: 'dark',
}
const THEME_KEY = 'theme-mode'
export const themeState = reactive({
- mode: ThemeMode.SYSTEM
+ mode: ThemeMode.SYSTEM,
})
function apply(mode) {
if (!process.client) return
const root = document.documentElement
if (mode === ThemeMode.SYSTEM) {
- root.dataset.theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
+ root.dataset.theme = window.matchMedia('(prefers-color-scheme: dark)').matches
+ ? 'dark'
+ : 'light'
} else {
root.dataset.theme = mode
}
diff --git a/frontend_nuxt/utils/tiebaEmoji.js b/frontend_nuxt/utils/tiebaEmoji.js
index ce91ea0ff..bf3a9074a 100644
--- a/frontend_nuxt/utils/tiebaEmoji.js
+++ b/frontend_nuxt/utils/tiebaEmoji.js
@@ -1,4 +1,5 @@
-export const TIEBA_EMOJI_CDN = 'https://cdn.jsdelivr.net/gh/microlong666/tieba_mobile_emotions@master/'
+export const TIEBA_EMOJI_CDN =
+ 'https://cdn.jsdelivr.net/gh/microlong666/tieba_mobile_emotions@master/'
// export const TIEBA_EMOJI_CDN = 'https://openisle-1307107697.cos.ap-guangzhou.myqcloud.com/assert/vditor/dist/images/emoji/'
export const tiebaEmoji = (() => {
diff --git a/frontend_nuxt/utils/twitter.js b/frontend_nuxt/utils/twitter.js
index 8362d17af..b8477eeff 100644
--- a/frontend_nuxt/utils/twitter.js
+++ b/frontend_nuxt/utils/twitter.js
@@ -52,8 +52,8 @@ export async function twitterExchange(code, state, reason) {
redirectUri: `${window.location.origin}/twitter-callback`,
reason,
state,
- codeVerifier
- })
+ codeVerifier,
+ }),
})
const data = await res.json()
if (res.ok && data.token) {
diff --git a/frontend_nuxt/utils/user.js b/frontend_nuxt/utils/user.js
index a7469067e..f0291a563 100644
--- a/frontend_nuxt/utils/user.js
+++ b/frontend_nuxt/utils/user.js
@@ -22,7 +22,9 @@ export async function fetchAdmins() {
export async function searchUsers(keyword) {
if (!keyword) return []
try {
- const res = await fetch(`${API_BASE_URL}/api/search/users?keyword=${encodeURIComponent(keyword)}`)
+ const res = await fetch(
+ `${API_BASE_URL}/api/search/users?keyword=${encodeURIComponent(keyword)}`,
+ )
return res.ok ? await res.json() : []
} catch (e) {
return []
diff --git a/frontend_nuxt/utils/vditor.js b/frontend_nuxt/utils/vditor.js
index 12ef522f1..b4a366066 100644
--- a/frontend_nuxt/utils/vditor.js
+++ b/frontend_nuxt/utils/vditor.js
@@ -13,22 +13,17 @@ export function getPreviewTheme() {
}
export function createVditor(editorId, options = {}) {
- const {
- placeholder = '',
- preview = {},
- input,
- after
- } = options
+ const { placeholder = '', preview = {}, input, after } = options
const fetchMentions = async (value) => {
if (!value) {
const [followings, admins] = await Promise.all([
fetchFollowings(authState.username),
- fetchAdmins()
+ fetchAdmins(),
])
const combined = [...followings, ...admins]
const seen = new Set()
- return combined.filter(u => {
+ return combined.filter((u) => {
if (seen.has(u.id)) return false
seen.add(u.id)
return true
@@ -56,7 +51,7 @@ export function createVditor(editorId, options = {}) {
'redo',
'|',
'link',
- 'upload'
+ 'upload',
]
let vditor
@@ -64,9 +59,12 @@ export function createVditor(editorId, options = {}) {
placeholder,
height: 'auto',
theme: getEditorTheme(),
- preview: Object.assign({
- theme: { current: getPreviewTheme() },
- }, preview),
+ preview: Object.assign(
+ {
+ theme: { current: getPreviewTheme() },
+ },
+ preview,
+ ),
hint: {
emoji: tiebaEmoji,
extend: [
@@ -74,9 +72,9 @@ export function createVditor(editorId, options = {}) {
key: '@',
hint: async (key) => {
const list = await fetchMentions(key)
- return list.map(u => ({
+ return list.map((u) => ({
value: `@[${u.username}]`,
- html: `