2023-05-26 16:47:05 +00:00
|
|
|
// Library imports
|
|
|
|
import 'reflect-metadata';
|
|
|
|
import Vue from 'vue';
|
2023-10-16 18:15:02 +00:00
|
|
|
|
2023-05-26 16:47:05 +00:00
|
|
|
import { generateFilePath } from '@nextcloud/router';
|
|
|
|
import { getRequestToken } from '@nextcloud/auth';
|
2023-10-16 18:15:02 +00:00
|
|
|
import { translate, translatePlural } from '@nextcloud/l10n';
|
2023-05-26 16:47:05 +00:00
|
|
|
|
|
|
|
// Global components
|
|
|
|
import XImg from './components/frame/XImg.vue';
|
|
|
|
import XLoadingIcon from './components/XLoadingIcon.vue';
|
|
|
|
import VueVirtualScroller from 'vue-virtual-scroller';
|
|
|
|
|
|
|
|
// Locals
|
2023-10-16 19:42:18 +00:00
|
|
|
import router, { routes } from './router';
|
2023-10-16 18:23:01 +00:00
|
|
|
import { constants, initstate } from './services/utils';
|
2023-05-26 16:47:05 +00:00
|
|
|
|
|
|
|
// 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-10-16 19:42:18 +00:00
|
|
|
routes: routes,
|
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
|
2023-10-19 18:57:26 +00:00
|
|
|
_m.video.clientId = Math.random().toString(36).substring(2, 15).padEnd(12, '0');
|
|
|
|
_m.video.clientIdPersistent = localStorage.getItem('videoClientIdPersistent') ?? _m.video.clientId;
|
2023-10-13 17:32:07 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-10-16 18:15:02 +00:00
|
|
|
// Register global components and plugins
|
2023-05-26 16:47:05 +00:00
|
|
|
Vue.use(VueVirtualScroller);
|
|
|
|
Vue.component('XImg', XImg);
|
|
|
|
Vue.component('XLoadingIcon', XLoadingIcon);
|
2023-10-16 18:15:02 +00:00
|
|
|
|
|
|
|
// Register global constants and functions
|
2023-10-16 18:23:01 +00:00
|
|
|
Vue.prototype.c = constants;
|
|
|
|
Vue.prototype.initstate = initstate;
|
2023-10-16 18:15:02 +00:00
|
|
|
Vue.prototype.t = translate;
|
|
|
|
Vue.prototype.n = translatePlural;
|