Skip to content

Commit af3fe37

Browse files
committed
feat: use nuxtjs/device
1 parent 6e74a98 commit af3fe37

7 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ For users who previously deployed using NuxtHub Admin:
192192
| `NUXT_SESSION_PASSWORD` | Yes | -- | Session encryption key(at least 32 characters) |
193193
| `NUXT_PUBLIC_TITLE` | No | `Exif Gallery Nuxt` | Application title |
194194
| `NUXT_PUBLIC_DESCRIPTION` | No | `A full-stack photo album solution that integrates AI intelligent processing, browser image compression, and other functions` | Application description |
195+
| `NUXT_PUBLIC_DISABLE_3D_CARD_DEFAULT` | No | `false` | Whether to disable 3D card effect by default (set to `true` to disable) |
195196

196197
## 📁 Project Structure
197198

‎README_zh.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ pnpm dev --remote
193193
| `NUXT_SESSION_PASSWORD` | 是 | 自动生成 | 会话加密密钥(至少32位) |
194194
| `NUXT_PUBLIC_TITLE` | 否 | `Exif Gallery Nuxt` | 应用标题 |
195195
| `NUXT_PUBLIC_DESCRIPTION` | 否 | 一个集成了 AI 智能处理、浏览器图片压缩等功能的全栈相册解决方案 | 应用描述 |
196+
| `NUXT_PUBLIC_DISABLE_3D_CARD_DEFAULT` | 否 | `false` | 是否默认禁用 3D 卡片效果(设为 `true`默认禁用) |
196197

197198
## 📁 项目结构
198199

‎app/composables/infos.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
33
const breakpoints = useBreakpoints(breakpointsTailwind)
44

55
export const mdScreen = breakpoints.greaterOrEqual('md')
6-
7-
export const isTouchDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator?.userAgent)

‎app/composables/useTheme.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
export function useTheme(init = false) {
22
const theme = useLocalStorage('shadcn-theme', 'blue')
33
const radius = useLocalStorage('shadcn-radius', '0.5')
4+
const config = useRuntimeConfig()
5+
const { isDesktop } = useDevice()
46
const disable3DCard = useCookie<boolean>('disable-3d-card', {
5-
default: () => isTouchDevice,
7+
default: () => {
8+
return ({ true: true, false: false }[config.public.disable3DCardDefault] ?? !isDesktop)
9+
},
610
sameSite: 'lax',
711
maxAge: 60 * 60 * 24 * 365,
812
})

‎nuxt.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineNuxtConfig({
1010
'@pinia/nuxt',
1111
'@vueuse/nuxt',
1212
'@unocss/nuxt',
13+
'@nuxtjs/device',
1314
'nuxt-auth-utils',
1415
],
1516
hub: {
@@ -61,6 +62,7 @@ export default defineNuxtConfig({
6162
public: {
6263
title: process.env.NUXT_PUBLIC_TITLE,
6364
description: process.env.NUXT_PUBLIC_DESCRIPTION,
65+
disable3DCardDefault: process.env.NUXT_PUBLIC_DISABLE_3D_CARD_DEFAULT,
6466
},
6567
},
6668
i18n: {

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@jsquash/webp": "^1.5.0",
2727
"@libsql/client": "^0.17.0",
2828
"@nuxthub/core": "0.10.4",
29+
"@nuxtjs/device": "4.0.0",
2930
"@paralleldrive/cuid2": "^3.3.0",
3031
"@pinia/nuxt": "^0.11.3",
3132
"@unocss/reset": "66.6.0",

‎pnpm-lock.yaml‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)