Hello Hive Community Members,
Welcome to daily updates from @sagarkothari88 - a Hive Witness & mobile-app-developer.
<body>
// this one to get the access to Buffer
<script src="https://bundle.run/[email protected]"></script>
async function openImagePickerForWebApp(id, account) {
return new Promise(function (resolve, reject) {
var input = document.createElement("input");
input.type = "file";
input.onchange = (e) => {
};
input.click();
});
}
async function openImagePickerForWebApp(id, account) {
return new Promise(function (resolve, reject) {
var input = document.createElement("input");
input.type = "file";
input.onchange = (e) => {
var file = e.target.files[0];
var reader = new FileReader();
reader.onload = async () => {
};
reader.readAsBinaryString(file);
};
input.click();
});
}
// Step 1. Get Prefix Buffer
const prefix = window.buffer.Buffer.from("ImageSigningChallenge");
// Step 2. Get Buffer of selected File
const fileBuffer = window.buffer.Buffer.from(reader.result, "binary");
// Step 3. Concate / join both the buffers in right order
const buf = window.buffer.Buffer.concat([prefix, fileBuffer]);
window.hive_keychain.requestSignBuffer(account,JSON.stringify(buf),"Posting",(res) => {
const url = `https://images.hive.blog/${account}/${res.result}`;
});
res.result, you'll find a signature.res.resultconst formData = new FormData();
formData.append("file", file, file.name);
const xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.onload = () => {
const res = JSON.parse(xhr.responseText);
const uploadUrl = res.url;
console.log(`Image Upload URL is - ${uploadUrl}`);
}
async function openImagePickerForWebApp(id, account) {
return new Promise(function (resolve, reject) {
var input = document.createElement("input");
input.type = "file";
input.onchange = (e) => {
var file = e.target.files[0];
var reader = new FileReader();
reader.onload = async () => {
const content = window.buffer.Buffer.from(reader.result,"binary");
const prefix = window.buffer.Buffer.from("ImageSigningChallenge");
const buf = window.buffer.Buffer.concat([prefix, content]);
window.hive_keychain.requestSignBuffer(
account,
JSON.stringify(buf),
"Posting",
(response) => {
const url = `https://images.hive.blog/${accountName}/${response.result}`;
const formData = new FormData();
formData.append("file", file, file.name);
const xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.onload = () => {
const res = JSON.parse(xhr.responseText);
const uploadUrl = res.url;
console.log(`uploaded url is ${uploadUrl}`);
};
});
};
reader.readAsBinaryString(file);
};
input.click();
});
}
NOTE: If you don't like tagging you under curation report, let me know in comment section & I'll exclude you from the curation report.
| Author | Post | Weight |
|---|---|---|
| @mysteriousroad/potato-panner-bites-recipe | 20 % | |
| @preeti/torai-posto-ridge-gourd-with | 20 % | |
| @floreudys79/gabriela-en-su-1era-presentacion | 20 % | |
| @yagelybr/eng-esp-visiting-plaza-bolivar-and-its-surroundings-places-full-of-history | 20 % | |
| @marlyncabrera/what-eases-my-mind-oror-kiss-104-on-me-time | 28 % | |
| @bonzopoe/reflexiones-innecesarias-084-aprender-a-escuchar-nuestras-tristezas-por-bonzopoe | 23 % | |
| @tonyes/esp-eng-soledad-solitud-o | 20 % | |
| @theresa16/my-veggie-shopping-beets-eng-esp | 20 % | |
| @yraimadiaz/refreshing-guava-hibiscus-water-with-guava-espeng | 21 % | |
| @stefano.massari/13-04-2024-economy-profit-maximization-en-it | 32 % | |
| @heroldius/street-art-683-grills-fokus-fleo-omar-bernal-and-monke-montreal | 28 % | |
| @enjar/cyberpunk-2077-or-the-untrustworthy-voodoos | 40 % | |
| @passenger777/oeluedeniz-eng-tr | 25 % | |
| @slwzl/first-dress-store-on-the-way-to-15-en-es | 21 % | |
| @luchyl/nature-in-vegetation-pobphotocontest-new-round- | 20 % | |
| @eliezerfloyd/los-ojos-del-alma-or-poema | 21 % | |
| @charjaim/memories-my-fathers-best-legacy | 20 % | |
| @indiaunited/indiaunited-1712966736939 | 2.5 % | |
| @jmis101/when-it-s-not-normal | 20 % | |
| @gidlark/pavuki-40-spiders-40 | 30 % | |
| @yetaras/mika-na-veronici | 31 % | |
| @josediccus/splinterlands-why-you-should-own-a-weapons-training-neutral-card- | 40 % | |
| @nkemakonam89/away-from-work-promoting-extended-vacation-days | 25 % | |
| @nitsuga12/behind-the-thinker-3d-prints-of-a-masterpiece-eng-esp | 21 % | |
| @costanza/playoffs-week-3-saturday-previews | 40 % | |
| @littlesorceress/contest-entry-smash-317-carnival | 21 % | |
| @mamaemigrante/edificios-que-cuentan-una-historia | 23 % | |
| @nadin-zakrevska/working-days-at-home-robochi | 22 % | |
| @tub3r0/unleashing-venka-the-vile-a | 20 % | |
| @goldenoakfarm/after-the-storms-april-11-and-12-2024-goldenoakfarm | 26 % | |
| @bradleyarrow/drip-day-building-update-1713-days-of-posting | 24 % | |
| @papilloncharity/after-the-storm | 40 % | |
| @mayorkeys/kgsnjccc | 21 % | |
| @iskawrites/women-who-experience-menstrual-cramps-should-have-workplace-flexibility | 20 % | |
| @randybpics/momomad-monochromatic-photo-shoot-in-the-magic-forest-engesp | 20 % | |
| @tattoodjay/saturday-a-walk-on-popes-island | 40 % | |
| @yameen/splinterlands-daily-rewards-or-purchased-and-opened-5-veteran-draws-or-got-2-epic-cards-or-04-12-2024 | 28 % | |
| @steevc/11169723686-3630856045 | 40 % | |
| @servelle/saturday-savers-club-2024-week-1635df84af607 | 21 % | |
| @mukund123/kucoin-to-start-tds-deduction-in-india | 20 % | |
| @sacra97/love-the-clouds-199-sunset | 28 % | |
| @ekavieka/losing-a-good-time | 27 % |