diff --git a/data/www/admin/index.html b/data/www/admin/index.html
index 5292743..534b920 100644
--- a/data/www/admin/index.html
+++ b/data/www/admin/index.html
@@ -122,89 +122,26 @@
diff --git a/data/www/details.html b/data/www/details.html
index 7c45c16..d7e98de 100644
--- a/data/www/details.html
+++ b/data/www/details.html
@@ -112,12 +112,13 @@
- {{title}} Admin Interface
+ {{title}} User Interface
- You have reached the {{title}} Admin Interface. This site can be used by
- the host of the challenge to see the challenge progress, solution, and
- hints for that challenge. This site is NOT part of the
- challenge.
+ You have reached the {{title}} User
+ Interface. This site can be used by the
+ contestants see the challenges and their
+ progress and hints for that challenge. This
+ site is NOT part of the challenge.
@@ -146,21 +147,6 @@
-
-
Solution
-
- Show solution
-
-
-
-
-
-
- {{challenge_solution}}
-
-
-
diff --git a/data/www/index.html b/data/www/index.html
index 7c45c16..4bc8808 100644
--- a/data/www/index.html
+++ b/data/www/index.html
@@ -114,98 +114,35 @@
{{title}} Admin Interface
- You have reached the {{title}} Admin Interface. This site can be used by
- the host of the challenge to see the challenge progress, solution, and
- hints for that challenge. This site is NOT part of the
- challenge.
+ You have reached the {{title}} User
+ Interface. This site can be used by the
+ contestants see the challenges and their
+ progress and hints for that challenge. This
+ site is NOT part of the challenge.
-
-
Challenge {{ challenge_idx}} — {{ challenge_title }}
-
{{ challenge_description }}
-
-
Hints
-
- Show hints
-
-
-
- {% for hint in challenge_hints %}
-
-
-
-
-
- {{hint}}
-
-
- {% endfor %}
-
-
-
-
-
Solution
-
- Show solution
-
-
-
-
-
-
- {{challenge_solution}}
-
-
-
-
-
-
-
-
Contestants
+
Challenges
- There are cuttently {{ contestants_amount }} contestants.
- These contestants currently have had at least one connection to
- the challenge:
+ There are cuttently {{ challenges_amount }} active challenges.
-
-
Winners
-
- There are cuttently {{ winners_amount }} winners. These contestants currently have been sent the
- secret:
-
-
-
diff --git a/src/challenge/mod.rs b/src/challenge/mod.rs
index 83ff319..f7081b7 100644
--- a/src/challenge/mod.rs
+++ b/src/challenge/mod.rs
@@ -5,6 +5,7 @@
use async_trait::async_trait;
use libpt::log::{error, info};
+use serde::{Deserialize, Serialize};
use crate::config::Config;
use crate::vault::VaultRef;
@@ -13,7 +14,7 @@ pub mod c1;
pub mod c2;
pub mod c3;
-#[derive(Clone, PartialEq, Eq, Hash, Debug)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, Serialize, Deserialize)]
pub struct ChallengeDesc {
id: usize,
title: String,
diff --git a/src/meta/admin.rs b/src/meta/admin.rs
index 5badfe5..4d74070 100644
--- a/src/meta/admin.rs
+++ b/src/meta/admin.rs
@@ -26,7 +26,7 @@ impl<'tp> Service<'tp> {
) -> impl Filter + Clone + 'tp {
let serv = this.clone();
warp::path!("admin" / "challenge" / usize)
- .map(move |id: usize| serv.challenges[id + 1].clone())
+ .map(move |id: usize| serv.challenges[id - 1].clone())
.and(with_serv(this.clone()))
.and_then(details)
.with(warp::trace(|info| {
@@ -51,7 +51,7 @@ async fn details(
let winners = vault.winners().await.into_iter().collect::>();
let r = Response::new(
serv.env
- .get_template("admin:index")
+ .get_template("admin:details")
.map_err(TemplateError::from)?
.render(context!(
title => "Wooly-Vault",
@@ -77,6 +77,24 @@ async fn details(
}
async fn index(serv: Arc>) -> Result, warp::Rejection> {
- let r = Response::new("todo".into());
+ let challenges = serv
+ .challenges
+ .iter()
+ .map(|v| v.0.to_owned())
+ .collect::>();
+ let r = Response::new(
+ serv.env
+ .get_template("admin:index")
+ .map_err(TemplateError::from)?
+ .render(context!(
+ title => "Wooly-Vault",
+ author => env!("CARGO_PKG_AUTHORS"),
+ year => "2024",
+ challenges => challenges,
+ challenges_amount => challenges.len(),
+ ))
+ .map_err(TemplateError::from)?
+ .into(),
+ );
Ok(Box::new(r))
}
diff --git a/src/meta/user.rs b/src/meta/user.rs
index 19143b4..b5259a5 100644
--- a/src/meta/user.rs
+++ b/src/meta/user.rs
@@ -26,7 +26,7 @@ impl<'tp> Service<'tp> {
) -> impl Filter + Clone + 'tp {
let serv = this.clone();
warp::path!("challenge" / usize)
- .map(move |id: usize| serv.challenges[id + 1].clone())
+ .map(move |id: usize| serv.challenges[id - 1].clone())
.and(with_serv(this.clone()))
.and_then(details)
.with(warp::trace(|info| {
@@ -51,7 +51,7 @@ async fn details(
let winners = vault.winners().await.into_iter().collect::>();
let r = Response::new(
serv.env
- .get_template("index")
+ .get_template("details")
.map_err(TemplateError::from)?
.render(context!(
title => "Wooly-Vault",
@@ -77,6 +77,24 @@ async fn details(
}
async fn index(serv: Arc>) -> Result, warp::Rejection> {
- let r = Response::new("todo".into());
+ let challenges = serv
+ .challenges
+ .iter()
+ .map(|v| v.0.to_owned())
+ .collect::>();
+ let r = Response::new(
+ serv.env
+ .get_template("admin:index")
+ .map_err(TemplateError::from)?
+ .render(context!(
+ title => "Wooly-Vault",
+ author => env!("CARGO_PKG_AUTHORS"),
+ year => "2024",
+ challenges => challenges,
+ challenges_amount => challenges.len(),
+ ))
+ .map_err(TemplateError::from)?
+ .into(),
+ );
Ok(Box::new(r))
}