From 6c32af061bcba241512d6245baae3a5ad65e84f8 Mon Sep 17 00:00:00 2001
From: Brian Picciano
Date: Mon, 15 May 2023 21:34:50 +0200
Subject: [PATCH] Polish up the FE a bit
---
src/service.rs | 10 +++---
src/service/http_tpl/base.html | 6 ++++
src/service/http_tpl/domain.html | 5 ---
src/service/http_tpl/domain_init.html | 8 +++++
src/service/http_tpl/index.html | 51 ++++++++++++++++-----------
5 files changed, 50 insertions(+), 30 deletions(-)
diff --git a/src/service.rs b/src/service.rs
index 22f25dd..fdd13e1 100644
--- a/src/service.rs
+++ b/src/service.rs
@@ -52,12 +52,12 @@ struct DomainGetArgs {
#[derive(Deserialize)]
struct DomainInitArgs {
domain: domain::Name,
- passphrase: String,
}
#[derive(Deserialize)]
struct DomainSyncArgs {
domain: domain::Name,
+ passphrase: String,
}
impl<'svc> Service<'svc> {
@@ -195,10 +195,6 @@ impl<'svc> Service<'svc> {
}
fn domain_init(&self, args: DomainInitArgs, domain_config: util::FlatConfig) -> SvcResponse {
- if args.passphrase != self.passphrase.as_str() {
- return self.render_error_page(401, "Incorrect passphrase");
- }
-
#[derive(Serialize)]
struct Response {
domain: domain::Name,
@@ -239,6 +235,10 @@ impl<'svc> Service<'svc> {
args: DomainSyncArgs,
domain_config: util::FlatConfig,
) -> SvcResponse {
+ if args.passphrase != self.passphrase.as_str() {
+ return self.render_error_page(401, "Incorrect passphrase");
+ }
+
let config: domain::config::Config = match domain_config.try_into() {
Ok(Some(config)) => config,
Ok(None) => return self.render_error_page(400, "domain config is required"),
diff --git a/src/service/http_tpl/base.html b/src/service/http_tpl/base.html
index be24126..b55a287 100644
--- a/src/service/http_tpl/base.html
+++ b/src/service/http_tpl/base.html
@@ -17,6 +17,12 @@
+
+
diff --git a/src/service/http_tpl/domain.html b/src/service/http_tpl/domain.html
index 186c3e1..4d78193 100644
--- a/src/service/http_tpl/domain.html
+++ b/src/service/http_tpl/domain.html
@@ -14,11 +14,6 @@ automatically updated too!
-
-