Skip to content

Commit 6c37d65

Browse files
committed
fix
1 parent 675a12e commit 6c37d65

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

popup/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const tabs = [
3333
{
3434
...CATEGORY.search,
3535
scripts: [
36-
// s.test,
36+
s.test,
3737
// s.ufs_statistic,
3838
R.theresanaiforthat,
3939
R.timeis,

scripts/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export function runFunc(fnPath = "", params = [], global = {}) {
142142

143143
export async function trackEvent(scriptId) {
144144
console.log("trackEvent", scriptId, version);
145-
// return;
145+
return;
146146
try {
147147
let res = await fetch(
148148
// "http://localhost:3000/count",

scripts/libs/ajax-hook/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function initFetch() {
6262
}
6363
}
6464

65-
let response = await originalFetch(urlOrRequest);
65+
let response = await originalFetch(urlOrRequest, options);
6666
for (const { fn } of onAfterFetchFn) {
6767
const res = await fn?.(request.url, request.options, response)?.catch(
6868
console.error

scripts/test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UfsGlobal } from "./content-scripts/ufs_global.js";
2-
import { fetchGraphQl, getFbdtsg } from "./fb_GLOBAL.js";
2+
import { hookFetch } from "./libs/ajax-hook/index.js";
33

44
export default {
55
icon: "",
@@ -12,6 +12,8 @@ export default {
1212
vi: "",
1313
},
1414

15+
whiteList: ["https://chatgpt.com/*"],
16+
1517
popupScript: {
1618
onClick: async () => {
1719
function getAverageRGB(img) {
@@ -329,6 +331,26 @@ export default {
329331
},
330332

331333
pageScript: {
334+
onDocumentStart: () => {
335+
hookFetch({
336+
onBefore: (url, options) => {
337+
if (
338+
url === "https://chatgpt.com/backend-anon/conversation" ||
339+
url === "https://chatgpt.com/backend-api/conversation"
340+
) {
341+
console.log(url, options);
342+
const body = JSON.parse(options.body);
343+
// body.model = "gpt-4o";
344+
body.messages.forEach((m) => {
345+
m.author.role = "system";
346+
// m.content.parts = ["what is your name"];
347+
});
348+
console.log("body", body);
349+
options.body = JSON.stringify(body);
350+
}
351+
},
352+
});
353+
},
332354
// download album
333355
_onClick: async () => {
334356
(async () => {

0 commit comments

Comments
 (0)