codefrau / SqueakJS

A Squeak Smalltalk VM in Javascript
https://squeak.js.org
MIT License
364 stars 75 forks source link

Internet for Images? #148

Closed kokofixcomputers closed 9 months ago

kokofixcomputers commented 10 months ago

Is there anyway to give internet access to images?

If you could make this it would be awesome.

codefrau commented 10 months ago

Not entirely sure what you're asking ... what are you trying to accomplish?

kokofixcomputers commented 10 months ago

Not entirely sure what you're asking ... what are you trying to accomplish?

You know that at lease squeak6 has a option to download a browser from GitHub but it has no internet access so it says cannot resolve host "github.com"

codefrau commented 9 months ago

The image does have some "internet access". To be specific, fetching files using WebClient's httpGet works as long as it's a CORS-enabled https server, because that's what the underlying browser's JavaScript environment allows. JS in the browser does not allow opening arbitrary network connections, it can only make HTTP requests.

The error message you see is misleading – the test for connectivity fails, but if you comment that out in Installer class>>ensureRecentMetacello you'll see that the line

WebClient httpGet: 'https://files.squeak.org/metacello/metacello-squeak60.sar'

actually does succeed and downloads a 500KB file. However, other code down the line fails too, I did not further investigate why, because installing this takes forever.

A better idea would be to prepare your image with all the stuff you need, and run that image in SqueakJS.

codefrau commented 9 months ago

Closing this for now, please open other issues for specific problems that we can fix at the VM level.