Hono dependency upgrade
This commit is contained in:
@@ -150,7 +150,7 @@
|
||||
"fast-diff": "https://esm.sh/fast-diff@1.3.0",
|
||||
"fuse": "https://deno.land/x/fuse@v6.4.1/dist/fuse.esm.min.js",
|
||||
"gitignore-parser": "https://esm.sh/gitignore-parser@0.0.2",
|
||||
"hono/": "https://deno.land/x/hono@v4.0.9/",
|
||||
"hono": "jsr:@hono/hono@4.7.4",
|
||||
"js-yaml": "npm:js-yaml@4.1.0",
|
||||
"mimetypes": "https://deno.land/x/mimetypes@v1.0.0/mod.ts",
|
||||
"porter-stemmer": "https://esm.sh/porter-stemmer@0.9.1",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Steps
|
||||
1. Look at deno.json to find all dependencies under `imports`
|
||||
3. Find out online (use web search) if there is a NEWER version available for each dependency, exclude the current version number from your search for better results. Note that the esm.sh ones are really npm dependencies, so you may want to search on npmjs.com for the latest version
|
||||
4. Only when you discover a newer version (higher version number), bump the version number, otherwise leave it as is
|
||||
|
||||
After each dependency bump run:
|
||||
* `deno task check` to ensure type checks
|
||||
* `deno task test` to ensure all tests still pass
|
||||
* `deno task lint` to ensure all linting rules are adhered to
|
||||
|
||||
Fix any issues as you go along.
|
||||
+11
-7
@@ -1,6 +1,7 @@
|
||||
import { deleteCookie, getCookie, setCookie } from "hono/helper.ts";
|
||||
import { cors } from "hono/middleware.ts";
|
||||
import { type Context, Hono, validator } from "hono/mod.ts";
|
||||
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
||||
import { cors } from "hono/cors";
|
||||
import { type Context, Hono } from "hono";
|
||||
import { validator } from "hono/validator";
|
||||
import type { AssetBundle } from "$lib/asset_bundle/bundle.ts";
|
||||
import type {
|
||||
EndpointRequest,
|
||||
@@ -335,7 +336,7 @@ export class HttpServer {
|
||||
|
||||
return c.html(html);
|
||||
}).post(
|
||||
validator("form", (value, c) => {
|
||||
validator("form", (value: any, c: Context) => {
|
||||
const username = value["username"];
|
||||
const password = value["password"];
|
||||
const rememberMe = value["rememberMe"];
|
||||
@@ -352,7 +353,7 @@ export class HttpServer {
|
||||
}),
|
||||
async (c) => {
|
||||
const req = c.req;
|
||||
const url = new URL(c.req.url);
|
||||
const url = new URL(req.url);
|
||||
const { username, password, rememberMe } = req.valid("form");
|
||||
|
||||
const {
|
||||
@@ -385,7 +386,7 @@ export class HttpServer {
|
||||
if (rememberMe) {
|
||||
setCookie(c, "refreshLogin", "true", { expires: inAWeek });
|
||||
}
|
||||
const values = await c.req.parseBody();
|
||||
const values = await req.parseBody();
|
||||
const from = values["from"];
|
||||
return c.redirect(typeof from === "string" ? from : "/");
|
||||
} else {
|
||||
@@ -763,7 +764,10 @@ export class HttpServer {
|
||||
}
|
||||
// Set status before returning the body
|
||||
c.status(fetchReq.status as any);
|
||||
return c.body(fetchReq.body, responseHeaders);
|
||||
// Handle null body case
|
||||
return fetchReq.body
|
||||
? c.body(fetchReq.body, responseHeaders)
|
||||
: c.body(null, responseHeaders);
|
||||
} catch (e: any) {
|
||||
console.error("Error fetching federated link", e);
|
||||
return c.text(e.message, 500);
|
||||
|
||||
Reference in New Issue
Block a user