This commit is contained in:
Juhász Ervin 2025-12-29 18:24:59 +01:00
parent 0f8a4e5208
commit c22430cdb9
16 changed files with 73 additions and 40 deletions

View File

@ -43,3 +43,10 @@ pnpm run preview
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
View Primevue out the [documentation](https://primevue.org/nuxt) for more information. View Primevue out the [documentation](https://primevue.org/nuxt) for more information.
## ikon és splash képernyő
Az assets/ mappát megtarthatod - ha később módosítani akarod az icon-t vagy splash-t, csak cseréld le az assets/icon.png vagy assets/splash.png fájlt, és futtasd újra:
pnpm capacitor-assets generate --iconBackgroundColor '#262626' --splashBackgroundColor '#262626'
pnpm cap sync

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
assets/splash-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
assets/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -1,37 +1,14 @@
const AUTH_KEY = '_auth' const AUTH_KEY = '_auth'
// Platform ellenőrzés - csak kliens oldalon
const isNative = (): boolean => {
if (typeof window === 'undefined') return false
try {
const { Capacitor } = require('@capacitor/core')
return Capacitor.isNativePlatform()
} catch {
return false
}
}
export const useAuthToken = () => { export const useAuthToken = () => {
const token = ref<string | null>(null) const token = ref<string | null>(null)
const isLoaded = ref(false) const isLoaded = ref(false)
// Token betöltése // Token betöltése - LocalStorage (működik web + native)
const loadToken = async (): Promise<string | null> => { const loadToken = async (): Promise<string | null> => {
// SSR esetén ne csináljunk semmit if (typeof window === 'undefined') return null
if (typeof window === 'undefined') {
return null
}
if (isNative()) { token.value = localStorage.getItem(AUTH_KEY)
// Natív app: Preferences használata
const { Preferences } = await import('@capacitor/preferences')
const { value } = await Preferences.get({ key: AUTH_KEY })
token.value = value
} else {
// Web: Cookie használata
const cookie = useCookie(AUTH_KEY)
token.value = cookie.value || null
}
isLoaded.value = true isLoaded.value = true
return token.value return token.value
} }
@ -41,13 +18,7 @@ export const useAuthToken = () => {
if (typeof window === 'undefined') return if (typeof window === 'undefined') return
token.value = newToken token.value = newToken
if (isNative()) { localStorage.setItem(AUTH_KEY, newToken)
const { Preferences } = await import('@capacitor/preferences')
await Preferences.set({ key: AUTH_KEY, value: newToken })
} else {
const cookie = useCookie(AUTH_KEY, { maxAge: 60 * 60 * 24 * 365 }) // 1 év
cookie.value = newToken
}
} }
// Token törlése (kijelentkezés) // Token törlése (kijelentkezés)
@ -55,13 +26,7 @@ export const useAuthToken = () => {
if (typeof window === 'undefined') return if (typeof window === 'undefined') return
token.value = null token.value = null
if (isNative()) { localStorage.removeItem(AUTH_KEY)
const { Preferences } = await import('@capacitor/preferences')
await Preferences.remove({ key: AUTH_KEY })
} else {
const cookie = useCookie(AUTH_KEY)
cookie.value = null
}
} }
// Getter a token értékhez // Getter a token értékhez

BIN
icons/icon-128.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
icons/icon-192.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
icons/icon-256.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
icons/icon-48.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
icons/icon-512.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
icons/icon-72.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
icons/icon-96.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -33,6 +33,7 @@
"@capacitor/android": "^8.0.0", "@capacitor/android": "^8.0.0",
"@capacitor/app": "^8.0.0", "@capacitor/app": "^8.0.0",
"@capacitor/core": "^8.0.0", "@capacitor/core": "^8.0.0",
"@capacitor/device": "^8.0.0",
"@capacitor/haptics": "^8.0.0", "@capacitor/haptics": "^8.0.0",
"@capacitor/ios": "^8.0.0", "@capacitor/ios": "^8.0.0",
"@capacitor/preferences": "^8.0.0", "@capacitor/preferences": "^8.0.0",

View File

@ -17,6 +17,9 @@ importers:
'@capacitor/core': '@capacitor/core':
specifier: ^8.0.0 specifier: ^8.0.0
version: 8.0.0 version: 8.0.0
'@capacitor/device':
specifier: ^8.0.0
version: 8.0.0(@capacitor/core@8.0.0)
'@capacitor/haptics': '@capacitor/haptics':
specifier: ^8.0.0 specifier: ^8.0.0
version: 8.0.0(@capacitor/core@8.0.0) version: 8.0.0(@capacitor/core@8.0.0)
@ -674,6 +677,11 @@ packages:
'@capacitor/core@8.0.0': '@capacitor/core@8.0.0':
resolution: {integrity: sha512-250HTVd/W/KdMygoqaedisvNbHbpbQTN2Hy/8ZYGm1nAqE0Fx7sGss4l0nDg33STxEdDhtVRoL2fIaaiukKseA==} resolution: {integrity: sha512-250HTVd/W/KdMygoqaedisvNbHbpbQTN2Hy/8ZYGm1nAqE0Fx7sGss4l0nDg33STxEdDhtVRoL2fIaaiukKseA==}
'@capacitor/device@8.0.0':
resolution: {integrity: sha512-qFmlTDnAvUwIg93YUF3u3ovqpDFqUl2RFkf2dVIF8Py7vTA+GjQIHQWITcBKfeUENoVXPNn04t5nxg5mAkjNEA==}
peerDependencies:
'@capacitor/core': '>=8.0.0'
'@capacitor/haptics@8.0.0': '@capacitor/haptics@8.0.0':
resolution: {integrity: sha512-DY1IUOjke1T4ITl7mFHQIKCaJJyHYAYRYHG9bVApU7PDOZiMVGMp48Yjzdqjya+wv/AHS5mDabSTUmhJ5uDvBA==} resolution: {integrity: sha512-DY1IUOjke1T4ITl7mFHQIKCaJJyHYAYRYHG9bVApU7PDOZiMVGMp48Yjzdqjya+wv/AHS5mDabSTUmhJ5uDvBA==}
peerDependencies: peerDependencies:
@ -6640,6 +6648,10 @@ snapshots:
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.8.1
'@capacitor/device@8.0.0(@capacitor/core@8.0.0)':
dependencies:
'@capacitor/core': 8.0.0
'@capacitor/haptics@8.0.0(@capacitor/core@8.0.0)': '@capacitor/haptics@8.0.0(@capacitor/core@8.0.0)':
dependencies: dependencies:
'@capacitor/core': 8.0.0 '@capacitor/core': 8.0.0

View File

@ -0,0 +1,47 @@
{
"background_color": "#262626",
"icons": [
{
"src": "../icons/icon-48.webp",
"type": "image/png",
"sizes": "48x48",
"purpose": "any maskable"
},
{
"src": "../icons/icon-72.webp",
"type": "image/png",
"sizes": "72x72",
"purpose": "any maskable"
},
{
"src": "../icons/icon-96.webp",
"type": "image/png",
"sizes": "96x96",
"purpose": "any maskable"
},
{
"src": "../icons/icon-128.webp",
"type": "image/png",
"sizes": "128x128",
"purpose": "any maskable"
},
{
"src": "../icons/icon-192.webp",
"type": "image/png",
"sizes": "192x192",
"purpose": "any maskable"
},
{
"src": "../icons/icon-256.webp",
"type": "image/png",
"sizes": "256x256",
"purpose": "any maskable"
},
{
"src": "../icons/icon-512.webp",
"type": "image/png",
"sizes": "512x512",
"purpose": "any maskable"
}
]
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.8 KiB