From 8797d1315247aee9a58f846b4dd0abbdb4bcb360 Mon Sep 17 00:00:00 2001 From: flakey5 <73616808+flakey5@users.noreply.github.com> Date: Thu, 2 May 2024 22:35:14 -0700 Subject: [PATCH] Add temporary static homepage --- index.ts | 6 ++++++ package-lock.json | 7 ++++--- package.json | 3 ++- static/index.html | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 static/index.html diff --git a/index.ts b/index.ts index b5ca864..e1057a8 100644 --- a/index.ts +++ b/index.ts @@ -1,6 +1,8 @@ +import { join } from 'node:path' import { platformaticService, Stackable } from '@platformatic/service' import fastifyUser from 'fastify-user' import fastifyPlugin from 'fastify-plugin' +import fastifyStatic from '@fastify/static' import { schema } from './lib/schema.js' import { Generator } from './lib/generator.js' import { AiWarpConfig } from './config.js' @@ -19,6 +21,10 @@ const stackable: Stackable = async function (fastify, opts) { await fastify.register(rateLimitPlugin, opts) await fastify.register(apiPlugin, opts) + await fastify.register(fastifyStatic, { + root: join(import.meta.dirname, 'static') + }) + await fastify.register(platformaticService, opts) } diff --git a/package-lock.json b/package-lock.json index 8e42471..9efcbaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@azure/openai": "^1.0.0-beta.12", "@fastify/error": "^3.4.1", "@fastify/rate-limit": "^9.1.0", + "@fastify/static": "^7.0.3", "@fastify/type-provider-typebox": "^4.0.0", "@platformatic/config": "^1.24.0", "@platformatic/generators": "^1.24.0", @@ -565,9 +566,9 @@ } }, "node_modules/@fastify/static": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-7.0.1.tgz", - "integrity": "sha512-i1p/nELMknAisNfnjo7yhfoUOdKzA+n92QaMirv2NkZrJ1Wl12v2nyTYlDwPN8XoStMBAnRK/Kx6zKmfrXUPXw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-7.0.3.tgz", + "integrity": "sha512-2tmTdF+uFCykasutaO6k4/wOt7eXyi7m3dGuCPo5micXzv0qt6ttb/nWnDYL/BlXjYGfp1JI4a1gyluTIylvQA==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", diff --git a/package.json b/package.json index 0c33a12..1e1f47e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start-ai-warp": "./dist/cli/start.js" }, "scripts": { - "build": "tsc --build", + "build": "tsc --build && cp -r ./static ./dist/", "build:config": "node ./dist/lib/schema.js --dump-schema | json2ts > config.d.ts", "clean": "rm -fr ./dist", "lint": "ts-standard | snazzy", @@ -38,6 +38,7 @@ "@azure/openai": "^1.0.0-beta.12", "@fastify/error": "^3.4.1", "@fastify/rate-limit": "^9.1.0", + "@fastify/static": "^7.0.3", "@fastify/type-provider-typebox": "^4.0.0", "@platformatic/config": "^1.24.0", "@platformatic/generators": "^1.24.0", diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..09eb4fe --- /dev/null +++ b/static/index.html @@ -0,0 +1,42 @@ + + + + + + AI Warp + + +
+ + + +
+ +

+ + + +