Skip to content

Commit

Permalink
移动需要配置代理信息的提示到下载失败时显示
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyuesaves committed Jun 30, 2024
1 parent 8270129 commit 307e652
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/main_modules/getTgSticker.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,20 @@ async function getTgSticker(url) {
duration: 6000,
});
} catch (err) {
let message = `${data.result.title} 下载失败 ${err?.message} ${err?.stack}`;
switch (err?.message) {
case "fetch failed":
if (config.proxy.enabled) {
message = `${data.result.title} 下载失败,网络错误,无法访问Telegram服务器`;
} else {
message = `${data.result.title} 下载失败,网络错误,请尝试添加代理地址`;
}
break;
default:
message = `${data.result.title} 下载失败,${err?.message} ${err?.stack}`;
}
settingWindow.webContents.send("LiteLoader.lite_tools.onDownloadTgStickerEvent", {
message: `${data.result.title} 下载失败 ${err?.message} ${err?.stack}`,
message,
type: "error",
duration: 6000,
});
Expand Down Expand Up @@ -110,6 +122,7 @@ async function getTgSticker(url) {
if (item.is_video) {
const fileName = `${file_unique_id}.gif`;
const filePath = join(folderPath, fileName);
// emmm 实在不知道该怎么转成带透明通道的gif
await new Promise((res, rej) => {
Ffmpeg(Readable.from(buffer))
.outputOptions(["-vf", "split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse", "-loop", "0"])
Expand Down
3 changes: 0 additions & 3 deletions src/pages/configView.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,6 @@ async function onConfigView(view) {
return;
}
clearToast();
if (!options.proxy.enabled) {
showToast("没有配置有效代理,请确保能够连接到Telegram服务器", "default", 30000);
}
if (!options.localEmoticons.ffmpegPath) {
showToast("没有配置FFmpeg路径,可能无法下载动态表情", "default", 30000);
}
Expand Down

0 comments on commit 307e652

Please sign in to comment.