diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index f7390c0..147ec87 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -50,4 +50,5 @@ jobs: uses: denoland/deployctl@v1 with: project: kaleidoshare - entrypoint: server.ts + entrypoint: server/index.ts + import-map: server/deno.jsonc diff --git a/.vscode/settings.json b/.vscode/settings.json index b55eded..260d6cd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,5 @@ "deno.enable": true, "deno.unstable": true, "deno.enablePaths": ["server.ts", "server"], - "deno.config": "./deno.jsonc" + "deno.config": "./server/deno.jsonc" } diff --git a/deno.jsonc b/deno.jsonc deleted file mode 100644 index ce82731..0000000 --- a/deno.jsonc +++ /dev/null @@ -1,26 +0,0 @@ -{ - "imports": { - // "simplewebauthn/server": "npm:@simplewebauthn/server@^7.2.0", - "simplewebauthn/server": "https://esm.sh/@simplewebauthn/server@7.3.0", - // "simplewebauthn/server/helpers": "npm:@simplewebauthn/server@^7.2.0/helpers", - "simplewebauthn/server/helpers": "https://esm.sh/@simplewebauthn/server@7.3.0/helpers", - // "simplewebauthn/typescript-types": "npm:@simplewebauthn/typescript-types", - "simplewebauthn/typescript-types": "https://esm.sh/@simplewebauthn/typescript-types@7.0.0", - "std/encoding/base64url": "https://deno.land/std@0.179.0/encoding/base64url.ts", - "std/_util/asserts": "https://deno.land/std@0.183.0/_util/asserts.ts", - // "ulid": "npm:ulid@2.3.0", - "ulid": "https://esm.sh/ulid@2.3.0", - // "ajv": "npm:ajv@8.12.0", - "ajv": "https://esm.sh/ajv@8.12.0", - "oak": "https://deno.land/x/oak@v12.2.0/mod.ts", - "oak_sessions": "https://deno.land/x/oak_sessions@v4.1.4/mod.ts", - "react": "https://esm.sh/react@18.2.0", - "react-dom/server": "https://esm.sh/react-dom@18.2.0/server" - }, - "scopes": {}, - "compilerOptions": { - "jsx": "react", - "jsxFactory": "React.createElement", - "jsxFragmentFactory": "React.Fragment" - } -} diff --git a/package.json b/package.json index efa8887..9b7082b 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,11 @@ "scripts": { "dev": "run-p dev:*", "dev:frontend": "vite", - "dev:backend": "deno run -A --watch --unstable ./server.ts", + "dev:backend": "deno run -A --watch --unstable --config server/deno.jsonc server/index.ts", "build": "run-s build:*", "build:schema": "ts-json-schema-generator --path 'schema/schema.ts' --out schema/schema.json", "build:frontend": "vite build", - "preview": "deno run -A --unstable ./server.ts", + "preview": "deno run -A --unstable --config server/deno.jsonc server/index.ts", "test": "run-s test:*", "test:backend": "node --loader tsx --test ./test/backend/*.test.mts", "test:frontend": "playwright test" diff --git a/server/api.ts b/server/api.ts index 2f10775..d41b08d 100644 --- a/server/api.ts +++ b/server/api.ts @@ -24,7 +24,8 @@ import { updateContent, } from "./content.ts"; -import Ajv, { ValidateFunction } from "ajv"; +import AjvImport, { ValidateFunction } from "ajv"; +const Ajv = AjvImport as unknown as typeof AjvImport.default; import schema from "../schema/schema.json" assert { type: "json" }; import { Settings, Output, Image } from "../schema/schema.ts"; import { makeContentPageForTwitterBot } from "./twitter.tsx"; diff --git a/server/deno.jsonc b/server/deno.jsonc new file mode 100644 index 0000000..2d0147b --- /dev/null +++ b/server/deno.jsonc @@ -0,0 +1,22 @@ +{ + "imports": { + "simplewebauthn/server": "npm:@simplewebauthn/server@^7.3.0", + "simplewebauthn/server/helpers": "npm:@simplewebauthn/server@^7.3.0/helpers", + "simplewebauthn/typescript-types": "npm:@simplewebauthn/typescript-types@7.4.0", + "std/encoding/base64url": "https://deno.land/std@0.179.0/encoding/base64url.ts", + "std/_util/asserts": "https://deno.land/std@0.183.0/_util/asserts.ts", + "ulid": "npm:ulid@2.3.0", + "ajv": "npm:ajv@8.12.0", + "oak": "https://deno.land/x/oak@v12.2.0/mod.ts", + "oak_sessions": "https://deno.land/x/oak_sessions@v4.1.4/mod.ts", + "react": "npm:react@18.2.0", + "react-dom/server": "npm:react-dom@18.2.0/server" + }, + "scopes": {}, + "compilerOptions": { + "jsx": "react", + "jsxFactory": "React.createElement", + "jsxFragmentFactory": "React.Fragment" + }, + "nodeModulesDir": false +} diff --git a/deno.lock b/server/deno.lock similarity index 60% rename from deno.lock rename to server/deno.lock index 283d8fe..aff0aaf 100644 --- a/deno.lock +++ b/server/deno.lock @@ -1,5 +1,281 @@ { - "version": "2", + "version": "3", + "packages": { + "specifiers": { + "npm:@simplewebauthn/server@^7.3.0": "npm:@simplewebauthn/server@7.4.0", + "npm:ajv@8.12.0": "npm:ajv@8.12.0", + "npm:react-dom@18.2.0": "npm:react-dom@18.2.0_react@18.2.0", + "npm:react@18.2.0": "npm:react@18.2.0", + "npm:ulid@2.3.0": "npm:ulid@2.3.0" + }, + "npm": { + "@cbor-extract/cbor-extract-darwin-arm64@2.1.1": { + "integrity": "sha512-blVBy5MXz6m36Vx0DfLd7PChOQKEs8lK2bD1WJn/vVgG4FXZiZmZb2GECHFvVPA5T7OnODd9xZiL3nMCv6QUhA==", + "dependencies": {} + }, + "@cbor-extract/cbor-extract-darwin-x64@2.1.1": { + "integrity": "sha512-h6KFOzqk8jXTvkOftyRIWGrd7sKQzQv2jVdTL9nKSf3D2drCvQB/LHUxAOpPXo3pv2clDtKs3xnHalpEh3rDsw==", + "dependencies": {} + }, + "@cbor-extract/cbor-extract-linux-arm64@2.1.1": { + "integrity": "sha512-SxAaRcYf8S0QHaMc7gvRSiTSr7nUYMqbUdErBEu+HYA4Q6UNydx1VwFE68hGcp1qvxcy9yT5U7gA+a5XikfwSQ==", + "dependencies": {} + }, + "@cbor-extract/cbor-extract-linux-arm@2.1.1": { + "integrity": "sha512-ds0uikdcIGUjPyraV4oJqyVE5gl/qYBpa/Wnh6l6xLE2lj/hwnjT2XcZCChdXwW/YFZ1LUHs6waoYN8PmK0nKQ==", + "dependencies": {} + }, + "@cbor-extract/cbor-extract-linux-x64@2.1.1": { + "integrity": "sha512-GVK+8fNIE9lJQHAlhOROYiI0Yd4bAZ4u++C2ZjlkS3YmO6hi+FUxe6Dqm+OKWTcMpL/l71N6CQAmaRcb4zyJuA==", + "dependencies": {} + }, + "@cbor-extract/cbor-extract-win32-x64@2.1.1": { + "integrity": "sha512-2Niq1C41dCRIDeD8LddiH+mxGlO7HJ612Ll3D/E73ZWBmycued+8ghTr/Ho3CMOWPUEr08XtyBMVXAjqF+TcKw==", + "dependencies": {} + }, + "@hexagon/base64@1.1.28": { + "integrity": "sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==", + "dependencies": {} + }, + "@peculiar/asn1-android@2.3.6": { + "integrity": "sha512-zkYh4DsiRhiNfg6tWaUuRc+huwlb9XJbmeZLrjTz9v76UK1Ehq3EnfJFED6P3sdznW/nqWe46LoM9JrqxcD58g==", + "dependencies": { + "@peculiar/asn1-schema": "@peculiar/asn1-schema@2.3.6", + "asn1js": "asn1js@3.0.5", + "tslib": "tslib@2.6.2" + } + }, + "@peculiar/asn1-ecc@2.3.6": { + "integrity": "sha512-Hu1xzMJQWv8/GvzOiinaE6XiD1/kEhq2C/V89UEoWeZ2fLUcGNIvMxOr/pMyL0OmpRWj/mhCTXOZp4PP+a0aTg==", + "dependencies": { + "@peculiar/asn1-schema": "@peculiar/asn1-schema@2.3.6", + "@peculiar/asn1-x509": "@peculiar/asn1-x509@2.3.6", + "asn1js": "asn1js@3.0.5", + "tslib": "tslib@2.6.2" + } + }, + "@peculiar/asn1-rsa@2.3.6": { + "integrity": "sha512-DswjJyAXZnvESuImGNTvbNKvh1XApBVqU+r3UmrFFTAI23gv62byl0f5OFKWTNhCf66WQrd3sklpsCZc/4+jwA==", + "dependencies": { + "@peculiar/asn1-schema": "@peculiar/asn1-schema@2.3.6", + "@peculiar/asn1-x509": "@peculiar/asn1-x509@2.3.6", + "asn1js": "asn1js@3.0.5", + "tslib": "tslib@2.6.2" + } + }, + "@peculiar/asn1-schema@2.3.6": { + "integrity": "sha512-izNRxPoaeJeg/AyH8hER6s+H7p4itk+03QCa4sbxI3lNdseQYCuxzgsuNK8bTXChtLTjpJz6NmXKA73qLa3rCA==", + "dependencies": { + "asn1js": "asn1js@3.0.5", + "pvtsutils": "pvtsutils@1.3.5", + "tslib": "tslib@2.6.2" + } + }, + "@peculiar/asn1-x509@2.3.6": { + "integrity": "sha512-dRwX31R1lcbIdzbztiMvLNTDoGptxdV7HocNx87LfKU0fEWh7fTWJjx4oV+glETSy6heF/hJHB2J4RGB3vVSYg==", + "dependencies": { + "@peculiar/asn1-schema": "@peculiar/asn1-schema@2.3.6", + "asn1js": "asn1js@3.0.5", + "ipaddr.js": "ipaddr.js@2.1.0", + "pvtsutils": "pvtsutils@1.3.5", + "tslib": "tslib@2.6.2" + } + }, + "@simplewebauthn/iso-webcrypto@7.4.0": { + "integrity": "sha512-LSx8zghjH+z9IFOhBdDv2AyhqnzDUCYFxFiwJbToowOigCgf4Y8fyZle9Y+0NS232bIoU6j/lgv5iT32m3eGyA==", + "dependencies": { + "@simplewebauthn/typescript-types": "@simplewebauthn/typescript-types@7.4.0", + "@types/node": "@types/node@18.18.4" + } + }, + "@simplewebauthn/server@7.4.0": { + "integrity": "sha512-Y6jj2WsE3zBDagSdOg3b7+SMw7zHku0Od45Q1ZpA19Wd5aUbV2mH281SbdhFN4UuKcGQSeeAgUObAWHvgxNOVA==", + "dependencies": { + "@hexagon/base64": "@hexagon/base64@1.1.28", + "@peculiar/asn1-android": "@peculiar/asn1-android@2.3.6", + "@peculiar/asn1-ecc": "@peculiar/asn1-ecc@2.3.6", + "@peculiar/asn1-rsa": "@peculiar/asn1-rsa@2.3.6", + "@peculiar/asn1-schema": "@peculiar/asn1-schema@2.3.6", + "@peculiar/asn1-x509": "@peculiar/asn1-x509@2.3.6", + "@simplewebauthn/iso-webcrypto": "@simplewebauthn/iso-webcrypto@7.4.0", + "@simplewebauthn/typescript-types": "@simplewebauthn/typescript-types@7.4.0", + "@types/debug": "@types/debug@4.1.9", + "@types/node": "@types/node@18.18.4", + "cbor-x": "cbor-x@1.5.4", + "cross-fetch": "cross-fetch@3.1.8", + "debug": "debug@4.3.4" + } + }, + "@simplewebauthn/typescript-types@7.4.0": { + "integrity": "sha512-8/ZjHeUPe210Bt5oyaOIGx4h8lHdsQs19BiOT44gi/jBEgK7uBGA0Fy7NRsyh777al3m6WM0mBf0UR7xd4R7WQ==", + "dependencies": {} + }, + "@types/debug@4.1.9": { + "integrity": "sha512-8Hz50m2eoS56ldRlepxSBa6PWEVCtzUo/92HgLc2qTMnotJNIm7xP+UZhyWoYsyOdd5dxZ+NZLb24rsKyFs2ow==", + "dependencies": { + "@types/ms": "@types/ms@0.7.32" + } + }, + "@types/ms@0.7.32": { + "integrity": "sha512-xPSg0jm4mqgEkNhowKgZFBNtwoEwF6gJ4Dhww+GFpm3IgtNseHQZ5IqdNwnquZEoANxyDAKDRAdVo4Z72VvD/g==", + "dependencies": {} + }, + "@types/node@18.18.4": { + "integrity": "sha512-t3rNFBgJRugIhackit2mVcLfF6IRc0JE4oeizPQL8Zrm8n2WY/0wOdpOPhdtG0V9Q2TlW/axbF1MJ6z+Yj/kKQ==", + "dependencies": {} + }, + "ajv@8.12.0": { + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "fast-deep-equal@3.1.3", + "json-schema-traverse": "json-schema-traverse@1.0.0", + "require-from-string": "require-from-string@2.0.2", + "uri-js": "uri-js@4.4.1" + } + }, + "asn1js@3.0.5": { + "integrity": "sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==", + "dependencies": { + "pvtsutils": "pvtsutils@1.3.5", + "pvutils": "pvutils@1.1.3", + "tslib": "tslib@2.6.2" + } + }, + "cbor-extract@2.1.1": { + "integrity": "sha512-1UX977+L+zOJHsp0mWFG13GLwO6ucKgSmSW6JTl8B9GUvACvHeIVpFqhU92299Z6PfD09aTXDell5p+lp1rUFA==", + "dependencies": { + "@cbor-extract/cbor-extract-darwin-arm64": "@cbor-extract/cbor-extract-darwin-arm64@2.1.1", + "@cbor-extract/cbor-extract-darwin-x64": "@cbor-extract/cbor-extract-darwin-x64@2.1.1", + "@cbor-extract/cbor-extract-linux-arm": "@cbor-extract/cbor-extract-linux-arm@2.1.1", + "@cbor-extract/cbor-extract-linux-arm64": "@cbor-extract/cbor-extract-linux-arm64@2.1.1", + "@cbor-extract/cbor-extract-linux-x64": "@cbor-extract/cbor-extract-linux-x64@2.1.1", + "@cbor-extract/cbor-extract-win32-x64": "@cbor-extract/cbor-extract-win32-x64@2.1.1", + "node-gyp-build-optional-packages": "node-gyp-build-optional-packages@5.0.3" + } + }, + "cbor-x@1.5.4": { + "integrity": "sha512-PVKILDn+Rf6MRhhcyzGXi5eizn1i0i3F8Fe6UMMxXBnWkalq9+C5+VTmlIjAYM4iF2IYF2N+zToqAfYOp+3rfw==", + "dependencies": { + "cbor-extract": "cbor-extract@2.1.1" + } + }, + "cross-fetch@3.1.8": { + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dependencies": { + "node-fetch": "node-fetch@2.7.0" + } + }, + "debug@4.3.4": { + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "ms@2.1.2" + } + }, + "fast-deep-equal@3.1.3": { + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dependencies": {} + }, + "ipaddr.js@2.1.0": { + "integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==", + "dependencies": {} + }, + "js-tokens@4.0.0": { + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dependencies": {} + }, + "json-schema-traverse@1.0.0": { + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dependencies": {} + }, + "loose-envify@1.4.0": { + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "js-tokens@4.0.0" + } + }, + "ms@2.1.2": { + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dependencies": {} + }, + "node-fetch@2.7.0": { + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "whatwg-url@5.0.0" + } + }, + "node-gyp-build-optional-packages@5.0.3": { + "integrity": "sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA==", + "dependencies": {} + }, + "punycode@2.3.0": { + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dependencies": {} + }, + "pvtsutils@1.3.5": { + "integrity": "sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==", + "dependencies": { + "tslib": "tslib@2.6.2" + } + }, + "pvutils@1.1.3": { + "integrity": "sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==", + "dependencies": {} + }, + "react-dom@18.2.0_react@18.2.0": { + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "dependencies": { + "loose-envify": "loose-envify@1.4.0", + "react": "react@18.2.0", + "scheduler": "scheduler@0.23.0" + } + }, + "react@18.2.0": { + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dependencies": { + "loose-envify": "loose-envify@1.4.0" + } + }, + "require-from-string@2.0.2": { + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dependencies": {} + }, + "scheduler@0.23.0": { + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dependencies": { + "loose-envify": "loose-envify@1.4.0" + } + }, + "tr46@0.0.3": { + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dependencies": {} + }, + "tslib@2.6.2": { + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dependencies": {} + }, + "ulid@2.3.0": { + "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", + "dependencies": {} + }, + "uri-js@4.4.1": { + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "punycode@2.3.0" + } + }, + "webidl-conversions@3.0.1": { + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dependencies": {} + }, + "whatwg-url@5.0.0": { + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "tr46@0.0.3", + "webidl-conversions": "webidl-conversions@3.0.1" + } + } + } + }, "remote": { "https://deno.land/std@0.149.0/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs": "dfcd6777d05345362c70f9f2c49abba3ed3f925fccfcf725abe2d16d51819433", "https://deno.land/std@0.149.0/_wasm_crypto/mod.ts": "6c60d332716147ded0eece0861780678d51b560f533b27db2e15c64a4ef83665", @@ -9,9 +285,6 @@ "https://deno.land/std@0.149.0/crypto/_fnv/util.ts": "4848313bed7f00f55be3cb080aa0583fc007812ba965b03e4009665bde614ce3", "https://deno.land/std@0.149.0/crypto/mod.ts": "037fc8712e6a0f4346957c1257e2befe3668c4ec2e89c3278859bfbe3047df76", "https://deno.land/std@0.149.0/encoding/base64.ts": "c8c16b4adaa60d7a8eee047c73ece26844435e8f7f1328d74593dbb2dd58ea4f", - "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", - "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", - "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", "https://deno.land/std@0.179.0/encoding/base64.ts": "7de04c2f8aeeb41453b09b186480be90f2ff357613b988e99fabb91d2eeceba1", "https://deno.land/std@0.179.0/encoding/base64url.ts": "3f1178f6446834457b16bfde8b559c1cd3481727fe384d3385e4a9995dc2d851", "https://deno.land/std@0.183.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462", @@ -102,7 +375,6 @@ "https://deno.land/std@0.183.0/streams/write_all.ts": "aec90152978581ea62d56bb53a5cbf487e6a89c902f87c5969681ffbdf32b998", "https://deno.land/std@0.183.0/streams/writer_from_stream_writer.ts": "07c7ee025151a190f37fc42cbb01ff93afc949119ebddc6e0d0df14df1bf6950", "https://deno.land/std@0.183.0/streams/zip_readable_streams.ts": "a9d81aa451240f79230add674809dbee038d93aabe286e2d9671e66591fc86ca", - "https://deno.land/std@0.183.0/types.d.ts": "dbaeb2c4d7c526db9828fc8df89d8aecf53b9ced72e0c4568f97ddd8cda616a4", "https://deno.land/x/nanoid@v3.0.0/async.ts": "654420a3b480b46393538c96a2690af1aa7cbe2fae5614054068c53f8d0679d4", "https://deno.land/x/nanoid@v3.0.0/customAlphabet.ts": "1cfd7cfd2f07ca8d78a7e7855fcc9f59abf01ef2a127484ef94328fadf940ead", "https://deno.land/x/nanoid@v3.0.0/customRandom.ts": "af56e19038c891a4b4ef2be931554c27579bd407ee5bbea5cb64f6ee1347cbe3", @@ -134,7 +406,6 @@ "https://deno.land/x/oak@v12.2.0/send.ts": "5ec49f106294593f468317a0c885da4f3274bf6d0fe9e16a7304391730b4f4fb", "https://deno.land/x/oak@v12.2.0/structured_clone.ts": "9c2d21c62f616400305a60cbd29eb06764ee97edc423223424b6cf55df0e8be2", "https://deno.land/x/oak@v12.2.0/testing.ts": "a0be5c84981afde666de29630f34b09d944ca1a2fe6a5185644b60ad95e16d18", - "https://deno.land/x/oak@v12.2.0/types.d.ts": "41951a18c3bfdb11e40707cab75da078ba8a4907cd7d4e11d8536bc2db0dde05", "https://deno.land/x/oak@v12.2.0/util.ts": "3af8c4ed04c6cc2bedbe66e562a77fc59c72df31c55a902a63885861ca1639d6", "https://deno.land/x/oak_sessions@v4.1.4/mod.ts": "ad069850ea964630827917e3f0447b803b79238a0d11dcb8045334f917e099b7", "https://deno.land/x/oak_sessions@v4.1.4/src/Session.ts": "9bf64dc834eb491b8f7249adcd2c7bd0f65bd66a51e74c0ac5939d2895b5db18", @@ -155,38 +426,6 @@ "https://deno.land/x/sqlite@v3.4.0/src/db.ts": "7ab765f31a07da0de4a5a421cc8f3f6298ce77518242a1f7c6f896b79e483882", "https://deno.land/x/sqlite@v3.4.0/src/error.ts": "abf9df169951faf8c21a68d99ef9efd257c788c19784f27dd147507fbdfe5fe7", "https://deno.land/x/sqlite@v3.4.0/src/query.ts": "df4d3d6b23d52b36243dd47c07ed6ed7cd23f7834a0f6a2f2c6dbffba63d4c28", - "https://deno.land/x/sqlite@v3.4.0/src/wasm.ts": "e79d0baa6e42423257fb3c7cc98091c54399254867e0f34a09b5bdef37bd9487", - "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", - "https://esm.sh/@simplewebauthn/server@7.3.0": "12f7ad351386497229783a0261653e6b282bf72487ec8227b349588376c5e94b", - "https://esm.sh/@simplewebauthn/server@7.3.0/helpers": "f59006c72ed607b43719cf6799e6e6cbfe433786ec4aac2559b036b89b7851b1", - "https://esm.sh/ajv@8.12.0": "40d8d6a1e045069b5d2de09e653ae8aa7a993def4a1438d84e2aa99cb8ef649d", - "https://esm.sh/react-dom@18.2.0/server": "bf857ebba56ff6e17faccac3c49e62aee2d5cb4f00d78842a8728d66a1362cd6", - "https://esm.sh/react@18.2.0": "8950a34a030620fce8349d6bd3913b3bdb186c5ec7968fa5ba4d054e22d78e6c", - "https://esm.sh/stable/react@18.2.0/denonext/react.mjs": "3c4f23bcfc53b256fcfaf6f834fa9f584c3bb7be667b2682c6cb6ba8ef88f8e6", - "https://esm.sh/ulid@2.3.0": "a10a27d5df8c9c0c455ef0abd083bf5743bf07900c83bc26a0b0d5fbdc383e35", - "https://esm.sh/v126/@hexagon/base64@1.1.26/denonext/base64.mjs": "87367ab7c38e24adc0094f7611b81d71e5b760f8267f1f057877ddf067c5a9aa", - "https://esm.sh/v126/@peculiar/asn1-android@2.3.6/denonext/asn1-android.mjs": "e9b6a3ae90d0005d74e40b99dcb342be7cd9b66d615efe499e5a426ce446bb96", - "https://esm.sh/v126/@peculiar/asn1-ecc@2.3.6/denonext/asn1-ecc.mjs": "30b786b3ce4a158d0c9b94c129201553a53997411533c1dea15e36ab7a40fb0c", - "https://esm.sh/v126/@peculiar/asn1-rsa@2.3.6/denonext/asn1-rsa.mjs": "2b9b2540ff1d67c8027f701fd54790c9c197800a5dedaf38ea0b85a732585816", - "https://esm.sh/v126/@peculiar/asn1-schema@2.3.6/denonext/asn1-schema.mjs": "2356b4677bfaec3f9606a0e4244be1e513bc64fc1089e1d9702e43c549bef2c1", - "https://esm.sh/v126/@peculiar/asn1-x509@2.3.6/denonext/asn1-x509.mjs": "4b51b6bc37bea9853190ff30653e7c9beec69a5ef88b4d667a0e1e5d8ab6e2a0", - "https://esm.sh/v126/@simplewebauthn/iso-webcrypto@7.2.0/denonext/iso-webcrypto.mjs": "08b0b49e7f88ccfea4379f57bc4d1b55e2fce144b1c97fe596229831fc6f1a4f", - "https://esm.sh/v126/@simplewebauthn/server@7.3.0/denonext/helpers.js": "80ac960fc03d337044b2e748847ee633bcdb0c50ec700875d620c06bccdb7282", - "https://esm.sh/v126/@simplewebauthn/server@7.3.0/denonext/server.mjs": "e45e24e9d195424b030dfe03c3442539844f8b1739a48e3d28d141192144ff41", - "https://esm.sh/v126/ajv@8.12.0/denonext/ajv.mjs": "c720458156c241201c3607d02e9614f44223fb4e1802a44700c33069b3965c35", - "https://esm.sh/v126/asn1js@3.0.5/denonext/asn1js.mjs": "e809961031f20d8913c6eef0de46948fa8399036a033ce45e23518017a09421a", - "https://esm.sh/v126/cbor-x@1.5.3/denonext/cbor-x.mjs": "d821987d5c0cf356e542bb09355640efcf64ea5d9a780fd22f0c9808080260aa", - "https://esm.sh/v126/cross-fetch@3.1.6/denonext/cross-fetch.mjs": "0ea6f129766748ee7301e36206d3c930ebb7b7dc108f33c70ed3337aeb061e70", - "https://esm.sh/v126/debug@4.3.4/denonext/debug.mjs": "16ad954fc2748e2253fc6ceb9b925be5a2a319099ee8aab58b9265e959e965aa", - "https://esm.sh/v126/fast-deep-equal@3.1.3/denonext/fast-deep-equal.mjs": "6313b3e05436550e1c0aeb2a282206b9b8d9213b4c6f247964dd7bb4835fb9e5", - "https://esm.sh/v126/ipaddr.js@2.1.0/denonext/ipaddr.mjs": "214c1ee845e73e7c51ba673b36e7e6b9c5d8e8fb1fc19443444ad9cec44adf7e", - "https://esm.sh/v126/json-schema-traverse@1.0.0/denonext/json-schema-traverse.mjs": "c5da8353bc014e49ebbb1a2c0162d29969a14c325da19644e511f96ba670cc45", - "https://esm.sh/v126/ms@2.1.2/denonext/ms.mjs": "aa4dc45ba72554c5011168f8910cc646c37af53cfff1a15a4decced838b8eb14", - "https://esm.sh/v126/pvtsutils@1.3.2/denonext/pvtsutils.mjs": "772622bb55a19c64fbe6120c25cdf9865765b7f3ab7a6e99e4cfb6db1edb7853", - "https://esm.sh/v126/pvutils@1.1.3/denonext/pvutils.mjs": "ad156a239ec0f1aa99f123fab44abc292c87d4fd6969d7af264436630457523c", - "https://esm.sh/v126/react-dom@18.2.0/denonext/server.js": "51030d008ce815bfad630aba624108044aa58b3a27e55410c7589a90b56edfe6", - "https://esm.sh/v126/tslib@2.5.3/denonext/tslib.mjs": "f90cda63475a8d3b839803d3f7b53ddc8d2488986074be85008a857c8e5befd5", - "https://esm.sh/v126/ulid@2.3.0/denonext/ulid.mjs": "9bf6b04f84d1c1d479ff466dae0e770a5171e190152051da8b6e1cd9b05aa3a2", - "https://esm.sh/v126/uri-js@4.4.1/denonext/uri-js.mjs": "4b46d46cd678979debedbf2d05fa39b50ec17656e3960a9ec3418e7763aa7c34" + "https://deno.land/x/sqlite@v3.4.0/src/wasm.ts": "e79d0baa6e42423257fb3c7cc98091c54399254867e0f34a09b5bdef37bd9487" } } diff --git a/server.ts b/server/index.ts similarity index 94% rename from server.ts rename to server/index.ts index ee6399b..643adea 100644 --- a/server.ts +++ b/server/index.ts @@ -1,8 +1,8 @@ import { Application } from "oak"; import { CookieStore, Session } from "oak_sessions"; -import { randomHex } from "./server/util.ts"; -import { openKv } from "./server/kv.ts"; -import { createRouters, handleError } from "./server/api.ts"; +import { randomHex } from "./util.ts"; +import { openKv } from "./kv.ts"; +import { createRouters, handleError } from "./api.ts"; const apiServerPort: number = parseInt(Deno.env.get("PORT") ?? "8000"); diff --git a/test/backend/bot.test.mts b/test/backend/bot.test.mts index fafdbc7..3e98027 100644 --- a/test/backend/bot.test.mts +++ b/test/backend/bot.test.mts @@ -12,15 +12,26 @@ test("bot", async (t) => { let p: childProcess.ChildProcess; before(async () => { fs.mkdirSync("tmp", { recursive: true }); - p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], { - env: { - ...process.env, - CHALLENGE: "test", - PORT: String(port), - KV_PATH: kvPath, - }, - stdio: "inherit", - }); + p = childProcess.spawn( + "deno", + [ + "run", + "-A", + "--unstable", + "--config", + "server/deno.jsonc", + "server/index.ts", + ], + { + env: { + ...process.env, + CHALLENGE: "test", + PORT: String(port), + KV_PATH: kvPath, + }, + stdio: "inherit", + } + ); await waitForServer(origin); }); after(() => { diff --git a/test/backend/content.test.mts b/test/backend/content.test.mts index 1a87888..31fdbab 100644 --- a/test/backend/content.test.mts +++ b/test/backend/content.test.mts @@ -17,15 +17,26 @@ test("content", async (t) => { let p: childProcess.ChildProcess; before(async () => { fs.mkdirSync("tmp", { recursive: true }); - p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], { - env: { - ...process.env, - CHALLENGE: "test", - PORT: String(port), - KV_PATH: kvPath, - }, - stdio: "inherit", - }); + p = childProcess.spawn( + "deno", + [ + "run", + "-A", + "--unstable", + "--config", + "server/deno.jsonc", + "server/index.ts", + ], + { + env: { + ...process.env, + CHALLENGE: "test", + PORT: String(port), + KV_PATH: kvPath, + }, + stdio: "inherit", + } + ); await waitForServer(origin); }); after(() => { diff --git a/test/backend/session.test.mts b/test/backend/session.test.mts index ff9b750..1f2b62c 100644 --- a/test/backend/session.test.mts +++ b/test/backend/session.test.mts @@ -19,15 +19,26 @@ test("session", async (t) => { let p: childProcess.ChildProcess; before(async () => { fs.mkdirSync("tmp", { recursive: true }); - p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], { - env: { - ...process.env, - CHALLENGE: "test", - PORT: String(port), - KV_PATH: kvPath, - }, - stdio: "inherit", - }); + p = childProcess.spawn( + "deno", + [ + "run", + "-A", + "--unstable", + "--config", + "server/deno.jsonc", + "server/index.ts", + ], + { + env: { + ...process.env, + CHALLENGE: "test", + PORT: String(port), + KV_PATH: kvPath, + }, + stdio: "inherit", + } + ); await waitForServer(origin); }); after(() => {