fix: guide EKAP human verification

This commit is contained in:
2026-09-15 17:41:51 +03:00
parent 242e7d8c2e
commit e5e1b12185
10 changed files with 372 additions and 56 deletions
+7 -10
View File
@@ -66,6 +66,7 @@ import { bildirimleriIsle } from './notifier.mjs';
import { scanSite } from './site-scan.mjs';
import { createDetailCache } from './detail-cache.mjs';
import { releaseInfo } from './release-info.mjs';
import { sourceFailure } from './source-error.mjs';
// ilan.gov.tr sunucusu ara sertifikayı (GeoTrust TLS RSA CA G1) göndermiyor;
// zinciri tamamlamak için PEM'i yerelden ekliyoruz.
@@ -663,13 +664,6 @@ function json(res, code, body) {
res.end(JSON.stringify(body));
}
const sourceUnavailable = error => ({
success: false,
error: error?.message || 'Resmi belge kaynağına ulaşılamadı.',
code: 'SOURCE_UNAVAILABLE',
retryable: true,
});
function readRaw(req, limit = 1024 * 1024) {
return new Promise((resolve, reject) => {
let buf = '';
@@ -842,7 +836,8 @@ const server = http.createServer(async (req, res) => {
const out = await documentUrl(ikn);
return json(res, 200, { success: true, ...out });
} catch (e) {
return json(res, 502, sourceUnavailable(e));
const failure = sourceFailure(e);
return json(res, failure.status, failure.body);
}
}
// İlan metni + kalemler — analiz için (tarayıcı gerektirmez)
@@ -854,7 +849,8 @@ const server = http.createServer(async (req, res) => {
const parsed = mergeAnnouncementFields(out.metin, out);
return json(res, 200, { success: true, ...out, ...parsed, tarih: out.tarih || parsed.tarih || '', saat: out.saat || parsed.saat || '' });
} catch (e) {
return json(res, 502, sourceUnavailable(e));
const failure = sourceFailure(e);
return json(res, failure.status, failure.body);
}
}
// Doküman metni — sunucu tarafı tarayıcı gerektirir
@@ -867,7 +863,8 @@ const server = http.createServer(async (req, res) => {
const out = await documentText(ikn);
return json(res, 200, { success: true, ...out });
} catch (e) {
return json(res, 502, sourceUnavailable(e));
const failure = sourceFailure(e);
return json(res, failure.status, failure.body);
}
}
if (url.pathname === '/api/documents/config') {