Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cloudflare-htmx

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-htmx - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

demo/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/3714b28a86636b4aee0ce98f85e512114b0369cad7b088f4488c5da54972fa6b.sqlite

2

demo/functions/_middleware.ts
import RootLayout from '@layouts/RootLayout';
import { applyLayout } from '@lib/html';
export const onRequestGet = [applyLayout(RootLayout)];
export const onRequest = [applyLayout(RootLayout, true)];
import DashLayout from '@layouts/DashLayout';
import { authConfig } from '@lib/constants';
import { applyLayout } from '@lib/html';
import { middlewareGuard } from 'cloudflare-auth';
export const onRequestGet = [
middlewareGuard(authConfig),
applyLayout(DashLayout),
];
export const onRequest = [middlewareGuard, applyLayout(DashLayout, false)];
import SubLayout from '@layouts/SubLayout';
import { applyLayout } from '@lib/html';
export const onRequestGet = [applyLayout(SubLayout)];
export const onRequest = [applyLayout(SubLayout, false)];
import Toast from '@components/Toast';
import { Env, isAuthorised, login } from 'cloudflare-auth';
import { Env, isAuthorised, loginWithToken } from 'cloudflare-auth';
import { html, view } from '@lib/html';
import { authConfig } from '@lib/constants';

@@ -14,4 +13,3 @@ export const onRequestPost: PagesFunction<Env> = async ({ request, env }) => {

}
const token = await login(email, env);
const magicLink = `${url.origin}/verify?token=${token}`;
const magicLink = await loginWithToken(email, env, url.origin, true);
try {

@@ -29,4 +27,4 @@ return view(

export const onRequestGet: PagesFunction = async ({ request }) => {
const loggedIn = await isAuthorised(authConfig, request);
export const onRequestGet: PagesFunction<Env> = async ({ env, request }) => {
const loggedIn = await isAuthorised(request, env);
if (loggedIn) {

@@ -33,0 +31,0 @@ console.log('redirect to dashboard');

@@ -1,6 +0,5 @@

import { authConfig } from '@lib/constants';
import { logout } from 'cloudflare-auth';
import { Env, logout } from 'cloudflare-auth';
export const onRequestPost: PagesFunction = async ({ request }) => {
return logout(authConfig, new URL(request.url));
export const onRequestPost: PagesFunction<Env> = async ({ env }) => {
return logout(env, '/');
};
import Spinner from '@components/Spinner';
import { html, view } from '@lib/html';
import { authConfig } from '@lib/constants';
import { verify, Env } from 'cloudflare-auth';

@@ -11,5 +10,6 @@

try {
return await verify(token!, env, authConfig, url);
} catch {
return Response.redirect(url.origin, 301);
return await verify(token!, env, '/dashboard');
} catch (e) {
console.log(e);
return Response.redirect(url.origin, 303);
}

@@ -16,0 +16,0 @@ };

@@ -13,13 +13,13 @@ {

"devDependencies": {
"@cloudflare/workers-types": "^4.20230404.0",
"@types/cookie": "^0.5.1",
"tailwindcss": "^3.3.1",
"wrangler": "^3.0.1"
"@cloudflare/workers-types": "^4.20231016.0",
"@types/cookie": "^0.5.3",
"tailwindcss": "^3.3.3",
"wrangler": "^3.14.0"
},
"private": true,
"dependencies": {
"cloudflare-auth": "^1.0.0",
"cloudflare-auth": "^1.5.0",
"cookie": "^0.5.0",
"daisyui": "^2.51.6"
"daisyui": "^2.52.0"
}
}

@@ -6,2 +6,4 @@ const HEADERS = { headers: { 'content-type': 'text/html;charset=UTF-8' } };

new Response(domArgs.join('\n'), HEADERS);
export const redirect = (url: string, status = 303) =>
new Response(null, { status, headers: { 'HX-Redirect': url } });

@@ -8,0 +10,0 @@ export type LayoutFunction<Env = any, Params extends string = any> = ({

{
"name": "cloudflare-htmx",
"version": "1.2.0",
"version": "1.2.1",
"description": "HTMX library for Cloudflare Pages",

@@ -5,0 +5,0 @@ "main": "index.ts",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc