commit
11fd9e1c0f
6 changed files with 14 additions and 7 deletions
|
@ -36,23 +36,25 @@ const Element: LinkedClient = {
|
||||||
experimental: false,
|
experimental: false,
|
||||||
clientId: ClientId.Element,
|
clientId: ClientId.Element,
|
||||||
toUrl: (link) => {
|
toUrl: (link) => {
|
||||||
|
const params = link.arguments.originalParams.toString();
|
||||||
|
const prefixedParams = params ? `?${params}` : '';
|
||||||
switch (link.kind) {
|
switch (link.kind) {
|
||||||
case LinkKind.Alias:
|
case LinkKind.Alias:
|
||||||
case LinkKind.RoomId:
|
case LinkKind.RoomId:
|
||||||
return new URL(
|
return new URL(
|
||||||
`https://app.element.io/#/room/${link.identifier}`
|
`https://app.element.io/#/room/${link.identifier}${prefixedParams}`
|
||||||
);
|
);
|
||||||
case LinkKind.UserId:
|
case LinkKind.UserId:
|
||||||
return new URL(
|
return new URL(
|
||||||
`https://app.element.io/#/user/${link.identifier}`
|
`https://app.element.io/#/user/${link.identifier}${prefixedParams}`
|
||||||
);
|
);
|
||||||
case LinkKind.Permalink:
|
case LinkKind.Permalink:
|
||||||
return new URL(
|
return new URL(
|
||||||
`https://app.element.io/#/room/${link.identifier}`
|
`https://app.element.io/#/room/${link.identifier}${prefixedParams}`
|
||||||
);
|
);
|
||||||
case LinkKind.GroupId:
|
case LinkKind.GroupId:
|
||||||
return new URL(
|
return new URL(
|
||||||
`https://app.element.io/#/group/${link.identifier}`
|
`https://app.element.io/#/group/${link.identifier}${prefixedParams}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ export const Default: React.FC = () => (
|
||||||
<HomeserverOptions
|
<HomeserverOptions
|
||||||
link={{
|
link={{
|
||||||
identifier: '#banter:matrix.org',
|
identifier: '#banter:matrix.org',
|
||||||
arguments: { vias: [] },
|
arguments: { vias: [], originalParams: new URLSearchParams() },
|
||||||
kind: LinkKind.Alias,
|
kind: LinkKind.Alias,
|
||||||
originalLink: 'This is all made up',
|
originalLink: 'This is all made up',
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -42,6 +42,7 @@ const userLink: SafeLink = {
|
||||||
identifier: '@jorik:matrix.org',
|
identifier: '@jorik:matrix.org',
|
||||||
arguments: {
|
arguments: {
|
||||||
vias: [],
|
vias: [],
|
||||||
|
originalParams: new URLSearchParams(),
|
||||||
},
|
},
|
||||||
originalLink: 'asdfsadf',
|
originalLink: 'asdfsadf',
|
||||||
};
|
};
|
||||||
|
@ -51,6 +52,7 @@ const roomLink: SafeLink = {
|
||||||
identifier: '#element-dev:matrix.org',
|
identifier: '#element-dev:matrix.org',
|
||||||
arguments: {
|
arguments: {
|
||||||
vias: [],
|
vias: [],
|
||||||
|
originalParams: new URLSearchParams(),
|
||||||
},
|
},
|
||||||
originalLink: 'asdfsadf',
|
originalLink: 'asdfsadf',
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,7 +127,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
|
||||||
let content: JSX.Element;
|
let content: JSX.Element;
|
||||||
const [showHSOptions, setShowHSOPtions] = useState(false);
|
const [showHSOptions, setShowHSOPtions] = useState(false);
|
||||||
|
|
||||||
const hses = useHSs({link});
|
const hses = useHSs({ link });
|
||||||
|
|
||||||
if (!hses.length) {
|
if (!hses.length) {
|
||||||
content = (
|
content = (
|
||||||
|
@ -169,7 +169,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
|
||||||
link={{
|
link={{
|
||||||
kind: LinkKind.UserId,
|
kind: LinkKind.UserId,
|
||||||
identifier: link.arguments.sharer,
|
identifier: link.arguments.sharer,
|
||||||
arguments: { vias: [] },
|
arguments: { vias: [], originalParams: new URLSearchParams() },
|
||||||
originalLink: '',
|
originalLink: '',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -92,6 +92,7 @@ export function parseArgs(args: string): Arguments {
|
||||||
vias: params.getAll('via'),
|
vias: params.getAll('via'),
|
||||||
client: bottomExchange(params.get('client')),
|
client: bottomExchange(params.get('client')),
|
||||||
sharer: bottomExchange(params.get('sharer')),
|
sharer: bottomExchange(params.get('sharer')),
|
||||||
|
originalParams: params,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ export interface Arguments {
|
||||||
client?: string;
|
client?: string;
|
||||||
// MXID
|
// MXID
|
||||||
sharer?: string;
|
sharer?: string;
|
||||||
|
// Original params
|
||||||
|
originalParams: URLSearchParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LinkContent {
|
export interface LinkContent {
|
||||||
|
|
Loading…
Reference in a new issue