Skip to content

Commit 0a0080b

Browse files
committed
Simplify: remove proxy; keep monthly msUserId only
1 parent c18bbce commit 0a0080b

File tree

2 files changed

+2
-57
lines changed

2 files changed

+2
-57
lines changed

docusaurus/api/meili-search.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

docusaurus/src/theme/SearchBar/index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ function SearchBarContent() {
3939
const uuid = (typeof crypto !== 'undefined' && crypto.randomUUID) ? crypto.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);
4040
const value = JSON.stringify({ id: uuid, month: monthKey });
4141
window.localStorage.setItem(key, value);
42-
try {
43-
// Also set a same‑origin cookie so serverless proxy can read it
44-
const ttlDays = 45; // longer than a month for safety; we rotate monthly client‑side
45-
const maxAge = ttlDays * 24 * 60 * 60;
46-
document.cookie = `msUserId=${uuid}; Max-Age=${maxAge}; Path=/; SameSite=Lax` + (window.location.protocol === 'https:' ? '; Secure' : '');
47-
} catch {}
4842
return uuid;
4943
} catch (_) {
5044
return null;
@@ -165,8 +159,8 @@ function SearchBarContent() {
165159
import('meilisearch-docsearch/css')
166160
]).then(([{ docsearch }]) => {
167161
const meiliHost = siteConfig.customFields.meilisearch.host;
168-
// Use proxy on non-localhost to avoid CORS limits and inject server-side header
169-
const useProxy = typeof window !== 'undefined' && window.location && window.location.hostname !== 'localhost';
162+
// Always call Meili directly (no proxy) since env config isn’t accessible
163+
const useProxy = false;
170164
const baseOptions = {
171165
container: searchButtonRef.current,
172166
host: useProxy ? `${window.location.origin}/api` : meiliHost,

0 commit comments

Comments
 (0)