diff --git a/packages/api/src/routes/v4/data.ts b/packages/api/src/routes/v4/data.ts index a03acff..068dced 100644 --- a/packages/api/src/routes/v4/data.ts +++ b/packages/api/src/routes/v4/data.ts @@ -9,9 +9,33 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: const fetchOptions = { headers: { 'Cache-Control': 'no-cache' }, }; - const result = await (await fetch(databaseUrl, fetchOptions)).json(); + const { rules, ...result } = await (await fetch(databaseUrl, fetchOptions)).json(); - reply.send({ data: result, success: true }); + reply.send({ + data: { + ...result, + rules: (rules as readonly string[]).map((urlFilter, index) => ({ + id: index + 1, + priority: 1, + action: { + type: 'block', + }, + condition: { + resourceTypes: [ + 'font', + 'image', + 'media', + 'object', + 'script', + 'stylesheet', + 'xmlhttprequest', + ], + urlFilter, + }, + })), + }, + success: true, + }); } catch (error) { reply.send({ errors: [error.message],