block-core / blockcore-notes

Notes app for decentralized infrastructures (Nostr and Web5)
https://notes.blockcore.net
MIT License
61 stars 21 forks source link

Add image to post from local device #93

Open sondreb opened 1 year ago

sondreb commented 1 year ago

While we should add support for pasting images directly into the content editor, we should also add a file browser option:

https://web.dev/progressively-enhance-your-pwa/

vr-varad commented 5 months ago

@sondreb , I hope you're doing well! I'm eager to contribute to this issue. If you could provide a bit more clarity on where exactly this feature needs to be integrated, I'd greatly appreciate it. Thank you kindly for your assistance.

sondreb commented 5 months ago

The idea is basically similar to how GitHub supports uploading images, if you copy an image anywhere on your computer you can go into the chat box here and paste it in. It will upload and fill in the link to the image in the text.

Since we don't do live preview support on Notes (and neither does text editor on GitHub), implementing it similar to GitHub would be OK.

vr-varad commented 5 months ago

@sondreb could u assign me this issue I would like to work on it.

miladsoft commented 5 months ago

I suggest that you think about uploading files to IPFS

vr-varad commented 5 months ago

@miladsoft which infrastructure service should I use as Infura is a prominent one and is currently out of service for ipfs?

miladsoft commented 5 months ago

Fleek:

miladsoft commented 5 months ago

I found out you can actually set up your own IPFS node using Docker, which makes it surprisingly easy. Think of Docker like a magic box that lets you run programs in these isolated environments. Pretty neat!

Here's what you'd need to do:

Grab Docker: First things first, you'll need Docker installed on your machine.

Download IPFS: With Docker set up, you can download the IPFS image using a simple command in your terminal (that's the command prompt thingy). It's like getting all the IPFS stuff ready to use.

Run Your Own Node: This is the exciting part! Another command in the terminal will fire up your very own IPFS node. You can customize where you want to store your IPFS data too. By the way, running your own node is way better than relying on services like Infura or Fleek – trust me!

Web Interface (Optional): If you prefer a more user-friendly way to interact with your node, there's actually a web interface you can access through your browser.

Use IPFS Commands: Once your node is up and running, you can use special commands to upload and download files. It's pretty straightforward!

That's it! You'll have your own IPFS node running on Docker, ready to explore the world of decentralized storage. If you get stuck anywhere or have any questions, feel free to ask – I'm happy to help!

miladsoft commented 5 months ago
  1. Install Docker: First things first, make sure you have Docker installed on your computer. Docker lets you run applications in isolated environments called containers.

  2. Pull the IPFS Docker Image: Once Docker is set up, pull the IPFS Docker image from Docker Hub by running this command in your terminal:

    docker pull ipfs/go-ipfs

    This will download the IPFS image and get it ready for you to use.

  3. Run the IPFS Container: Time to fire up your IPFS node! Run this command in your terminal:

    docker run -d --name ipfs-node -v /path/to/ipfs-data:/data/ipfs -p 4001:4001 -p 5001:5001 -p 8080:8080 ipfs/go-ipfs

    Replace /path/to/ipfs-data with the directory where you want to store your IPFS data. This command will create a new container named ipfs-node running the IPFS node, and you can access it through ports 4001, 5001, and 8080.

  4. Access the IPFS Web UI (Optional): If you want a user-friendly interface, you can access the IPFS Web UI by going to http://localhost:5001/webui in your web browser.

  5. Use IPFS Commands: With your IPFS node up and running, you can start using IPFS commands to upload and download files. For example, to add a file, use:

    docker exec ipfs-node ipfs add /path/to/file

    And to download a file, use:

    docker exec ipfs-node ipfs get <CID>

    Replace <CID> with the Content Identifier (CID) of the file you want to download.

vr-varad commented 5 months ago

Thanks @miladsoft I have some experience with docker I will try to implement it and share the results.

vr-varad commented 5 months ago

@miladsoft I was able to upload files at docker container of ipfs-go and was able to retrieve it how could I implement it to the code base could u give help me with that.

miladsoft commented 5 months ago

Great work! I admire your perseverance. Could you please share your code on GitHub here and specify that uploading files to IPFS requires running the IPFS in Docker first? Additionally, consider adding a section in the settings for inserting the addresses of servers implementing IPFS in Docker. I believe this would create a more comprehensive scenario. Absolutely, @sondreb's input is invaluable, and I'm eager to hear his perspective on this matter too.

vr-varad commented 5 months ago

@miladsoft I found doing it with docker a bit difficult so I did it with pinata and pushed in the pr. I will try doing it with docker. Thanks for guidance @miladsoft