forked from distante/memories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
50 lines (40 loc) · 1.21 KB
/
main.ts
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
import './bootstrap';
import Vue from 'vue';
import App from './App.vue';
import router, { routes } from './router';
// Global components
import XImg from '@components/frame/XImg.vue';
import VueVirtualScroller from 'vue-virtual-scroller';
// CSS for components
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
import '@nextcloud/dialogs/style.css';
// Initialize global memories object
globalThis._m = {
mode: 'user',
get route() {
return router.currentRoute;
},
router: router,
routes: routes,
modals: {} as any,
sidebar: {} as any,
viewer: {} as any,
video: {} as any,
window: {
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
},
};
// Generate client id for this instance
// Does not need to be cryptographically secure
_m.video.clientId = Math.random().toString(36).substring(2, 15).padEnd(12, '0');
_m.video.clientIdPersistent = localStorage.getItem('videoClientIdPersistent') ?? _m.video.clientId;
localStorage.setItem('videoClientIdPersistent', _m.video.clientIdPersistent);
// Register global components and plugins
Vue.use(VueVirtualScroller);
Vue.component('XImg', XImg);
export default new Vue({
el: '#content',
router,
render: (h) => h(App),
});