hmt 2 anni fa
parent
commit
aeed459226
3 ha cambiato i file con 6 aggiunte e 5 eliminazioni
  1. 2 2
      app.ts
  2. 2 2
      bbb.ts
  3. 2 1
      deps.ts

+ 2 - 2
app.ts

@@ -1,4 +1,4 @@
-import { opine, Router, secret, HttpError, Color, deferred, Deferred } from "./deps.ts";
+import { opine, ErrorRequestHandler, Router, secret, HttpError, Color, deferred, Deferred } from "./deps.ts";
 import { BBB } from './bbb.ts';
 import { Servers } from './servers.ts'
 import type { server } from './deps.ts'
@@ -73,7 +73,7 @@ router.get("/", (req, res, next) => {
   res.send(`<response><returncode>SUCCESS</returncode><version>2.0</version></response>`);
 })
 
-const errorHandler = (err, req, res, next) => {
+const errorHandler: ErrorRequestHandler = (err, req, res, next) => {
   res.setStatus(err.status ?? 500);
   res.end();
   console.log(`${Color.red(`${res.status}`)} ${req.originalUrl}`)

+ 2 - 2
bbb.ts

@@ -1,4 +1,4 @@
-import { createHash } from "./deps.ts";
+import { Request, ParamsDictionary, createHash } from "./deps.ts";
 import type { server } from './deps.ts'
 
 export class BBB {
@@ -9,7 +9,7 @@ export class BBB {
   meeting_id: string
   url: string
 
-  constructor(req) {
+  constructor(req: Request<ParamsDictionary, any, any>) {
     this.call = req.params.call
     this.checksum_incoming = req.query.checksum
     this.query = req._parsedUrl?.query || ""

+ 2 - 1
deps.ts

@@ -4,6 +4,7 @@ export { join } from "https://deno.land/std/path/mod.ts";
 export { createHash } from "https://deno.land/std/hash/mod.ts";
 export * as Color from "https://deno.land/std/fmt/colors.ts";
 export { HttpError } from "https://deno.land/x/http_error@0.1.3/mod.ts";
-export { opine, Router } from "https://deno.land/x/opine@2.1.5/mod.ts";
+export { opine, Router } from "https://deno.land/x/opine@1.9.1/mod.ts";
+export type { ErrorRequestHandler, Request, ParamsDictionary } from "https://deno.land/x/opine@1.9.1/mod.ts";
 export const secret: string = Deno.env.get("TINYSCALE_SECRET") || ""
 export interface server { host: string; secret: string };