2023-03-17 15:46:55 -04:00
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
import router from '@/routes'
|
|
|
|
|
import App from '@/App.vue'
|
|
|
|
|
import { createPinia } from 'pinia'
|
2023-04-26 10:28:08 -07:00
|
|
|
import 'omorphia/dist/style.css'
|
2023-04-06 21:06:37 -04:00
|
|
|
import '@/assets/stylesheets/global.scss'
|
2023-06-02 07:09:46 -07:00
|
|
|
import 'floating-vue/dist/style.css'
|
2023-04-08 18:54:38 -07:00
|
|
|
import FloatingVue from 'floating-vue'
|
2023-06-30 08:11:32 -07:00
|
|
|
import { get_opening_command, initialize_state } from '@/helpers/state'
|
2023-04-19 11:44:44 -07:00
|
|
|
import loadCssMixin from './mixins/macCssFix.js'
|
2023-06-30 08:11:32 -07:00
|
|
|
import { get } from '@/helpers/settings'
|
2023-07-26 20:33:03 -07:00
|
|
|
import { invoke } from '@tauri-apps/api'
|
|
|
|
|
import { isDev } from './helpers/utils.js'
|
2023-02-27 09:11:34 -07:00
|
|
|
|
2023-03-17 15:46:55 -04:00
|
|
|
const pinia = createPinia()
|
|
|
|
|
|
2023-04-26 10:28:08 -07:00
|
|
|
let app = createApp(App)
|
|
|
|
|
app.use(router)
|
|
|
|
|
app.use(pinia)
|
|
|
|
|
app.use(FloatingVue)
|
|
|
|
|
app.mixin(loadCssMixin)
|
|
|
|
|
|
2023-05-10 18:50:42 -04:00
|
|
|
const mountedApp = app.mount('#app')
|
|
|
|
|
|
2023-07-26 20:33:03 -07:00
|
|
|
const raw_invoke = async (plugin, fn, args) => {
|
|
|
|
|
return await invoke('plugin:' + plugin + '|' + fn, args)
|
|
|
|
|
}
|
|
|
|
|
isDev()
|
|
|
|
|
.then((dev) => {
|
|
|
|
|
if (dev) {
|
|
|
|
|
window.raw_invoke = raw_invoke
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.error(err)
|
|
|
|
|
})
|
|
|
|
|
|
2023-04-08 18:54:38 -07:00
|
|
|
initialize_state()
|
2023-06-30 08:11:32 -07:00
|
|
|
.then(() => {
|
|
|
|
|
// First, redirect to other landing page if we have that setting
|
|
|
|
|
get()
|
|
|
|
|
.then((fetchSettings) => {
|
|
|
|
|
if (fetchSettings?.default_page && fetchSettings?.default_page !== 'Home') {
|
|
|
|
|
router.push({ name: fetchSettings?.default_page })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.error(err)
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
mountedApp.initialize()
|
|
|
|
|
get_opening_command().then((command) => {
|
|
|
|
|
console.log(JSON.stringify(command)) // change me to use whatever FE command handler is made
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
2023-04-26 10:28:08 -07:00
|
|
|
.catch((err) => {
|
|
|
|
|
console.error(err)
|
2023-04-08 18:54:38 -07:00
|
|
|
})
|