build: prune admin bundle
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/900/head
parent
664bbae0ca
commit
ba473e6314
|
@ -3,7 +3,9 @@ import './bootstrap';
|
|||
import Vue from 'vue';
|
||||
import App from '@components/admin/AdminMain.vue';
|
||||
|
||||
_m.mode = 'admin';
|
||||
globalThis._m = {
|
||||
mode: 'admin',
|
||||
} as any;
|
||||
|
||||
export default new Vue({
|
||||
el: '#vue-content',
|
||||
|
|
|
@ -6,42 +6,15 @@ 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 VueVirtualScroller from 'vue-virtual-scroller';
|
||||
|
||||
// Locals
|
||||
import router, { routes } from './router';
|
||||
import { constants, initstate } from '@services/utils';
|
||||
import { translate, translatePlural } from '@services/l10n';
|
||||
|
||||
// CSS for components
|
||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
||||
|
||||
// Global CSS
|
||||
import './styles/global.scss';
|
||||
|
||||
// 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,
|
||||
},
|
||||
};
|
||||
|
||||
// CSP config for webpack dynamic chunk loading
|
||||
__webpack_nonce__ = window.btoa(getRequestToken() ?? '');
|
||||
|
||||
|
@ -51,20 +24,12 @@ __webpack_nonce__ = window.btoa(getRequestToken() ?? '');
|
|||
// 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
|
||||
_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);
|
||||
|
||||
// Turn on virtual keyboard support
|
||||
if ('virtualKeyboard' in navigator) {
|
||||
(<any>navigator.virtualKeyboard).overlaysContent = true;
|
||||
}
|
||||
|
||||
// Register global components and plugins
|
||||
Vue.use(VueVirtualScroller);
|
||||
Vue.component('XImg', XImg);
|
||||
Vue.component('XLoadingIcon', XLoadingIcon);
|
||||
|
||||
// Register global constants and functions
|
||||
|
|
|
@ -78,7 +78,6 @@ export default defineComponent({
|
|||
|
||||
methods: {
|
||||
async refreshSystemConfig() {
|
||||
console.log(this.components);
|
||||
try {
|
||||
this.loading++;
|
||||
const res = await axios.get<ISystemConfig>(API.SYSTEM_CONFIG(null));
|
||||
|
|
|
@ -27,7 +27,10 @@ declare global {
|
|||
};
|
||||
};
|
||||
|
||||
/** Global Memories object. Initialized in src/bootstrap.ts */
|
||||
/**
|
||||
* Global Memories object. Initialized in main.ts
|
||||
* Most of this is not available for admin.ts.
|
||||
*/
|
||||
var _m: {
|
||||
mode: 'admin' | 'user';
|
||||
route: Route;
|
||||
|
|
40
src/main.ts
40
src/main.ts
|
@ -2,9 +2,45 @@ import './bootstrap';
|
|||
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import router, { routes } from './router';
|
||||
|
||||
_m.mode = 'user';
|
||||
// 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';
|
||||
|
||||
// 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',
|
||||
|
|
|
@ -190,6 +190,9 @@ export const fragment = {
|
|||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Skip unless in user mode
|
||||
if (_m.mode !== 'user') return;
|
||||
|
||||
// Only contextual fragments should be present on page load
|
||||
if (fragment.list.length) {
|
||||
const contextual = fragment.list.filter((frag) => frag.type === FragmentType.viewer);
|
||||
|
|
Loading…
Reference in New Issue