2023-05-26 16:47:05 +00:00
|
|
|
// Library imports
|
|
|
|
import 'reflect-metadata';
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { generateFilePath } from '@nextcloud/router';
|
|
|
|
import { getRequestToken } from '@nextcloud/auth';
|
|
|
|
|
|
|
|
// Global components
|
|
|
|
import XImg from './components/frame/XImg.vue';
|
|
|
|
import XLoadingIcon from './components/XLoadingIcon.vue';
|
|
|
|
import GlobalMixin from './mixins/GlobalMixin';
|
|
|
|
import VueVirtualScroller from 'vue-virtual-scroller';
|
|
|
|
|
|
|
|
// Locals
|
|
|
|
import router from './router';
|
|
|
|
|
|
|
|
// CSS for components
|
|
|
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
|
|
|
|
|
|
|
// Global CSS
|
2023-08-22 01:17:55 +00:00
|
|
|
import './styles/global.scss';
|
2023-05-26 16:47:05 +00:00
|
|
|
|
2023-10-13 17:32:07 +00:00
|
|
|
// Initialize global memories object
|
|
|
|
globalThis._m = {
|
|
|
|
mode: 'user',
|
|
|
|
|
|
|
|
get route() {
|
|
|
|
return router.currentRoute;
|
|
|
|
},
|
2023-05-26 16:47:05 +00:00
|
|
|
|
2023-10-13 17:32:07 +00:00
|
|
|
modals: {} as any,
|
|
|
|
sidebar: {} as any,
|
|
|
|
viewer: {} as any,
|
|
|
|
video: {} as any,
|
2023-09-30 17:30:59 +00:00
|
|
|
|
2023-10-13 17:32:07 +00:00
|
|
|
window: {
|
|
|
|
innerWidth: window.innerWidth,
|
|
|
|
innerHeight: window.innerHeight,
|
|
|
|
},
|
|
|
|
};
|
2023-05-26 16:47:05 +00:00
|
|
|
|
|
|
|
// CSP config for webpack dynamic chunk loading
|
|
|
|
__webpack_nonce__ = window.btoa(getRequestToken() ?? '');
|
|
|
|
|
|
|
|
// Correct the root of the app for chunk loading
|
|
|
|
// OC.linkTo matches the apps folders
|
|
|
|
// OC.generateUrl ensure the index.php (or not)
|
|
|
|
// We do not want the index.php since we're loading files
|
|
|
|
__webpack_public_path__ = generateFilePath('memories', '', 'js/');
|
|
|
|
|
|
|
|
// Generate client id for this instance
|
|
|
|
// Does not need to be cryptographically secure
|
|
|
|
const getClientId = (): string => Math.random().toString(36).substring(2, 15).padEnd(12, '0');
|
2023-10-13 17:32:07 +00:00
|
|
|
_m.video.clientId = getClientId();
|
|
|
|
_m.video.clientIdPersistent = localStorage.getItem('videoClientIdPersistent') ?? getClientId();
|
|
|
|
localStorage.setItem('videoClientIdPersistent', _m.video.clientIdPersistent);
|
2023-05-26 16:47:05 +00:00
|
|
|
|
|
|
|
// Turn on virtual keyboard support
|
|
|
|
if ('virtualKeyboard' in navigator) {
|
|
|
|
(<any>navigator.virtualKeyboard).overlaysContent = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.mixin(GlobalMixin as any);
|
|
|
|
Vue.use(VueVirtualScroller);
|
|
|
|
Vue.component('XImg', XImg);
|
|
|
|
Vue.component('XLoadingIcon', XLoadingIcon);
|