diff --git a/desktop/index.ts b/desktop/index.ts index 0334d7863..bf2b1b0f4 100644 --- a/desktop/index.ts +++ b/desktop/index.ts @@ -24,7 +24,7 @@ function createWindow () { webPreferences: { contextIsolation: false, enableRemoteModule: false, - webSecurity: true, + webSecurity: false, nodeIntegration: true } }) @@ -45,6 +45,21 @@ function createWindow () { mainWindow.once('ready-to-show', () => { mainWindow?.show() }) + + /* + mainWindow.webContents.on('will-navigate', function (event: any, newUrl: string) { + console.log(newUrl); + // More complex code to handle tokens goes here + }); + + mainWindow.webContents.on('did-get-redirect-request', function( + event: any, + oldUrl: string, + newUrl: string + ) { + console.log(newUrl); + }); + */ } diff --git a/package.json b/package.json index d07e97f9f..0b328e4b9 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "desktop:dev": "concurrently -k \"cross-env BROWSER=none yarn dev\" \"yarn desktop:set\"", "desktop:start": "cross-env NODE_ENV=development electron dist/main/index.js", "desktop:build": "cross-env NODE_ENV=production tsc desktop/index.ts --moduleResolution Node --removeComments -t esnext --outDir dist/main && yarn build && electron-builder", + "desktop:view": "yarn desktop:build && yarn desktop:dev", "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src && yarn format", "format": "prettier src/**/*.{vue,css,ts} --write", "test": "jest", diff --git a/src/use/google/fonts.ts b/src/use/google/fonts.ts index 3a99e40a1..02c8a3a4a 100644 --- a/src/use/google/fonts.ts +++ b/src/use/google/fonts.ts @@ -31,13 +31,6 @@ export const useFonts = () => { } const get = async () => { - if (isElectron()) { - const normalize = {} - const names: Array = [] - - return { normalize, names } - } - let normalize: Record = {} const names: Array = [] diff --git a/src/use/pdf.ts b/src/use/pdf.ts index 3007992e6..51d827647 100644 --- a/src/use/pdf.ts +++ b/src/use/pdf.ts @@ -506,8 +506,8 @@ export const usePDF = () => { if (store.state.pdf.normalize['Roboto']) set['Roboto'] = store.state.pdf.normalize['Roboto'] - // @ts-ignore - ;(pdfMake).fonts = set + // @ts-ignore + // ;(pdfMake).fonts = set } const create = (): void => { diff --git a/src/use/start.ts b/src/use/start.ts index 9e8a7b4e5..3ddd3b705 100644 --- a/src/use/start.ts +++ b/src/use/start.ts @@ -8,6 +8,7 @@ import { useToast } from 'vue-toastification' import { useEnv } from './env' import i18n from '@/lang' import isElectron from 'is-electron' +import { useUtils } from './utils' export const useStart: Callback = () => { const store = useStore() @@ -17,6 +18,7 @@ export const useStart: Callback = () => { const pdf = usePDF() const env = useEnv() const format = useFormat() + const utils = useUtils() const { t } = i18n.global const global = () => { @@ -135,13 +137,12 @@ export const useStart: Callback = () => { const init = () => { dark() lang() + auth() + pdf.init() + initial() if (isElectron()) return - - initial() global() - auth() - pdf.init() } return { init } diff --git a/src/use/utils.ts b/src/use/utils.ts index f3ac78d34..80b55d8d4 100644 --- a/src/use/utils.ts +++ b/src/use/utils.ts @@ -18,5 +18,11 @@ export const useUtils = () => { return { insert } } - return { delay, prevent, array } + const join = (parts: any, sep?: any): string => { + var separator = sep || '/' + var replace = new RegExp(separator + '{1,}', 'g') + return parts.join(separator).replace(replace, separator) + } + + return { delay, prevent, array, join } }