Closed hasparus closed 2 years ago
Deploy preview for ethereum-code-viewer ready!
Built with commit 80d0d7d1e1f9edde2d20cb36fcb6f9f4f3ada8ba
✅ Preview: https://ethereum-code-viewer-ntwlronq6-dethcrypto.vercel.app
This pull request is being automatically deployed with vercel-action
Deploy preview for ethereum-code-viewer ready!
Built with commit 4ca82183dc9f0fb01b221e81dd521651d2acd19f
✅ Preview: https://ethereum-code-viewer-6n7mnvjan-dethcrypto.vercel.app
This pull request is being automatically deployed with vercel-action
Deploy preview for ethereum-code-viewer ready!
Built with commit 95ac292c3874b10f68e2184ada752963262612f0
✅ Preview: https://ethereum-code-viewer-77k5pbxi2-dethcrypto.vercel.app
This pull request is being automatically deployed with vercel-action
Deploy preview for ethereum-code-viewer ready!
Built with commit 5edb404bc4e241b4ab56884dece9db2ed8620662
✅ Preview: https://ethereum-code-viewer-ek9bng9mi-dethcrypto.vercel.app
This pull request is being automatically deployed with vercel-action
Closes https://github.com/dethcrypto/ethereum-code-viewer/issues/24
Goal: Settings should be merged between all Ethereum Code Viewer domains
Currently, for every Etherscan instance (i.e. blockchain explorer with Etherscan-compatible API and URL scheme), we have a rewrite in Vercel config pointing to the same app.
In every domain we're hosted on, VSCode saves data to LocalStorage and IndexedDB using:
BrowserStorageService
defined insrc/vs/platform/storage/browser/storageService.ts
IndexedDB
file system provider with file schemes'vscode-userdata'
and'vscode-log'
.We could mess with the VSCode host implementation and move the storage itself to an iframe.
Instead, we're moving the app to one domain
ecv.deth.net
which can be opened inside of an iframe, and all existing domains will be from now on just entry-points.Thus, Ethereum Code Viewer has 3 "levels" from now on.
Caveats
getLayoutMap
Running the app in the iframe instead of a "storage iframe" simplifies storage, but we encounter a problem due to privacy mitigations of
navigator.getLayoutMap
.See https://wicg.github.io/keyboard-map/#privacy-mitigations.
I've worked around it by exposing top-level
getLayoutMap
by post-message from top-level iframe and monkey-patchingnavigator.getLayoutMap
in the vscode-host, but shadowing [keyboardLayoutService.ts] might have been an alternative (possibly better?) solution. I'm still not 100% sure if shadowing/swizzling incurs less maintenance burden than monkey-patching in the long term.[keyboardlayoutservice.ts]: https://github.com/microsoft/vscode/blob/2d23c42a936db1c7b3b06f918cde29561cc47cd6/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.ts
document.title
We'd like VSCode to be responsible for setting document title again.
I've added a MutationObserver to watch for
document.title
changes. Alternatively, we could "swizzle/shadow" in VSCode's browser/parts/titlebar/titlebarPart.ts, but I'm trying to avoid shadowing whenever it's possible.