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