@appwarden/middleware 1.1.4 → 1.1.5

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/README.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @appwarden/middleware
2
2
 
3
- Instantly shut off all access to a domain from your Discord server.
3
+ > Read the docs [to learn more](https://appwarden.io/docs)
4
4
 
5
- Read the docs [to get started](https://appwarden.io/docs/getting-started#for-projects-deployed-on-cloudflare-pages)
5
+ ## Stop in progress attacks in their tracks
6
+
7
+ Instantly halt all external access to a domain from your Discord server
8
+
9
+ ```
10
+ /quarantine lock your.app.io
11
+ ```
12
+
13
+ ## Installation
14
+
15
+ Compatible with websites powered by [Cloudflare](https://developers.cloudflare.com/pages/) or [Vercel](https://vercel.com).
16
+
17
+ ### Cloudflare
18
+
19
+ We recommend using the [`@appwarden/build-cloudflare-action`](https://github.com/appwarden/build-cloudflare-action) Github Action to deploy on Cloudflare.
20
+
21
+ > Read the docs [to get started](https://appwarden.io/docs/guides/cloudflare-integration)
22
+
23
+ ### Vercel
24
+
25
+ > Read the docs [to get started](https://appwarden.io/docs/guides/vercel-integration)
@@ -18,12 +18,7 @@ var store = {
18
18
  const cacheKeyUrl = new URL(cacheKey, context.serviceOrigin);
19
19
  return {
20
20
  getValue: () => getCacheValue(context, cacheKeyUrl),
21
- updateValue: (json) => updateCacheValue(
22
- context,
23
- cacheKeyUrl,
24
- json,
25
- options?.cacheExpirationSeconds
26
- ),
21
+ updateValue: (json) => updateCacheValue(context, cacheKeyUrl, json, options?.ttl),
27
22
  deleteValue: () => clearCache(context, cacheKeyUrl)
28
23
  };
29
24
  }
@@ -37,20 +32,20 @@ var getCacheValue = async (context, cacheKey) => {
37
32
  debug(`[${cacheKey.pathname}] Cache MATCH!`);
38
33
  return match;
39
34
  };
40
- var updateCacheValue = async (context, cacheKey, value, cacheExpirationSeconds) => {
35
+ var updateCacheValue = async (context, cacheKey, value, ttl) => {
41
36
  debug(
42
37
  "updating cache...",
43
38
  cacheKey.href,
44
39
  value,
45
- cacheExpirationSeconds ? `expires in ${cacheExpirationSeconds}s` : ""
40
+ ttl ? `expires in ${ttl}s` : ""
46
41
  );
47
42
  await context.cache.put(
48
43
  cacheKey,
49
44
  new Response(JSON.stringify(value), {
50
45
  headers: {
51
46
  "content-type": "application/json",
52
- ...cacheExpirationSeconds && {
53
- "cache-control": `max-age=${cacheExpirationSeconds}`
47
+ ...ttl && {
48
+ "cache-control": `max-age=${ttl}`
54
49
  }
55
50
  }
56
51
  })
@@ -85,8 +80,8 @@ var getLockValue = async (context) => {
85
80
  try {
86
81
  let shouldDeleteEdgeValue = false;
87
82
  let cacheResponse, lockValue = {
88
- isLockedTest: 0,
89
83
  isLocked: 0,
84
+ isLockedTest: 0,
90
85
  lastCheck: Date.now(),
91
86
  code: ""
92
87
  };
package/cloudflare.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  insertErrorLogs,
3
3
  useAppwarden,
4
4
  useContentSecurityPolicy
5
- } from "./chunk-6DI6L6AE.js";
5
+ } from "./chunk-CGJ2UT3T.js";
6
6
  import {
7
7
  ConfigFnInputSchema,
8
8
  usePipeline
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useContentSecurityPolicy
3
- } from "./chunk-6DI6L6AE.js";
3
+ } from "./chunk-CGJ2UT3T.js";
4
4
  import {
5
5
  APPWARDEN_CACHE_KEY,
6
6
  APPWARDEN_USER_AGENT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appwarden/middleware",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Instantly shut off access your app deployed on Cloudflare or Vercel",
5
5
  "type": "module",
6
6
  "license": "MIT",