mirror of
https://github.com/mollersuite/monofile.git
synced 2024-10-06 20:16:25 -07:00
Bring back /cpt
This commit is contained in:
parent
f441e06a21
commit
d5cf1470cf
|
@ -1,4 +1,4 @@
|
||||||
import { Hono } from "hono"
|
import { Context, Hono } from "hono"
|
||||||
import * as Accounts from "../../../lib/accounts.js"
|
import * as Accounts from "../../../lib/accounts.js"
|
||||||
import * as auth from "../../../lib/auth.js"
|
import * as auth from "../../../lib/auth.js"
|
||||||
import RangeParser, { type Range } from "range-parser"
|
import RangeParser, { type Range } from "range-parser"
|
||||||
|
@ -20,8 +20,8 @@ export let primaryApi = new Hono<{
|
||||||
|
|
||||||
primaryApi.all("*", getAccount)
|
primaryApi.all("*", getAccount)
|
||||||
|
|
||||||
export default function (files: Files, apiRoot: Hono) {
|
function fileReader(apiRoot: Hono) {
|
||||||
primaryApi.get("/file/:fileId", async (ctx) =>
|
return async (ctx: Context) =>
|
||||||
apiRoot.fetch(
|
apiRoot.fetch(
|
||||||
new Request(
|
new Request(
|
||||||
(new URL(
|
(new URL(
|
||||||
|
@ -30,7 +30,12 @@ export default function (files: Files, apiRoot: Hono) {
|
||||||
),
|
),
|
||||||
ctx.env
|
ctx.env
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
export default function (files: Files, apiRoot: Hono) {
|
||||||
|
|
||||||
|
primaryApi.get("/file/:fileId", fileReader(apiRoot))
|
||||||
|
primaryApi.get("/cpt/:fileId/*", fileReader(apiRoot))
|
||||||
|
|
||||||
primaryApi.post("/upload", async (ctx) =>
|
primaryApi.post("/upload", async (ctx) =>
|
||||||
apiRoot.fetch(
|
apiRoot.fetch(
|
||||||
|
|
Loading…
Reference in a new issue