fix: proxy MCP and expose EKAP verification gates
This commit is contained in:
+8
-4
@@ -942,7 +942,8 @@ const server = http.createServer(async (req, res) => {
|
||||
if (urunAramaCache.size > 200) urunAramaCache.delete(urunAramaCache.keys().next().value);
|
||||
return json(res, 200, { success: true, ...out });
|
||||
} catch (e) {
|
||||
return json(res, 502, { success: false, error: e.message });
|
||||
const failure = sourceFailure(e);
|
||||
return json(res, failure.status, failure.body);
|
||||
}
|
||||
}
|
||||
// OKAS kataloğunda ad ile arama — idarenin kendi sınıflandırma kodunu bulmak için
|
||||
@@ -957,7 +958,8 @@ const server = http.createServer(async (req, res) => {
|
||||
urunAramaCache.set(anahtar, { zaman: Date.now(), veri: kalemler });
|
||||
return json(res, 200, { success: true, kalemler });
|
||||
} catch (e) {
|
||||
return json(res, 502, { success: false, error: e.message });
|
||||
const failure = sourceFailure(e);
|
||||
return json(res, failure.status, failure.body);
|
||||
}
|
||||
}
|
||||
// --- Anlamsal uyum bonusu: profil metni ↔ havuz (sunucuda gömme) ---
|
||||
@@ -1053,7 +1055,8 @@ const server = http.createServer(async (req, res) => {
|
||||
);
|
||||
return json(res, 200, { success: true, ...out });
|
||||
} catch (e) {
|
||||
return json(res, 502, { success: false, error: e.message });
|
||||
const failure = sourceFailure(e);
|
||||
return json(res, failure.status, failure.body);
|
||||
}
|
||||
}
|
||||
if (url.pathname === '/api/kik/karar') {
|
||||
@@ -1063,7 +1066,8 @@ const server = http.createServer(async (req, res) => {
|
||||
const metin = await kararMetni(id);
|
||||
return json(res, 200, { success: true, id, metin });
|
||||
} catch (e) {
|
||||
return json(res, 502, { success: false, error: e.message });
|
||||
const failure = sourceFailure(e);
|
||||
return json(res, failure.status, failure.body);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const MANUAL_EKAP_URL = 'https://ekap.kik.gov.tr/EKAP/';
|
||||
export function sourceFailure(error) {
|
||||
const rawMessage = error?.message || 'Resmi belge kaynağına ulaşılamadı.';
|
||||
const humanVerification = error?.code === 'HUMAN_VERIFICATION_REQUIRED'
|
||||
|| /HUMAN_VERIFICATION_REQUIRED|EKAP\s+428/i.test(rawMessage);
|
||||
|| /HUMAN_VERIFICATION_REQUIRED|(?:EKAP|KİK)[^\n]{0,120}(?:HTTP\s*)?428|HTTP\s*428/i.test(rawMessage);
|
||||
|
||||
if (humanVerification) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user