yandere_fe/src/main.js

94 lines
2.6 KiB
JavaScript
Raw Normal View History

2016-10-26 07:46:32 -07:00
import Vue from 'vue'
2016-10-26 10:03:55 -07:00
import VueRouter from 'vue-router'
import Vuex from 'vuex'
2018-09-09 09:36:13 -07:00
import interfaceModule from './modules/interface.js'
2018-09-09 11:21:23 -07:00
import instanceModule from './modules/instance.js'
2016-10-27 09:03:25 -07:00
import statusesModule from './modules/statuses.js'
import usersModule from './modules/users.js'
import apiModule from './modules/api.js'
import configModule from './modules/config.js'
2017-12-05 02:47:10 -08:00
import chatModule from './modules/chat.js'
2018-10-26 06:16:23 -07:00
import oauthModule from './modules/oauth.js'
import authFlowModule from './modules/auth_flow.js'
import mediaViewerModule from './modules/media_viewer.js'
import oauthTokensModule from './modules/oauth_tokens.js'
2019-03-19 01:53:11 -07:00
import reportsModule from './modules/reports.js'
import pollsModule from './modules/polls.js'
2016-10-26 10:03:55 -07:00
2017-11-07 06:14:37 -08:00
import VueI18n from 'vue-i18n'
import createPersistedState from './lib/persisted_state.js'
2018-12-25 05:43:18 -08:00
import pushNotifications from './lib/push_notifications_plugin.js'
2017-02-14 13:42:13 -08:00
2017-11-07 06:14:37 -08:00
import messages from './i18n/messages.js'
2018-01-26 06:11:34 -08:00
import VueChatScroll from 'vue-chat-scroll'
2019-04-02 10:18:36 -07:00
import VueClickOutside from 'v-click-outside'
2019-05-20 13:19:59 -07:00
import PortalVue from 'portal-vue'
2019-07-11 05:30:35 -07:00
import VTooltip from 'v-tooltip'
2018-01-26 06:11:34 -08:00
2018-10-26 06:16:23 -07:00
import afterStoreSetup from './boot/after_store.js'
2017-11-08 12:18:42 -08:00
const currentLocale = (window.navigator.language || 'en').split('-')[0]
2016-10-26 10:03:55 -07:00
Vue.use(Vuex)
Vue.use(VueRouter)
2017-11-07 06:14:37 -08:00
Vue.use(VueI18n)
2018-01-26 06:11:34 -08:00
Vue.use(VueChatScroll)
2019-04-02 10:18:36 -07:00
Vue.use(VueClickOutside)
2019-05-20 13:19:59 -07:00
Vue.use(PortalVue)
2019-07-11 05:30:35 -07:00
Vue.use(VTooltip)
2016-10-26 10:03:55 -07:00
2017-11-07 06:14:37 -08:00
const i18n = new VueI18n({
// By default, use the browser locale, we will update it if neccessary
2017-11-07 06:23:00 -08:00
locale: currentLocale,
2017-11-07 06:14:37 -08:00
fallbackLocale: 'en',
messages
})
2018-10-26 06:16:23 -07:00
const persistedStateOptions = {
paths: [
'config',
'users.lastLoginName',
'oauth'
]
2019-03-13 03:29:45 -07:00
};
2018-12-13 03:04:09 -08:00
2019-03-13 03:29:45 -07:00
(async () => {
const persistedState = await createPersistedState(persistedStateOptions)
2018-10-26 06:16:23 -07:00
const store = new Vuex.Store({
modules: {
2019-03-31 18:59:18 -07:00
i18n: {
getters: {
i18n: () => i18n
}
},
2018-10-26 06:16:23 -07:00
interface: interfaceModule,
instance: instanceModule,
statuses: statusesModule,
users: usersModule,
api: apiModule,
config: configModule,
chat: chatModule,
oauth: oauthModule,
authFlow: authFlowModule,
mediaViewer: mediaViewerModule,
2019-03-19 01:53:11 -07:00
oauthTokens: oauthTokensModule,
reports: reportsModule,
polls: pollsModule
2018-10-26 06:16:23 -07:00
},
2018-12-25 05:43:18 -08:00
plugins: [persistedState, pushNotifications],
2018-10-26 06:16:23 -07:00
strict: false // Socket modifies itself, let's ignore this for now.
// strict: process.env.NODE_ENV !== 'production'
2018-02-03 07:27:33 -08:00
})
afterStoreSetup({ store, i18n })
2019-03-13 03:29:45 -07:00
})()
// These are inlined by webpack's DefinePlugin
/* eslint-disable */
window.___pleromafe_mode = process.env
window.___pleromafe_commit_hash = COMMIT_HASH
window.___pleromafe_dev_overrides = DEV_OVERRIDES