Boot URL component-encoded boot sector? #1010
-
Is it possible to pass a boot image (esp. a 512 byte boot sector) as a URL query parameter? I saw mention of a In my case, I just wanted to be able to point someone to a custom boot sector without them having to download the image, and then select it in the v86 UI. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Not currently possible, but I'd accept a pull request. |
Beta Was this translation helpful? Give feedback.
-
I found that XHR can works with Data URI: let xhr = new XMLHttpRequest();
xhr.open("GET", "data:,hello!");
xhr.onload = function() {
console.log(xhr.response); // output: "hello!"
};
xhr.send(); So after converting binary to base64 uri (as octet-stream data): import base64
# https://gist.github.com/SuperMaxusa/7a84325c73d0ed47d6f5678fef780063
with open("bootsector.bin", "rb") as f:
print("data:file/octet-stream;base64," + base64.b64encode(f.read()).decode("ascii")) And here is example link: https://copy.sh/v86?profile=custom&fda.url=data:file/octet-stream;base64,McCOwDD/vRp8tBOzArABuRAAtgqI8s0Q6/5Xb3csIGl0J3Mgd29ya3Mh (this is "stripped" boot sector, I'm didn't truncate zeros for correct size in 512 bytes, because then link length is too big, but with nonstripped bootsector is also works) I can't confirm that this is a good way, and maybe, that just load image from url (how this done a KolibriOS profile, see #32 and browser/main.js#L517-L522) is easier. |
Beta Was this translation helpful? Give feedback.
-
Interesting! I didn't think that would work based on the code I glanced at (and also due to the 512 byte length, plus Base64 overhead), but I tried it after removing the boot sector signature and it indeed worked for me too (link to boot sector that computes a special number). Given that this appears to depend on the boot sector signature not being checked, it seems like it could break in the future, but just for fun this is exactly what I was looking for. Thanks! |
Beta Was this translation helpful? Give feedback.
I found that XHR can works with Data URI:
So after converting binary to base64 uri (as octet-stream data):
And here is example link: https://copy.sh/v86?profile=custom&fda.url=data:file/octet-stream;base64,McCOwDD/vRp8tBO…