Add test mode

`*` char permit to defined test mode with warning message

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
Gregoire Parant 2021-12-10 01:51:40 +01:00
parent 27aa3c51d3
commit a5d4d163e1
5 changed files with 24 additions and 4 deletions

View file

@ -32,7 +32,7 @@ export class Room {
if (this.id.startsWith("/")) {
this.id = this.id.substr(1);
}
if (this.id.startsWith("_/")) {
if (this.id.startsWith("_/") || this.id.startsWith("*/")) {
this.isPublic = true;
} else if (this.id.startsWith("@/")) {
this.isPublic = false;
@ -138,7 +138,7 @@ export class Room {
}
if (this.isPublic) {
const match = /_\/([^/]+)\/.+/.exec(this.id);
const match = /[_*]\/([^/]+)\/.+/.exec(this.id);
if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
this.instance = match[1];
return this.instance;