I don’t know what those words mean 😢
Discussion
HTTP is the protocol of the web GET is used to load a file, and PUT is used to save a file
To save to your hosting you'd need to be able to save a file, but also prove it's you, because you dont want everyone uploading, so you could authenticate.
Since you already have a nostr ID, you could authenticate with that.
If successful the "created" result (201) is returned. And your image will be on your server at a URL
That URL then goes in the post and you get to see your image from your own web hosting.
I put that design into ai chat, and this came out:
```
// Solution
// Setup authentication with your nostrID
const authentication = nostrID => {
if (nostrID == valid){ // Check is nostrID is valid
return 201 // Return valid result
}
else {
return 401 // Return invalid result
}
};
// Initialize variables for HTTP & URLs
let http = "";
let saveUrl = "";
let getUrl ="";
// Setup HTTP
http = new XMLHttpRequest();
// Setup GET and PUT URLs
saveUrl = "https://mywebsite.com/save";
getUrl = "https://mywebsite.com/get";
// Save File
http.open("PUT", saveUrl, true); // Open PUT request to save file
let token = authentication(); // Authenticate with nostrID
http.onload = function() { // When onload is called
if (http.status == 201) { // Check if authentication succesful
let data = http.responseText; // Get response from PUT request
console.log(data); // Log data
}
};
// Get File
http.open("GET", getUrl, true); // Open GET request to get file
let token = authentication(); // Authenticate with nostrID
http.onload = function() { // When onload is called
if (http.status == 201) { // Check if authentication succesful
let response = http.responseText; // Get response from GET request
console.log(response); // Log data
}
};
```