generated from Dicken/dickendock
round27: Ping-Regression rueckgaengig gemacht (Echo/Samsung-Geraete ignorieren ICMP), Aktualisiert-Text entfernt, Suchmaschinen-Hinweis+README, API-Scanner stark erweitert mit eigenem Reiter
This commit is contained in:
@@ -19,13 +19,17 @@ export async function apiRoutes(app: FastifyInstance): Promise<void> {
|
||||
const services = serviceRepo.listServices();
|
||||
let servicesWithApi = 0;
|
||||
let totalFound = 0;
|
||||
const newFindings: { serviceId: string; serviceName: string; apis: apiRepo.DetectedApiEntry[] }[] = [];
|
||||
|
||||
for (const service of services) {
|
||||
const found = await detectApis(service.url);
|
||||
if (found.length > 0) {
|
||||
apiRepo.replaceApisForService(service.id, found);
|
||||
const { added } = apiRepo.replaceApisForService(service.id, found);
|
||||
servicesWithApi++;
|
||||
totalFound += found.length;
|
||||
if (added.length > 0) {
|
||||
newFindings.push({ serviceId: service.id, serviceName: service.displayName, apis: added });
|
||||
}
|
||||
} else {
|
||||
apiRepo.deleteApisForService(service.id);
|
||||
}
|
||||
@@ -38,7 +42,7 @@ export async function apiRoutes(app: FastifyInstance): Promise<void> {
|
||||
message: `API-Scan: ${services.length} Dienst(e) geprüft, bei ${servicesWithApi} Dienst(en) ${totalFound} API-Endpunkt(e) gefunden.`,
|
||||
});
|
||||
|
||||
return { checked: services.length, servicesWithApi, totalFound };
|
||||
return { checked: services.length, servicesWithApi, totalFound, newFindings };
|
||||
});
|
||||
|
||||
app.post("/api/scan/apis/:serviceId", async (request, reply) => {
|
||||
@@ -49,9 +53,10 @@ export async function apiRoutes(app: FastifyInstance): Promise<void> {
|
||||
}
|
||||
|
||||
const found = await detectApis(service.url);
|
||||
const saved = found.length > 0 ? apiRepo.replaceApisForService(service.id, found) : [];
|
||||
const { saved, added } =
|
||||
found.length > 0 ? apiRepo.replaceApisForService(service.id, found) : { saved: [], added: [] };
|
||||
if (found.length === 0) apiRepo.deleteApisForService(service.id);
|
||||
|
||||
return { serviceId, apis: saved };
|
||||
return { serviceId, apis: saved, added };
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user