-
+
CantyOni_on's Index
-
-
+
+
-
-
-
+
\ No newline at end of file
+
diff --git a/components/nav/NavBarEntryItem.vue b/components/nav/NavBarEntryItem.vue
index 4fddb82..059a615 100644
--- a/components/nav/NavBarEntryItem.vue
+++ b/components/nav/NavBarEntryItem.vue
@@ -1,14 +1,14 @@
-
@@ -66,4 +72,4 @@ const onClick = (to: string | undefined, url: boolean) => {
transform: perspective(500px) rotateX(-45deg) translateX(-50%);
}
}
-
\ No newline at end of file
+
diff --git a/components/sponer/upyun.vue b/components/sponer/upyun.vue
index cfcf678..bc688a4 100644
--- a/components/sponer/upyun.vue
+++ b/components/sponer/upyun.vue
@@ -3,11 +3,18 @@
-
- 本网站由提供CDN加速/云储存服务
+
+ 本网站由提供CDN加速/云储存服务
\ No newline at end of file
+
diff --git a/components/widget/SocialMediaWidget.vue b/components/widget/SocialMediaWidget.vue
index 05c275a..51b3ea1 100644
--- a/components/widget/SocialMediaWidget.vue
+++ b/components/widget/SocialMediaWidget.vue
@@ -8,13 +8,17 @@ defineProps<{
\ No newline at end of file
+
diff --git a/composables/function.ts b/composables/function.ts
index 509f83a..a78c69f 100644
--- a/composables/function.ts
+++ b/composables/function.ts
@@ -1,8 +1,7 @@
export const getAssetURL = (image: string) => {
// 参数一: 相对路径
// 参数二: 当前路径的URL
- if (import.meta.client)
- return new URL(`../assets/images/${image}`, import.meta.url).href
+ if (import.meta.client) { return new URL(`../assets/images/${image}`, import.meta.url).href }
return `/_nuxt/assets/images/${image}`
}
@@ -17,20 +16,20 @@ export const debounce = (fn: Function, delay: number) => {
}
export const setMobileTopColor = () => {
- const lightMeta = document.createElement('meta');
- lightMeta.setAttribute('name', 'theme-color');
- lightMeta.setAttribute('media', '(prefers-color-scheme: light)');
- lightMeta.setAttribute('content', '#60a5fa');
+ const lightMeta = document.createElement('meta')
+ lightMeta.setAttribute('name', 'theme-color')
+ lightMeta.setAttribute('media', '(prefers-color-scheme: light)')
+ lightMeta.setAttribute('content', '#60a5fa')
- const darkMeta = document.createElement('meta');
- darkMeta.setAttribute('name', 'theme-color');
- darkMeta.setAttribute('media', '(prefers-color-scheme: dark)');
- darkMeta.setAttribute('content', '#60a5fa');
+ const darkMeta = document.createElement('meta')
+ darkMeta.setAttribute('name', 'theme-color')
+ darkMeta.setAttribute('media', '(prefers-color-scheme: dark)')
+ darkMeta.setAttribute('content', '#60a5fa')
- document.head.appendChild(lightMeta);
- document.head.appendChild(darkMeta);
+ document.head.appendChild(lightMeta)
+ document.head.appendChild(darkMeta)
}
export const removeMobileTopColor = () => {
- document.querySelectorAll('meta[name="theme-color"]').forEach(meta => meta.remove());
+ document.querySelectorAll('meta[name="theme-color"]').forEach(meta => meta.remove())
}
diff --git a/composables/network.ts b/composables/network.ts
index 9965b15..8f77ea1 100644
--- a/composables/network.ts
+++ b/composables/network.ts
@@ -1,28 +1,26 @@
import type { AsyncData, UseFetchOptions } from '#app'
export function requestCore
(url: string, options: UseFetchOptions) {
- // const config = useRuntimeConfig()
- const {$mitt} = useNuxtApp()
+ // Const config = useRuntimeConfig()
+ const { $mitt } = useNuxtApp()
return useFetch(url, {
- baseURL: "https://cantyonion.site",
+ baseURL: 'https://cantyonion.site',
retry: false,
timeout: 3000,
onRequest({ options }) {
- let token: string = ""
+ let token: string = ''
if (import.meta.client) {
- token = localStorage.getItem("token") || ""
+ token = localStorage.getItem('token') || ''
}
- if (!options.headers.get('Authorization'))
- options.headers.set('Authorization', `Bearer ${token}`)
+ if (!options.headers.get('Authorization')) { options.headers.set('Authorization', `Bearer ${token}`) }
},
onResponse({ response }) {
// HTTP状态码2XX/3XX执行,否则不执行
if (response.status < 200 || response.status >= 400) {
console.error(`HTTP 错误: ${response.status}`)
- return
}
// 业务code状态码判断
- // if (response._data.code !== 200) {
+ // If (response._data.code !== 200) {
//
// }
},
@@ -30,10 +28,10 @@ export function requestCore(url: string, options: UseFetchOptions)
$mitt.emit('eventBus', {
level: 'error',
title: `HTTP错误:${response.status}`,
- message: response.statusText
+ message: response.statusText,
})
},
- ...options
+ ...options,
})
}
@@ -43,8 +41,7 @@ export function get(url: string, options?: UseFetchOptions
return async (): Promise => {
if (result != null) {
await result.refresh()
- if (result.status.value === 'success')
- return result.data.value
+ if (result.status.value === 'success') { return result.data.value }
throw result.error
}
@@ -54,4 +51,4 @@ export function get(url: string, options?: UseFetchOptions
}) as AsyncData
return result.data.value
}
-}
\ No newline at end of file
+}
diff --git a/error.vue b/error.vue
index 0009506..1530c72 100644
--- a/error.vue
+++ b/error.vue
@@ -3,49 +3,49 @@ import type { NuxtError } from '#app'
import { setMobileTopColor } from '~/composables/function'
const props = defineProps({
- error: Object as () => NuxtError
-})
+ error: Object as () => NuxtError,
+ }),
-const {$mitt} = useNuxtApp()
+ { $mitt } = useNuxtApp(),
-const errorMessages: Record = {
- '400': {
- icon: '❓',
- title: '哦豁!请求有点问题',
- message: '请求似乎有点小问题,服务器君有点摸不着头脑呢!',
+ errorMessages: Record = {
+ 400: {
+ icon: '❓',
+ title: '哦豁!请求有点问题',
+ message: '请求似乎有点小问题,服务器君有点摸不着头脑呢!',
+ },
+ 403: {
+ icon: '🔒',
+ title: '哎呀!大门被锁住了',
+ message: '你没有权限访问这个角落,试试返回首页吧!',
+ },
+ 404: {
+ icon: '🌌',
+ title: '哎呀!你发现了超级基地的秘密角落',
+ message: '看起来你找的页面藏到了未知的时空层里!',
+ },
+ 500: {
+ icon: '🚀',
+ title: '糟糕!超级基地出了一点故障',
+ message: '服务器君正在努力解决问题,请稍等片刻!',
+ },
+ 502: {
+ icon: '👽',
+ title: '糟糕!基地信号被外星人拦截了',
+ message: '网络通道似乎遇到了问题,请稍后再试!',
+ },
+ default: {
+ icon: '⚠️',
+ title: '哦豁!此时遇到了点小麻烦',
+ message: '请求在穿越洋葱星球时迷路了,请返回首页重新探索!',
+ },
},
- '403': {
- icon: '🔒',
- title: '哎呀!大门被锁住了',
- message: '你没有权限访问这个角落,试试返回首页吧!',
- },
- '404': {
- icon: '🌌',
- title: '哎呀!你发现了超级基地的秘密角落',
- message: '看起来你找的页面藏到了未知的时空层里!',
- },
- '500': {
- icon: '🚀',
- title: '糟糕!超级基地出了一点故障',
- message: '服务器君正在努力解决问题,请稍等片刻!',
- },
- '502': {
- icon: '👽',
- title: '糟糕!基地信号被外星人拦截了',
- message: '网络通道似乎遇到了问题,请稍后再试!',
- },
- default: {
- icon: '⚠️',
- title: '哦豁!此时遇到了点小麻烦',
- message: '请求在穿越洋葱星球时迷路了,请返回首页重新探索!',
- },
-};
-const errorContent = computed(() => errorMessages[props.error!.statusCode] || errorMessages['default']);
+ errorContent = computed(() => errorMessages[props.error!.statusCode] || errorMessages.default)
console.error(props.error)
onMounted(() => {
- $mitt.emit("startLoading", false)
+ $mitt.emit('startLoading', false)
setMobileTopColor()
})
@@ -56,13 +56,17 @@ onUnmounted(() => {
\ No newline at end of file
+
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 2236f5e..f07c4b6 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,5 +1,7 @@
+import js from '@eslint/js'
import withNuxt from './.nuxt/eslint.config.mjs'
-export default withNuxt({
- files: ['**/*.ts', '**/*.tsx']
-})
\ No newline at end of file
+export default withNuxt([
+ js.configs.all,
+ { files: ['**/*.ts', '**/*.tsx'] },
+])
diff --git a/middleware/00.loading.global.ts b/middleware/00.loading.global.ts
index 9ba1d54..1ed11c5 100644
--- a/middleware/00.loading.global.ts
+++ b/middleware/00.loading.global.ts
@@ -1,4 +1,4 @@
export default defineNuxtRouteMiddleware(() => {
- const {$mitt} = useNuxtApp()
+ const { $mitt } = useNuxtApp()
$mitt.emit('startLoading', true)
-})
\ No newline at end of file
+})
diff --git a/middleware/maintenance.global.ts b/middleware/maintenance.global.ts
index 4cc39ae..8450991 100644
--- a/middleware/maintenance.global.ts
+++ b/middleware/maintenance.global.ts
@@ -1,5 +1,4 @@
export default defineNuxtRouteMiddleware((to, _) => {
- if (to.meta.maintenance === true && import.meta.env.DEV)
- return navigateTo('/error/maintenance')
+ if (to.meta.maintenance === true && import.meta.env.DEV) { return navigateTo('/error/maintenance') }
return true
-})
\ No newline at end of file
+})
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 9b30341..f5bc495 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -1,12 +1,12 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
-// see https://blog.csdn.net/m0_53022813/article/details/137379480
-import eslintPlugin from "vite-plugin-eslint";
+// See https://blog.csdn.net/m0_53022813/article/details/137379480
+import eslintPlugin from 'vite-plugin-eslint'
export default defineNuxtConfig({
- compatibilityDate: '2024-04-03',
- devtools: { enabled: true },
modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt', '@nuxt/image', '@nuxt/eslint'],
+ components: true,
+ devtools: { enabled: true },
app: {
head: {
title: 'CANTYONION.SITE',
@@ -18,50 +18,50 @@ export default defineNuxtConfig({
],
link: [
{ rel: 'icon', href: '/favicon.png' },
- ]
- }
+ ],
+ },
},
- components: true,
css: [
'@fortawesome/fontawesome-svg-core/styles.css',
'github-markdown-css/github-markdown-light.css',
- '~/assets/css/main.scss'
+ '~/assets/css/main.scss',
],
+ runtimeConfig: {
+ public: {
+ gitApiKey: 'fb8aec429ea7d0a36f7238dbffda9d2d66c7b045',
+ baseURL: 'https://cantyonion.site',
+ },
+ },
+ build: {
+ transpile: ['@fortawesome/vue-fontawesome', 'vue3-typed-js', 'pinia-plugin-persistedstate'],
+ },
+ devServer: {
+ host: '0.0.0.0',
+ },
+ compatibilityDate: '2024-04-03',
+ vite: {
+ plugins: [
+ eslintPlugin({
+ include: ['**/*.ts', '**/*.vue'],
+ }),
+ ],
+ css: {
+ preprocessorOptions: {
+ scss: {
+ api: 'modern-compiler', // Or "modern"
+ },
+ },
+ },
+ },
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
- build: {
- transpile: ['@fortawesome/vue-fontawesome', 'vue3-typed-js', 'pinia-plugin-persistedstate']
- },
- vite: {
- plugins: [
- eslintPlugin({
- include: ['**/*.ts', '**/*.vue']
- })
- ],
- css: {
- preprocessorOptions: {
- scss: {
- api: 'modern-compiler' // or "modern"
- }
- }
- },
- },
- runtimeConfig: {
- public: {
- gitApiKey: 'fb8aec429ea7d0a36f7238dbffda9d2d66c7b045',
- baseURL: 'https://cantyonion.site'
- }
- },
- devServer: {
- host: '0.0.0.0'
- },
eslint: {
config: {
- stylistic: true
- }
- }
-})
\ No newline at end of file
+ stylistic: true,
+ },
+ },
+})
diff --git a/pages/[...default].vue b/pages/[...default].vue
index 9c21ff4..063ace4 100644
--- a/pages/[...default].vue
+++ b/pages/[...default].vue
@@ -1,11 +1,10 @@
-
\ No newline at end of file
+
diff --git a/pages/article.vue b/pages/article.vue
index 621f28e..33ebe74 100644
--- a/pages/article.vue
+++ b/pages/article.vue
@@ -1,15 +1,15 @@
-
+
\ No newline at end of file
+
diff --git a/pages/article/[cid].vue b/pages/article/[cid].vue
index dbe1de7..33886fe 100644
--- a/pages/article/[cid].vue
+++ b/pages/article/[cid].vue
@@ -1,23 +1,23 @@
@@ -25,7 +25,9 @@ content.value = await getPost()
-
{{ title }}
+
+ {{ title }}
+
@@ -43,10 +45,10 @@ content.value = await getPost()
-
+
\ No newline at end of file
+
diff --git a/pages/article/index.vue b/pages/article/index.vue
index e44371f..33f8792 100644
--- a/pages/article/index.vue
+++ b/pages/article/index.vue
@@ -1,13 +1,13 @@
-
+
\ No newline at end of file
+
diff --git a/pages/auth.vue b/pages/auth.vue
index 96c0baf..f56c613 100644
--- a/pages/auth.vue
+++ b/pages/auth.vue
@@ -3,9 +3,8 @@
-
\ No newline at end of file
+
diff --git a/pages/diary.vue b/pages/diary.vue
index e44371f..33f8792 100644
--- a/pages/diary.vue
+++ b/pages/diary.vue
@@ -1,13 +1,13 @@
-
+
\ No newline at end of file
+
diff --git a/pages/error/[code].vue b/pages/error/[code].vue
index df33a49..95631e6 100644
--- a/pages/error/[code].vue
+++ b/pages/error/[code].vue
@@ -1,20 +1,18 @@
-
\ No newline at end of file
+
diff --git a/pages/error/maintenance.vue b/pages/error/maintenance.vue
index 068d3ba..3a64f2d 100644
--- a/pages/error/maintenance.vue
+++ b/pages/error/maintenance.vue
@@ -1,15 +1,19 @@
-
+
\ No newline at end of file
+
diff --git a/pages/index.vue b/pages/index.vue
index 75a96d3..e4c7a8d 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1,96 +1,98 @@
-
+
\ No newline at end of file
+
diff --git a/pages/talk.vue b/pages/talk.vue
index e44371f..33f8792 100644
--- a/pages/talk.vue
+++ b/pages/talk.vue
@@ -1,13 +1,13 @@
-
+
\ No newline at end of file
+
diff --git a/plugins/fontawsome.ts b/plugins/fontawsome.ts
index e6480fe..b811e61 100644
--- a/plugins/fontawsome.ts
+++ b/plugins/fontawsome.ts
@@ -1,24 +1,24 @@
-import {library, config} from '@fortawesome/fontawesome-svg-core'
-import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
-import {faClock, faFolder} from '@fortawesome/free-regular-svg-icons'
+import { config, library } from '@fortawesome/fontawesome-svg-core'
+import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
+import { faClock, faFolder } from '@fortawesome/free-regular-svg-icons'
import {
- faXmark,
+ faBars,
faBlog,
- faGauge,
- faCodeBranch,
- faCloud,
- faChevronRight,
- faCodeCommit,
- faCode,
- faHouse,
- faPen,
faBrush,
faChessRook,
- faBars,
faChevronDown,
- faLink
+ faChevronRight,
+ faCloud,
+ faCode,
+ faCodeBranch,
+ faCodeCommit,
+ faGauge,
+ faHouse,
+ faLink,
+ faPen,
+ faXmark,
} from '@fortawesome/free-solid-svg-icons'
-import {faWeibo, faQq, faGithubAlt, faSteamSymbol} from '@fortawesome/free-brands-svg-icons'
+import { faGithubAlt, faQq, faSteamSymbol, faWeibo } from '@fortawesome/free-brands-svg-icons'
// 因为默认添加了 nuxt会造成一些错误,所以不自动添加样式
config.autoAddCss = false
@@ -26,8 +26,8 @@ config.autoAddCss = false
export default defineNuxtPlugin((nuxtApp) => {
library.add(
faClock, faXmark, faBlog, faGauge, faCodeBranch, faCloud, faWeibo, faQq, faGithubAlt, faSteamSymbol, faChevronRight,
- faCodeCommit, faCode, faHouse, faPen, faBrush, faChessRook, faBars, faChevronDown, faFolder, faLink
+ faCodeCommit, faCode, faHouse, faPen, faBrush, faChessRook, faBars, faChevronDown, faFolder, faLink,
)
nuxtApp.vueApp.component('font-awesome-icon', FontAwesomeIcon)
-})
\ No newline at end of file
+})
diff --git a/plugins/markdown-it.ts b/plugins/markdown-it.ts
index c02ecac..ca631d1 100644
--- a/plugins/markdown-it.ts
+++ b/plugins/markdown-it.ts
@@ -1,48 +1,49 @@
import md, { type Options } from 'markdown-it'
// @ts-ignore
import mm from 'markdown-it-mathjax3'
+
const options: Options = {
- // Enable HTML tags in source
- html: true,
+ // Enable HTML tags in source
+ html: true,
- // Use '/' to close single tags (
).
- // This is only for full CommonMark compatibility.
- xhtmlOut: true,
+ // Use '/' to close single tags (
).
+ // This is only for full CommonMark compatibility.
+ xhtmlOut: true,
- // Convert '\n' in paragraphs into
- breaks: true,
+ // Convert '\n' in paragraphs into
+ breaks: true,
- // CSS language prefix for fenced blocks. Can be
- // useful for external highlighters.
- langPrefix: 'language-',
+ // CSS language prefix for fenced blocks. Can be
+ // Useful for external highlighters.
+ langPrefix: 'language-',
- // Autoconvert URL-like text to links
- linkify: true,
+ // Autoconvert URL-like text to links
+ linkify: true,
- // Enable some language-neutral replacement + quotes beautification
- // For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs
- typographer: true,
+ // Enable some language-neutral replacement + quotes beautification
+ // For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs
+ typographer: true,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- //
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes: '“”‘’',
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // And smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // And ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '“”‘’',
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externally.
- // If result starts with {
- const render = md(options)
- .use(mm, {
- })
- return {
- provide: {
- mdRender: render
- }
- }
-})
\ No newline at end of file
+ const render = md(options)
+ .use(mm, {
+ })
+ return {
+ provide: {
+ mdRender: render,
+ },
+ }
+})
diff --git a/plugins/mitt.ts b/plugins/mitt.ts
index d6ce654..8733f84 100644
--- a/plugins/mitt.ts
+++ b/plugins/mitt.ts
@@ -1,19 +1,17 @@
import mitt from 'mitt'
type Events = {
- openPost: IPost
- startLoading: boolean
- eventBus: INotification
+ openPost: IPost
+ startLoading: boolean
+ eventBus: INotification
}
-
-
export default defineNuxtPlugin(() => {
- const emitter = mitt()
+ const emitter = mitt()
- return {
- provide: {
- mitt: emitter
- }
- }
-})
\ No newline at end of file
+ return {
+ provide: {
+ mitt: emitter,
+ },
+ }
+})
diff --git a/plugins/typedjs.ts b/plugins/typedjs.ts
index cdf9391..f1f74fd 100644
--- a/plugins/typedjs.ts
+++ b/plugins/typedjs.ts
@@ -3,4 +3,4 @@ import VueTyped from 'vue3-typed-js'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueTyped)
-})
\ No newline at end of file
+})
diff --git a/tailwind.config.ts b/tailwind.config.ts
index be9696b..d911017 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -2,16 +2,15 @@ import type { Config } from 'tailwindcss'
export default {
content: [
- "./components/**/*.{js,vue,ts}",
- "./layouts/**/*.vue",
- "./pages/**/*.vue",
- "./plugins/**/*.{js,ts}",
- "./app.vue",
- "./error.vue",
+ './components/**/*.{js,vue,ts}',
+ './layouts/**/*.vue',
+ './pages/**/*.vue',
+ './plugins/**/*.{js,ts}',
+ './app.vue',
+ './error.vue',
],
theme: {
extend: {},
},
plugins: [],
} satisfies Config
-
diff --git a/types/blog.d.ts b/types/blog.d.ts
index f9bd602..acacea9 100644
--- a/types/blog.d.ts
+++ b/types/blog.d.ts
@@ -66,4 +66,4 @@ declare interface IDate {
declare interface IPostFull extends IPost {
text: string
-}
\ No newline at end of file
+}
diff --git a/types/git.d.ts b/types/git.d.ts
index 13fca47..70279f0 100644
--- a/types/git.d.ts
+++ b/types/git.d.ts
@@ -1,5 +1,5 @@
declare interface IActivity {
- id: string;
+ id: string
content: T
op_type: string
repo: {
@@ -17,11 +17,11 @@ declare interface IContent {
}
declare interface ICommit {
- Sha1: string,
- Message: string,
- AuthorEmail: string,
- AuthorName: string,
- CommitterEmail: string,
- CommitterName: string,
+ Sha1: string
+ Message: string
+ AuthorEmail: string
+ AuthorName: string
+ CommitterEmail: string
+ CommitterName: string
Timestamp: string
-}
\ No newline at end of file
+}
diff --git a/types/index.d.ts b/types/index.d.ts
index 30e8966..ee986f3 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -2,4 +2,4 @@ declare interface IBlogResponse {
status: string
message: string
data: T
-}
\ No newline at end of file
+}
diff --git a/types/notification.d.ts b/types/notification.d.ts
index 33979be..0ac69e7 100644
--- a/types/notification.d.ts
+++ b/types/notification.d.ts
@@ -1,5 +1,5 @@
declare interface INotification {
- level: 'warning' | 'error' | 'info' | 'success'
- title: string
- message: string
-}
\ No newline at end of file
+ level: 'warning' | 'error' | 'info' | 'success'
+ title: string
+ message: string
+}