/
main.js
87 lines (81 loc) · 2.5 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import Vue from 'vue'
import App from './App.vue'
import VueNativeSock from 'vue-native-websocket'
import store from './store/store'
import {router} from "./router/router";
import BootstrapVue from 'bootstrap-vue'
import VueChatScroll from 'vue-chat-scroll'
import GetTextPlugin from 'vue-gettext'
import translations from '../translations/translations.json'
import { library } from '@fortawesome/fontawesome-svg-core'
import LinkifyHtml from 'linkifyjs/html'
import VueSanitize from "vue-sanitize";
import {
faArrowLeft,
faEllipsisV,
faPencilAlt,
faTrash,
faUserFriends,
faPaperPlane,
faTimes,
faCheck,
faVolumeMute,
faHeart,
faSearch,
faArrowDown,
faPlus
} from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
library.add(faArrowLeft, faEllipsisV, faPencilAlt, faPlus, faTrash, faPaperPlane,
faUserFriends, faTimes, faCheck, faVolumeMute, faHeart, faSearch, faArrowDown)
import { longClickDirective } from 'vue-long-click'
const longClickInstance = longClickDirective({ delay: 800, interval: 0 })
Vue.directive('longclick', longClickInstance)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(VueChatScroll)
Vue.use(BootstrapVue)
Vue.mixin({
methods: {
linkify: function (content) {
return LinkifyHtml(content);
},
},
})
var defaultSanitizeOptions = {
allowedTags: [],
allowedAttributes: {
}
};
Vue.use(VueSanitize, defaultSanitizeOptions);
Vue.use(GetTextPlugin, { translations: translations, defaultLanguage: 'en', })
Vue.config.productionTip = false
// set backend adress
var websocketAdress = "ws://";
if (window.location.protocol === "https:") {
websocketAdress = "wss://";
}
websocketAdress += window.location.host;
websocketAdress += "/ws";
if (process.env.NODE_ENV == "development") {
if (process.env.VUE_APP_WS_ADDRESS) {
websocketAdress = 'ws://' + process.env.VUE_APP_WS_ADDRESS + ':9080/ws';
} else {
websocketAdress = 'ws://localhost:9080/ws';
}
}
// initialise connection to the backend
Vue.use(VueNativeSock, websocketAdress,
{
store: store,
// format: 'json',
reconnection: true, // (Boolean) whether to reconnect automatically (false)
reconnectionAttempts: 5, // (Number) number of reconnection attempts before giving up (Infinity),
reconnectionDelay: 3000, // (Number) how long to initially wait before attempting a new (1000) }
}
)
export default new Vue({
store,
router,
render: h => h(App),
}).$mount('#app')
// Vue.use(VueSocketio, `//${window.location.host}`, store);