куча говна
All checks were successful
Deploy / deploy (push) Successful in 4m32s

This commit is contained in:
Никита Круглицкий
2025-10-20 00:10:13 +06:00
parent 31460598ba
commit ec67be8aa6
50 changed files with 1616 additions and 1011 deletions

View File

@@ -0,0 +1,41 @@
import { relaunch } from '@tauri-apps/plugin-process'
import { check } from '@tauri-apps/plugin-updater'
export default defineNuxtRouteMiddleware(async (to, from) => {
if (from?.name)
return
const update = await check()
console.log(update)
if (import.meta.dev)
return
if (update) {
console.log(
`found update ${update.version} from ${update.date} with notes ${update.body}`,
)
let downloaded = 0
let contentLength = 0
// alternatively we could also call update.download() and update.install() separately
await update.downloadAndInstall((event) => {
switch (event.event) {
case 'Started':
contentLength = event.data.contentLength ?? 0
console.log(`started downloading ${event.data.contentLength} bytes`)
break
case 'Progress':
downloaded += event.data.chunkLength
console.log(`downloaded ${downloaded} from ${contentLength}`)
break
case 'Finished':
console.log('download finished')
break
}
})
console.log('update installed')
await relaunch()
}
})

View File

@@ -0,0 +1,20 @@
import chadApi from '#shared/chad-api'
export default defineNuxtRouteMiddleware(async (to, from) => {
const { me, setMe } = useAuth()
if (!me.value && !from?.name) {
try {
setMe(await chadApi('/me'))
}
catch {
if (to.meta.auth !== 'guest') {
return navigateTo({ name: 'Login' })
}
}
}
if (me.value && to.meta.auth === 'guest') {
return navigateTo('/')
}
})

View File

@@ -1,5 +0,0 @@
export default defineNuxtRouteMiddleware((to, from) => {
console.group('Build Info')
console.log(`COMMIT_SHA: ${__COMMIT_SHA__}`)
console.groupEnd()
})

View File

@@ -1,18 +0,0 @@
export default defineNuxtRouteMiddleware((to, from) => {
const { username } = usePreferences()
if (!username.value && to.name !== 'Login') {
return navigateTo({ name: 'Login' })
}
if (!username.value)
return
const { init } = useMediasoup()
init()
if (to.path === 'Login') {
return navigateTo('/')
}
})