From 2b5dbca5ac54fd3131cd4cb5ffecbe301c05f991 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Fri, 17 Apr 2026 18:15:21 +0200 Subject: [PATCH 01/11] [~] Update commit message policy prefixes for clarity --- .github/commit-policy.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/commit-policy.md b/.github/commit-policy.md index aae166f..ce9cdf1 100644 --- a/.github/commit-policy.md +++ b/.github/commit-policy.md @@ -14,15 +14,10 @@ Optional body with more details. ## Prefixes - [+] New feature or file added - [-] File or feature removed -- [~] Modification or update -- [!] Bug fix -- [*] Refactor or cleanup +- [~] Modification or update or other - [?] Tests -- [#] Configuration or build ## Examples [+] Add user authentication module [-] Remove deprecated payment API [~] Update README with new install steps -[!] Fix crash on null pointer in parser -[*] Refactor database connection pool From 0cca22088d7e1dad42f932bb60b4955b91532b47 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Fri, 17 Apr 2026 22:17:39 +0200 Subject: [PATCH 02/11] [+] Add HttpRequest function and update button for request test --- web-client/src/App.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web-client/src/App.jsx b/web-client/src/App.jsx index 9f6b51e..9f4446a 100644 --- a/web-client/src/App.jsx +++ b/web-client/src/App.jsx @@ -1,11 +1,21 @@ import { useState } from 'react' import './App.css' +function HttpRequest() { + const localhost = "test" +} + function App() { const [count, setCount] = useState(0) return (
+ +
Hello Word
From 0dcceec54759f1e9a90d4aecc367da406f36c42a Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Fri, 17 Apr 2026 22:19:06 +0200 Subject: [PATCH 03/11] [+] Add SimpleHost function and integrate server start command --- main.go | 5 +++++ server/server_request.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 server/server_request.go diff --git a/main.go b/main.go index 2367060..f1842c9 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,11 @@ func main() { server.ViewConfig(cfg) continue } + if rep == "-start" && cfg.StartStatut == 0 { + go server.SimpleHost() + cfg.StartStatut = 1 + continue + } fmt.Println("Command not found.") } } diff --git a/server/server_request.go b/server/server_request.go new file mode 100644 index 0000000..2ed6c2e --- /dev/null +++ b/server/server_request.go @@ -0,0 +1,14 @@ +package server + +import ( + "fmt" + "net/http" +) + +func SimpleHost() { + err := http.ListenAndServe(":8000", nil) + if err != nil { + fmt.Println("error server") + } + fmt.Println("END FUNCTION") +} \ No newline at end of file From 59e16b99d02edc0c72221fa379072d88a144def5 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Fri, 17 Apr 2026 22:19:25 +0200 Subject: [PATCH 04/11] [~] Update LoadConf function to initialize StartStatut field --- server/server.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/server.go b/server/server.go index 959e3cc..3fc7350 100644 --- a/server/server.go +++ b/server/server.go @@ -18,12 +18,14 @@ type conf struct { Host string `toml:"host"` } `toml:"server"` Path string + StartStatut int } func LoadConf(path string) (conf, error) { var cfg conf _, err := toml.DecodeFile(path, &cfg) cfg.Path, err = os.Getwd() + cfg.StartStatut = 0 return cfg, err } From 08e2469d3e4fa0d498c48cc8965703898af73019 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Sat, 18 Apr 2026 17:11:06 +0200 Subject: [PATCH 05/11] [+] Add request http with backend --- web-client/src/App.jsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/web-client/src/App.jsx b/web-client/src/App.jsx index 9f4446a..b979262 100644 --- a/web-client/src/App.jsx +++ b/web-client/src/App.jsx @@ -2,7 +2,17 @@ import { useState } from 'react' import './App.css' function HttpRequest() { - const localhost = "test" + fetch("http://localhost:8000/") + .then((res) => { + if (!res.ok) throw new Error(`HTTP ${res.status}`) + return res.json() + }) + .then((data) => { + console.log("JSON OK:", data) + }) + .catch((err) => { + console.error("Erreur requête:", err) + }) } function App() { @@ -13,10 +23,10 @@ function App() { - -
+
Hello Word
From 4cfb1c0c0a56cfed2b1d9fe2624973a4c0a1718e Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Sat, 18 Apr 2026 17:11:44 +0200 Subject: [PATCH 06/11] [~] Update command handling to remove hyphens and fix SimpleHost call [+] Add command cd and ls --- main.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index f1842c9..cf7cf4f 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "os" "server/server" ) @@ -12,32 +13,48 @@ func main() { fmt.Println("Terminal du serveur :") for { var rep string + var path string fmt.Print("$MIRA-Stream> ") _, err := fmt.Scan(&rep) if err != nil { log.Fatalln("error input") } - if rep == "-exit" { + if rep == "exit" { break } - if rep == "-vfolder" { + if rep == "vfolder" { server.ChangeVFolder(&cfg) fmt.Printf("After change : %+v\n", cfg) continue } - if rep == "-list" { + if rep == "list" { server.TakeFolder(&cfg) continue } - if rep == "-config" { + if rep == "config" { server.ViewConfig(cfg) continue } - if rep == "-start" && cfg.StartStatut == 0 { - go server.SimpleHost() + if rep == "start" && cfg.StartStatut == 0 { + go server.SimpleHost(cfg) cfg.StartStatut = 1 continue } + if rep == "cd" { + _, err := fmt.Scan(&path) + if err != nil { + log.Fatalln("error cd") + } + os.Chdir(path) + cfg.Path, err = os.Getwd() + fmt.Printf("DEBUG CD : %v\n", cfg.Path) + continue + } + if rep == "ls" { + folder, _ := os.ReadDir(cfg.Path) + fmt.Printf("DEBUG LS : %+v\n", folder) + continue + } fmt.Println("Command not found.") } } From e21ccdc8db94ac96fcc4c6214ac5db4cc5772d7e Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Sat, 18 Apr 2026 17:11:59 +0200 Subject: [PATCH 07/11] [+] Add items handler and update SimpleHost to serve JSON data --- server/server_request.go | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/server/server_request.go b/server/server_request.go index 2ed6c2e..2939e62 100644 --- a/server/server_request.go +++ b/server/server_request.go @@ -1,11 +1,49 @@ package server import ( + "encoding/json" "fmt" "net/http" ) -func SimpleHost() { +type Item struct { + ID int `json:"id"` + Name string `json:"name"` +} + +var items = []Item{ + {ID: 1, Name: "Item A"}, + {ID: 2, Name: "Item B"}, +} + +func itemsHandler(w http.ResponseWriter, r *http.Request) { + // Allow the Vite dev server to read API responses from the browser. + w.Header().Set("Access-Control-Allow-Origin", "http://localhost:5173") + w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") + w.Header().Set("Access-Control-Allow-Headers", "Content-Type") + + if r.Method == http.MethodOptions { + w.WriteHeader(http.StatusNoContent) + return + } + + switch r.Method { + case http.MethodGet: + // On renvoie la liste en JSON + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(items); err != nil { + w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintln(w, "Erreur d'encodage JSON") + } + default: + w.WriteHeader(http.StatusMethodNotAllowed) + w.Write([]byte("Méthode non autorisée")) + } +} + +func SimpleHost(cfg conf) { + http.HandleFunc("/", itemsHandler) + fmt.Println("API lancer") err := http.ListenAndServe(":8000", nil) if err != nil { fmt.Println("error server") From 6a1107e8a8f84b0bea6f1905f5f892002c7fbbd4 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Mon, 20 Apr 2026 18:03:57 +0200 Subject: [PATCH 08/11] [~] Update App component layout and enhance HTTP request handling --- web-client/src/App.jsx | 91 +++++++++++++++++++++++++++++++++------- web-client/src/index.css | 2 +- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/web-client/src/App.jsx b/web-client/src/App.jsx index b979262..6b7c04a 100644 --- a/web-client/src/App.jsx +++ b/web-client/src/App.jsx @@ -1,35 +1,96 @@ -import { useState } from 'react' +import { useState, useRef } from 'react' import './App.css' function HttpRequest() { - fetch("http://localhost:8000/") + fetch('http://localhost:8000/') .then((res) => { if (!res.ok) throw new Error(`HTTP ${res.status}`) return res.json() }) .then((data) => { - console.log("JSON OK:", data) + console.log('JSON OK:', data) }) .catch((err) => { - console.error("Erreur requête:", err) + console.error('Erreur requête:', err) }) } function App() { const [count, setCount] = useState(0) + const items = [ + { label: 'Ce connecter' }, + { label: 'Github' }, + ] + + const sectionRef = useRef(null) + + const handleScroll = () => { + sectionRef.current?.scrollIntoView({ behavior: 'smooth' }) + } + return ( -
- - -
- Hello Word -
-
+
+
+ + MIRA Stream + + + +
+ +
+
+

+ Bienvenue sur Mira Stream +

+ + +
+ +
+

+ Ton header est maintenant rendu par un composant React local, sans librairie externe. +

+ +
+ +
+
+
+
) } diff --git a/web-client/src/index.css b/web-client/src/index.css index 47d7925..5aa4a31 100644 --- a/web-client/src/index.css +++ b/web-client/src/index.css @@ -1,7 +1,7 @@ :root { --text: #6b6375; --text-h: #08060d; - --bg: #2b2b2b; + --bg: #09090b; --border: #e5e4e7; --code-bg: #f4f3ec; --accent: #aa3bff; From 9871ce492be3232db9db0e6f5d71ebfabd3893c6 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Mon, 20 Apr 2026 18:04:08 +0200 Subject: [PATCH 09/11] [~] Update server startup message and enhance folder search functionality --- main.go | 2 +- server/server_request.go | 30 +++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index cf7cf4f..f60890a 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( ) func main() { - fmt.Println("Démarage du serveur") + fmt.Println("Démarage du serveur...") cfg := server.ServerStart() fmt.Println("Terminal du serveur :") for { diff --git a/server/server_request.go b/server/server_request.go index 2939e62..486e72d 100644 --- a/server/server_request.go +++ b/server/server_request.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "net/http" + "os" ) type Item struct { @@ -11,11 +12,35 @@ type Item struct { Name string `json:"name"` } +type Folder struct { + Name string `json:"name"` + Type string `json:"type"` +} + var items = []Item{ {ID: 1, Name: "Item A"}, {ID: 2, Name: "Item B"}, } +func SearchInFolder() ([]Folder) { + entries, err := os.ReadDir(".") + if err != nil { + return nil + } + folders := make([]Folder, 0, len(entries)) + for _, entry := range entries { + entryType := "file" + if entry.IsDir() { + entryType = "dir" + } + folders = append(folders, Folder{ + Name: entry.Name(), + Type: entryType, + }) + } + return folders +} + func itemsHandler(w http.ResponseWriter, r *http.Request) { // Allow the Vite dev server to read API responses from the browser. w.Header().Set("Access-Control-Allow-Origin", "http://localhost:5173") @@ -31,7 +56,7 @@ func itemsHandler(w http.ResponseWriter, r *http.Request) { case http.MethodGet: // On renvoie la liste en JSON w.Header().Set("Content-Type", "application/json") - if err := json.NewEncoder(w).Encode(items); err != nil { + if err := json.NewEncoder(w).Encode(SearchInFolder()); err != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintln(w, "Erreur d'encodage JSON") } @@ -48,5 +73,4 @@ func SimpleHost(cfg conf) { if err != nil { fmt.Println("error server") } - fmt.Println("END FUNCTION") -} \ No newline at end of file +} From e211ffe4e02b109054c691e6b717be9ecdd2b951 Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Tue, 21 Apr 2026 10:52:09 +0200 Subject: [PATCH 10/11] [+] start connection --- web-client/src/connection.jsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 web-client/src/connection.jsx diff --git a/web-client/src/connection.jsx b/web-client/src/connection.jsx new file mode 100644 index 0000000..8b29376 --- /dev/null +++ b/web-client/src/connection.jsx @@ -0,0 +1,21 @@ +import React from "react"; + +export default function LoginPage() { + const goHome = () => { + window.location.hash = '#home' + } + return ( +
+ +
+ hello word +
+
+ ); +} \ No newline at end of file From 01d9de5c666ff50536f0a685d926c47425f9fc2d Mon Sep 17 00:00:00 2001 From: Lucas EECKHOUTTE Date: Tue, 21 Apr 2026 10:59:37 +0200 Subject: [PATCH 11/11] [+] add new environement --- .github/workflows/La-Mira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/La-Mira.yml b/.github/workflows/La-Mira.yml index 91e9aab..6496e48 100644 --- a/.github/workflows/La-Mira.yml +++ b/.github/workflows/La-Mira.yml @@ -7,8 +7,8 @@ on: branches: [ "main" ] jobs: - build: + environment: production runs-on: ubuntu-latest steps: - uses: actions/checkout@v6