From 6cb3381df59d576389ac69f1e4b01c99515fb0e6 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 16 Feb 2021 18:03:12 +0000
Subject: [PATCH] Remove redundant lockOrigin parameter from usercontent
now that each Element has its own, and not usercontent.riot.im
it only has to permit its own origin
---
src/components/views/messages/MFileBody.js | 2 +-
src/usercontent/index.js | 9 +--------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js
index d17a1c4ce3..770cd4fff3 100644
--- a/src/components/views/messages/MFileBody.js
+++ b/src/components/views/messages/MFileBody.js
@@ -288,7 +288,7 @@ export default class MFileBody extends React.Component {
diff --git a/src/usercontent/index.js b/src/usercontent/index.js
index 2e87e182af..6ecd17dcd7 100644
--- a/src/usercontent/index.js
+++ b/src/usercontent/index.js
@@ -1,10 +1,3 @@
-const params = window.location.search.substring(1).split('&');
-let lockOrigin;
-for (let i = 0; i < params.length; ++i) {
- const parts = params[i].split('=');
- if (parts[0] === 'origin') lockOrigin = decodeURIComponent(parts[1]);
-}
-
function remoteRender(event) {
const data = event.data;
@@ -45,7 +38,7 @@ function remoteSetTint(event) {
}
window.onmessage = function(e) {
- if (e.origin === lockOrigin) {
+ if (e.origin === window.location.origin) {
if (e.data.blob) remoteRender(e);
else remoteSetTint(e);
}