瀏覽代碼

default strict mode

hmt 3 年之前
父節點
當前提交
f20c6ab43a
共有 2 個文件被更改,包括 9 次插入8 次删除
  1. 3 3
      README.md
  2. 6 5
      app.ts

+ 3 - 3
README.md

@@ -25,13 +25,13 @@ Then create a `servers.json` file like this here:
 
 
 Now you are ready to start the script with setting a port and a secret:
 Now you are ready to start the script with setting a port and a secret:
 
 
-    TINYSCALE_SECRET=some_secret_string deno run --allow-net --allow-read --allow-env https://deno.land/x/tinyscale@v1.4.0/mod.ts
+    TINYSCALE_SECRET=some_secret_string deno run --allow-net --allow-read --allow-env https://deno.land/x/tinyscale@v1.5.0/mod.ts
 
 
-tinyscales then runs on port 3005 and you will have to set up your reverse proxy so that it can pick up requests or you leave it on that port. If you prefer a different port you can set one with another env-var: `PORT 3006`
+tinyscale then runs on port 3005 and you will have to set up your reverse proxy so that it can pick up requests or you leave it on that port. If you prefer a different port you can set one with another env var: `PORT 3006`
 
 
 When started, tinyscale will connect to each server and make a single call to check if your configuration is correct. If there is a problem tinyscale will abort. If your configuration works you can start using it in your environment by replacing your existing BBB settings with the new tinyscale url in your third party apps. Make sure to also replace the BBB secrets with your new `TINYSCALE_SECRET`.
 When started, tinyscale will connect to each server and make a single call to check if your configuration is correct. If there is a problem tinyscale will abort. If your configuration works you can start using it in your environment by replacing your existing BBB settings with the new tinyscale url in your third party apps. Make sure to also replace the BBB secrets with your new `TINYSCALE_SECRET`.
 
 
-If you set the additional env var `TINYSCALE_STRICT=true` you can have tinyscale only switch servers when called with a `create`. This may result in better server handling (ymmv).
+If you set the additional env var `TINYSCALE_STRICT=false` tinyscale will switch servers with every call to a room that doesn't exist. This might result in a more random distribution of room creations (ymmv).
 
 
 tinyscale has been tested to work with NextCloud, Moodle and Greenlight.
 tinyscale has been tested to work with NextCloud, Moodle and Greenlight.
 
 

+ 6 - 5
app.ts

@@ -2,20 +2,21 @@ import { opine, ErrorRequestHandler, Router, createHash, server, createError, Co
 import { BBB } from './bbb.ts';
 import { BBB } from './bbb.ts';
 
 
 const date = () => new Date().toLocaleTimeString('de')
 const date = () => new Date().toLocaleTimeString('de')
-const VERSION = 'v1.4.0'
-const tinyscale_strict: boolean = Deno.env.get("TINYSCALE_STRICT") === 'true'|| '1' ? true : false
-console.log(date() + Color.green(` Starting tinyscale ${VERSION} in ${tinyscale_strict ? 'strict':'loose'} mode`))
+const VERSION = 'v1.5.0'
 // give your tinyscale server a secret so it looks like a BBB server
 // give your tinyscale server a secret so it looks like a BBB server
-const secret = Deno.env.get("TINYSCALE_SECRET") || ""
+const secret: string = Deno.env.get("TINYSCALE_SECRET") || ""
 if (!secret) throw "No secret set for tinyscale"
 if (!secret) throw "No secret set for tinyscale"
+const tinyscale_strict: boolean = Deno.env.get("TINYSCALE_STRICT") === 'false' ? false : true
+console.log(date() + Color.green(` Starting tinyscale ${VERSION} in ${tinyscale_strict ? 'strict':'loose'} mode`))
+console.log(`Your secret is set to ${Color.green(secret)}`)
 
 
 // store your BBB servers in servers.json
 // store your BBB servers in servers.json
 const file: string = await Deno.readTextFile('servers.json')
 const file: string = await Deno.readTextFile('servers.json')
 const servers: server[] = JSON.parse(file)
 const servers: server[] = JSON.parse(file)
 // create an iterator so that we can treat all servers equally
 // create an iterator so that we can treat all servers equally
 let iterator = servers[Symbol.iterator]();
 let iterator = servers[Symbol.iterator]();
-console.log(servers)
 console.log('Checking servers first …')
 console.log('Checking servers first …')
+console.log(servers)
 // check servers for connectivity and if the secret is correct
 // check servers for connectivity and if the secret is correct
 servers.forEach(async s => {
 servers.forEach(async s => {
   const hash = createHash("sha1");
   const hash = createHash("sha1");