mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-18 21:10:57 +08:00
66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
import { createApp } from 'vue'
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import './assets/global.css'
|
|
import Toast, { POSITION } from 'vue-toastification'
|
|
import 'vue-toastification/dist/index.css'
|
|
import './assets/toast.css'
|
|
// Use Sugar theme from vue-toast-notification for better toast styling.
|
|
// If you prefer Bootstrap style, replace with theme-bootstrap.css instead.
|
|
import { useToast } from 'vue-toastification'
|
|
import { checkToken, clearToken, isLogin } from './utils/auth'
|
|
import { loginWithGoogle } from './utils/google'
|
|
import { initTheme } from './utils/theme'
|
|
import { clearVditorStorage } from './utils/clearVditorStorage'
|
|
import { initIOSKeyboardFix } from './utils/iosKeyboardFix'
|
|
|
|
// 采用本地开发环境
|
|
// export const API_DOMAIN = 'http://127.0.0.1'
|
|
// export const API_PORT = 8081
|
|
|
|
// 采用线上环境
|
|
export const API_DOMAIN = 'https://www.open-isle.com'
|
|
export const API_PORT = ''
|
|
|
|
// For 开发
|
|
// export const API_BASE_URL = API_PORT ? `${API_DOMAIN}:${API_PORT}` : API_DOMAIN
|
|
// 线上部署
|
|
export const API_BASE_URL = ""
|
|
|
|
export const GOOGLE_CLIENT_ID = '777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com'
|
|
export const GITHUB_CLIENT_ID = 'Ov23liVkO1NPAX5JyWxJ'
|
|
export const DISCORD_CLIENT_ID = '1394985417044000779'
|
|
export const TWITTER_CLIENT_ID = 'ZTRTU05KSk9KTTJrTTdrVC1tc1E6MTpjaQ'
|
|
export const toast = useToast()
|
|
|
|
initTheme()
|
|
clearVditorStorage()
|
|
initIOSKeyboardFix()
|
|
|
|
const app = createApp(App)
|
|
app.use(router)
|
|
app.use(
|
|
Toast,
|
|
{
|
|
position: POSITION.TOP_RIGHT,
|
|
containerClassName: "open-isle-toast-style-v1",
|
|
transition: "Vue-Toastification__fade",
|
|
// closeButton: false,
|
|
timeout: 2000,
|
|
},
|
|
)
|
|
|
|
app.mount('#app')
|
|
|
|
checkToken().then(valid => {
|
|
if (!valid) {
|
|
clearToken()
|
|
}
|
|
|
|
// 引导用户优先采用Google Login登录
|
|
if (!isLogin()) {
|
|
setTimeout(() => {
|
|
loginWithGoogle()
|
|
}, 3000)
|
|
}
|
|
}) |