Skip to content

Commit de09b2b

Browse files
committed
fix: do not use cors proxy
1 parent 30cb866 commit de09b2b

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

src/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,8 @@ export default function App() {
397397
if (cursor) params.push(`cursor=${encodeURIComponent(cursor)}`);
398398
if (filterDate) params.push(`updated_since=${encodeURIComponent(filterDate.toISOString())}`);
399399
if (params.length > 0) baseUrl += `?${params.join('&')}`;
400-
// Wrap API URL with the CORS proxy
401-
const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(baseUrl)}`;
402-
// console.log('Fetching URL:', proxyUrl);
403-
const response = await fetch(proxyUrl, {
400+
// const response = await fetch(proxyUrl(baseUrl), {
401+
const response = await fetch(baseUrl, {
404402
method: 'GET',
405403
headers: { Accept: 'application/json, application/problem+json' },
406404
cache: 'force-cache' as const,

src/components/server-card.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export const ServerCard = ({
9696
try {
9797
const url = `${registryUrl}/${encodeURIComponent(item.server.name)}/versions`;
9898
// Then wrap it with the CORS proxy
99-
const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(url)}`;
100-
const res = await fetch(proxyUrl, {
99+
// const res = await fetch(proxyUrl(url), {
100+
const res = await fetch(url, {
101101
method: 'GET',
102102
headers: { Accept: 'application/json, application/problem+json' },
103103
cache: 'force-cache' as const,
@@ -131,13 +131,13 @@ export const ServerCard = ({
131131
<CardHeader>
132132
<div className="flex items-start justify-between gap-2">
133133
<div className="flex-1 min-w-0">
134-
<CardTitle className="text-md break-words mb-2">{item.server.name}</CardTitle>
134+
<CardTitle className="text-md wrap-break-word mb-2">{item.server.name}</CardTitle>
135135
<div className="flex items-center gap-2 mb-1">
136136
{/* Status indicator */}
137137
{itemMeta?.status && (
138138
<Tooltip>
139139
<TooltipTrigger asChild>
140-
<div className="flex-shrink-0">
140+
<div className="shrink-0">
141141
{itemMeta.status === 'active' ? (
142142
<CheckCircle className="h-4 w-4 text-green-700" />
143143
) : (
@@ -189,7 +189,7 @@ export const ServerCard = ({
189189
{itemMeta?.publishedAt && (
190190
<Tooltip>
191191
<TooltipTrigger asChild>
192-
<div className="flex text-muted-foreground items-center gap-1 flex-shrink-0">
192+
<div className="flex text-muted-foreground items-center gap-1 shrink-0">
193193
<Calendar className="h-4 w-4" />
194194
<span className="text-xs">
195195
{(() => formatDate(new Date(itemMeta.updatedAt || itemMeta.publishedAt)))()}
@@ -218,14 +218,14 @@ export const ServerCard = ({
218218
href={displayedServer.repository.url}
219219
target="_blank"
220220
rel="noopener noreferrer"
221-
className="flex-shrink-0 p-1 rounded-md hover:bg-accent transition-colors"
221+
className="shrink-0 p-1 rounded-md hover:bg-accent transition-colors"
222222
onClick={(e) => e.stopPropagation()}
223223
>
224224
{displayedServer.repository?.source === 'github' ? (
225225
<img
226226
src={GithubLogo}
227227
alt="GitHub"
228-
className="h-4 w-4 [filter:invert(0)] dark:[filter:invert(0.6)]"
228+
className="h-4 w-4 filter-[invert(0)] dark:filter-[invert(0.6)]"
229229
/>
230230
) : (
231231
<Link2 className="h-4 w-4" />
@@ -264,7 +264,7 @@ export const ServerCard = ({
264264
href={displayedServer.websiteUrl}
265265
target="_blank"
266266
rel="noopener noreferrer"
267-
className="flex-shrink-0 p-1 rounded-md hover:bg-accent transition-colors text-muted-foreground"
267+
className="shrink-0 p-1 rounded-md hover:bg-accent transition-colors text-muted-foreground"
268268
onClick={(e) => e.stopPropagation()}
269269
>
270270
<House className="h-4 w-4" />
@@ -291,7 +291,7 @@ export const ServerCard = ({
291291
<TooltipTrigger asChild>
292292
<button
293293
type="button"
294-
className="flex-shrink-0 p-1 rounded-md hover:bg-accent transition-colors text-muted-foreground"
294+
className="shrink-0 p-1 rounded-md hover:bg-accent transition-colors text-muted-foreground"
295295
onClick={(e) => e.stopPropagation()}
296296
>
297297
<FileJson className="h-4 w-4" />
@@ -330,7 +330,7 @@ export const ServerCard = ({
330330
{getPkgIcon(pkg)}
331331
<span className="font-mono text-muted-foreground">{pkg.identifier}</span>
332332
{pkg.environmentVariables && Object.keys(pkg.environmentVariables).length > 0 && (
333-
<Settings className="text-slate-400 flex-shrink-0" />
333+
<Settings className="text-slate-400 shrink-0" />
334334
)}
335335
</Button>
336336
</DialogTrigger>
@@ -358,7 +358,7 @@ export const ServerCard = ({
358358
})()}
359359
</span>
360360
{((remote.headers && remote.headers.length > 0) || remote.variables) && (
361-
<Settings className="text-slate-400 flex-shrink-0" />
361+
<Settings className="text-slate-400 shrink-0" />
362362
)}
363363
</Button>
364364
</DialogTrigger>

src/lib/indexeddb.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,9 @@ const fetchAllServers = async (apiUrl: string): Promise<McpServerItem[]> => {
309309
if (params.length > 0) {
310310
baseUrl += `?${params.join('&')}`;
311311
}
312-
// Wrap with CORS proxy
313-
const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(baseUrl)}`;
314-
console.log('Fetching all servers URL:', proxyUrl);
315-
const response = await fetch(proxyUrl, {
312+
// console.log('Fetching all servers URL:', proxyUrl);
313+
// const response = await fetch(proxyUrl(baseUrl), {
314+
const response = await fetch(baseUrl, {
316315
method: 'GET',
317316
headers: { Accept: 'application/json, application/problem+json' },
318317
cache: 'force-cache' as const,

src/lib/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ export function cn(...inputs: ClassValue[]) {
88
export const formatDate = (date: Date, separator: string = '.') => {
99
return `${date.getFullYear()}${separator}${String(date.getMonth() + 1).padStart(2, '0')}${separator}${String(date.getDate()).padStart(2, '0')}`;
1010
};
11+
12+
// /** CORS proxy helper */
13+
// export const proxyUrl = (url: string) => {
14+
// return `https://api.allorigins.win/raw?url=${encodeURIComponent(url)}`;
15+
// }

0 commit comments

Comments
 (0)