mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-09 06:22:16 +08:00
✨ Feature(custom): upgrade to electron v39 and electron-vite 5.0, suppress derecation notification
This commit is contained in:
@@ -43,7 +43,7 @@ export function setMiniWindowShape(win: BrowserWindow) {
|
||||
win.setShape(shape)
|
||||
}
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const preloadPath = fileURLToPath(new URL('../preload/index.mjs', import.meta.url))
|
||||
|
||||
const { width: defaultWindowWidth, height: defaultWindowHeight } = getDefaultWindowSizes()
|
||||
@@ -181,7 +181,7 @@ windowList.set(IWindowList.TRAY_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(process.env.ELECTRON_RENDERER_URL)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'))
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'))
|
||||
}
|
||||
window.on('blur', () => {
|
||||
window.hide()
|
||||
@@ -197,7 +197,7 @@ windowList.set(IWindowList.SETTING_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#main-page/upload`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'main-page/upload',
|
||||
})
|
||||
}
|
||||
@@ -222,7 +222,7 @@ windowList.set(IWindowList.MINI_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#mini-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'mini-page',
|
||||
})
|
||||
}
|
||||
@@ -237,7 +237,7 @@ windowList.set(IWindowList.RENAME_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#rename-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'rename-page',
|
||||
})
|
||||
}
|
||||
@@ -259,7 +259,7 @@ windowList.set(IWindowList.TOOLBOX_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#toolbox-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'toolbox-page',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import yaml from 'js-yaml'
|
||||
import type { ILocales, ILocalesKey } from '#/types/i18n'
|
||||
import type { II18nItem, IStringKeyMap } from '#/types/types'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const builtinI18nList: II18nItem[] = [
|
||||
{
|
||||
@@ -26,7 +26,7 @@ const builtinI18nList: II18nItem[] = [
|
||||
]
|
||||
class I18nManager {
|
||||
private i18n: I18n | null = null
|
||||
private builtinI18nFolder = path.join(__dirname, '../../resources', 'i18n').replace('app.asar', 'app.asar.unpacked')
|
||||
private builtinI18nFolder = path.join(dirname, '../../resources', 'i18n').replace('app.asar', 'app.asar.unpacked')
|
||||
private outterI18nFolder = ''
|
||||
private localesMap = new Map<string, ILocales>()
|
||||
private currentLanguage: string = 'zh-CN'
|
||||
|
||||
@@ -39,6 +39,7 @@ import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||
import updateChecker from '~/utils/updateChecker'
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
process.noDeprecation = true
|
||||
|
||||
const handleStartUpFiles = (argv: string[], cwd: string) => {
|
||||
const files = getUploadFiles(argv, cwd, logger)
|
||||
|
||||
@@ -11,7 +11,7 @@ import { i18nManager } from '~/i18n'
|
||||
|
||||
const configPath = dbPathChecker()
|
||||
const CONFIG_DIR = path.dirname(configPath)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
function beforeOpen() {
|
||||
if (process.platform === 'darwin') {
|
||||
@@ -50,7 +50,7 @@ function resolveMacWorkFlow() {
|
||||
try {
|
||||
copyFileOutsideOfElectronAsar(
|
||||
path
|
||||
.join(__dirname, '../../resources', 'Upload pictures with PicList.workflow')
|
||||
.join(dirname, '../../resources', 'Upload pictures with PicList.workflow')
|
||||
.replace('app.asar', 'app.asar.unpacked'),
|
||||
dest,
|
||||
)
|
||||
@@ -93,7 +93,7 @@ function resolveClipboardImageGenerator() {
|
||||
|
||||
return files.map(item => {
|
||||
return {
|
||||
origin: path.join(__dirname, '../../resources', item).replace('app.asar', 'app.asar.unpacked'),
|
||||
origin: path.join(dirname, '../../resources', item).replace('app.asar', 'app.asar.unpacked'),
|
||||
dest: path.join(CONFIG_DIR, item),
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user