mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
18 lines
621 B
TypeScript
18 lines
621 B
TypeScript
|
|
import { ApiSettingsModel, TApiSettings } from "@schema/ApiSettingsSchema";
|
|
|
|
function cryptApiKeyName(apiSettings: TApiSettings): TApiSettings {
|
|
return { ...apiSettings, apiKey: apiSettings.apiKey.substring(0, 6) + '******' }
|
|
}
|
|
|
|
export default defineEventHandler(async event => {
|
|
|
|
const data = await getRequestDataOld(event, { allowGuests: false, allowLitlyx: false, requireRange: false });
|
|
if (!data) return;
|
|
|
|
const { project_id } = data;
|
|
|
|
const apiKeys = await ApiSettingsModel.find({ project_id }, { project_id: 0 })
|
|
return apiKeys.map(e => cryptApiKeyName(e.toJSON())) as TApiSettings[];
|
|
|
|
}); |