opacacms 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/webcomponent.js +67 -17
- package/dist/{chunk-z3ffn2b7.js → chunk-941zxavt.js} +38 -20
- package/dist/runtimes/bun.js +1 -1
- package/dist/runtimes/cloudflare-workers.js +1 -1
- package/dist/runtimes/next.js +1 -1
- package/dist/runtimes/node.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +44 -8
|
@@ -1068,7 +1068,6 @@ function createGlobalHandlers(config, globalConfig, getAuth) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
|
|
1070
1070
|
// src/server/router.ts
|
|
1071
|
-
import { graphqlServer } from "@hono/graphql-server";
|
|
1072
1071
|
import { Hono as Hono4 } from "hono";
|
|
1073
1072
|
|
|
1074
1073
|
// src/server/openapi.ts
|
|
@@ -1804,7 +1803,6 @@ function createDatabaseInitMiddleware(config, state) {
|
|
|
1804
1803
|
}
|
|
1805
1804
|
|
|
1806
1805
|
// src/server/middlewares/rate-limit.ts
|
|
1807
|
-
import { rateLimiter } from "hono-rate-limiter";
|
|
1808
1806
|
function createRateLimitMiddleware(config) {
|
|
1809
1807
|
const rateLimitConfig = config.api?.rateLimit;
|
|
1810
1808
|
if (rateLimitConfig?.enabled === false) {
|
|
@@ -1821,11 +1819,17 @@ function createRateLimitMiddleware(config) {
|
|
|
1821
1819
|
}
|
|
1822
1820
|
}
|
|
1823
1821
|
if (provider) {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1822
|
+
try {
|
|
1823
|
+
const { rateLimiter } = await import("hono-rate-limiter");
|
|
1824
|
+
const limiter = rateLimiter({
|
|
1825
|
+
binding: () => provider,
|
|
1826
|
+
keyGenerator: rateLimitConfig?.keyGenerator || ((c2) => c2.req.header("cf-connecting-ip") || c2.req.header("x-forwarded-for") || "anonymous")
|
|
1827
|
+
});
|
|
1828
|
+
return limiter(c, next);
|
|
1829
|
+
} catch (e) {
|
|
1830
|
+
logger.error("Failed to load 'hono-rate-limiter'. Please install it to use rate limiting features.", e);
|
|
1831
|
+
return await next();
|
|
1832
|
+
}
|
|
1829
1833
|
}
|
|
1830
1834
|
let resolvedStore = rateLimitConfig?.store;
|
|
1831
1835
|
if (!resolvedStore && c.env) {
|
|
@@ -1839,15 +1843,21 @@ function createRateLimitMiddleware(config) {
|
|
|
1839
1843
|
}
|
|
1840
1844
|
}
|
|
1841
1845
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1846
|
+
try {
|
|
1847
|
+
const { rateLimiter } = await import("hono-rate-limiter");
|
|
1848
|
+
const limiter = rateLimiter({
|
|
1849
|
+
windowMs,
|
|
1850
|
+
limit,
|
|
1851
|
+
standardHeaders: "draft-6",
|
|
1852
|
+
store: resolvedStore,
|
|
1853
|
+
keyGenerator: rateLimitConfig?.keyGenerator || ((c2) => c2.req.header("cf-connecting-ip") || c2.req.header("x-forwarded-for") || "anonymous"),
|
|
1854
|
+
message: "Too many requests from this IP, please try again after a minute."
|
|
1855
|
+
});
|
|
1856
|
+
return limiter(c, next);
|
|
1857
|
+
} catch (e) {
|
|
1858
|
+
logger.error("Failed to load 'hono-rate-limiter'. Please install it to use rate limiting features.", e);
|
|
1859
|
+
return await next();
|
|
1860
|
+
}
|
|
1851
1861
|
};
|
|
1852
1862
|
}
|
|
1853
1863
|
|
|
@@ -2237,10 +2247,18 @@ function createAPIRouter(config, settings = {}, env = {}) {
|
|
|
2237
2247
|
if (isGraphQLEnabled) {
|
|
2238
2248
|
const graphqlPath = config.api?.graphql?.path || "/graphql";
|
|
2239
2249
|
const schema = generateGraphQLSchema(config, state);
|
|
2240
|
-
router.use(graphqlPath,
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2250
|
+
router.use(graphqlPath, async (c, next) => {
|
|
2251
|
+
try {
|
|
2252
|
+
const { graphqlServer } = await import("@hono/graphql-server");
|
|
2253
|
+
return graphqlServer({
|
|
2254
|
+
schema,
|
|
2255
|
+
graphiql: config.api?.graphql?.graphiql ?? false
|
|
2256
|
+
})(c, next);
|
|
2257
|
+
} catch (e) {
|
|
2258
|
+
logger.error("Failed to load @hono/graphql-server. Please install 'graphql' and '@hono/graphql-server' to use GraphQL features.", e);
|
|
2259
|
+
return c.json({ error: "GraphQL is enabled but dependencies are missing." }, 500);
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2244
2262
|
}
|
|
2245
2263
|
if (config.api?.openAPI?.enabled) {
|
|
2246
2264
|
router.get("/open-api.json", (c) => {
|
package/dist/runtimes/bun.js
CHANGED
package/dist/runtimes/next.js
CHANGED
package/dist/runtimes/node.js
CHANGED
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opacacms",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "OpacaCMS: A lightweight, type-safe, and developer-first Headless CMS for the edge and beyond.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"cms",
|
|
8
|
+
"headless-cms",
|
|
9
|
+
"typescript",
|
|
10
|
+
"hono",
|
|
11
|
+
"sqlite",
|
|
12
|
+
"d1",
|
|
13
|
+
"cloudflare-workers",
|
|
14
|
+
"admin-panel",
|
|
15
|
+
"edge"
|
|
16
|
+
],
|
|
17
|
+
"author": "fhorray",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/fhorray/opacacms.git",
|
|
21
|
+
"directory": "packages/opacacms"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/fhorray/opacacms/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://opaca.francy.dev",
|
|
4
27
|
"scripts": {
|
|
5
28
|
"build": "bun run ../../scripts/build.ts && tsc --emitDeclarationOnly",
|
|
6
29
|
"build:publish": "bun run ../../scripts/build.ts --publish && tsc --emitDeclarationOnly",
|
|
@@ -149,10 +172,13 @@
|
|
|
149
172
|
"@types/react-dom": "^19.2.3",
|
|
150
173
|
"better-sqlite3": "^12.6.2",
|
|
151
174
|
"bun-plugin-scss": "^1.0.0",
|
|
175
|
+
"class-variance-authority": "^0.7.1",
|
|
152
176
|
"dotenv": "^17.3.1",
|
|
153
177
|
"esbuild": "^0.27.4",
|
|
154
178
|
"esbuild-wasm": "^0.27.4",
|
|
155
179
|
"happy-dom": "^20.8.4",
|
|
180
|
+
"hono": "^4.12.7",
|
|
181
|
+
"ky": "^1.14.3",
|
|
156
182
|
"kysely-bun-sqlite": "^0.4.0",
|
|
157
183
|
"kysely-d1": "^0.4.0",
|
|
158
184
|
"kysely-postgres-js": "^3.0.0",
|
|
@@ -160,24 +186,34 @@
|
|
|
160
186
|
"lucide-react": "^0.577.0",
|
|
161
187
|
"nanostores": "^1.1.1",
|
|
162
188
|
"postgres": "^3.4.8",
|
|
163
|
-
"
|
|
189
|
+
"radix-ui": "^1.4.3",
|
|
190
|
+
"sass": "^1.98.0",
|
|
191
|
+
"zod": "^4.3.6"
|
|
164
192
|
},
|
|
165
193
|
"peerDependencies": {
|
|
194
|
+
"hono": "^4.0.0",
|
|
166
195
|
"react": "^19.2.4",
|
|
167
196
|
"react-dom": "^19.2.4",
|
|
168
|
-
"typescript": "^5.9.3"
|
|
197
|
+
"typescript": "^5.9.3",
|
|
198
|
+
"zod": "^4.3.6"
|
|
199
|
+
},
|
|
200
|
+
"peerDependenciesMeta": {
|
|
201
|
+
"@hono/graphql-server": {
|
|
202
|
+
"optional": true
|
|
203
|
+
},
|
|
204
|
+
"graphql": {
|
|
205
|
+
"optional": true
|
|
206
|
+
},
|
|
207
|
+
"hono-rate-limiter": {
|
|
208
|
+
"optional": true
|
|
209
|
+
}
|
|
169
210
|
},
|
|
170
211
|
"dependencies": {
|
|
171
212
|
"@hono/graphql-server": "^0.7.0",
|
|
172
213
|
"better-auth": "^1.5.5",
|
|
173
|
-
"class-variance-authority": "^0.7.1",
|
|
174
214
|
"graphql": "^16.13.1",
|
|
175
|
-
"hono": "^4.12.7",
|
|
176
215
|
"hono-rate-limiter": "^0.5.3",
|
|
177
|
-
"ky": "^1.14.3",
|
|
178
216
|
"kysely": "^0.28.11",
|
|
179
|
-
"radix-ui": "^1.4.3",
|
|
180
|
-
"zod": "^4.3.6",
|
|
181
217
|
"zod-to-json-schema": "^3.25.1"
|
|
182
218
|
},
|
|
183
219
|
"files": [
|