removed authent thing

This commit is contained in:
guamss 2026-09-08 16:59:36 +02:00
parent ae906317c2
commit 816dd21291
3 changed files with 11 additions and 172 deletions

View File

@ -7,16 +7,19 @@ import "../styles/navbar.css";
<ul>
<section>
<li><a href="/">Accueil</a></li>
<li><a href="/post-create">Créer un post</a></li>
<li>
<a
target="_blank"
href="https://gitea.guams.fr/Guams/kolibri_blog/_upload/master/"
>Créer un post</a
>
</li>
</section>
<section>
<input type="text" placeholder="Rechercher..." />
</section>
</ul>
<div>
<button>Se connecter</button>
<button>S'inscrire en tant que lecteur</button>
</div>
<div></div>
</nav>
<div>
<span> coucou !!</span>

View File

@ -1,154 +0,0 @@
---
import { postService } from "../api/axios";
import Layout from "../layouts/Layout.astro";
import { PostOut } from "../models/post";
import "../styles/post-create.css";
export const prerender = false;
if (Astro.request.method === "POST") {
try {
const data = await Astro.request.formData();
const postToSend: PostOut = new PostOut();
const mdFile = data.get("markdownInput");
const illustration = data.get("illustrationInput");
const documentImages = data
.getAll("documentImagesInput")
.filter((entry) => entry instanceof File);
if (illustration instanceof File && illustration.size > 0) {
await postService.sendIllustration(illustration).then((res) => {
postToSend.illustration_image = res.data;
});
}
await postService.sendDocumentImages(documentImages).then((res) => {
postToSend.document_images = new Map(Object.entries(res.data));
});
if (mdFile instanceof File) {
await mdFile.text().then((txt) => (postToSend.content = txt));
await postService
.sendPost(postToSend)
.then((res) => console.log(res.data));
}
} catch (error) {
if (error instanceof Error) {
console.error(error.message);
}
}
}
---
<Layout>
<form method="POST" enctype="multipart/form-data">
<u>Consigne</u>
<p>le markdown doit contenir cette entête :</p>
<pre>
---
<span class="green">title</span>: <span class="blue">"titre"</span>
<span class="green">pubDate</span>: <span class="blue">YYYY-MM-DD</span>
<span class="green">description</span>: <span class="blue">'description du post'</span>
<span class="green">author</span>: <span class="blue">"author"</span>
<span class="green">illustration</span>: <span class="blue">"image.png"</span>
<span class="green">tags</span>: [<span class="blue">"Manga"</span>, <span class="blue">"Anime"</span>]
---
</pre>
<label for="markdownInput">
<span id="mdMessage">Ajouter un fichier markdown</span>
<span id="mdFilename"></span>
</label>
<input
id="markdownInput"
type="file"
name="markdownInput"
accept=".md"
required
/>
<label for="illustrationInput" id="illustrationLabel">
Ajouter l'image d'illustration du document
</label>
<input
id="illustrationInput"
type="file"
name="illustrationInput"
accept="image/*"
required
/>
<label for="documentImagesInput" id="documentImagesLabel">
Ajouter les images du document
</label>
<input
id="documentImagesInput"
type="file"
name="documentImagesInput"
accept="image/*"
multiple
required
/>
<button type="submit">Créer le post</button>
</form>
</Layout>
<script>
const mdInput = document.querySelector<HTMLInputElement>("#markdownInput");
const mdMessage = document.querySelector<HTMLElement>("#mdMessage");
const mdFilename = document.querySelector<HTMLElement>("#mdFilename");
mdInput?.addEventListener("change", (event) => {
const target = event.target as HTMLInputElement;
const file = target.files?.[0];
if (file && mdMessage && mdFilename) {
mdMessage.style.display = "none";
mdFilename.textContent = file.name;
} else if (mdMessage && mdFilename) {
mdMessage.style.display = "inline";
mdFilename.textContent = "";
}
});
const illustrationInput =
document.querySelector<HTMLInputElement>("#illustrationInput");
const illustrationLabel =
document.querySelector<HTMLElement>("#illustrationLabel");
illustrationInput?.addEventListener("change", (event) => {
const target = event.target as HTMLInputElement;
const file = target.files?.[0];
if (illustrationLabel) {
illustrationLabel.textContent = file
? file.name
: "Ajouter l'image d'illustration du document";
}
});
const documentImagesInput = document.querySelector<HTMLInputElement>(
"#documentImagesInput",
);
const documentImagesLabel = document.querySelector<HTMLElement>(
"#documentImagesLabel",
);
documentImagesInput?.addEventListener("change", (event) => {
const target = event.target as HTMLInputElement;
const files = target.files;
if (documentImagesLabel && files) {
if (files.length === 1) {
documentImagesLabel.textContent = files[0].name;
} else if (files.length > 1) {
documentImagesLabel.textContent = `${files.length} images sélectionnées`;
} else {
documentImagesLabel.textContent = "Ajouter les images du document";
}
}
});
</script>

View File

@ -8,11 +8,12 @@ header {
flex-direction: column;
> nav {
gap: 2rem;
width: 100%;
display: flex;
flex-direction: row;
flex-direction: column;
justify-content: space-between;
align-items: center;
align-items: stretch;
> ul {
color: light-dark(
@ -145,17 +146,6 @@ header {
}
}
@media screen and (max-width: 1600px) {
header {
> nav {
flex-direction: column;
justify-content: space-between;
align-items: stretch;
gap: 2rem;
}
}
}
@media screen and (max-width: 770px) {
header {
> nav {