diff --git a/p2p/10.IPFS_or_HTTP/README.md b/p2p/10.IPFS_or_HTTP/README.md
index 5aea7da3..2b32d04c 100644
--- a/p2p/10.IPFS_or_HTTP/README.md
+++ b/p2p/10.IPFS_or_HTTP/README.md
@@ -1,20 +1,18 @@
-# 3. Learn the differences between HTTP and IPFS !
+# 10. Learn the differences between HTTP and IPFS
## π« Table of contents
+
* [Step 0 - Setup](README.md#π§-step-0---setup)
* [Step 1 - HTTP](README.md#step-1---http)
- * [Discover the basics](README.md#βοΈ-10-discover-the-basics)
- * [Storage](README.md#πΎ-11-storage)
+ * [Discover the basics](README.md#βοΈ-10-discover-the-basics)
+ * [Storage](README.md#πΎ-11-storage)
* [Step 2 - IPFS](README.md#step-2---ipfs)
- * [Improve the storage](README.md#πΈοΈ-20-improve-the-storage)
- * [Retrieve](README.md#π₯-22-retrieve)
+ * [Improve the storage](README.md#πΈοΈ-20-improve-the-storage)
+ * [Retrieve](README.md#π₯-22-retrieve)
* [Going further](README.md#π-going-further)
-
In this Workshop, you will learn :
-βοΈ Run a web application with `docker-compose`
-
βοΈ The basics of HTTP
βοΈ The basics of IPFS, and why in some cases it is better than HTTP
@@ -22,91 +20,69 @@ In this Workshop, you will learn :
βοΈ How to change a centralized storage into a distributed one via IPFS with Infura !
## π§ Step 0 - Setup
+
Please follow each instruction on the [SETUP.md](SETUP.md) file.
## Step 1 - HTTP
+
### βοΈ 1.0 Discover the basics
-Wanna launch the platform? Alright, make sure you are on the [sources](./sources.zip) directory where the `Dockerfile` and
-`docker-compose.yml` are.
-Build the multi service container :
-```bash
-sudo docker-compose build
-```
-You have to only use this command once. After several steps, you should have this output:
-```bash
-Successfully built a998a543950c
-Successfully tagged music-share_web:latest
-```
-> π‘ The number `a998a543950c` is the id of your container, it's ok if yours is different.
+Wanna launch the back-end? It's very simple, just execute the `./backend` binary.
-Then, each time you want to launch your website, run :
-```bash
-docker-compose up
-```
you should have this log :
-```bash
-Starting music-share_db_1 ... done
-Starting music-share_web_1 ... done
-Attaching to music-share_db_1, music-share_web_1
-db_1 |
-db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
-db_1 |
-db_1 | 2021-08-02 20:48:37.281 UTC [1] LOG: starting PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
-db_1 | 2021-08-02 20:48:37.281 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
-db_1 | 2021-08-02 20:48:37.281 UTC [1] LOG: listening on IPv6 address "::", port 5432
-db_1 | 2021-08-02 20:48:37.283 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
-db_1 | 2021-08-02 20:48:37.286 UTC [25] LOG: database system was shut down at 2021-08-02 20:48:32 UTC
-db_1 | 2021-08-02 20:48:37.289 UTC [1] LOG: database system is ready to accept connections
-web_1 | No changes detected
-web_1 | Operations to perform:
-web_1 | Apply all migrations: admin, auth, contenttypes, musicshare, sessions
-web_1 | Running migrations:
-web_1 | No migrations to apply.
-web_1 | Watching for file changes with StatReloader
-web_1 | Performing system checks...
-web_1 |
-web_1 | System check identified no issues (0 silenced).
-web_1 | August 02, 2021 - 20:48:39
-web_1 | Django version 3.1.6, using settings 'music_share_project.settings'
-web_1 | Starting development server at http://0.0.0.0:8000/
-web_1 | Quit the server with CONTROL-C.
+```bash
+[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
+
+[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
+ - using env: export GIN_MODE=release
+ - using code: gin.SetMode(gin.ReleaseMode)
+
+[GIN-debug] GET /images --> main.getImages (4 handlers)
+[GIN-debug] GET /images/:id --> main.getImageByID (4 handlers)
+[GIN-debug] POST /upload --> main.uploadImage (4 handlers)
+[GIN-debug] GET /uploads/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
+[GIN-debug] HEAD /uploads/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
+[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
+Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
+[GIN-debug] Listening and serving HTTP on 0.0.0.0:8080
```
-As you can see, `db_1` is our database which seems okay and ready to accept new connections,
-and `web_1` is the backend of our website. You can open your favorite browser like Firefox or Chrome (or Opera,
-no discrimination here) and go to this url: [http://0.0.0.0:8000/](http://0.0.0.0:8000/).
-You should see our beautiful website !!
+As you can see, there is different route for the back-end of our website. You can open your favorite browser like Firefox or Chrome (or Opera,
+no discrimination here) and go to this URL: [http://0.0.0.0:8080/images](http://0.0.0.0:8080/images).
+
+You should see an empty array !!
+
+If you want to shut down the server, use `Ctrl` + `C` and then run `docker stop ${id}`.
-If you want to shut down the server, use `Ctrl` + `C` and then run `docker-compose down -v`.
+Now it's time to wake the front-end up.
+
+Go to [the source of the front-end](./openocean/frontend/) and type `bun i` to download the dependencies. Then, type `bun dev` to launch the front-side of our web-app.
+
+Now visit this URL: [localhost:5173](localhost:5173). You should see a pretty UI made by two genius.
### πΎ 1.1 Storage
-Go to the [freearchivemusic](https://freemusicarchive.org/music/Scott_Holmes/rock-background-music/country-road-drive)
-website and download the song.
-By the way, you can look for any other genres of music you prefer on this website, it is free and open source. For the example, we are going to
-stick with this song.
-Go back to [http://0.0.0.0:8000/](http://0.0.0.0:8000/), scroll down and click on the button `upload a song`.
+Go to [Unsplash](https://unsplash.com/photos/a-woman-sitting-at-a-table-using-a-cell-phone-nplkFSNschY) website and download the image.
+By the way, you can look for any other image you prefer on this website, it is free and open source. For the example, we are going to stick with this image.
+Go back to [http://localhost:5173/](http://localhost:5173), scroll down and click on the button on the `up right`.
Fill the form correctly and validates it.
-You can find the code of the form in `musichare/forms.py`, and the associate model object in
-`musicshare/models.py`.
-
Now, look at your terminal, you should see those strange logs appear:
+
```bash
-web_1 | [06/Aug/2021 11:02:33] "GET / HTTP/1.1" 200 4650
-web_1 | [06/Aug/2021 11:02:37] "GET /upload/ HTTP/1.1" 200 4640
-web_1 | [06/Aug/2021 11:02:57] "POST /upload/ HTTP/1.1" 302 0
-web_1 | [06/Aug/2021 11:02:57] "GET /success/ HTTP/1.1" 200 4360
-web_1 | [06/Aug/2021 11:02:59] "POST / HTTP/1.1" 200 5120
-web_1 | [06/Aug/2021 11:02:59] "GET /media/static/Scott_Holmes_Music_-_Country_Road_Drive.mp3 HTTP/1.1" 200 8983053
+[GIN] 2024/12/02 - 19:10:29 | 200 | 85.347Β΅s | 172.17.0.1 | GET "/images"
+[GIN] 2024/12/02 - 19:10:29 | 200 | 140.871Β΅s | 172.17.0.1 | GET "/images"
+[GIN] 2024/12/02 - 19:10:37 | 200 | 2.93712ms | 172.17.0.1 | POST "/upload"
+[GIN] 2024/12/02 - 19:10:37 | 200 | 30.521Β΅s | 172.17.0.1 | GET "/images/08245a6c-0843-4f68-bb41-c1dea72369c7"
+[GIN] 2024/12/02 - 19:10:37 | 200 | 15.784Β΅s | 172.17.0.1 | GET "/images/08245a6c-0843-4f68-bb41-c1dea72369c7"
+[GIN] 2024/12/02 - 19:10:37 | 200 | 5.895332ms | 172.17.0.1 | GET "/uploads/65fb793f-a8b5-4c88-9fbc-6432d40961ba.png"
+
```
+
Let me explain:
-The first part of the message is obviously the datetime. The second one is the method, `GET`, because we want to just
-get the page ; we are asking the server to give us the `/` route which is the home page.
-Then, the `HTTP` protocol and finally two numbers. The `200` is the most interesting : it is a status, preview code. `200` means
-that the server is ok to give us that page from the `/` route, and it has been delivered correctly.
+The first part of the message is obviously the date-time. The second one is two numbers. The `200` is the most interesting : it is a status, preview code. `200` means that the server is OK to give us that page from the `/images` route, and it has been delivered correctly.
+Then, the time it took to respond to the request. Afterward, the address which requested. And finally, the method, `GET`, because we want to just get the page ; we are asking the server to give us the `/images` route which is the home page.
![](http_request_flowchart.png)
*Scheme of a HTTP request*
@@ -118,15 +94,12 @@ some information :that is the main difference between `POST` and `GET`.
> π‘ Learn more about HTTP methods [here](https://www.restapitutorial.com/lessons/httpmethods.html).
-Now, look at our `media/static` folder : you have the mp3 file you just downloaded in here !
->π‘ This is how HTTP works. When retrieving data, HTTP focuses on **location**. Have you noticed the url ?
-First, it is `0.0.0.0` which is your local IP; then `:8000` to signify the port. Finally, the routes or file you want to
-get, joined by a `/`. That format does not ring a bell to you ? It is like a path !
+Then, go to look at our `uploads` folder : you have the file you just downloaded in here !
+>π‘ This is how HTTP works. When retrieving data, HTTP focuses on **location**.
## Step 2 - IPFS
-> π‘ HTTP is cool but has its limits : if the server is down, you won't be able to retrieve the data stored. Furthermore,
-your government can easily block access to certain servers by their IPs that host particular website for censure purposes.
+> π‘ HTTP is cool but has its limits : if the server is down, you won't be able to retrieve the data stored. Furthermore, your government can easily block access to certain servers by their IPs that host particular website for censure purposes.
Let's see how IPFS answers this issues.
At its core, IPFS is a [distributed system](https://blog.stackpath.com/distributed-system/) for storing and accessing files, websites, applications, and data.
@@ -141,13 +114,17 @@ If this is not enough clear for you, I strongly advise you to refer to this [vid
### πΈοΈ 2.0 Improve the storage
Here is what we are going to do : We are going to upload our files directly on IPFS and not locally anymore.
-Instead of having the file locally, let's have its corresponding hash in our database.
+Instead of having the file locally, let's pin it with [Pinata](https://pinata.cloud/). Which is a pinning service.
+
+1. Go to `frontend/src/hooks/` and create a new hook `usePinFileToIPFS.ts` as a manner of `usePostImage.ts` It should call the [list file Pinata API route](https://docs.pinata.cloud/api-reference/endpoint/list-files).
+> π‘ Don't forget to create an [Pinata API & Gateway key](https://app.pinata.cloud/developers/api-keys) and write it down into your a `.env`. You can create one by typing in your terminal in `frontend/` folder:
-1. Go to `musicshare/models.py` and add a CharField for the hash.
-2. Go to `musicshare/views.py` and modify the code of the upload view to communicate with IPFS API in order to upload the file there.
- Please use port `5001` for the connection.
-3. Open `musicshare/templates/musicshare/index.html` to line `179`
- and make sure the hash of the song appears.
+ ```
+cp .env.dist .env
+```
+
+2. Go to `frontend/src/pages/Upload.tsx` and modify the code of the upload view to communicate with your new hook in order to upload the file there.
+3. Go https://app.pinata.cloud/pinmanager and make sure the hash of the song appears.
Some Trouble with IPFS API ?
@@ -156,34 +133,31 @@ Instead of having the file locally, let's have its corresponding hash in our dat
What is an API ?
- Infura IPFS API
+ Infura IPFS API
- ipfs-Api python package
+ ipfs-Api python package
-To apply your migrations, shut down the server and relaunch it.
-
-Test another time to upload your music, copy past the hash of the newly added song and go to `https://ipfs.infura.io:5001/api/v0/cat?arg={your_hash_here}`.
-You should see your song play, even if the server has been shut down !
-
### π₯ 2.2 Retrieve
-Last step : if anyone wants to download from our website some mp3 songs, we need to get it from IPFS.
-Since you did the previous step, this one would seem easy : in your `musicshare/views.py`
- on the `download` view, do the same thing as previously but instead of adding a file, call the `cat` (or `get`) method.
+
+Last step : if anyone wants to see from our website some images, we need to get it from IPFS.
+Since you did the previous step, this one would seem easy : in your `src/page`
+ on the `index.tsx`, do the same thing as previously but instead of adding a file, call the get method to retrieve your image.
## π Going further
-A very cool feature with IPFS is that if someone is having an IPFS node running on its machine and download your mp3 audio
-then you deleted it, you will be able to retrieve it from its node !
+
+A very cool feature with IPFS is that if someone is having an IPFS node running on its machine and download your image then you deleted it, you will be able to retrieve it from its node !
* Learn [how](https://docs.ipfs.io/how-to/command-line-quick-start) you can deploy and configure your own IPFS node.
* Want to store a lot of data on IPFS but being the only one that can access it? Look at [OrbitDB](https://orbitdb.org/).
## Authors
-| [
Adina Cazalens](https://github.com/NaadiQmmr) |
+| [
Sacha Dujardin](https://github.com/Sacharbon) |
| :---: |
+
Organization
diff --git a/p2p/10.IPFS_or_HTTP/SETUP.md b/p2p/10.IPFS_or_HTTP/SETUP.md
index 3a31e09a..b2815e07 100644
--- a/p2p/10.IPFS_or_HTTP/SETUP.md
+++ b/p2p/10.IPFS_or_HTTP/SETUP.md
@@ -1,9 +1,7 @@
# Setup π§
-In order to launch our music platform, you have to download Docker and the `source.zip`
-which contains the code of our web application.
-* [Docker](https://github.com/PoCInnovation/Workshops/blob/master/software/04.Docker/SETUP.md)
-* Download the [source.zip](https://github.com/PoCInnovation/Workshops/raw/p2p/digital_ipfs/p2p/3.IPFS_or_HTTP/sources.zip), move it to your working directory `mv ~/Downloads/sources.zip ; cd ` and unzip it `unzip ./sources.zip`.
+In order to launch our image platform, you have to download Docker and Bun.
+* [Bun](https://bun.sh/)
[Go back to the exercise](README.md#step-1---http)
diff --git a/p2p/10.IPFS_or_HTTP/openocean/backend b/p2p/10.IPFS_or_HTTP/openocean/backend
new file mode 100755
index 00000000..19288e02
Binary files /dev/null and b/p2p/10.IPFS_or_HTTP/openocean/backend differ
diff --git a/p2p/10.IPFS_or_HTTP/openocean/backend/Dockerfile b/p2p/10.IPFS_or_HTTP/openocean/backend/Dockerfile
deleted file mode 100644
index 54ed472c..00000000
--- a/p2p/10.IPFS_or_HTTP/openocean/backend/Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM golang:1.23.3
-
-WORKDIR /app
-
-COPY go.mod go.sum ./
-
-RUN go mod download
-
-COPY *.go ./
-
-EXPOSE 8080
-
-CMD ["go", "run", "."]
diff --git a/p2p/10.IPFS_or_HTTP/openocean/backend/go.mod b/p2p/10.IPFS_or_HTTP/openocean/backend/go.mod
deleted file mode 100644
index 169559ec..00000000
--- a/p2p/10.IPFS_or_HTTP/openocean/backend/go.mod
+++ /dev/null
@@ -1,38 +0,0 @@
-module web-service-workshop
-
-go 1.23.3
-
-require (
- github.com/gin-contrib/cors v1.7.2
- github.com/gin-gonic/gin v1.10.0
- github.com/google/uuid v1.6.0
-)
-
-require (
- github.com/bytedance/sonic v1.11.6 // indirect
- github.com/bytedance/sonic/loader v0.1.1 // indirect
- github.com/cloudwego/base64x v0.1.4 // indirect
- github.com/cloudwego/iasm v0.2.0 // indirect
- github.com/gabriel-vasile/mimetype v1.4.3 // indirect
- github.com/gin-contrib/sse v0.1.0 // indirect
- github.com/go-playground/locales v0.14.1 // indirect
- github.com/go-playground/universal-translator v0.18.1 // indirect
- github.com/go-playground/validator/v10 v10.20.0 // indirect
- github.com/goccy/go-json v0.10.2 // indirect
- github.com/json-iterator/go v1.1.12 // indirect
- github.com/klauspost/cpuid/v2 v2.2.7 // indirect
- github.com/leodido/go-urn v1.4.0 // indirect
- github.com/mattn/go-isatty v0.0.20 // indirect
- github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
- github.com/modern-go/reflect2 v1.0.2 // indirect
- github.com/pelletier/go-toml/v2 v2.2.2 // indirect
- github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
- github.com/ugorji/go/codec v1.2.12 // indirect
- golang.org/x/arch v0.8.0 // indirect
- golang.org/x/crypto v0.23.0 // indirect
- golang.org/x/net v0.25.0 // indirect
- golang.org/x/sys v0.20.0 // indirect
- golang.org/x/text v0.15.0 // indirect
- google.golang.org/protobuf v1.34.1 // indirect
- gopkg.in/yaml.v3 v3.0.1 // indirect
-)
diff --git a/p2p/10.IPFS_or_HTTP/openocean/backend/go.sum b/p2p/10.IPFS_or_HTTP/openocean/backend/go.sum
deleted file mode 100644
index 6a65ad66..00000000
--- a/p2p/10.IPFS_or_HTTP/openocean/backend/go.sum
+++ /dev/null
@@ -1,83 +0,0 @@
-github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
-github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
-github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
-github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
-github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
-github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
-github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
-github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
-github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
-github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw=
-github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
-github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
-github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
-github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
-github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
-github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
-github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
-github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
-github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
-github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
-github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
-github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
-github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
-github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
-github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
-github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
-github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
-github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
-github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
-github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
-github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
-github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
-github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
-github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
-github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
-github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
-github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
-github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
-github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
-github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
-github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
-github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
-github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
-golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
-golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
-golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
-golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
-golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
-golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
-golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
-golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
-golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
-google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
-google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
-rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
diff --git a/p2p/10.IPFS_or_HTTP/openocean/backend/main.go b/p2p/10.IPFS_or_HTTP/openocean/backend/main.go
deleted file mode 100644
index 5f2fe6ab..00000000
--- a/p2p/10.IPFS_or_HTTP/openocean/backend/main.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package main
-
-import (
- "log"
- "net/http"
- "os"
- "path/filepath"
- "time"
-
- "github.com/gin-contrib/cors"
- "github.com/gin-gonic/gin"
- "github.com/google/uuid"
-)
-
-type image struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Filename string `json:"filename"`
- FilePath string `json:"-"`
-}
-
-var (
- images = []image{}
- uploadDir = "./uploads/"
-)
-
-func main() {
- if err := os.MkdirAll(uploadDir, os.ModePerm); err != nil {
- log.Fatal(err)
- }
- router := gin.Default()
-
- router.Use(cors.New(cors.Config{
- AllowOrigins: []string{"*"},
- AllowMethods: []string{"GET", "POST"},
- AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization"},
- ExposeHeaders: []string{"Content-Length"},
- AllowCredentials: true,
- MaxAge: 12 * time.Hour,
- }))
-
- router.GET("/images", getImages)
- router.GET("/images/:id", getImageByID)
-
- router.POST("/upload", uploadImage)
-
- router.Static("/uploads", uploadDir)
-
- router.Run("0.0.0.0:8080")
-}
-
-func getImages(c *gin.Context) {
- c.IndentedJSON(http.StatusOK, images)
-}
-
-func uploadImage(c *gin.Context) {
- file, err := c.FormFile("image")
- if err != nil {
- c.IndentedJSON(http.StatusBadRequest, gin.H{"error": err.Error()})
- }
-
- uniqueFilename := uuid.New().String() + filepath.Ext(file.Filename)
- filePath := filepath.Join(uploadDir, uniqueFilename)
-
- if err := c.SaveUploadedFile(file, filePath); err != nil {
- c.IndentedJSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
- return
- }
-
- newImage := image{
- ID: uuid.New().String(),
- Name: c.PostForm("name"),
- Filename: uniqueFilename,
- FilePath: filePath,
- }
-
- images = append(images, newImage)
- c.IndentedJSON(http.StatusOK, newImage)
-}
-
-func getImageByID(c *gin.Context) {
- id := c.Param("id")
-
- for _, a := range images {
- if a.ID == id {
- publicImage := image{
- ID: a.ID,
- Name: a.Name,
- Filename: a.Filename,
- }
- c.IndentedJSON(http.StatusOK, publicImage)
- return
- }
- }
- c.IndentedJSON(http.StatusNotFound, gin.H{"message": "image not found"})
-}
diff --git a/p2p/10.IPFS_or_HTTP/openocean/frontend/.env.dist b/p2p/10.IPFS_or_HTTP/openocean/frontend/.env.dist
new file mode 100644
index 00000000..3f3c2a64
--- /dev/null
+++ b/p2p/10.IPFS_or_HTTP/openocean/frontend/.env.dist
@@ -0,0 +1,2 @@
+VITE_PINATA_API_KEY=
+VITE_PINATA_GATEWAY=
diff --git a/p2p/10.IPFS_or_HTTP/openocean/frontend/src/constants.ts b/p2p/10.IPFS_or_HTTP/openocean/frontend/src/constants.ts
index 0875ecc3..6aa56907 100644
--- a/p2p/10.IPFS_or_HTTP/openocean/frontend/src/constants.ts
+++ b/p2p/10.IPFS_or_HTTP/openocean/frontend/src/constants.ts
@@ -8,6 +8,6 @@ const vars = {
const env = from(vars, {});
export const constants = {
- pinataAPIKey: env.get("VITE_PINATA_API_KEY").required().asString(),
- pinataGateway: env.get("VITE_PINATA_GATEWAY").required().asString(),
+ pinataAPIKey: env.get("VITE_PINATA_API_KEY").asString(),
+ pinataGateway: env.get("VITE_PINATA_GATEWAY").asString(),
};