mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
feat: 添加 ESLint 配置并优化代码风格,移除未使用的功能
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { ipcMain, WebContents } from 'electron';
|
||||
import { spawn, ChildProcess, exec } from 'node:child_process';
|
||||
import readline from 'node:readline';
|
||||
import { promisify } from 'node:util';
|
||||
import pino from 'pino';
|
||||
|
||||
@@ -122,7 +121,7 @@ const parseUpgradableList = (output: string) => {
|
||||
// Listen for download requests from renderer process
|
||||
ipcMain.on('queue-install', async (event, download_json) => {
|
||||
const download = JSON.parse(download_json);
|
||||
const { id, pkgname, upgradeOnly } = download || {};
|
||||
const { id, pkgname } = download || {};
|
||||
|
||||
if (!id || !pkgname) {
|
||||
logger.warn('passed arguments missing id or pkgname');
|
||||
@@ -151,9 +150,9 @@ ipcMain.on('queue-install', async (event, download_json) => {
|
||||
const webContents = event.sender;
|
||||
|
||||
// 开始组装安装命令
|
||||
let superUserCmd = await checkSuperUserCommand();
|
||||
const superUserCmd = await checkSuperUserCommand();
|
||||
let execCommand = '';
|
||||
let execParams = [];
|
||||
const execParams = [];
|
||||
if (superUserCmd.length > 0) {
|
||||
execCommand = superUserCmd;
|
||||
execParams.push(SHELL_CALLER_PATH);
|
||||
@@ -258,7 +257,7 @@ ipcMain.handle('check-installed', async (_event, pkgname: string) => {
|
||||
|
||||
logger.info(`检查应用是否已安装: ${pkgname}`);
|
||||
|
||||
let child = spawn(SHELL_CALLER_PATH, ['apm', 'list', '--installed', pkgname], {
|
||||
const child = spawn(SHELL_CALLER_PATH, ['apm', 'list', '--installed', pkgname], {
|
||||
shell: true,
|
||||
env: process.env
|
||||
});
|
||||
@@ -291,16 +290,16 @@ ipcMain.on('remove-installed', async (_event, pkgname: string) => {
|
||||
}
|
||||
logger.info(`卸载已安装应用: ${pkgname}`);
|
||||
|
||||
let superUserCmd = await checkSuperUserCommand();
|
||||
const superUserCmd = await checkSuperUserCommand();
|
||||
let execCommand = '';
|
||||
let execParams = [];
|
||||
const execParams = [];
|
||||
if (superUserCmd.length > 0) {
|
||||
execCommand = superUserCmd;
|
||||
execParams.push(SHELL_CALLER_PATH);
|
||||
} else {
|
||||
execCommand = SHELL_CALLER_PATH;
|
||||
}
|
||||
let child = spawn(execCommand, [...execParams, 'apm', 'remove', '-y', pkgname], {
|
||||
const child = spawn(execCommand, [...execParams, 'apm', 'remove', '-y', pkgname], {
|
||||
shell: true,
|
||||
env: process.env
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import pino from "pino";
|
||||
|
||||
const logger = pino({ 'name': 'deeplink.ts' });
|
||||
type Query = Record<string, string>;
|
||||
export type Listener = (query: Query) => any;
|
||||
export type Listener = (query: Query) => void;
|
||||
|
||||
class ListenersMap {
|
||||
private map: Map<string, Set<Listener>> = new Map();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { app, BrowserWindow, ipcMain, Menu, shell, Tray } from 'electron'
|
||||
import { createRequire } from 'node:module'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
import os from 'node:os'
|
||||
@@ -19,7 +18,6 @@ import './backend/install-manager.js'
|
||||
import './handle-url-scheme.js'
|
||||
|
||||
const logger = pino({ 'name': 'index.ts' });
|
||||
const require = createRequire(import.meta.url)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
// The built directory structure
|
||||
@@ -187,8 +185,13 @@ app.whenReady().then(() => {
|
||||
// 双击触发
|
||||
tray.on('click', () => {
|
||||
// 双击通知区图标实现应用的显示或隐藏
|
||||
win.isVisible() ? win.hide() : win.show()
|
||||
win.isVisible() ? win.setSkipTaskbar(false) : win.setSkipTaskbar(true);
|
||||
if (win.isVisible()) {
|
||||
win.hide();
|
||||
win.setSkipTaskbar(true);
|
||||
} else {
|
||||
win.show();
|
||||
win.setSkipTaskbar(false);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user