From 30687678863373556376d5df6bc560d671393350 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Wed, 6 Dec 2023 13:52:22 -0800 Subject: [PATCH 1/3] drop querystring in favor of URLSearch params --- package.json | 1 - web/widgets.ts | 16 ++++++++++++---- webpack.config.js | 3 +-- yarn.lock | 5 ----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 560c5d93..a53f7ad3 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "node-fetch": "^2.6.1", "pg": "^8.9.0", "postcss-preset-env": "^6.7.0", - "querystring-es3": "^0.2.1", "prom-client": "^15.0.0", "qs": "^6.11.2", "rfc4648": "^1.4.0", diff --git a/web/widgets.ts b/web/widgets.ts index 7cb2d1bc..ad3bc67f 100644 --- a/web/widgets.ts +++ b/web/widgets.ts @@ -14,11 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as qs from 'qs'; - export const urlParams = (new URL(window.location.href)).searchParams; export const widgetId = urlParams.get("widgetId"); export const isWidget = widgetId && widgetId !== "$matrix_widget_id"; -const widgetQuery = qs.parse(window.location.hash.substring(1)); -export const addlQuery = Object.assign({}, qs.parse(window.location.search.substring(1)), widgetQuery); +const widgetparams = new URLSearchParams(window.location.hash.substring(1)) +const widgetQuery = {} +for (const entry of widgetparams.entries()) { + widgetQuery[entry[0]] = entry[1] +} + +const searchParams = new URLSearchParams(window.location.search.substring(1)) +const parsedSearch = {} +for (const entry of searchParams.entries()) { + parsedSearch[entry[0]] = entry[1] +} +export const addlQuery = Object.assign({}, parsedSearch, widgetQuery); diff --git a/webpack.config.js b/webpack.config.js index 3b4806a0..ac7474a3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,8 +49,7 @@ module.exports = { ], }, resolve: { - extensions: ['.ts', '.js'], - fallback: { "querystring": require.resolve("querystring-es3") } + extensions: ['.ts', '.js'] }, plugins: [ new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }), diff --git a/yarn.lock b/yarn.lock index 273b706a..e80e21e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4906,11 +4906,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== -querystring-es3@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA== - railroad-diagrams@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e" From 8c435ca3ef1b037c7edf8090a486bd67e88d54f3 Mon Sep 17 00:00:00 2001 From: Shay Date: Tue, 2 Jan 2024 20:08:10 -0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Will Hunt --- web/widgets.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/web/widgets.ts b/web/widgets.ts index ad3bc67f..38e2b8b3 100644 --- a/web/widgets.ts +++ b/web/widgets.ts @@ -19,14 +19,8 @@ export const widgetId = urlParams.get("widgetId"); export const isWidget = widgetId && widgetId !== "$matrix_widget_id"; const widgetparams = new URLSearchParams(window.location.hash.substring(1)) -const widgetQuery = {} -for (const entry of widgetparams.entries()) { - widgetQuery[entry[0]] = entry[1] -} +const widgetQuery = Object.fromEntries(widgetparams.entries()); const searchParams = new URLSearchParams(window.location.search.substring(1)) -const parsedSearch = {} -for (const entry of searchParams.entries()) { - parsedSearch[entry[0]] = entry[1] -} -export const addlQuery = Object.assign({}, parsedSearch, widgetQuery); +const parsedSearch = Object.fromEntries(searchParams.entries()); +export const addlQuery = { ...parsedSearch, ...widgetQuery }; From 282684b3f755a385a72d09ba9585ca4cc6c8daad Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Tue, 2 Jan 2024 20:15:20 -0800 Subject: [PATCH 3/3] fix complement pull --- .github/workflows/e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 73cf97e4..b9fcf6f3 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -68,7 +68,7 @@ jobs: - name: Run Homerunner tests timeout-minutes: 10 env: - HOMERUNNER_IMAGE: ghcr.io/matrix-org/synapse/complement-synapse:latest + HOMERUNNER_IMAGE: ghcr.io/element-hq/synapse/complement-synapse:latest HOMERUNNER_SPAWN_HS_TIMEOUT_SECS: 100 NODE_OPTIONS: --dns-result-order ipv4first run: |