Skip to content

Commit 67af2bf

Browse files
chore: ci build
1 parent 24a4d10 commit 67af2bf

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

dist/chatgpt.user.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN ChatGPT Exporter
44
// @name:zh-TW ChatGPT Exporter
55
// @namespace pionxzh
6-
// @version 2.24.4
6+
// @version 2.24.5
77
// @author pionxzh
88
// @description Easily export the whole ChatGPT conversation history for further analysis or sharing.
99
// @description:zh-CN 轻松导出 ChatGPT 聊天记录,以便进一步分析或分享。
@@ -1050,9 +1050,13 @@ html {
10501050
function getHistoryDisabled() {
10511051
return localStorage.getItem(KEY_OAI_HISTORY_DISABLED) === '"true"';
10521052
}
1053+
function getPageAccessToken() {
1054+
var _a, _b, _c, _d, _e, _f;
1055+
return ((_f = (_e = (_d = (_c = (_b = (_a = _unsafeWindow == null ? void 0 : _unsafeWindow.__remixContext) == null ? void 0 : _a.state) == null ? void 0 : _b.loaderData) == null ? void 0 : _c.root) == null ? void 0 : _d.clientBootstrap) == null ? void 0 : _e.session) == null ? void 0 : _f.accessToken) ?? null;
1056+
}
10531057
function getUserProfile() {
1054-
var _a, _b, _c;
1055-
const user = (_c = (_b = (_a = _unsafeWindow == null ? void 0 : _unsafeWindow.__NEXT_DATA__) == null ? void 0 : _a.props) == null ? void 0 : _b.pageProps) == null ? void 0 : _c.user;
1058+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1059+
const user = ((_c = (_b = (_a = _unsafeWindow == null ? void 0 : _unsafeWindow.__NEXT_DATA__) == null ? void 0 : _a.props) == null ? void 0 : _b.pageProps) == null ? void 0 : _c.user) ?? ((_i = (_h = (_g = (_f = (_e = (_d = _unsafeWindow == null ? void 0 : _unsafeWindow.__remixContext) == null ? void 0 : _d.state) == null ? void 0 : _e.loaderData) == null ? void 0 : _f.root) == null ? void 0 : _g.clientBootstrap) == null ? void 0 : _h.session) == null ? void 0 : _i.user);
10561060
if (!user) throw new Error("No user found.");
10571061
return user;
10581062
}
@@ -1065,10 +1069,13 @@ html {
10651069
return location.pathname.startsWith("/share") && !location.pathname.endsWith("/continue");
10661070
}
10671071
function getConversationFromSharePage() {
1068-
var _a, _b, _c, _d;
1072+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
10691073
if ((_d = (_c = (_b = (_a = window.__NEXT_DATA__) == null ? void 0 : _a.props) == null ? void 0 : _b.pageProps) == null ? void 0 : _c.serverResponse) == null ? void 0 : _d.data) {
10701074
return JSON.parse(JSON.stringify(window.__NEXT_DATA__.props.pageProps.serverResponse.data));
10711075
}
1076+
if ((_i = (_h = (_g = (_f = (_e = window.__remixContext) == null ? void 0 : _e.state) == null ? void 0 : _f.loaderData) == null ? void 0 : _g["routes/share.$shareId.($action)"]) == null ? void 0 : _h.serverResponse) == null ? void 0 : _i.data) {
1077+
return JSON.parse(JSON.stringify(window.__remixContext.state.loaderData["routes/share.$shareId.($action)"].serverResponse.data));
1078+
}
10721079
return null;
10731080
}
10741081
const defaultAvatar = "data:image/svg+xml,%3Csvg%20stroke%3D%22currentColor%22%20fill%3D%22none%22%20stroke-width%3D%221.5%22%20viewBox%3D%22-6%20-6%2036%2036%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20style%3D%22color%3A%20white%3B%20background%3A%20%23ab68ff%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2%22%3E%3C%2Fpath%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%227%22%20r%3D%224%22%3E%3C%2Fcircle%3E%3C%2Fsvg%3E";
@@ -1249,6 +1256,8 @@ html {
12491256
}
12501257
const fetchSession = memorize(_fetchSession);
12511258
async function getAccessToken() {
1259+
const pageAccessToken = getPageAccessToken();
1260+
if (pageAccessToken) return pageAccessToken;
12521261
const session = await fetchSession();
12531262
return session.accessToken;
12541263
}
@@ -22719,24 +22728,24 @@ ${content2}`;
2271922728
main();
2272022729
function main() {
2272122730
onloadSafe(() => {
22722-
const container = document.createElement("div");
22723-
container.style.zIndex = "20";
22724-
D$4(/* @__PURE__ */ o$8(Menu, { container }), container);
2272522731
const styleEl = document.createElement("style");
2272622732
styleEl.id = "sentinel-css";
2272722733
document.head.append(styleEl);
22734+
const injectionWeakMap = /* @__PURE__ */ new WeakMap();
2272822735
sentinel.on("nav", (nav) => {
22729-
const chatList = document.querySelector("nav > div.overflow-y-auto, nav > div.overflow-y-hidden");
22736+
if (injectionWeakMap.has(nav)) return;
22737+
injectionWeakMap.set(nav, true);
22738+
const container = getMenuContainer();
22739+
const chatList = nav.querySelector(":scope > div.overflow-y-auto, :scope > div.overflow-y-hidden");
2273022740
if (chatList) {
2273122741
chatList.after(container);
2273222742
} else {
2273322743
nav.append(container);
2273422744
}
2273522745
});
2273622746
if (isSharePage()) {
22737-
const continueUrl = `${location.href}/continue`;
22738-
sentinel.on(`a[href="${continueUrl}"]`, (link2) => {
22739-
link2.after(container);
22747+
sentinel.on(`div[role="presentation"] > .w-full > div >.flex.w-full`, (target) => {
22748+
target.prepend(getMenuContainer());
2274022749
});
2274122750
}
2274222751
let chatId = "";
@@ -22769,5 +22778,11 @@ ${content2}`;
2276922778
});
2277022779
});
2277122780
}
22781+
function getMenuContainer() {
22782+
const container = document.createElement("div");
22783+
container.style.zIndex = "20";
22784+
D$4(/* @__PURE__ */ o$8(Menu, { container }), container);
22785+
return container;
22786+
}
2277222787

2277322788
})(JSZip, html2canvas);

0 commit comments

Comments
 (0)