allow widget related params in the fragment (#1675)
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -33,6 +33,9 @@ interface RoomIdentifier {
|
|||||||
// clearer what each flag means, and helps us avoid coupling Element Call's
|
// clearer what each flag means, and helps us avoid coupling Element Call's
|
||||||
// behavior to the needs of specific consumers.
|
// behavior to the needs of specific consumers.
|
||||||
interface UrlParams {
|
interface UrlParams {
|
||||||
|
// Widget api related params
|
||||||
|
widgetId: string | null;
|
||||||
|
parentUrl: string | null;
|
||||||
/**
|
/**
|
||||||
* Anything about what room we're pointed to should be from useRoomIdentifier which
|
* Anything about what room we're pointed to should be from useRoomIdentifier which
|
||||||
* parses the path and resolves alias with respect to the default server name, however
|
* parses the path and resolves alias with respect to the default server name, however
|
||||||
@@ -178,6 +181,9 @@ export const getUrlParams = (
|
|||||||
const fontScale = parseFloat(parser.getParam("fontScale") ?? "");
|
const fontScale = parseFloat(parser.getParam("fontScale") ?? "");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
widgetId: parser.getParam("widgetId"),
|
||||||
|
parentUrl: parser.getParam("parentUrl"),
|
||||||
|
|
||||||
// NB. we don't validate roomId here as we do in getRoomIdentifierFromUrl:
|
// NB. we don't validate roomId here as we do in getRoomIdentifierFromUrl:
|
||||||
// what would we do if it were invalid? If the widget API says that's what
|
// what would we do if it were invalid? If the widget API says that's what
|
||||||
// the room ID is, then that's what it is.
|
// the room ID is, then that's what it is.
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ interface WidgetHelpers {
|
|||||||
*/
|
*/
|
||||||
export const widget: WidgetHelpers | null = (() => {
|
export const widget: WidgetHelpers | null = (() => {
|
||||||
try {
|
try {
|
||||||
const query = new URLSearchParams(window.location.search);
|
const { widgetId, parentUrl } = getUrlParams();
|
||||||
const widgetId = query.get("widgetId");
|
|
||||||
const parentUrl = query.get("parentUrl");
|
|
||||||
|
|
||||||
if (widgetId && parentUrl) {
|
if (widgetId && parentUrl) {
|
||||||
const parentOrigin = new URL(parentUrl).origin;
|
const parentOrigin = new URL(parentUrl).origin;
|
||||||
|
|||||||
Reference in New Issue
Block a user