Skip to content

Commit 8c08ded

Browse files
committed
激活相关 bugfix;少量参数调整;多选任务时右键可直接调出批量操作菜单,支持批量下载;修复预设名中包含“.”时的异常
1 parent c3b3ec4 commit 8c08ded

File tree

22 files changed

+448
-100
lines changed

22 files changed

+448
-100
lines changed

WindowsInstaller/FFBox.iss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "FFBox"
5-
#define MyAppVersion "5.1"
5+
#define MyAppVersion "5.2"
66
#define MyAppPublisher "滔滔清风"
77
#define MyAppURL "http://ttqf.tech"
88
; #define MyCopyright "版权所有"
@@ -11,7 +11,7 @@
1111

1212
; 安装包输出文件夹
1313
#define MySetupOutDir "./output"
14-
#define MySetupOutBaseFilename "Windows_x86-64_FFBox_5.1"
14+
#define MySetupOutBaseFilename "Windows_x86-64_FFBox_5.2"
1515

1616
; 安装包所用的资源文件夹
1717
#define MyResDir "./res"
@@ -21,7 +21,7 @@
2121
; 点击 license 打开的网页连接
2222
#define MyAppLkLicenseURL 'http://ffbox.ttqf.tech/LICENSE'
2323
; 安装目录至少需要的空间
24-
#define MyAppNeedSpaceByte 322000000
24+
#define MyAppNeedSpaceByte 321000000
2525
; 外部程序调用本安装程序时,会向外部传安装进度的 window api Message ID
2626
#define WM_MY_INSTALL_PROGRESS 6364
2727

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "FFBox",
3-
"version": "5.1.0",
3+
"version": "5.2.0",
44
"description": "",
55
"main": "app/main/index.cjs",
66
"scripts": {

scripts/dev-frontend.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ await injectProcessEnv();
137137
// bootstrap
138138
const server = await createServer({ configFile: rendererConfig })
139139

140-
await server.listen();
140+
await server.listen(5174);
141141
const address = server.httpServer.address();
142142
console.log(`已启动服务于 ${address.address}:${address.port}`);
143143
await watchPreload(server);

src/backend/FFBoxService.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,11 +1110,10 @@ export class FFBoxService extends (EventEmitter as new () => TypedEventEmitter<F
11101110
return true;
11111111
}
11121112
}
1113-
if (this.functionLevel < 45) {
1114-
if (progressLog.elapsed + new Date().getTime() / 1000 - progressLog.lastStarted > 671) {
1115-
this.trailLimit_stopTranscoding(id, 'working');
1116-
return true;
1117-
}
1113+
const maxWorkingDuration = this.functionLevel < 45 ? 671 : 40271;
1114+
if (progressLog.elapsed + new Date().getTime() / 1000 - progressLog.lastStarted > maxWorkingDuration) {
1115+
this.trailLimit_stopTranscoding(id, 'working');
1116+
return true;
11181117
}
11191118
}
11201119

src/common/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export const version = (() => {
2-
let ret = '5.2-alpha';
2+
let ret = '5.2';
33
if (!buildInfo) {
44
ret += ' *'
55
} else if (buildInfo.isDev) {
66
ret += ` ${buildInfo.gitCommit}`
77
}
88
return ret;
99
})();
10-
export const buildNumber = 18;
11-
// 1.0 1.1 2.0 2.1 2.2 2.3 2.4 2.5 2.6 3.0 4.0 4.1 4.2 4.3 4.4 4.5 5.0 5.1
10+
export const buildNumber = 19;
11+
// 1.0 1.1 2.0 2.1 2.2 2.3 2.4 2.5 2.6 3.0 4.0 4.1 4.2 4.3 4.4 4.5 5.0 5.1 5.2

src/common/i11n/zh-CN.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import { I11n } from './i11n';
33
const lang: I11n = {
44
service: {
55
功能限制_暂停转码: (taskName, byFrontend, reason) =>
6-
`任务「${taskName}」转码达到${byFrontend ? '前端' : '后端'}时长上限了\n` +
7-
`💔您的用户等级最高支持 11:11 的${reason === 'media' ? '媒体时长' : '处理耗时'}\n` +
6+
`任务「${taskName}」转码达到${byFrontend ? '前端' : '后端'}${reason === 'media' ? '媒体时长' : '处理耗时'}时长上限了\n` +
87
'🤫开发者设计该项限制的意图是为了给“伸手党”和“白嫖党”制造一些不便😞谁知盘中餐,粒粒皆辛苦!\n' +
98
'☺️探访一下 FFBox 官网、作者发布媒介,或者 AI,或许就能发现激活方式了✅',
109
功能限制_不能继续: (taskName, byFrontend, reason, pid) =>
11-
`任务「${taskName}」转码达到${byFrontend ? '前端' : '后端'}时长上限了\n` +
12-
`💔您的用户等级最高支持 11:11 的${reason === 'media' ? '媒体时长' : '处理耗时'}\n` +
13-
`您可以选择停止该任务,或改用 FFBox 以外的软件恢复进程。PID:${pid}`,
10+
`任务「${taskName}」转码达到${byFrontend ? '前端' : '后端'}${reason === 'media' ? '媒体时长' : '处理耗时'}时长上限了\n` +
11+
'请在菜单中心的功能解限面板查看详情\n' +
12+
`您可以选择停止该任务、激活${byFrontend ? '前端' : '后端'}后重试,或改用 FFBox 以外的软件恢复进程。PID:${pid}`,
1413
功能限制_任务数上限: (maxTaskCount, byFrontend) =>
1514
`😞任务数量达到${byFrontend ? '前端' : '后端'}上限了\n` +
1615
`💔您的用户等级最高支持在任务列表中放入 ${maxTaskCount} 个任务,您可以先删除一些任务再添加\n` +

src/common/params/formats.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,6 @@ export const builtInMuxers: MenuItem<Muxer>[] = [
107107
label: 'DVD',
108108
tooltip: '(另有 .vob 扩展名)\n默认视频编码器:mpeg2video\n默认音频编码器:mp2',
109109
},
110-
{
111-
type: 'normal',
112-
value: 'h264',
113-
label: 'h264',
114-
tooltip: 'h.264 裸流',
115-
},
116-
{
117-
type: 'normal',
118-
value: 'hevc',
119-
label: 'hevc',
120-
tooltip: 'hevc 裸流',
121-
},
122110
],
123111
},
124112
{
@@ -265,6 +253,24 @@ export const builtInMuxers: MenuItem<Muxer>[] = [
265253
label: 'WEBP',
266254
tooltip: 'WebP 是由 Google 开发的衍生自 VP8 的现代图像格式,支持有损和无损压缩、透明通道和动画,广泛用于网页图片。',
267255
},
256+
{
257+
type: 'normal',
258+
value: 'h264',
259+
label: 'h264',
260+
tooltip: 'h.264 裸流',
261+
},
262+
{
263+
type: 'normal',
264+
value: 'hevc',
265+
label: 'hevc',
266+
tooltip: 'hevc 裸流',
267+
},
268+
{
269+
type: 'normal',
270+
value: 'mjpeg',
271+
label: 'mjpeg',
272+
tooltip: 'mjpeg 裸流',
273+
},
268274
],
269275
},
270276
];

src/common/params/vcodecs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,7 @@ export const resolution: MenuItem[] = [
17081708
{ type: 'submenu', label: '电脑显示标准', subMenu: [
17091709
{ type: 'normal', label: '10240×4320', value: '10240x4320', tooltip: '(64:27), 44.2M 像素' },
17101710
{ type: 'normal', label: '7680×4320', value: '7680x4320', tooltip: 'UHD 8K (16:9), 33.2M 像素' },
1711+
{ type: 'normal', label: '6144×3456', value: '6144x3456', tooltip: '(16:9), 21.2M 像素' },
17111712
{ type: 'normal', label: '5760×3240', value: '5760x3240', tooltip: '(16:9), 18.7M 像素' },
17121713
{ type: 'normal', label: '5120×3200', value: '5120x3200', tooltip: 'WHXGA (8:5), 16.4M 像素' },
17131714
{ type: 'normal', label: '4096×3072', value: '4096x3072', tooltip: '(4:3), 12.6M 像素' },

src/main/index.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ import osBridge from './osBridge';
1414
import * as mica from './mica';
1515
// import { FFBoxService } from './service/FFBoxService';
1616

17+
interface DownloadMap {
18+
item?: Electron.DownloadItem;
19+
finalFileBaseName?: string;
20+
dir?: string; // 批量下载前指定文件夹,这样每个文件下载时就不弹窗
21+
fileTime?: { accessTime: number, createTime: number, modifyTime: number };
22+
}
1723

1824
class ElectronApp {
1925
mainWindow: BrowserWindow | null = null;
2026
// electronStore: ElectronStore;
2127
service: ProcessInstance | null = null;
2228
blockWindowClose = true;
23-
downloadMap: Map<string, { item?: Electron.DownloadItem, finalFileBaseName?: string, fileTime?: { accessTime: number, createTime: number, modifyTime: number } }> = new Map();
29+
downloadMap: Map<string, DownloadMap> = new Map();
2430

2531
constructor() {
2632
this.mountAppEvents();
@@ -149,8 +155,11 @@ class ElectronApp {
149155
if (!map || map?.item) return;
150156
map.item = item;
151157

152-
item.setSaveDialogOptions({ defaultPath: map.finalFileBaseName });
153-
// item.setSavePath(folderpath + `\\${item.getFilename()}`); // 设置文件存放位置
158+
if (map.dir) {
159+
item.setSavePath(path.join(map.dir, map.finalFileBaseName));
160+
} else {
161+
item.setSaveDialogOptions({ defaultPath: map.finalFileBaseName });
162+
}
154163
mainWindow.webContents.send('downloadStatusChange', { url: url, status: 'started' });
155164
item.on('updated', (event, state) => {
156165
if (state === 'interrupted') {
@@ -435,6 +444,19 @@ class ElectronApp {
435444
this.mainWindow!.webContents.downloadURL(params.url);
436445
});
437446

447+
ipcMain.on('downloadFiles', async (_event, params: { sessionId: string; files: { url: string; finalFileBaseName?: string; fileTime?: any }[] }) => {
448+
const result = await dialog.showOpenDialog(this.mainWindow, {
449+
title: `指定 ${params.files.length} 个下载文件的保存文件夹`,
450+
properties: ['openDirectory', 'createDirectory']
451+
});
452+
if (!result.canceled) {
453+
for (const file of params.files) {
454+
this.downloadMap.set(file.url, { finalFileBaseName: file.finalFileBaseName, fileTime: file.fileTime, dir: result.filePaths[0] });
455+
this.mainWindow!.webContents.downloadURL(file.url);
456+
}
457+
}
458+
});
459+
438460
// 启动一个 ffboxService,这个 ffboxService 目前钦定监听 localhost:33269,而 serviceBridge 会连接此 service
439461
ipcMain.handle('startService', () => this.createService());
440462

0 commit comments

Comments
 (0)