Skip to content

Commit

Permalink
fix(desktop): google api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Oct 20, 2021
1 parent 4bfb081 commit aecade1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
17 changes: 16 additions & 1 deletion desktop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function createWindow () {
webPreferences: {
contextIsolation: false,
enableRemoteModule: false,
webSecurity: true,
webSecurity: false,
nodeIntegration: true
}
})
Expand All @@ -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);
});
*/
}


Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions src/use/google/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ export const useFonts = () => {
}

const get = async () => {
if (isElectron()) {
const normalize = {}
const names: Array<any> = []

return { normalize, names }
}

let normalize: Record<string, any> = {}
const names: Array<string> = []

Expand Down
4 changes: 2 additions & 2 deletions src/use/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ export const usePDF = () => {
if (store.state.pdf.normalize['Roboto'])
set['Roboto'] = store.state.pdf.normalize['Roboto']

// @ts-ignore
;(<any>pdfMake).fonts = set
// @ts-ignore
// ;(<any>pdfMake).fonts = set
}

const create = (): void => {
Expand Down
9 changes: 5 additions & 4 deletions src/use/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> = () => {
const store = useStore()
Expand All @@ -17,6 +18,7 @@ export const useStart: Callback<void> = () => {
const pdf = usePDF()
const env = useEnv()
const format = useFormat()
const utils = useUtils()
const { t } = i18n.global

const global = () => {
Expand Down Expand Up @@ -135,13 +137,12 @@ export const useStart: Callback<void> = () => {
const init = () => {
dark()
lang()
auth()
pdf.init()
initial()

if (isElectron()) return

initial()
global()
auth()
pdf.init()
}

return { init }
Expand Down
8 changes: 7 additions & 1 deletion src/use/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

0 comments on commit aecade1

Please sign in to comment.