hmt 3 éve
szülő
commit
4b7a42fd76
3 módosított fájl, 13 hozzáadás és 7 törlés
  1. 8 4
      app.ts
  2. 2 1
      bbb.ts
  3. 3 2
      deps.ts

+ 8 - 4
app.ts

@@ -1,4 +1,5 @@
-import { createError, opine, ErrorRequestHandler, Router, server, createHash } from "./deps.ts";
+import { createError, opine, proxy, ErrorRequestHandler, Router, createHash } from "./deps.ts";
+export interface server { host: string; secret: string };
 import { BBB } from './bbb.ts';
 
 // give your tinyscale server a secret so it looks like a BBB server
@@ -44,7 +45,9 @@ function get_available_server(): server {
 
 const router = Router()
 // the api itself answering to every call
-router.all("/bigbluebutton/api/:call", async (req, res, next) => {
+
+// @ts-ignore
+const api = async (req, res, next) => {
   const handler = new BBB(req)
   if (!handler.authenticated(secret)) {
     res.setStatus(401).end()
@@ -60,8 +63,9 @@ router.all("/bigbluebutton/api/:call", async (req, res, next) => {
   console.log(`Redirecting to ${server.host}`)
   const redirect = handler.rewritten_query(server)
   console.log(redirect)
-  res.redirect(redirect)
-});
+  return redirect
+};
+router.all("/bigbluebutton/api/:call", api)
 // the fake answering machine to make sure we are recognized as a proper api
 router.get("/bigbluebutton/api", (req, res, next) => {
   console.log('sending fake xml response')

+ 2 - 1
bbb.ts

@@ -1,4 +1,5 @@
-import { Request, ParamsDictionary, server, createHash } from "./deps.ts";
+import { Request, ParamsDictionary,  createHash } from "./deps.ts";
+export interface server { host: string; secret: string };
 
 export class BBB {
   call: string

+ 3 - 2
deps.ts

@@ -1,11 +1,12 @@
 export {
   join,
-} from "https://deno.land/std@0.94.0/path/mod.ts";
+} from "https://deno.land/std@0.95.0/path/mod.ts";
 export {
   json,
   opine,
   Router,
 } from "https://deno.land/x/opine@1.3.2/mod.ts";
+export { proxy } from "https://deno.land/x/opineHttpProxy@2.5.0/mod.ts";
 export type {
   ErrorRequestHandler,
   Request,
@@ -13,4 +14,4 @@ export type {
  } from "https://deno.land/x/opine@1.3.2/mod.ts";
 export interface server { host: string; secret: string };
 export { createError } from "https://deno.land/x/http_errors@3.0.0/mod.ts";
-export { createHash } from "https://deno.land/std@0.94.0/hash/mod.ts";
+export { createHash } from "https://deno.land/std@0.95.0/hash/mod.ts";