Files

63 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2024-09-11 09:13:00 +08:00
import Aura from '@primevue/themes/aura'
2024-05-06 11:08:51 +08:00
import PrimeVue from 'primevue/config'
import ToastService from 'primevue/toastservice'
2024-09-11 09:13:00 +08:00
import { createRouter, createWebHistory } from 'vue-router/auto'
import { routes } from 'vue-router/auto-routes'
2024-05-06 11:08:51 +08:00
import App from '~/App.vue'
import EasyTierFrontendLib, { I18nUtils } from 'easytier-frontend-lib'
2024-04-14 23:29:34 +08:00
2024-09-11 09:13:00 +08:00
import { getAutoLaunchStatusAsync, loadAutoLaunchStatusAsync } from './modules/auto_launch'
2024-05-06 11:08:51 +08:00
import '~/styles.css'
import 'easytier-frontend-lib/style.css'
2024-04-14 23:29:34 +08:00
2024-05-05 23:14:37 +08:00
if (import.meta.env.PROD) {
2024-05-06 11:08:51 +08:00
document.addEventListener('keydown', (event) => {
2024-05-05 23:14:37 +08:00
if (
2024-05-06 11:08:51 +08:00
event.key === 'F5'
|| (event.ctrlKey && event.key === 'r')
|| (event.metaKey && event.key === 'r')
2024-09-11 09:13:00 +08:00
) {
2024-05-06 11:08:51 +08:00
event.preventDefault()
2024-09-11 09:13:00 +08:00
}
2024-05-06 11:08:51 +08:00
})
2024-04-14 23:29:34 +08:00
2024-05-06 11:08:51 +08:00
document.addEventListener('contextmenu', (event) => {
event.preventDefault()
})
2024-04-14 23:29:34 +08:00
}
2024-05-07 23:01:23 +08:00
async function main() {
await I18nUtils.loadLanguageAsync(localStorage.getItem('lang') || 'en')
2024-06-04 23:06:10 +08:00
await loadAutoLaunchStatusAsync(getAutoLaunchStatusAsync())
2024-04-14 23:29:34 +08:00
2024-05-07 23:01:23 +08:00
const app = createApp(App)
2024-04-14 23:29:34 +08:00
2024-05-07 23:01:23 +08:00
const router = createRouter({
history: createWebHistory(),
2024-09-11 09:13:00 +08:00
routes,
2024-05-07 23:01:23 +08:00
})
app.use(router)
app.use(createPinia())
app.use(EasyTierFrontendLib)
// app.use(i18n, { useScope: 'global' })
2024-07-08 23:18:10 +08:00
app.use(PrimeVue, {
theme: {
preset: Aura,
options: {
2024-09-11 09:13:00 +08:00
prefix: 'p',
darkModeSelector: 'system',
cssLayer: {
name: 'primevue',
2025-03-16 11:07:35 +08:00
order: 'tailwind-base, primevue, tailwind-utilities',
},
2024-09-11 09:13:00 +08:00
},
},
})
2024-11-08 23:33:17 +08:00
app.use(ToastService as any)
2024-05-07 23:01:23 +08:00
app.mount('#app')
}
2024-05-05 23:14:37 +08:00
2024-05-07 23:01:23 +08:00
main()