Skip to content

Commit 26d6c85

Browse files
authored
Merge pull request #6 from natbienetre/pierre.peronnet/typing
Pierre.peronnet/typing
2 parents 3c9bd9e + 72773c6 commit 26d6c85

15 files changed

+592
-49
lines changed

plugins/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ lint: run-lint
66

77
publish:
88
@git diff-index --quiet HEAD -- || (echo "Working directory is not clean" && exit 1)
9-
$(MAKE) run-publish
9+
YARN_RUN="npm publish --access public" $(MAKE) _run
1010

1111
ci-test:
1212
YARN_RUN="install --immutable" $(MAKE) _run
@@ -19,4 +19,4 @@ YARN_RUN ?= --version
1919
CACHE_FOLDER ?= $(CURDIR)/.yarn/cache
2020

2121
_run:
22-
$(foreach plugin,$(PLUGINS),cd $(plugin) && yarn --cache-folder=$(CACHE_FOLDER) $(YARN_RUN) && cd ..;)
22+
$(foreach plugin,$(PLUGINS),cd $(plugin) && yarn $(YARN_RUN) && cd ..;)

plugins/cloudflare-auto-session/functions/_middleware.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { withDefaults } from '../src/args'
55
const authenticatedQuery = 'authenticated'
66
const allowedQuery = 'allowed'
77

8-
export const onRequestGet = async (context: EventPluginContext<Record<string, string | undefined>, any, any, PluginArgs>): Promise<Response> => {
8+
export const onRequestGet = (context: EventPluginContext<Record<string, string | undefined>, any, any, PluginArgs>): Response | Promise<Response> => {
99
const { request, env, pluginArgs, next } = context
1010

1111
// Get the arguments given to the Plugin by the developer
@@ -20,21 +20,19 @@ export const onRequestGet = async (context: EventPluginContext<Record<string, st
2020

2121
console.debug('Proxy to login form', url.toString())
2222

23-
return await env.ASSETS.fetch(new Request(url, request))
23+
return env.ASSETS.fetch(new Request(url, request))
2424
}
2525

26-
return await next()
26+
return next()
2727
}
2828

29-
export const onRequestPost = async ({ request, pluginArgs }: EventPluginContext<Record<string, string | undefined>, any, any, PluginArgs>): Promise<Response> => {
29+
export const onRequestPost = ({ request, pluginArgs }: EventPluginContext<Record<string, string | undefined>, any, any, PluginArgs>): Response | Promise<Response> => {
3030
// Get the arguments given to the Plugin by the developer
3131
const { cookieName, cookieSecret, login, isValid } = withDefaults(pluginArgs)
3232

3333
const session = new Session(cookieName, cookieSecret, isValid)
3434

3535
if (session.valid(request)) {
36-
await request.body?.cancel()
37-
3836
return new Response('Already logged in', {
3937
status: 302,
4038
headers: {
@@ -45,7 +43,7 @@ export const onRequestPost = async ({ request, pluginArgs }: EventPluginContext<
4543

4644
const url = new URL(request.url)
4745

48-
return await request.formData()
46+
return request.formData()
4947
.then(login)
5048
.then(({ authenticated, allowed, cookie }: SessionSpec): Response => {
5149
url.searchParams.set(authenticatedQuery, authenticated.toString())

plugins/cloudflare-auto-session/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@natbienetre/cloudflare-auto-session",
33
"main": "dist/index.js",
44
"types": "index.d.ts",
5-
"version": "0.3.0",
5+
"version": "0.3.2",
66
"license": "MPL-2.0",
77
"funding": "https://github.com/sponsors/holyhope",
88
"files": [

plugins/cloudflare-auto-session/src/args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Defaults = {
1717
allowed: false
1818
}
1919
},
20-
formAsset: 'nbe-login',
20+
formAsset: '/nbe-login/',
2121
isValid: (_: any): boolean => true
2222
}
2323

-15.1 KB
Binary file not shown.

plugins/cloudflare-env-var-password/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 541 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)