Skip to content

Commit

Permalink
Merge pull request #111 from caorushizi/feat/terminal
Browse files Browse the repository at this point in the history
feat: ✨ use terminal
  • Loading branch information
caorushizi authored Mar 10, 2024
2 parents 712338d + 84196b0 commit cf77cf8
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 215 deletions.
1 change: 1 addition & 0 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"lodash": "^4.17.21",
"node-pty": "^1.0.0",
"reflect-metadata": "^0.2.1",
"strip-ansi": "^7.1.0",
"ts-node": "^10.9.2",
"typeorm": "^0.3.19"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getLocalIP() {
return localIP;
}

export { sleep, stripColors, formatHeaders } from "./utils";
export { sleep, formatHeaders } from "./utils";
export * from "./variables";
export { on, handle } from "./decorator";
export { convertToAudio } from "./ffmpeg";
Expand Down
8 changes: 0 additions & 8 deletions packages/main/src/helper/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ export async function sleep(second = 1): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, second * 1000));
}

export function stripColors(str: string) {
// 匹配控制台颜色字符的正则表达式
// eslint-disable-next-line no-control-regex
const colorRegex = /\x1b\[(\d+)(;\d+)*m/g;
// 将所有颜色字符替换为空字符串
return str.replace(colorRegex, "");
}

export function formatHeaders(headersStr: string): string {
const headers: Record<string, any> | null = JSON.parse(headersStr);
if (!headers) return "";
Expand Down
3 changes: 1 addition & 2 deletions packages/main/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export type Task = {
export interface DownloadProgress {
id: number;
type: string;
cur: string;
total: string;
percent: string;
speed: string;
isLive: boolean;
}
Expand Down
Loading

0 comments on commit cf77cf8

Please sign in to comment.