mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 14:48:13 -05:00
📦 Chore: types change
This commit is contained in:
parent
f3ec0cb4be
commit
43d2a8e5c8
@ -44,7 +44,7 @@
|
|||||||
"keycode": "^2.2.0",
|
"keycode": "^2.2.0",
|
||||||
"lodash-id": "^0.14.0",
|
"lodash-id": "^0.14.0",
|
||||||
"lowdb": "^1.0.0",
|
"lowdb": "^1.0.0",
|
||||||
"picgo": "^1.4.24",
|
"picgo": "^1.5.0-alpha.0",
|
||||||
"qrcode.vue": "^1.7.0",
|
"qrcode.vue": "^1.7.0",
|
||||||
"uuidv4": "^6.2.11",
|
"uuidv4": "^6.2.11",
|
||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
|
@ -11,7 +11,7 @@ import uploader from 'apis/app/uploader'
|
|||||||
import getPicBeds from '~/main/utils/getPicBeds'
|
import getPicBeds from '~/main/utils/getPicBeds'
|
||||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import pasteTemplate from '~/main/utils/pasteTemplate'
|
import pasteTemplate from '~/main/utils/pasteTemplate'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
WebContents
|
WebContents
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import uploader from '.'
|
import uploader from '.'
|
||||||
import pasteTemplate from '~/main/utils/pasteTemplate'
|
import pasteTemplate from '~/main/utils/pasteTemplate'
|
||||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||||
|
@ -8,9 +8,9 @@ import dayjs from 'dayjs'
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import db from '~/main/apis/core/datastore'
|
import db from '~/main/apis/core/datastore'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import util from 'util'
|
import util from 'util'
|
||||||
import { IPicGo } from 'picgo/dist/src/types'
|
import { IPicGo } from 'picgo'
|
||||||
import { showNotification, calcDurationRange } from '~/main/utils/common'
|
import { showNotification, calcDurationRange } from '~/main/utils/common'
|
||||||
import { TALKING_DATA_EVENT } from '~/universal/events/constants'
|
import { TALKING_DATA_EVENT } from '~/universal/events/constants'
|
||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
@ -60,12 +60,12 @@ class Uploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init () {
|
init () {
|
||||||
picgo.on('notification', message => {
|
picgo.on('notification', (message: Electron.NotificationConstructorOptions | undefined) => {
|
||||||
const notification = new Notification(message)
|
const notification = new Notification(message)
|
||||||
notification.show()
|
notification.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
picgo.on('uploadProgress', progress => {
|
picgo.on('uploadProgress', (progress: any) => {
|
||||||
this.webContents?.send('uploadProgress', progress)
|
this.webContents?.send('uploadProgress', progress)
|
||||||
})
|
})
|
||||||
picgo.on('beforeTransform', () => {
|
picgo.on('beforeTransform', () => {
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
export enum IWindowList {
|
|
||||||
SETTING_WINDOW = 'SETTING_WINDOW',
|
|
||||||
TRAY_WINDOW = 'TRAY_WINDOW',
|
|
||||||
MINI_WINDOW = 'MINI_WINDOW',
|
|
||||||
RENAME_WINDOW = 'RENAME_WINDOW'
|
|
||||||
}
|
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
export const TRAY_WINDOW_URL = isDevelopment
|
export const TRAY_WINDOW_URL = isDevelopment
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
IWindowList,
|
|
||||||
SETTING_WINDOW_URL,
|
SETTING_WINDOW_URL,
|
||||||
TRAY_WINDOW_URL,
|
TRAY_WINDOW_URL,
|
||||||
MINI_WINDOW_URL,
|
MINI_WINDOW_URL,
|
||||||
RENAME_WINDOW_URL
|
RENAME_WINDOW_URL
|
||||||
} from './constants'
|
} from './constants'
|
||||||
import { IWindowListItem } from '#/types/electron'
|
import { IWindowList } from '#/types/enum'
|
||||||
import bus from '@core/bus'
|
import bus from '@core/bus'
|
||||||
import { CREATE_APP_MENU } from '@core/bus/constants'
|
import { CREATE_APP_MENU } from '@core/bus/constants'
|
||||||
import db from '~/main/apis/core/datastore'
|
import db from '~/main/apis/core/datastore'
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
BrowserWindow
|
BrowserWindow
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
import { IWindowManager, IWindowListItem } from '#/types/electron'
|
|
||||||
import windowList from './windowList'
|
import windowList from './windowList'
|
||||||
import {
|
import { IWindowList } from '#/types/enum'
|
||||||
IWindowList
|
|
||||||
} from './constants'
|
|
||||||
|
|
||||||
class WindowManager implements IWindowManager {
|
class WindowManager implements IWindowManager {
|
||||||
private windowMap: Map<IWindowList | string, BrowserWindow> = new Map()
|
private windowMap: Map<IWindowList | string, BrowserWindow> = new Map()
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import PicGoCore from '~/universal/types/picgo'
|
|
||||||
import { dbChecker, dbPathChecker } from 'apis/core/datastore/dbChecker'
|
import { dbChecker, dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
// eslint-disable-next-line
|
import { PicGo } from 'picgo'
|
||||||
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
|
||||||
const PicGo = requireFunc('picgo') as typeof PicGoCore
|
|
||||||
|
|
||||||
const CONFIG_PATH = dbPathChecker()
|
const CONFIG_PATH = dbPathChecker()
|
||||||
|
|
||||||
@ -18,4 +15,4 @@ picgo.saveConfig({
|
|||||||
global.PICGO_GUI_VERSION = pkg.version
|
global.PICGO_GUI_VERSION = pkg.version
|
||||||
picgo.GUI_VERSION = global.PICGO_GUI_VERSION
|
picgo.GUI_VERSION = global.PICGO_GUI_VERSION
|
||||||
|
|
||||||
export default picgo! as PicGoCore
|
export default picgo
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
createMenu
|
createMenu
|
||||||
} from 'apis/app/system'
|
} from 'apis/app/system'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import {
|
import {
|
||||||
UPLOAD_WITH_FILES,
|
UPLOAD_WITH_FILES,
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
BrowserWindow
|
BrowserWindow
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import uploader from 'apis/app/uploader'
|
import uploader from 'apis/app/uploader'
|
||||||
import pasteTemplate from '~/main/utils/pasteTemplate'
|
import pasteTemplate from '~/main/utils/pasteTemplate'
|
||||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||||
|
@ -7,14 +7,12 @@ import {
|
|||||||
ipcMain,
|
ipcMain,
|
||||||
clipboard
|
clipboard
|
||||||
} from 'electron'
|
} from 'electron'
|
||||||
import PicGoCore from '~/universal/types/picgo'
|
import { IPasteStyle, IPicGoHelperType, IWindowList } from '#/types/enum'
|
||||||
import { IPasteStyle, IPicGoHelperType } from '#/types/enum'
|
|
||||||
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import { handleStreamlinePluginName } from '~/universal/utils/common'
|
import { handleStreamlinePluginName } from '~/universal/utils/common'
|
||||||
import { IGuiMenuItem } from 'picgo/dist/src/types'
|
import { IGuiMenuItem, PicGo as PicGoCore } from 'picgo'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
|
||||||
import { showNotification } from '~/main/utils/common'
|
import { showNotification } from '~/main/utils/common'
|
||||||
import { dbPathChecker } from 'apis/core/datastore/dbChecker'
|
import { dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||||
import {
|
import {
|
||||||
@ -36,7 +34,7 @@ import pasteTemplate from '../utils/pasteTemplate'
|
|||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
||||||
// const PluginHandler = requireFunc('picgo/dist/lib/PluginHandler').default
|
// const PluginHandler = requireFunc('picgo/lib/PluginHandler').default
|
||||||
const STORE_PATH = path.dirname(dbPathChecker())
|
const STORE_PATH = path.dirname(dbPathChecker())
|
||||||
// const CONFIG_PATH = path.join(STORE_PATH, '/data.json')
|
// const CONFIG_PATH = path.join(STORE_PATH, '/data.json')
|
||||||
|
|
||||||
@ -209,7 +207,8 @@ const handleGetPicBedConfig = () => {
|
|||||||
ipcMain.on('getPicBedConfig', (event: IpcMainEvent, type: string) => {
|
ipcMain.on('getPicBedConfig', (event: IpcMainEvent, type: string) => {
|
||||||
const name = picgo.helper.uploader.get(type)?.name || type
|
const name = picgo.helper.uploader.get(type)?.name || type
|
||||||
if (picgo.helper.uploader.get(type)?.config) {
|
if (picgo.helper.uploader.get(type)?.config) {
|
||||||
const config = handleConfigWithFunction(picgo.helper.uploader.get(type)!.config(picgo))
|
const _config = picgo.helper.uploader.get(type)!.config!(picgo)
|
||||||
|
const config = handleConfigWithFunction(_config)
|
||||||
event.sender.send('getPicBedConfig', config, name)
|
event.sender.send('getPicBedConfig', config, name)
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('getPicBedConfig', [], name)
|
event.sender.send('getPicBedConfig', [], name)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import { Menu, BrowserWindow, app, dialog } from 'electron'
|
import { Menu, BrowserWindow, app, dialog } from 'electron'
|
||||||
import getPicBeds from '~/main/utils/getPicBeds'
|
import getPicBeds from '~/main/utils/getPicBeds'
|
||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
@ -9,9 +9,9 @@ import {
|
|||||||
import { privacyManager } from '~/main/utils/privacyManager'
|
import { privacyManager } from '~/main/utils/privacyManager'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
import GuiApi from 'apis/gui'
|
import GuiApi from 'apis/gui'
|
||||||
import PicGoCore from '~/universal/types/picgo'
|
|
||||||
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN } from '~/universal/events/constants'
|
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN } from '~/universal/events/constants'
|
||||||
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
||||||
|
import { PicGo as PicGoCore } from 'picgo'
|
||||||
|
|
||||||
interface GuiMenuItem {
|
interface GuiMenuItem {
|
||||||
label: string
|
label: string
|
||||||
|
@ -13,7 +13,7 @@ import beforeOpen from '~/main/utils/beforeOpen'
|
|||||||
import fixPath from 'fix-path'
|
import fixPath from 'fix-path'
|
||||||
import ipcList from '~/main/events/ipcList'
|
import ipcList from '~/main/events/ipcList'
|
||||||
import busEventList from '~/main/events/busEventList'
|
import busEventList from '~/main/events/busEventList'
|
||||||
import { IWindowList } from 'apis/app/window/constants'
|
import { IWindowList } from '#/types/enum'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import {
|
import {
|
||||||
updateShortKeyFromVersion212,
|
updateShortKeyFromVersion212,
|
||||||
|
@ -2,7 +2,7 @@ import { DBStore } from '@picgo/store'
|
|||||||
import ConfigStore from '~/main/apis/core/datastore'
|
import ConfigStore from '~/main/apis/core/datastore'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
import PicGoCore from '#/types/picgo'
|
import { PicGo as PicGoCore } from 'picgo'
|
||||||
// from v2.1.2
|
// from v2.1.2
|
||||||
const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
||||||
// #557 极端情况可能会出现配置不存在,需要重新写入
|
// #557 极端情况可能会出现配置不存在,需要重新写入
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import Logger from 'picgo/dist/src/lib/Logger'
|
import { Logger } from 'picgo'
|
||||||
interface IResultFileObject {
|
interface IResultFileObject {
|
||||||
path: string
|
path: string
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import keyDetect from '@/utils/key-binding'
|
import keyDetect from '@/utils/key-binding'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
import { IConfig } from 'picgo/dist/src/types/index'
|
import { IConfig } from 'picgo'
|
||||||
import { PICGO_OPEN_FILE, OPEN_URL } from '#/events/constants'
|
import { PICGO_OPEN_FILE, OPEN_URL } from '#/events/constants'
|
||||||
import {
|
import {
|
||||||
ipcRenderer
|
ipcRenderer
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { IConfig } from 'picgo/dist/src/types'
|
import { IConfig } from 'picgo'
|
||||||
@Component
|
@Component
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
defaultPicBed = 'smms'
|
defaultPicBed = 'smms'
|
||||||
|
16
src/universal/types/electron.d.ts
vendored
16
src/universal/types/electron.d.ts
vendored
@ -1,9 +1,6 @@
|
|||||||
import {
|
// https://stackoverflow.com/questions/45420448/how-to-import-external-type-into-global-d-ts-file
|
||||||
BrowserWindow
|
declare type BrowserWindow = import('electron').BrowserWindow
|
||||||
} from 'electron'
|
declare type IWindowList = import('./enum').IWindowList
|
||||||
import {
|
|
||||||
IWindowList
|
|
||||||
} from 'apis/app/window/constants'
|
|
||||||
|
|
||||||
declare interface IWindowListItem {
|
declare interface IWindowListItem {
|
||||||
isValid: boolean
|
isValid: boolean
|
||||||
@ -20,10 +17,3 @@ declare interface IWindowManager {
|
|||||||
deleteById: (id: number) => void
|
deleteById: (id: number) => void
|
||||||
getAvailableWindow: () => BrowserWindow
|
getAvailableWindow: () => BrowserWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js/44387594#44387594
|
|
||||||
declare global {
|
|
||||||
var PICGO_GUI_VERSION: string
|
|
||||||
var PICGO_CORE_VERSION: string
|
|
||||||
var notificationList: IAppNotification[]
|
|
||||||
}
|
|
||||||
|
@ -20,3 +20,10 @@ export enum IPasteStyle {
|
|||||||
UBB = 'UBB',
|
UBB = 'UBB',
|
||||||
CUSTOM = 'Custom'
|
CUSTOM = 'Custom'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum IWindowList {
|
||||||
|
SETTING_WINDOW = 'SETTING_WINDOW',
|
||||||
|
TRAY_WINDOW = 'TRAY_WINDOW',
|
||||||
|
MINI_WINDOW = 'MINI_WINDOW',
|
||||||
|
RENAME_WINDOW = 'RENAME_WINDOW'
|
||||||
|
}
|
||||||
|
5
src/universal/types/global.d.ts
vendored
Normal file
5
src/universal/types/global.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
// https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js/44387594#44387594
|
||||||
|
declare var PICGO_GUI_VERSION: string
|
||||||
|
declare var PICGO_CORE_VERSION: string
|
||||||
|
declare var notificationList: IAppNotification[]
|
2
src/universal/types/picgo.d.ts
vendored
2
src/universal/types/picgo.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import PicGoCore from 'picgo'
|
|
||||||
export default PicGoCore
|
|
2
src/universal/types/types.d.ts
vendored
2
src/universal/types/types.d.ts
vendored
@ -122,7 +122,7 @@ interface IBounds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PicGo Types
|
// PicGo Types
|
||||||
type ICtx = import('picgo')
|
type ICtx = import('picgo').PicGo
|
||||||
interface IPicGoPlugin {
|
interface IPicGoPlugin {
|
||||||
name: string
|
name: string
|
||||||
fullName: string
|
fullName: string
|
||||||
|
Loading…
Reference in New Issue
Block a user