wip: create a client as a web component#8
wip: create a client as a web component#8tylerchilds wants to merge 10 commits intodid-coop:mainfrom
Conversation
|
|
DId it work for you? For me It didn't. I could run the client but the http requests it sent to server would get 5xx or 4xx response. If it had worked for you, then I think mine failing is because of some of the changes I made recently to the server and how it verifies signatures. @tylerchilds wdyt? https://github.com/tylerchilds/wallet-attached-storage-server/pull/1/files |
@gobengo The put request got a 204 for me, but the get request was a 500, so it wasn't fully working. the 204 was an improvement from after you added put support, so i at least knew the integration was improving. |
The 500 was happening because the space controller was not a DID but a whole DID URI with hash fragment. |
|
@tylerchilds Is this the expected behavior? If we want this to be merged as an example into the main branch, it would be ideal if the webpage was a bit more descriptive of what it is trying to exemplify, whether it succeeded in doing so, etc. I ran it in a wrong way for a bit and the server (a rogue process that was not the intended one) responded to PUT /space/:uuid with 405. But this example didn't really complain at that error (iirc). The iframe showed a 404 page though. Once I fixed it, now the demo shows this 'Index5' thing. If that is the 'successfully loaded' state, can you make it more clear? |
gobengo
left a comment
There was a problem hiding this comment.
the example should be more useful or at least more clearly indicate it is successfully loaded vs errored (and hint the user how to evaluate it?)
Yes and no-- work is wip until we get the basic integration connected and then we can put together an actually practical UI-- the SES errors are likely metamask adjacent (and I can work to improve ses compat, if that's a goal for WAS) The 500 from your screenshots and my previous tests is now resolved.
agreed, simplified it for now to eliminate the premature ui controls and just made the iframe full screen for now-- effectively making this a demo of rendering whatever we're immediately publishing.
sorry for the churn!
Made the iframe just read "Initial Test Successful" I've fixed the PR to be cleanly rebased from the upstream, but wasn't able to get back to the fully successful test seen in your screenshot rendering the iframe contents. Reproduction
Expected:
Actual:
|
|
A lead on the 401 unauthorized error-- i might be doing the env var wrong for cors and npm run dev the log ends with |
|
@tylerchilds I haven't tested but a guess is try CORS_ALLOWED_ORIGINS='["http://localhost:8081/"]' npm run dev note the trailing '/' in the URL. if I'm parsing it with the URL constructor and then stringifying again, I think that's what will come up update: this was probably bad advice. trailing slash is part of URL but not the origin part of the URL |
i just tried with the trailing / and it yielded more cors errors. in the current version, the put works, but the get fails. with the trailing /, they both fail. |
|
I've revised this to have compatibilty with https://sillyz.computer/app/was-hello |
|
@tylerchilds I had pushed some new features to main branch here since you branched off. That includes refactoring of the authz and support for PublicCanRead acls. I did a mergeback from main, then updated was-hello to configure the space so there is a PublicCanRead acl applying to the resource that loads in the iframe, and got it working. wdyt? |
fix: was-hello iframe request gest 401 instead of expected 200 with html that was put there
|
@gobengo perfect, merged on my end and tested. publishing to was on my local system from sillyz works, as crazy as that sounds. |
| if (!responseToGetSpace) return | ||
|
|
||
| const index = space.resource(src) | ||
| const blobForIndex = new Blob(['<!doctype html><h1>Hello WAS!</h1>'], { type: 'text/html' }) |
There was a problem hiding this comment.
@tylerchilds It still feels like this is showing something but not necessarily plan98. Are there any plan98 web components we can put in this HTML so that once it is loading it is doing plan98 pretty looking stuff?
gobengo
left a comment
There was a problem hiding this comment.
@tylerchilds Would you be willing to add one of your awesome custom elements to the html that gets written to storage and then showed in iframe? I think it will really help highlight the plan98 part of this example.


.nvmrc
pins a version to load with
nvm useindex.html
sets up import map, calls main.js, mounts
<my-wallet></my-wallet>custom elementmain.js
initializes elf.js to warm up the system and attach observers to lazy-load custom elements from the current directory
elf.js
defines a function to define a custom element that serves as a root operating context, returning the operations of the system
my-wallet.js
includes relevant client deps for WAS and elf.js, has scaffolding to update a ui with identities in card format?
USAGE
these are just static files for now-- we can serve them however. In my testing, i just ran a sample python server in the client folder on port 8009
and running the server
and finally by visiting http://localhost:8009/
this is connected to the latest 200 request work in #4 and #7 for #3