Skip to content

Commit c3d8452

Browse files
committed
fix: rebuild cuda 12.4.0 addon.node, and implement log message sanitization
1 parent 1b52044 commit c3d8452

File tree

9 files changed

+358
-110
lines changed

9 files changed

+358
-110
lines changed

docs/docs/download.md

Lines changed: 5 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -11,122 +11,19 @@ title: 下载软件
1111

1212
当前最新稳定版本:[![Release](https://img.shields.io/github/v/release/buxuku/SmartSub?style=flat-square&logo=github&color=blue)](https://github.com/buxuku/SmartSub/releases/latest)
1313

14-
import Tabs from '@theme/Tabs';
15-
import TabItem from '@theme/TabItem';
16-
17-
<div className="download-section" style={{marginTop: '40px', marginBottom: '40px'}}>
18-
<Tabs groupId="os-choice" queryString="os">
19-
<TabItem value="windows" label="Windows" default>
20-
<div className="row" style={{marginBottom: '1rem'}}>
21-
<div className="col col--6" style={{marginBottom: '1rem'}}>
22-
<div className="card">
23-
<div className="card__header">
24-
<h3>Windows (NVIDIA CUDA 12.4.0+)</h3>
25-
</div>
26-
<div className="card__body">
27-
<p>适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 12.4.0 或更高版本。</p>
28-
</div>
29-
<div className="card__footer">
30-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Windows_2.3.7_x64_12.4.1_optimized.exe" className="button button--primary button--block">
31-
下载 (EXE)
32-
</a>
33-
</div>
34-
</div>
35-
</div>
36-
<div className="col col--6" style={{marginBottom: '1rem'}}>
37-
<div className="card">
38-
<div className="card__header">
39-
<h3>Windows (NVIDIA CUDA 12.2.0+)</h3>
40-
</div>
41-
<div className="card__body">
42-
<p>适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 12.2.0 或更高版本。</p>
43-
</div>
44-
<div className="card__footer">
45-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Windows_2.3.7_x64_12.2.0_optimized.exe" className="button button--primary button--block">
46-
下载 (EXE)
47-
</a>
48-
</div>
49-
</div>
50-
</div>
51-
</div>
52-
<div className="row">
53-
<div className="col col--6" style={{marginBottom: '1rem'}}>
54-
<div className="card">
55-
<div className="card__header">
56-
<h3>Windows (NVIDIA CUDA 11.8.0)</h3>
57-
</div>
58-
<div className="card__body">
59-
<p>适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 11.8.0 版本。</p>
60-
</div>
61-
<div className="card__footer">
62-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Windows_2.3.7_x64_11.8.0_optimized.exe" className="button button--primary button--block">
63-
下载 (EXE)
64-
</a>
65-
</div>
66-
</div>
67-
</div>
68-
<div className="col col--6" style={{marginBottom: '1rem'}}>
69-
<div className="card">
70-
<div className="card__header">
71-
<h3>Windows (无 CUDA)</h3>
72-
</div>
73-
<div className="card__body">
74-
<p>适用于 Windows x64 系统。如果您没有 NVIDIA 显卡,或不确定 CUDA 版本,请选择此版本。</p>
75-
</div>
76-
<div className="card__footer">
77-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Windows_2.3.7_x64_no_cuda_optimized.exe" className="button button--primary button--block">
78-
下载 (EXE)
79-
</a>
80-
</div>
81-
</div>
82-
</div>
83-
</div>
84-
</TabItem>
85-
<TabItem value="macos" label="macOS">
86-
<div className="row">
87-
<div className="col col--6" style={{marginBottom: '1rem'}}>
88-
<div className="card">
89-
<div className="card__header">
90-
<h3>Mac (Apple Silicon)</h3>
91-
</div>
92-
<div className="card__body">
93-
<p>适用于配备 Apple Silicon (M系列) 芯片的 Mac。</p>
94-
</div>
95-
<div className="card__footer">
96-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Mac_2.3.7_arm64.dmg" className="button button--primary button--block">
97-
下载 (DMG)
98-
</a>
99-
</div>
100-
</div>
101-
</div>
102-
<div className="col col--6" style={{marginBottom: '1rem'}}>
103-
<div className="card">
104-
<div className="card__header">
105-
<h3>Mac (Intel)</h3>
106-
</div>
107-
<div className="card__body">
108-
<p>适用于配备 Intel 处理器的 Mac。</p>
109-
</div>
110-
<div className="card__footer">
111-
<a href="https://github.com/buxuku/SmartSub/releases/download/v2.3.7/SmartSub_Mac_2.3.7_x64.dmg" className="button button--primary button--block">
112-
下载 (DMG)
113-
</a>
114-
</div>
115-
</div>
116-
</div>
117-
</div>
118-
</TabItem>
119-
</Tabs>
120-
</div>
14+
import DownloadCards from '@site/src/components/DownloadCards';
15+
16+
<DownloadCards />
12117

12218
## 安装前准备
12319

12420
### 验证系统要求
12521

12622
- **Windows**: Windows 10/11 (64位)
12723
- **macOS**: macOS 11.0 或更高版本
24+
- **Linux**: Ubuntu 22.04 或更高版本(其他发行版可能也支持,但未经完整测试)
12825
- **硬件加速**:
129-
- **NVIDIA CUDA**: 需要支持 CUDA 的 NVIDIA 显卡并安装 CUDA Toolkit
26+
- **NVIDIA CUDA**: 需要支持 CUDA 的 NVIDIA 显卡并安装 CUDA Toolkit(支持 Windows 和 Linux)
13027
- **Apple Core ML**: 需要 Apple Silicon (M系列) 芯片的 Mac 设备
13128

13229
### 下载 CUDA Toolkit (如需 CUDA 加速)

docs/docusaurus.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { themes as prismThemes } from 'prism-react-renderer';
22
import type { Config } from '@docusaurus/types';
33
import type * as Preset from '@docusaurus/preset-classic';
44

5+
// Read version from root package.json
6+
import * as fs from 'fs';
7+
import * as path from 'path';
8+
9+
const rootPackageJson = JSON.parse(
10+
fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'),
11+
);
12+
const appVersion = rootPackageJson.version;
13+
514
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
615

716
const config: Config = {
@@ -23,6 +32,11 @@ const config: Config = {
2332
onBrokenLinks: 'throw',
2433
onBrokenMarkdownLinks: 'warn',
2534

35+
// Custom fields to expose app version to components
36+
customFields: {
37+
appVersion,
38+
},
39+
2640
// Even if you don't use internationalization, you can use this field to set
2741
// useful metadata like html lang. For example, if your site is Chinese, you
2842
// may want to replace "en" with "zh-Hans".
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
import React from 'react';
2+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
3+
import Tabs from '@theme/Tabs';
4+
import TabItem from '@theme/TabItem';
5+
6+
const GITHUB_RELEASE_BASE =
7+
'https://github.com/buxuku/SmartSub/releases/download';
8+
9+
interface DownloadCardProps {
10+
title: string;
11+
description: string;
12+
downloadUrl: string;
13+
buttonText: string;
14+
}
15+
16+
function DownloadCard({
17+
title,
18+
description,
19+
downloadUrl,
20+
buttonText,
21+
}: DownloadCardProps) {
22+
return (
23+
<div className="col col--6" style={{ marginBottom: '1rem' }}>
24+
<div className="card">
25+
<div className="card__header">
26+
<h3>{title}</h3>
27+
</div>
28+
<div className="card__body">
29+
<p>{description}</p>
30+
</div>
31+
<div className="card__footer">
32+
<a
33+
href={downloadUrl}
34+
className="button button--primary button--block"
35+
>
36+
{buttonText}
37+
</a>
38+
</div>
39+
</div>
40+
</div>
41+
);
42+
}
43+
44+
export default function DownloadCards(): JSX.Element {
45+
const { siteConfig } = useDocusaurusContext();
46+
const version = siteConfig.customFields?.appVersion as string;
47+
48+
// Generate download URLs
49+
const getWindowsUrl = (cudaVersion: string, cudaOpt: string) =>
50+
`${GITHUB_RELEASE_BASE}/v${version}/SmartSub_Windows_${version}_x64_${cudaVersion}_${cudaOpt}.exe`;
51+
52+
const getMacUrl = (arch: string) =>
53+
`${GITHUB_RELEASE_BASE}/v${version}/SmartSub_Mac_${version}_${arch}.dmg`;
54+
55+
const getLinuxUrl = (
56+
cudaVersion: string,
57+
cudaOpt: string,
58+
ext: string = 'AppImage',
59+
) =>
60+
`${GITHUB_RELEASE_BASE}/v${version}/SmartSub_Linux_${version}_x64_${cudaVersion}_${cudaOpt}.${ext}`;
61+
62+
return (
63+
<div
64+
className="download-section"
65+
style={{ marginTop: '40px', marginBottom: '40px' }}
66+
>
67+
<Tabs groupId="os-choice" queryString="os">
68+
<TabItem value="windows" label="Windows" default>
69+
<div className="row" style={{ marginBottom: '1rem' }}>
70+
<DownloadCard
71+
title="Windows (NVIDIA CUDA 13.0.2+)"
72+
description="适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 13.0.2 或更高版本。"
73+
downloadUrl={getWindowsUrl('13.0.2', 'optimized')}
74+
buttonText="下载 (EXE)"
75+
/>
76+
<DownloadCard
77+
title="Windows (NVIDIA CUDA 12.4.0+)"
78+
description="适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 12.4.0 或更高版本。"
79+
downloadUrl={getWindowsUrl('12.4.0', 'optimized')}
80+
buttonText="下载 (EXE)"
81+
/>
82+
</div>
83+
<div className="row" style={{ marginBottom: '1rem' }}>
84+
<DownloadCard
85+
title="Windows (NVIDIA CUDA 12.2.0+)"
86+
description="适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 12.2.0 或更高版本。"
87+
downloadUrl={getWindowsUrl('12.2.0', 'optimized')}
88+
buttonText="下载 (EXE)"
89+
/>
90+
<DownloadCard
91+
title="Windows (NVIDIA CUDA 11.8.0)"
92+
description="适用于 Windows x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 11.8.0 版本。"
93+
downloadUrl={getWindowsUrl('11.8.0', 'optimized')}
94+
buttonText="下载 (EXE)"
95+
/>
96+
</div>
97+
<div className="row">
98+
<DownloadCard
99+
title="Windows (无 CUDA)"
100+
description="适用于 Windows x64 系统。如果您没有 NVIDIA 显卡,或不确定 CUDA 版本,请选择此版本。"
101+
downloadUrl={getWindowsUrl('no-cuda', 'generic')}
102+
buttonText="下载 (EXE)"
103+
/>
104+
</div>
105+
</TabItem>
106+
107+
<TabItem value="macos" label="macOS">
108+
<div className="row">
109+
<DownloadCard
110+
title="Mac (Apple Silicon)"
111+
description="适用于配备 Apple Silicon (M系列) 芯片的 Mac。"
112+
downloadUrl={getMacUrl('arm64')}
113+
buttonText="下载 (DMG)"
114+
/>
115+
<DownloadCard
116+
title="Mac (Intel)"
117+
description="适用于配备 Intel 处理器的 Mac。"
118+
downloadUrl={getMacUrl('x64')}
119+
buttonText="下载 (DMG)"
120+
/>
121+
</div>
122+
</TabItem>
123+
124+
<TabItem value="linux" label="Linux">
125+
<div className="row" style={{ marginBottom: '1rem' }}>
126+
<DownloadCard
127+
title="Linux (NVIDIA CUDA 13.0.2+)"
128+
description="适用于 Linux x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 13.0.2 或更高版本。"
129+
downloadUrl={getLinuxUrl('13.0.2', 'optimized')}
130+
buttonText="下载 (AppImage)"
131+
/>
132+
<DownloadCard
133+
title="Linux (NVIDIA CUDA 12.4.0+)"
134+
description="适用于 Linux x64 系统,需 NVIDIA 显卡及 CUDA Toolkit 12.4.0 或更高版本。"
135+
downloadUrl={getLinuxUrl('12.4.0', 'optimized')}
136+
buttonText="下载 (AppImage)"
137+
/>
138+
</div>
139+
<div className="row">
140+
<DownloadCard
141+
title="Linux (无 CUDA)"
142+
description="适用于 Linux x64 系统。如果您没有 NVIDIA 显卡,或不确定 CUDA 版本,请选择此版本。"
143+
downloadUrl={getLinuxUrl('no-cuda', 'generic')}
144+
buttonText="下载 (AppImage)"
145+
/>
146+
</div>
147+
</TabItem>
148+
</Tabs>
149+
</div>
150+
);
151+
}

main/helpers/logger.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BrowserWindow } from 'electron';
22
import { store } from './store';
33
import { LogEntry } from './store/types';
4+
import { sanitizeLogMessage } from './utils';
45

56
export function logMessage(
67
message: string | Error,
@@ -10,8 +11,11 @@ export function logMessage(
1011
const messageStr =
1112
message instanceof Error ? message.message : String(message);
1213

14+
// 对日志消息进行脱敏处理,防止泄露敏感信息
15+
const sanitizedMessage = sanitizeLogMessage(messageStr);
16+
1317
const newLog: LogEntry = {
14-
message: messageStr,
18+
message: sanitizedMessage,
1519
type,
1620
timestamp: Date.now(),
1721
};

0 commit comments

Comments
 (0)