From 371ccabee90da54d18a7fd77a9a64e49950f12e0 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 31 Jul 2024 17:46:42 -0400 Subject: [PATCH] not finished --- README.md | 9 ++++++--- package.json | 5 ++--- pnpm-lock.yaml | 39 ++++++++++++++++++++++++++------------ src/bundle/rewrite/html.ts | 14 ++++++++++++++ 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1b4cf19..ed01daf 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,12 @@ Once you have the scripts served, register your service worker and set your tran ```js if ('serviceWorker' in navigator) { const registration = await navigator.serviceWorker.register('/sw.js') - BareMux.SetTransport( - "EpxMod.EpoxyClient", // replace with your transport - { wisp: `wss://wisp-server-here.com` } // replace with the url of your wisp server + let connection = new BareMux.BareMuxConnection("/baremux/worker.js") + await connection.setTransport( + "/epoxy/index.mjs", // replace with your transport + [{ + wisp: `wss://wisp-server-here.com`, // replace with the url of your wisp server + }] ) }) } diff --git a/package.json b/package.json index 9c76621..cb7ebf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meteorproxy", - "version": "1.0.6-patch.1", + "version": "1.0.6-patch.2", "description": "The modern interception proxy you've been waiting for", "type": "module", "main": "./lib/index.cjs", @@ -44,8 +44,7 @@ "husky": "^9.1.4", "prettier": "^3.3.3", "tsx": "^4.16.2", - "typescript": "^5.5.3", - "wisp-server-node": "^1.1.0" + "typescript": "^5.5.3" }, "dependencies": { "@mercuryworkshop/bare-mux": "^2.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fd0f90..aa4fc85 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: meriyah: specifier: ^4.5.0 version: 4.5.0 + meteorproxy: + specifier: 'file:' + version: file:(utf-8-validate@6.0.4) rimraf: specifier: ^6.0.1 version: 6.0.1 @@ -93,9 +96,6 @@ importers: typescript: specifier: ^5.5.3 version: 5.5.3 - wisp-server-node: - specifier: ^1.1.0 - version: 1.1.0 packages: @@ -996,6 +996,9 @@ packages: resolution: {integrity: sha512-Rbiu0QPIxTXgOXwiIpRVJfZRQ2FWyfzYrOGBs9SN5RbaXg1CN5ELn/plodwWwluX93yzc4qO/bNIen1ThGFCxw==} engines: {node: '>=10.4.0'} + 'meteorproxy@file:': + resolution: {directory: '', type: directory} + micromatch@4.0.7: resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==} engines: {node: '>=8.6'} @@ -1295,9 +1298,6 @@ packages: engines: {node: '>= 8'} hasBin: true - wisp-server-node@1.1.0: - resolution: {integrity: sha512-kJcuDIZZfV/HOkTepoVLfwzP7IieE0GfU57UTe8z2IwNRp+YbL12q5xsImcMNEYb9QeP/8loXiyBKXdZ+vojow==} - wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -2105,6 +2105,26 @@ snapshots: meriyah@4.5.0: {} + meteorproxy@file:(utf-8-validate@6.0.4): + dependencies: + '@mercuryworkshop/bare-mux': 2.0.2 + '@mercuryworkshop/wisp-js': 0.1.0(utf-8-validate@6.0.4) + '@types/estree': 1.0.5 + '@webreflection/idb-map': 0.3.1 + astring: 1.8.6 + cookie-es: 1.1.0 + dom-serializer: 2.0.0 + domhandler: 5.0.3 + domutils: 3.1.0 + esbuild: 0.23.0 + estraverse: 5.3.0 + htmlparser2: 9.1.0 + meriyah: 4.5.0 + rimraf: 6.0.1 + set-cookie-parser: 2.6.0 + transitivePeerDependencies: + - utf-8-validate + micromatch@4.0.7: dependencies: braces: 3.0.3 @@ -2380,17 +2400,12 @@ snapshots: utf-8-validate@6.0.4: dependencies: node-gyp-build: 4.8.1 + optional: true which@2.0.2: dependencies: isexe: 2.0.0 - wisp-server-node@1.1.0: - dependencies: - bufferutil: 4.0.8 - utf-8-validate: 6.0.4 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@6.0.4) - wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 diff --git a/src/bundle/rewrite/html.ts b/src/bundle/rewrite/html.ts index 4e7dcf4..6fc05bd 100644 --- a/src/bundle/rewrite/html.ts +++ b/src/bundle/rewrite/html.ts @@ -110,6 +110,20 @@ function rewriteElement(element: Element, origin: URL) { } } + if (['link', 'a'].includes(element.name)) { + if (hasAttrib(element, 'href')) { + self.$meteor.util.log(element.attribs.href, 'green') + /* + if (typeof location !== "undefined") { + element.attribs.onclick = ` + ${location.href = element.attribs.href} + ` + delete element.attribs.href + } + */ + } + } + for (const child of element.children) { if (child.type === ElementType.ElementType.Tag) { rewriteElement(child, origin)