Skip to content

Commit

Permalink
Merge pull request #163 from caorushizi/feat/dependencies
Browse files Browse the repository at this point in the history
fix: 🐛  update dependencies
  • Loading branch information
caorushizi authored May 26, 2024
2 parents 31dd5d2 + a4cd419 commit e90942d
Show file tree
Hide file tree
Showing 27 changed files with 156 additions and 135 deletions.
2 changes: 2 additions & 0 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "main",
"version": "0.1.0",
"description": "在线视频下载器",
"type": "module",
"main": "main/index.js",
"scripts": {
"postinstall": "electron-rebuild -f -w",
Expand All @@ -21,6 +22,7 @@
"devDependencies": {
"@electron/rebuild": "^3.6.0",
"@rushstack/eslint-patch": "^1.10.3",
"@types/electron-devtools-installer": "^2.2.5",
"@types/fs-extra": "^11.0.4",
"@types/gulp": "^4.0.17",
"@types/lodash": "^4.17.4",
Expand Down
22 changes: 11 additions & 11 deletions packages/main/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { inject, injectable } from "inversify";
import { DownloadStatus } from "./interfaces";
import { TYPES } from "./types";
import { DownloadStatus } from "./interfaces.ts";
import { TYPES } from "./types.ts";
import { Menu, Tray, app, nativeImage, nativeTheme } from "electron";
import TrayIcon from "./tray-icon.png";
import path from "path";
import MainWindow from "./windows/MainWindow";
import WebviewService from "./services/WebviewService";
import VideoRepository from "./repository/VideoRepository";
import ElectronDevtools from "./vendor/ElectronDevtools";
import ElectronStore from "./vendor/ElectronStore";
import ElectronUpdater from "./vendor/ElectronUpdater";
import TypeORM from "./vendor/TypeORM";
import ProtocolService from "./core/protocol";
import IpcHandlerService from "./core/ipc";
import MainWindow from "./windows/MainWindow.ts";
import WebviewService from "./services/WebviewService.ts";
import VideoRepository from "./repository/VideoRepository.ts";
import ElectronDevtools from "./vendor/ElectronDevtools.ts";
import ElectronStore from "./vendor/ElectronStore.ts";
import ElectronUpdater from "./vendor/ElectronUpdater.ts";
import TypeORM from "./vendor/TypeORM.ts";
import ProtocolService from "./core/protocol.ts";
import IpcHandlerService from "./core/ipc.ts";

@injectable()
export default class ElectronApp {
Expand Down
16 changes: 8 additions & 8 deletions packages/main/src/controller/DownloadController.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { IpcMainEvent } from "electron/main";
import { inject, injectable } from "inversify";
import { handle } from "../helper";
import { handle } from "../helper/index.ts";
import {
type Controller,
DownloadItem,
DownloadItemPagination,
Task,
DownloadStatus,
} from "../interfaces";
import { TYPES } from "../types";
import MainWindow from "../windows/MainWindow";
import ElectronStore from "../vendor/ElectronStore";
import DownloadService from "../services/DownloadService";
import VideoRepository from "../repository/VideoRepository";
import WebviewService from "../services/WebviewService";
} from "../interfaces.ts";
import { TYPES } from "../types.ts";
import MainWindow from "../windows/MainWindow.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import DownloadService from "../services/DownloadService.ts";
import VideoRepository from "../repository/VideoRepository.ts";
import WebviewService from "../services/WebviewService.ts";

@injectable()
export default class DownloadController implements Controller {
Expand Down
24 changes: 12 additions & 12 deletions packages/main/src/controller/HomeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import {
shell,
clipboard,
} from "electron";
import { Favorite } from "../entity/Favorite";
import { convertToAudio, db, workspace } from "../helper";
import { Favorite } from "../entity/Favorite.ts";
import { convertToAudio, db, workspace } from "../helper/index.ts";
import { inject, injectable } from "inversify";
import { AppStore, EnvPath } from "../main";
import { AppStore, EnvPath } from "../main.ts";
import path from "path";
import { handle, getLocalIP } from "../helper";
import { type Controller } from "../interfaces";
import { TYPES } from "../types";
import { handle, getLocalIP } from "../helper/index.ts";
import { type Controller } from "../interfaces.ts";
import { TYPES } from "../types.ts";
import fs from "fs-extra";
import MainWindow from "../windows/MainWindow";
import BrowserWindow from "../windows/BrowserWindow";
import ElectronStore from "../vendor/ElectronStore";
import WebviewService from "../services/WebviewService";
import FavoriteRepository from "../repository/FavoriteRepository";
import VideoRepository from "../repository/VideoRepository";
import MainWindow from "../windows/MainWindow.ts";
import BrowserWindow from "../windows/BrowserWindow.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import WebviewService from "../services/WebviewService.ts";
import FavoriteRepository from "../repository/FavoriteRepository.ts";
import VideoRepository from "../repository/VideoRepository.ts";

@injectable()
export default class HomeController implements Controller {
Expand Down
12 changes: 6 additions & 6 deletions packages/main/src/controller/WebviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
MenuItemConstructorOptions,
} from "electron";
import { inject, injectable } from "inversify";
import { handle } from "../helper";
import { type Controller } from "../interfaces";
import { TYPES } from "../types";
import WebviewService from "../services/WebviewService";
import ElectronStore from "../vendor/ElectronStore";
import { SniffingHelper } from "../services/SniffingHelperService";
import { handle } from "../helper/index.ts";
import { type Controller } from "../interfaces.ts";
import { TYPES } from "../types.ts";
import WebviewService from "../services/WebviewService.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import { SniffingHelper } from "../services/SniffingHelperService.ts";

@injectable()
export default class WebviewController implements Controller {
Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/core/ipc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ipcMain } from "electron";
import { inject, injectable, multiInject } from "inversify";
import { Controller } from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import { error, success } from "../helper/utils";
import { Controller } from "../interfaces.ts";
import { TYPES } from "../types.ts";
import ElectronLogger from "../vendor/ElectronLogger.ts";
import { error, success } from "../helper/utils.ts";

@injectable()
export default class IpcHandlerService {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/core/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pathExists, readFile } from "fs-extra";
import { injectable } from "inversify";
import { join } from "path";
import { URL } from "url";
import { defaultScheme } from "../helper";
import { defaultScheme } from "../helper/index.ts";
import mime from "mime-types";

@injectable()
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/entity/Video.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadStatus, DownloadType } from "../interfaces";
import { DownloadStatus, DownloadType } from "../interfaces.ts";
import {
Column,
CreateDateColumn,
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/helper/ffmpeg.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spawn } from "child_process";
import { ffmpegPath } from "./variables";
import { ffmpegPath } from "./variables.ts";

export const convertToAudio = async (
input: string,
Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function fetchWrapper(url: string) {
return fetch(url, options);
}

export { sleep, formatHeaders } from "./utils";
export * from "./variables";
export { on, handle } from "./decorator";
export { convertToAudio } from "./ffmpeg";
export { sleep, formatHeaders } from "./utils.ts";
export * from "./variables.ts";
export { on, handle } from "./decorator.ts";
export { convertToAudio } from "./ffmpeg.ts";
export { fetchWrapper as fetch };
8 changes: 4 additions & 4 deletions packages/main/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "reflect-metadata";
import { app, protocol } from "electron";
import { defaultScheme } from "./helper";
import { container } from "./inversify.config";
import { TYPES } from "./types";
import ElectronApp from "./app";
import { defaultScheme } from "./helper/index.ts";
import { container } from "./inversify.config.ts";
import { TYPES } from "./types.ts";
import ElectronApp from "./app.ts";

const gotTheLock = app.requestSingleInstanceLock();
const start = async (): Promise<void> => {
Expand Down
40 changes: 20 additions & 20 deletions packages/main/src/inversify.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import DownloadController from "./controller/DownloadController";
import HomeController from "./controller/HomeController";
import WebviewController from "./controller/WebviewController";
import DownloadController from "./controller/DownloadController.ts";
import HomeController from "./controller/HomeController.ts";
import WebviewController from "./controller/WebviewController.ts";
import { Container } from "inversify";
import FavoriteRepository from "./repository/FavoriteRepository";
import VideoRepository from "./repository/VideoRepository";
import WebviewService from "./services/WebviewService";
import ElectronApp from "./app";
import { Controller } from "./interfaces";
import { TYPES } from "./types";
import MainWindow from "./windows/MainWindow";
import BrowserWindow from "./windows/BrowserWindow";
import { SniffingHelper } from "./services/SniffingHelperService";
import DownloadService from "./services/DownloadService";
import ElectronLogger from "./vendor/ElectronLogger";
import ElectronUpdater from "./vendor/ElectronUpdater";
import TypeORM from "./vendor/TypeORM";
import ElectronDevtools from "./vendor/ElectronDevtools";
import ElectronStore from "./vendor/ElectronStore";
import IpcHandler from "./core/ipc";
import ProtocolService from "./core/protocol";
import FavoriteRepository from "./repository/FavoriteRepository.ts";
import VideoRepository from "./repository/VideoRepository.ts";
import WebviewService from "./services/WebviewService.ts";
import ElectronApp from "./app.ts";
import { Controller } from "./interfaces.ts";
import { TYPES } from "./types.ts";
import MainWindow from "./windows/MainWindow.ts";
import BrowserWindow from "./windows/BrowserWindow.ts";
import { SniffingHelper } from "./services/SniffingHelperService.ts";
import DownloadService from "./services/DownloadService.ts";
import ElectronLogger from "./vendor/ElectronLogger.ts";
import ElectronUpdater from "./vendor/ElectronUpdater.ts";
import TypeORM from "./vendor/TypeORM.ts";
import ElectronDevtools from "./vendor/ElectronDevtools.ts";
import ElectronStore from "./vendor/ElectronStore.ts";
import IpcHandler from "./core/ipc.ts";
import ProtocolService from "./core/protocol.ts";

const container = new Container({
skipBaseClassChecks: true,
Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/preload.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { contextBridge, ipcRenderer } from "electron/renderer";
import { shell } from "electron/common";
import { AppStore, BrowserStore, EnvPath } from "./main";
import { type Favorite } from "./entity/Favorite";
import { AppStore, BrowserStore, EnvPath } from "./main.ts";
import { type Favorite } from "./entity/Favorite.ts";
import {
VideoResponse,
type DownloadItem,
type DownloadItemPagination,
} from "./interfaces";
import { Video } from "./entity/Video";
} from "./interfaces.ts";
import { Video } from "./entity/Video.ts";

const apiFunctions: Record<string, any> = {};

Expand Down
6 changes: 3 additions & 3 deletions packages/main/src/repository/FavoriteRepository.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import { Favorite } from "../entity/Favorite";
import TypeORM from "../vendor/TypeORM";
import { TYPES } from "../types.ts";
import { Favorite } from "../entity/Favorite.ts";
import TypeORM from "../vendor/TypeORM.ts";

@injectable()
export default class FavoriteRepository {
Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/repository/VideoRepository.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Video } from "../entity/Video";
import { Video } from "../entity/Video.ts";
import { inject, injectable } from "inversify";
import {
DownloadFilter,
DownloadItem,
DownloadItemPagination,
DownloadStatus,
} from "../interfaces";
import { TYPES } from "../types";
} from "../interfaces.ts";
import { TYPES } from "../types.ts";
import { In, Not } from "typeorm";
import TypeORM from "../vendor/TypeORM";
import TypeORM from "../vendor/TypeORM.ts";

@injectable()
export default class VideoRepository {
Expand Down
16 changes: 10 additions & 6 deletions packages/main/src/services/DownloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import {
DownloadProgress,
DownloadStatus,
Task,
} from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import ElectronStore from "../vendor/ElectronStore";
import VideoRepository from "../repository/VideoRepository";
import { Platform, biliDownloaderBin, m3u8DownloaderBin } from "../helper";
} from "../interfaces.ts";
import { TYPES } from "../types.ts";
import ElectronLogger from "../vendor/ElectronLogger.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import VideoRepository from "../repository/VideoRepository.ts";
import {
Platform,
biliDownloaderBin,
m3u8DownloaderBin,
} from "../helper/index.ts";
import * as pty from "node-pty";
import stripAnsi from "strip-ansi";

Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/services/SniffingHelperService.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { inject, injectable } from "inversify";
import { DownloadType } from "../interfaces";
import { TYPES } from "../types";
import ElectronLogger from "../vendor/ElectronLogger";
import { DownloadType } from "../interfaces.ts";
import { TYPES } from "../types.ts";
import ElectronLogger from "../vendor/ElectronLogger.ts";
import EventEmitter from "events";
import { session } from "electron";
import { PERSIST_WEBVIEW } from "../helper";
import { PERSIST_WEBVIEW } from "../helper/index.ts";
import { OnCompletedListenerDetails } from "electron/main";

export interface SourceParams {
Expand Down
22 changes: 14 additions & 8 deletions packages/main/src/services/WebviewService.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { WebContentsView, session } from "electron";
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import { TYPES } from "../types.ts";
import isDev from "electron-is-dev";
import { PERSIST_WEBVIEW, fetch, mobileUA, pcUA, pluginPath } from "../helper";
import {
PERSIST_WEBVIEW,
fetch,
mobileUA,
pcUA,
pluginPath,
} from "../helper/index.ts";
import { ElectronBlocker } from "@cliqz/adblocker-electron";
import ElectronLogger from "../vendor/ElectronLogger";
import ElectronStore from "../vendor/ElectronStore";
import MainWindow from "../windows/MainWindow";
import BrowserWindow from "../windows/BrowserWindow";
import VideoRepository from "../repository/VideoRepository";
import { SniffingHelper } from "./SniffingHelperService";
import ElectronLogger from "../vendor/ElectronLogger.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import MainWindow from "../windows/MainWindow.ts";
import BrowserWindow from "../windows/BrowserWindow.ts";
import VideoRepository from "../repository/VideoRepository.ts";
import { SniffingHelper } from "./SniffingHelperService.ts";
import { resolve } from "path";
import { readFileSync } from "fs-extra";

Expand Down
10 changes: 5 additions & 5 deletions packages/main/src/vendor/ElectronDevtools.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { inject, injectable } from "inversify";
import { TYPES } from "../types";
import { TYPES } from "../types.ts";
import isDev from "electron-is-dev";
import installExtension, {
import install, {
REDUX_DEVTOOLS,
REACT_DEVELOPER_TOOLS,
} from "electron-devtools-installer";
import ElectronLogger from "./ElectronLogger";
import { Vendor } from "../core/vendor";
import ElectronLogger from "./ElectronLogger.ts";
import { Vendor } from "../core/vendor.ts";

@injectable()
export default class DevToolsService implements Vendor {
Expand All @@ -26,7 +26,7 @@ export default class DevToolsService implements Vendor {

try {
this.logger.debug("当前环境为开发环境,开始加载开发者工具");
await installExtension([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS]);
await install([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS]);
this.logger.debug("加载开发者工具成功");
} catch (err: unknown) {
this.logger.error("加载开发者工具失败", err);
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/vendor/ElectronLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import logger, { Logger } from "electron-log";
import { injectable } from "inversify";
import dayjs from "dayjs";
import path from "path";
import { appName, workspace } from "../helper";
import { Vendor } from "../core/vendor";
import { appName, workspace } from "../helper/index.ts";
import { Vendor } from "../core/vendor.ts";

@injectable()
export default class ElectronLogger implements Vendor {
Expand Down
Loading

0 comments on commit e90942d

Please sign in to comment.