diff --git a/packages/server/package-lock.json b/packages/server/package-lock.json deleted file mode 100644 index 0872420..0000000 --- a/packages/server/package-lock.json +++ /dev/null @@ -1,379 +0,0 @@ -{ - "name": "server", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "server", - "dependencies": { - "hono": "^4.4.8", - "react-router-dom": "^6.24.0", - "zustand": "^4.5.4" - }, - "devDependencies": { - "@cloudflare/workers-types": "^4.20240529.0", - "@hono/vite-cloudflare-pages": "^0.4.1", - "@hono/vite-dev-server": "^0.12.1", - "@unocss/postcss": "^0.61.0", - "wrangler": "^3.57.2" - } - }, - "../../node_modules/.pnpm/@cloudflare+workers-types@4.20240620.0/node_modules/@cloudflare/workers-types": { - "version": "4.20240620.0", - "dev": true, - "license": "MIT OR Apache-2.0" - }, - "../../node_modules/.pnpm/@hono+vite-cloudflare-pages@0.4.1_hono@4.4.8/node_modules/@hono/vite-cloudflare-pages": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "devDependencies": { - "glob": "^10.3.10", - "hono": "^4.2.7", - "publint": "^0.1.12", - "rimraf": "^5.0.1", - "tsup": "^7.2.0", - "vite": "^5.2.10", - "vitest": "^1.2.1" - }, - "engines": { - "node": ">=18.14.1" - }, - "peerDependencies": { - "hono": "*" - } - }, - "../../node_modules/.pnpm/@hono+vite-dev-server@0.12.2_hono@4.4.8/node_modules/@hono/vite-dev-server": { - "version": "0.12.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@hono/node-server": "^1.11.0", - "miniflare": "^3.20231218.2", - "minimatch": "^9.0.3" - }, - "devDependencies": { - "@playwright/test": "^1.37.1", - "glob": "^10.3.10", - "hono": "^4.2.7", - "playwright": "^1.39.0", - "publint": "^0.2.5", - "rimraf": "^5.0.1", - "tsup": "^7.2.0", - "vite": "^5.2.10", - "vitest": "^0.34.6", - "wrangler": "^3.28.4" - }, - "engines": { - "node": ">=18.14.1" - }, - "peerDependencies": { - "hono": "*" - } - }, - "../../node_modules/.pnpm/@unocss+postcss@0.61.0_postcss@8.4.38/node_modules/@unocss/postcss": { - "version": "0.61.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@unocss/config": "0.61.0", - "@unocss/core": "0.61.0", - "@unocss/rule-utils": "0.61.0", - "css-tree": "^2.3.1", - "fast-glob": "^3.3.2", - "magic-string": "^0.30.10", - "postcss": "^8.4.38" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "postcss": "^8.4.21" - } - }, - "../../node_modules/.pnpm/hono@4.4.8/node_modules/hono": { - "version": "4.4.8", - "license": "MIT", - "devDependencies": { - "@hono/eslint-config": "^0.0.6", - "@hono/node-server": "^1.8.2", - "@types/crypto-js": "^4.1.1", - "@types/glob": "^8.0.0", - "@types/jsdom": "^21.1.4", - "@types/node": "20.11.4", - "@types/supertest": "^2.0.12", - "@vitest/coverage-v8": "^1.1.0", - "arg": "^5.0.2", - "crypto-js": "^4.1.1", - "esbuild": "^0.15.12", - "eslint": "^8.55.0", - "glob": "7.2.3", - "jsdom": "^22.1.0", - "msw": "^2.3.0", - "np": "7.7.0", - "prettier": "^2.6.2", - "publint": "^0.1.8", - "rimraf": "^3.0.2", - "supertest": "^6.3.3", - "tsx": "^4.7.0", - "typescript": "^5.3.3", - "vite-plugin-fastly-js-compute": "^0.4.2", - "vitest": "^1.2.2", - "wrangler": "^3.58.0", - "ws": "^8.17.0", - "zod": "^3.20.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "../../node_modules/.pnpm/react-router-dom@6.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-router-dom": { - "version": "6.24.0", - "license": "MIT", - "dependencies": { - "@remix-run/router": "1.17.0", - "react-router": "6.24.0" - }, - "devDependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" - } - }, - "../../node_modules/.pnpm/wrangler@3.61.0_@cloudflare+workers-types@4.20240620.0/node_modules/wrangler": { - "version": "3.61.0", - "dev": true, - "license": "MIT OR Apache-2.0", - "dependencies": { - "@cloudflare/kv-asset-handler": "0.3.3", - "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@esbuild-plugins/node-modules-polyfill": "^0.2.2", - "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "esbuild": "0.17.19", - "miniflare": "3.20240610.1", - "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", - "resolve": "^1.22.8", - "resolve.exports": "^2.0.2", - "selfsigned": "^2.0.1", - "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@1.10.0-1717606461.a117952", - "xxhash-wasm": "^1.0.1" - }, - "bin": { - "wrangler": "bin/wrangler.js", - "wrangler2": "bin/wrangler.js" - }, - "devDependencies": { - "@cloudflare/cli": "1.1.1", - "@cloudflare/eslint-config-worker": "1.1.0", - "@cloudflare/pages-shared": "^0.11.44", - "@cloudflare/types": "^6.18.4", - "@cloudflare/workers-tsconfig": "0.0.0", - "@cloudflare/workers-types": "^4.20240605.0", - "@cspotcode/source-map-support": "0.8.1", - "@iarna/toml": "^3.0.0", - "@microsoft/api-extractor": "^7.47.0", - "@sentry/node": "^7.86.0", - "@sentry/types": "^7.86.0", - "@sentry/utils": "^7.86.0", - "@types/body-parser": "^1.19.2", - "@types/command-exists": "^1.2.0", - "@types/express": "^4.17.13", - "@types/glob-to-regexp": "^0.4.1", - "@types/is-ci": "^3.0.0", - "@types/javascript-time-ago": "^2.0.3", - "@types/mime": "^3.0.4", - "@types/minimatch": "^5.1.2", - "@types/prompts": "^2.0.14", - "@types/react": "^18.2.21", - "@types/resolve": "^1.20.6", - "@types/serve-static": "^1.13.10", - "@types/shell-quote": "^1.7.2", - "@types/signal-exit": "^3.0.1", - "@types/supports-color": "^8.1.1", - "@types/ws": "^8.5.7", - "@types/yargs": "^17.0.22", - "@vitest/ui": "^1.6.0", - "@webcontainer/env": "^1.1.0", - "body-parser": "^1.20.0", - "chalk": "^5.2.0", - "cli-table3": "^0.6.3", - "clipboardy": "^3.0.0", - "cmd-shim": "^4.1.0", - "command-exists": "^1.2.9", - "concurrently": "^8.2.2", - "devtools-protocol": "^0.0.1182435", - "dotenv": "^16.0.0", - "es-module-lexer": "^1.3.0", - "execa": "^6.1.0", - "express": "^4.18.1", - "find-up": "^6.3.0", - "get-port": "^7.0.0", - "glob-to-regexp": "^0.4.1", - "http-terminator": "^3.2.0", - "https-proxy-agent": "7.0.2", - "ignore": "^5.2.0", - "ink": "^3.2.0", - "ink-select-input": "^4.2.1", - "ink-spinner": "^4.0.3", - "ink-table": "^3.0.0", - "is-ci": "^3.0.1", - "javascript-time-ago": "^2.5.4", - "md5-file": "5.0.0", - "mime": "^3.0.0", - "minimatch": "^5.1.0", - "mock-socket": "^9.3.1", - "msw": "^2.3.0", - "open": "^8.4.0", - "p-queue": "^7.2.0", - "patch-console": "^1.0.0", - "pretty-bytes": "^6.0.0", - "prompts": "^2.4.2", - "ps-list": "^8.1.1", - "react": "^18.2.0", - "react-error-boundary": "^3.1.4", - "semiver": "^1.1.0", - "serve-static": "^1.15.0", - "shell-quote": "^1.8.1", - "shellac": "^0.8.0", - "signal-exit": "^3.0.7", - "strip-ansi": "^7.1.0", - "supports-color": "^9.2.2", - "timeago.js": "^4.0.2", - "ts-dedent": "^2.2.0", - "ts-json-schema-generator": "^1.5.0", - "undici": "^5.28.4", - "update-check": "^1.5.4", - "vitest": "^1.6.0", - "vitest-websocket-mock": "^0.3.0", - "ws": "^8.14.2", - "xdg-app-paths": "^8.3.0", - "yargs": "^17.7.2", - "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz" - }, - "engines": { - "node": ">=16.17.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@cloudflare/workers-types": "^4.20240605.0" - }, - "peerDependenciesMeta": { - "@cloudflare/workers-types": { - "optional": true - } - } - }, - "node_modules/@cloudflare/workers-types": { - "resolved": "../../node_modules/.pnpm/@cloudflare+workers-types@4.20240620.0/node_modules/@cloudflare/workers-types", - "link": true - }, - "node_modules/@hono/vite-cloudflare-pages": { - "resolved": "../../node_modules/.pnpm/@hono+vite-cloudflare-pages@0.4.1_hono@4.4.8/node_modules/@hono/vite-cloudflare-pages", - "link": true - }, - "node_modules/@hono/vite-dev-server": { - "resolved": "../../node_modules/.pnpm/@hono+vite-dev-server@0.12.2_hono@4.4.8/node_modules/@hono/vite-dev-server", - "link": true - }, - "node_modules/@unocss/postcss": { - "resolved": "../../node_modules/.pnpm/@unocss+postcss@0.61.0_postcss@8.4.38/node_modules/@unocss/postcss", - "link": true - }, - "node_modules/hono": { - "resolved": "../../node_modules/.pnpm/hono@4.4.8/node_modules/hono", - "link": true - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT", - "peer": true - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "license": "MIT", - "peer": true, - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-router-dom": { - "resolved": "../../node_modules/.pnpm/react-router-dom@6.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-router-dom", - "link": true - }, - "node_modules/use-sync-external-store": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "license": "MIT", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/wrangler": { - "resolved": "../../node_modules/.pnpm/wrangler@3.61.0_@cloudflare+workers-types@4.20240620.0/node_modules/wrangler", - "link": true - }, - "node_modules/zustand": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.4.tgz", - "integrity": "sha512-/BPMyLKJPtFEvVL0E9E9BTUM63MNyhPGlvxk1XjrfWTUlV+BR8jufjsovHzrtR6YNcBEcL7cMHovL1n9xHawEg==", - "license": "MIT", - "dependencies": { - "use-sync-external-store": "1.2.0" - }, - "engines": { - "node": ">=12.7.0" - }, - "peerDependencies": { - "@types/react": ">=16.8", - "immer": ">=9.0.6", - "react": ">=16.8" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - } - } - } - } -} diff --git a/packages/server/src/model/store.ts b/packages/server/src/model/store.ts index e28a47f..fec48a0 100644 --- a/packages/server/src/model/store.ts +++ b/packages/server/src/model/store.ts @@ -10,8 +10,8 @@ async function verifyAdminToken(DB: D1Database, token: string): Promise<'new' | } const exist = await checkAdminExist(DB) if (!exist) { - setAdminToken(DB, token) - return 'new' + const success = await setAdminToken(DB, token) + return success ? 'new' : 'reject' } return 'reject' } @@ -22,6 +22,7 @@ async function setAdminToken(DB: D1Database, token: string): Promise { throw new Error('Admin token already exists') } const result = await DB.prepare(`INSERT INTO stores (key, value) VALUES ('ADMIN_TOKEN', ?)`).bind(token).run() + console.log(result) return result.success }