Renderlib-dev commited on
Commit
ddd600e
·
verified ·
1 Parent(s): 3f8afd4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +12 -4
index.html CHANGED
@@ -2110,6 +2110,7 @@
2110
  try {
2111
  await fetch(Config.GAS_URL, {
2112
  method: 'POST',
 
2113
  body: JSON.stringify({ action: "delete_account", email: State.user })
2114
  });
2115
  } catch(e) {
@@ -2178,10 +2179,9 @@
2178
  btn.innerText = "Wait...";
2179
 
2180
  try {
2181
- // Network error fix: Remove content-type application/json to avoid preflight issues in GAS.
2182
- // Using standard text payload which GAS can parse.
2183
  const res = await fetch(Config.GAS_URL, {
2184
  method: 'POST',
 
2185
  body: JSON.stringify(payload)
2186
  });
2187
 
@@ -2230,6 +2230,7 @@
2230
  try {
2231
  const res = await fetch(Config.GAS_URL, {
2232
  method: 'POST',
 
2233
  body: JSON.stringify({ action: "get_all_chats", email: State.user })
2234
  });
2235
  const textResponse = await res.text();
@@ -2272,6 +2273,7 @@
2272
  try {
2273
  const res = await fetch(Config.GAS_URL, {
2274
  method: 'POST',
 
2275
  body: JSON.stringify({ action: "get_chat", email: State.user, threadId: threadId })
2276
  });
2277
  const textResponse = await res.text();
@@ -2329,6 +2331,7 @@
2329
 
2330
  fetch(Config.GAS_URL, {
2331
  method: 'POST',
 
2332
  body: JSON.stringify({
2333
  action: "save_chat",
2334
  email: State.user,
@@ -2352,6 +2355,7 @@
2352
 
2353
  fetch(Config.GAS_URL, {
2354
  method: 'POST',
 
2355
  body: JSON.stringify({ action: "clear_all_chats", email: State.user })
2356
  }).catch(e => console.error("Clear error:", e)).then(() => this.syncAllChats());
2357
  }
@@ -2364,6 +2368,7 @@
2364
 
2365
  fetch(Config.GAS_URL, {
2366
  method: 'POST',
 
2367
  body: JSON.stringify({ action: "delete_chat", email: State.user, threadId: threadId })
2368
  }).catch(e => console.error("Delete error:", e)).then(() => this.syncAllChats());
2369
  }
@@ -2842,8 +2847,10 @@
2842
  let mathCounter = 0;
2843
 
2844
  function replacer(match) {
2845
- const id = `___MATH_${mathCounter++}___`;
 
2846
  mathBlocks[id] = match;
 
2847
  return id;
2848
  }
2849
 
@@ -2857,7 +2864,8 @@
2857
 
2858
  postprocessMath(html, mathBlocks) {
2859
  for (const [id, mathStr] of Object.entries(mathBlocks)) {
2860
- html = html.replace(id, mathStr);
 
2861
  }
2862
  return html;
2863
  },
 
2110
  try {
2111
  await fetch(Config.GAS_URL, {
2112
  method: 'POST',
2113
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2114
  body: JSON.stringify({ action: "delete_account", email: State.user })
2115
  });
2116
  } catch(e) {
 
2179
  btn.innerText = "Wait...";
2180
 
2181
  try {
 
 
2182
  const res = await fetch(Config.GAS_URL, {
2183
  method: 'POST',
2184
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2185
  body: JSON.stringify(payload)
2186
  });
2187
 
 
2230
  try {
2231
  const res = await fetch(Config.GAS_URL, {
2232
  method: 'POST',
2233
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2234
  body: JSON.stringify({ action: "get_all_chats", email: State.user })
2235
  });
2236
  const textResponse = await res.text();
 
2273
  try {
2274
  const res = await fetch(Config.GAS_URL, {
2275
  method: 'POST',
2276
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2277
  body: JSON.stringify({ action: "get_chat", email: State.user, threadId: threadId })
2278
  });
2279
  const textResponse = await res.text();
 
2331
 
2332
  fetch(Config.GAS_URL, {
2333
  method: 'POST',
2334
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2335
  body: JSON.stringify({
2336
  action: "save_chat",
2337
  email: State.user,
 
2355
 
2356
  fetch(Config.GAS_URL, {
2357
  method: 'POST',
2358
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2359
  body: JSON.stringify({ action: "clear_all_chats", email: State.user })
2360
  }).catch(e => console.error("Clear error:", e)).then(() => this.syncAllChats());
2361
  }
 
2368
 
2369
  fetch(Config.GAS_URL, {
2370
  method: 'POST',
2371
+ headers: { 'Content-Type': 'text/plain;charset=utf-8' },
2372
  body: JSON.stringify({ action: "delete_chat", email: State.user, threadId: threadId })
2373
  }).catch(e => console.error("Delete error:", e)).then(() => this.syncAllChats());
2374
  }
 
2847
  let mathCounter = 0;
2848
 
2849
  function replacer(match) {
2850
+ // Changed placeholder to completely avoid underscores or any special markdown characters
2851
+ const id = `MATHBLOCKPLACEHOLDER${mathCounter}ENDPLACEHOLDER`;
2852
  mathBlocks[id] = match;
2853
+ mathCounter++;
2854
  return id;
2855
  }
2856
 
 
2864
 
2865
  postprocessMath(html, mathBlocks) {
2866
  for (const [id, mathStr] of Object.entries(mathBlocks)) {
2867
+ // Using split.join to ensure global replace regardless of markdown alterations
2868
+ html = html.split(id).join(mathStr);
2869
  }
2870
  return html;
2871
  },