https://gitlab.com/l4tch/fetchsafe
This project builds upon Hello SAFE demonstrates a simple SAFE app, written in Rust using the Yew framework, deployed as WebAssembly and running in SAFE Browser to demonstrate fetching and deserializing JSON files.
Hopefully this also assists SAFE devs in resolving this issue.
As always, if it can be improved in any way I invite you to reply here or in the repo.
4 Likes
Looks good to me on the shared-vault
mild amount of footering requiredā¦
willie@gagarin:~/projects/maidsafe/fetchsafe/scripts$ sh build-develop
build-develop: 2: set: Illegal option -o pipefail
willie@gagarin:~/projects/maidsafe/fetchsafe/scripts$ less build-develop
willie@gagarin:~/projects/maidsafe/fetchsafe/scripts$ chmod +x build-develop
willie@gagarin:~/projects/maidsafe/fetchsafe/scripts$ ./build-develop
[INFO]: Checking for the Wasm targetā¦
[INFO]: Compiling to Wasmā¦
Compiling proc-macro2 v1.0.8
Compiling unicode-xid v0.2.0
ā¦
ā¦
ā¦
Compiling fetchsafe v0.1.0 (/home/willie/projects/maidsafe/fetchsafe)
Finished dev [unoptimized + debuginfo] target(s) in 1m 12s
[INFO]: Installing wasm-bindgenā¦
[INFO]: Optional fields missing from Cargo.toml: ādescriptionā, ārepositoryā, and ālicenseā. These are not necessary, but recommended
[INFO]: Done in 1m 14s
[INFO]: Your wasm pkg is ready to publish at /home/willie/projects/maidsafe/fetchsafe/pkg.
[WARN]: Thereās a newer version of wasm-pack available, the new version is: 0.9.1, you are using: 0.9.0. To update, navigate to: wasm-pack
/home/willie/projects/maidsafe/fetchsafe/scripts/ā¦/main.js ā dist/fetchsafe.jsā¦
created dist/fetchsafe.js in 307ms
sed: canāt read s/pkg/fetchsafe_bg.wasm/fetchsafe.wasm/g: No such file or directory
I just ignored the last bit and it Just Works
2 Likes
@southside
Enter that XOR-URL into the text input of the Fetch SAFE app at the XOR-URL of the FilesContainer of the dist
directory and press your enter
key.
I donāt observe the error. After it, what does the init
line of fetchsafe.js
(790 for me) contain?
await init('/fetchsafe.wasm');
is expected.
When I said ālooks goodā that was before I read the code - or tried to - WASM is totally new to me- so I should see a text box that I put the XOR-URL for
willie@gagarin:~/projects/maidsafe/fetchsafe$ safe files put dist/ --recursive
FilesContainer created at: "safe://hnyynyiceqh3f6jwewfaxiibusdzcyahicsqwg596eijkp61pnsdtk8rwnbnc"
+ dist/fetchsafe.css safe://hbhyyynsxerinwom7o4w5sya8h3giheusihmkq9setpc6d4jti8r3ghxyw
+ dist/fetchsafe.js safe://hbkygydn8qe474xgu646fa8yu5tgkjnwae5iumwkcyhbjts7hqs6jtk95c
+ dist/fetchsafe.json safe://hbkygony7b8kajf6i9pan37mxa5ujt9regiqg8o93wqtubk9pi8fintf6f
+ dist/index.html safe://hbhybyd6hbjyw888949zzdzqxuuszrcpjcs1ob3g9pxapwgmsncuzwcj7b
3) Run
- Open the XOR-URL of the FilesContainer created when deploying with SAFE Browser
safe://hnyynyiceqh3f6jwewfaxiibusdzcyahicsqwg596eijkp61pnsdtk8rwnbnc
no content displayed
should I see an input field?
- Enter the XOR-URL of fetchsafe.json to observe failure
- dist/fetchsafe.json safe://hbkygony7b8kajf6i9pan37mxa5ujt9regiqg8o93wqtubk9pi8fintf6f
That looked like success to me, no failureā¦
until I read the codeā¦
- Enter fetchsafe.json to observe success
not yetā¦
line 790 of fetchsafe.js
` await init('/pkg/fetchsafe_bg.wasm');`
I edited that line and syncd to the shared vault
- can you see it at ?
safe://hnyynyiceqh3f6jwewfaxiibusdzcyahicsqwg596eijkp61pnsdtk8rwnbnc
then
safe cat safe://hbkygyn14owrnzwuw4zpi61bdifg3o1a7gbafgzk91orgp5epdwozxwh3m
ā¦
return wasm;
});
}
async function main() {
await init('fetchsafe.wasm');
run_app();
}
main();
}());
but when I revisit thr Files Container XOR_URL on the browser
safe://hnyynyiceqh3f6jwewfaxiibusdzcyahicsqwg596eijkp61pnsdtk8rwnbnc
I still get a blank page, for each or the versions
1 Like
Should we try to encourage some others to have a try at it with by putting this on the main forum?
1 Like
@southside
What messages does the console contain?
@southside
These projects target developers and as such I donāt believe so.
One way to get more developers is to ask punters to help solve problems. Iām no dev, just a guy who likes to test things and report back
1 Like
Indeed Willie, and very helpful it is to have you and others willing to poke around.
1 Like
If you can put up with the daft questionsā¦
1 Like
Iāll have a go.
Just opened a beer thoughā¦
I donāt see that lineā¦
@southside
~/projects/maidsafe/hellosafe
It would take the output of several breweries and most distilleries west of the Spey to drown my sorrows at the xenophobic idiocy of your countrymen that dragged me out of the EUā¦
I have failed miserably to find the Ben Elton clip that should go here - but YKWIM
1 Like
willie@gagarin:~/projects/maidsafe/fetchsafe$ safe files put dist/ --recursive
FilesContainer created at: āsafe://hnyynyi631tnsh8o5o8bfg8jgk461j79yew4hj5nm9awntihxf3d4whcpgbncā
- dist/fetchsafe.css safe://hbhyyynsxerinwom7o4w5sya8h3giheusihmkq9setpc6d4jti8r3ghxyw
- dist/fetchsafe.js safe://hbkygyn14owrnzwuw4zpi61bdifg3o1a7gbafgzk91orgp5epdwozxwh3m
- dist/fetchsafe.json safe://hbkygony7b8kajf6i9pan37mxa5ujt9regiqg8o93wqtubk9pi8fintf6f
- dist/fetchsafe.wasm safe://hbyyyyd89nskmwxm5ypiut3bjruw8fns3c87nb5n9yns8k999bcu4nwjcd
- dist/index.html safe://hbhybyd6hbjyw888949zzdzqxuuszrcpjcs1ob3g9pxapwgmsncuzwcj7b
looking good so farā¦
Enter the XOR-URL of fetchsafe.json to observe failure
but when I hit enter, nothing happens
1 Like
@southside
Thatās the issue Iāve reported. If you instead enter āfetchsafe.jsonā youāll see its contents displayed in the console.
1 Like