Update frontend/src/app/components/twitter-widget/twitter-widget.component.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
mononaut 2026-03-31 09:47:48 +00:00 committed by GitHub
parent d8c4b99c13
commit 843b652510
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,11 @@ export class TwitterWidgetComponent implements OnChanges {
if (!this.handle) {
return;
}
const url = `https://${this.stateService.env.TWIDGET_DOMAIN}/api/v1/social/x/${this.handle}`;
const baseOrigin = this.stateService.env.TWIDGET_DOMAIN;
const normalizedOrigin = baseOrigin && !/^https?:\/\//i.test(baseOrigin)
? `https://${baseOrigin}`
: baseOrigin;
const url = new URL(`/api/v1/social/x/${this.handle}`, normalizedOrigin).toString();
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.sanitizer.sanitize(SecurityContext.URL, url));
}