This commit is contained in:
Pascal Engélibert 2020-11-02 13:14:09 +01:00
parent 1e98a6306c
commit 4f23d6c860
2 changed files with 14 additions and 6 deletions

View File

@ -94,6 +94,7 @@ pub async fn start_server(
bincode::serialize(&Ad {
author: query.author,
password: hasher.finalize()[..].try_into().unwrap(),
price: query.price,
pubkey: (!query.pubkey.is_empty()).then_some(query.pubkey),
time: 0,
title: query.title,
@ -200,6 +201,7 @@ struct ErrorTemplate<'a> {
#[derive(Clone, Debug, Deserialize)]
struct NewAdQuery {
author: String,
price: String,
psw: String,
pubkey: String,
title: String,
@ -224,6 +226,7 @@ enum Query {
struct Ad {
author: String,
password: PasswordHash,
price: String,
pubkey: Option<String>,
time: u64,
title: String,

View File

@ -25,16 +25,19 @@
<p>Ceci est une démo du nouveau site ĞMarché en développement. C'est très moche et il n'y a pas tellement de fonctionnalités mais ça avance. ;)</p>
<p>&#9888; <strong>Merci de ne pas encore utiliser ce site pour de vrais événements&#8239;!</strong></p>
<form method="post">
<table border="1">
<thead>
<tr><td></td><td>Annonce</td><td>Vendeur</td></tr>
<tr><td></td><td>Annonce</td><td>Prix</td><td>Vendeur</td></tr>
</thead>
<tbody>
{{#each ads}}
<tr>
<td><input type="radio" name="ad" value="{{this.id}}"/></td>
<td>{{this.ad.title}}</td>
<td>{{this.ad.price}}</td>
<td>{{#if this.ad.pubkey}}<details><summary>{{this.ad.author}}</summary><br/>{{this.ad.pubkey}}</details>{{else}}{{this.ad.author}}{{/if}}</td>
</tr>
{{/each}}
@ -57,18 +60,20 @@
<fieldset>
<legend>Nouvelle annonce</legend>
<label for="f_new_title">Titre&nbsp;:</label>
<input type="text" id="f_new_title" name="title"/><br />
<input type="text" id="f_new_title" name="title" placeholder="Carottes" required/><br/>
<label for="f_new_price">Prix&nbsp;:</label>
<input type="text" id="f_new_price" name="price" placeholder="42 DU/kg" required/><br/>
<label for="f_new_author">Votre nom&nbsp;:</label>
<input type="text" id="f_new_author" name="author"/><br />
<input type="text" id="f_new_author" name="author" placeholder="Toto" required/><br/>
<label for="f_new_pubkey">Clé publique&nbsp;:</label>
<input type="text" id="f_new_pubkey" name="pubkey"/><br />
<input type="text" id="f_new_pubkey" name="pubkey"/><br/>
<label for="f_new_psw">Mot de passe&nbsp;:</label>
<input type="text" id="f_new_psw" name="psw"/><br />
<input type="text" id="f_new_psw" name="psw"/><span>Le mot de passe sera demandé pour modifier ou supprimer l'annonce.</span><br/>
<input type="submit" value="Publier"/>
</fieldset>
</form>
<hr style="clear: both;" />
<hr style="clear: both;"/>
<p><a href="https://git.p2p.legal/tuxmain/gmarche-rs">Code source</a> sous licence <a href="https://www.gnu.org/licenses/licenses.html#AGPL">GNU AGPL v3</a>. &#129408; Écrit en <a href="https://www.rust-lang.org">Rust</a>. Images de Attilax.<br/>
CopyLeft 2020 Pascal Engélibert</p>