1
0
mirror of https://github.com/lencx/ChatGPT.git synced 2024-10-01 01:06:13 -04:00

Merge pull request #190 from lencx/fix_export

This commit is contained in:
lencx 2023-01-12 21:06:16 +08:00 committed by GitHub
commit eccee44866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 28 deletions

View File

@ -22,22 +22,22 @@
### Windows
- [ChatGPT_0.8.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT_0.8.0_x64_en-US.msi):
- [ChatGPT_0.8.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT_0.8.1_x64_en-US.msi):
- 使用 [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
# install the latest version
winget install --id=lencx.ChatGPT -e
# install the specified version
winget install --id=lencx.ChatGPT -e --version 0.7.4
winget install --id=lencx.ChatGPT -e --version 0.8.1
```
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.8.0))**
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.8.1))**
### Mac
- [ChatGPT_0.8.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT_0.8.0_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT.app.tar.gz)
- [ChatGPT_0.8.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT_0.8.1_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT.app.tar.gz)
- Homebrew \
_[Homebrew 快捷安装](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@ -53,8 +53,8 @@
### Linux
- [chat-gpt_0.8.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/chat-gpt_0.8.0_amd64.deb)
- [chat-gpt_0.8.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/chat-gpt_0.8.0_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- [chat-gpt_0.8.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/chat-gpt_0.8.1_amd64.deb)
- [chat-gpt_0.8.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/chat-gpt_0.8.1_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- 使用 [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin):
```bash
yay -S chatgpt-desktop-bin

View File

@ -24,22 +24,22 @@
### Windows
- [ChatGPT_0.8.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT_0.8.0_x64_en-US.msi): Direct download installer
- [ChatGPT_0.8.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT_0.8.1_x64_en-US.msi): Direct download installer
- Use [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
# install the latest version
winget install --id=lencx.ChatGPT -e
# install the specified version
winget install --id=lencx.ChatGPT -e --version 0.7.4
winget install --id=lencx.ChatGPT -e --version 0.8.1
```
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.8.0))**
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.8.1))**
### Mac
- [ChatGPT_0.8.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT_0.8.0_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/ChatGPT.app.tar.gz): Download the `.app` installer
- [ChatGPT_0.8.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT_0.8.1_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/ChatGPT.app.tar.gz): Download the `.app` installer
- Homebrew \
Or you can install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@ -55,8 +55,8 @@
### Linux
- [chat-gpt_0.8.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/chat-gpt_0.8.0_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.8.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.8.0/chat-gpt_0.8.0_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- [chat-gpt_0.8.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/chat-gpt_0.8.1_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.8.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.8.1/chat-gpt_0.8.1_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- Available on [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin) with the package name `chatgpt-desktop-bin`, and you can use your favourite AUR package manager to install it.
<!-- download end -->

View File

@ -1,5 +1,12 @@
# UPDATE LOG
## v0.8.1
fix:
- export button keeps blinking
- export button in the old chat does not work
- disable export sharing links because it is a security risk
## v0.8.0
feat:

View File

@ -71,7 +71,7 @@ async function init() {
document.addEventListener("click", (e) => {
const origin = e.target.closest("a");
if (!origin.target) return;
if (!origin || !origin.target) return;
if (origin && origin.href && origin.target !== '_self') {
invoke('open_link', { url: origin.href });
}

View File

@ -3,7 +3,7 @@
async function init() {
document.addEventListener("click", (e) => {
const origin = e.target.closest("a");
if (!origin.target) return;
if (!origin || !origin.target) return;
if (origin && origin.href && origin.target !== '_self') {
if (/\/(login|signup)$/.test(window.location.href)) {
origin.target = '_self';

View File

@ -24,7 +24,7 @@ async function init() {
} else if (shouldRemoveButtons()) {
removeButtons();
}
}, 200);
}, 1000);
}
const Format = {
@ -47,9 +47,16 @@ function shouldRemoveButtons() {
function shouldAddButtons(actionsArea) {
// first, check if there's a "Try Again" button and no other buttons
const buttons = actionsArea.querySelectorAll("button");
const hasTryAgainButton = Array.from(buttons).some((button) => {
return !button.id?.includes("download");
});
// fix: https://github.com/lencx/ChatGPT/issues/189
if (buttons.length === 1) {
return false;
}
if (hasTryAgainButton && buttons.length === 1) {
return true;
}
@ -106,16 +113,18 @@ function addActionsButtons(actionsArea, TryAgainButton) {
downloadThread({ as: Format.PDF });
};
actionsArea.appendChild(downloadPdfButton);
const exportHtml = TryAgainButton.cloneNode(true);
exportHtml.id = "download-html-button";
downloadButton.setAttribute("share-ext", "true");
// exportHtml.innerText = "Share Link";
exportHtml.title = "Share Link";
exportHtml.innerHTML = setIcon('link');
exportHtml.onclick = () => {
sendRequest();
};
actionsArea.appendChild(exportHtml);
// fix: https://github.com/lencx/ChatGPT/issues/126
// const exportHtml = TryAgainButton.cloneNode(true);
// exportHtml.id = "download-html-button";
// downloadButton.setAttribute("share-ext", "true");
// // exportHtml.innerText = "Share Link";
// exportHtml.title = "Share Link";
// exportHtml.innerHTML = setIcon('link');
// exportHtml.onclick = () => {
// sendRequest();
// };
// actionsArea.appendChild(exportHtml);
}
function downloadThread({ as = Format.PNG } = {}) {
@ -175,12 +184,27 @@ class Elements {
this.thread = document.querySelector(
"[class*='react-scroll-to-bottom']>[class*='react-scroll-to-bottom']>div"
);
// fix: old chat https://github.com/lencx/ChatGPT/issues/185
if (!this.thread) {
this.thread = document.querySelector(
"main .overflow-y-auto"
);
}
// h-full overflow-y-auto
this.positionForm = document.querySelector("form").parentNode;
// this.styledThread = document.querySelector("main");
// this.threadContent = document.querySelector(".gAnhyd");
this.scroller = Array.from(
document.querySelectorAll('[class*="react-scroll-to"]')
).filter((el) => el.classList.contains("h-full"))[0];
// fix: old chat
if (!this.scroller) {
this.scroller = document.querySelector('main .overflow-y-auto');
}
this.hiddens = Array.from(document.querySelectorAll(".overflow-hidden"));
this.images = Array.from(document.querySelectorAll("img[srcset]"));
}

View File

@ -7,7 +7,7 @@
},
"package": {
"productName": "ChatGPT",
"version": "0.8.0"
"version": "0.8.1"
},
"tauri": {
"allowlist": {