gadgetbridge integration
This commit is contained in:
10
src/index.ts
10
src/index.ts
@@ -19,6 +19,9 @@ import type { OpenAPIV3 } from "openapi-types";
|
||||
import { SwaggerTheme, SwaggerThemeNameEnum } from "swagger-themes";
|
||||
import { z } from "zod";
|
||||
import { Config } from "./config.js";
|
||||
import { GadgetbridgeClient } from "./gadgetbridge/client.js";
|
||||
import { privateGadgetbridgeRoutes } from "./gadgetbridge/private-routes.js";
|
||||
import { GadgetbridgeService } from "./gadgetbridge/service.js";
|
||||
import { GristClient } from "./grist/client.js";
|
||||
import { privateGristRoutes } from "./grist/private-routes.js";
|
||||
import { GristService } from "./grist/service.js";
|
||||
@@ -82,6 +85,7 @@ await publicServer.register(
|
||||
await privateServer.register(
|
||||
fastifySwagger,
|
||||
getSwaggerObject([
|
||||
{ url: "http://localhost:8080", description: "dev" },
|
||||
{ url: "http://192.168.178.161:20001", description: "prod" },
|
||||
]),
|
||||
);
|
||||
@@ -136,6 +140,9 @@ await privateServer.register(fastifyAxios, getAxiosConfig());
|
||||
await publicServer.register(fastifyWebsocket);
|
||||
|
||||
// Clients and Services
|
||||
const gadgetbridgeClient = new GadgetbridgeClient(Config.gadgetbridge.db_path);
|
||||
const gadgetbridgeService = new GadgetbridgeService(gadgetbridgeClient);
|
||||
|
||||
const gristClient = new GristClient(privateServer.axios.grist);
|
||||
const gristService = new GristService(gristClient);
|
||||
|
||||
@@ -171,6 +178,9 @@ async function verifyAPIKey(
|
||||
// Register routes
|
||||
await publicServer.register(publicWsRoutes, { wsService, hpService });
|
||||
|
||||
await privateServer.register(privateGadgetbridgeRoutes, {
|
||||
gadgetbridgeService,
|
||||
});
|
||||
await privateServer.register(privateGristRoutes, { gristService });
|
||||
await privateServer.register(privateHomeAssistantRoutes, {
|
||||
haService,
|
||||
|
||||
Reference in New Issue
Block a user