diff --git a/src/index.rs b/src/index.rs index 16122a6ee8..ddcf9ddbcb 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1789,13 +1789,17 @@ impl Index { .with_context(|| format!("current {current} height is greater than sat height {height}"))?; Ok(Blocktime::Expected( - Utc::now() - .round_subsecs(0) - .checked_add_signed( - chrono::Duration::try_seconds(10 * 60 * i64::from(expected_blocks)) - .context("timestamp out of range")?, - ) - .context("timestamp out of range")?, + if self.settings.chain() == Chain::Regtest { + DateTime::default() + } else { + Utc::now() + } + .round_subsecs(0) + .checked_add_signed( + chrono::Duration::try_seconds(10 * 60 * i64::from(expected_blocks)) + .context("timestamp out of range")?, + ) + .context("timestamp out of range")?, )) } diff --git a/src/inscriptions/media.rs b/src/inscriptions/media.rs index a6ebbd97e7..0cc5e7b0ba 100644 --- a/src/inscriptions/media.rs +++ b/src/inscriptions/media.rs @@ -75,10 +75,12 @@ impl Media { ("application/pdf", GENERIC, Pdf, &["pdf"]), ("application/pgp-signature", TEXT, Text, &["asc"]), ("application/protobuf", GENERIC, Unknown, &["binpb"]), + ("application/x-bittorrent", GENERIC, Unknown, &["torrent"]), ("application/x-javascript", TEXT, Code(JavaScript), &[]), ("application/yaml", TEXT, Code(Yaml), &["yaml", "yml"]), ("audio/flac", GENERIC, Audio, &["flac"]), ("audio/mpeg", GENERIC, Audio, &["mp3"]), + ("audio/ogg;codecs=opus", GENERIC, Audio, &["opus"]), ("audio/wav", GENERIC, Audio, &["wav"]), ("font/otf", GENERIC, Font, &["otf"]), ("font/ttf", GENERIC, Font, &["ttf"]), diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index a04b0c652d..4d3de9eb3f 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -849,13 +849,15 @@ impl Server { return Ok(if accept_json { StatusCode::NOT_FOUND.into_response() } else { + let unlock = if let Some(height) = rune.unlock_height(server_config.chain.network()) { + Some((height, index.block_time(height)?.timestamp())) + } else { + None + }; + ( StatusCode::NOT_FOUND, - RuneNotFoundHtml { - rune, - unlock_height: rune.unlock_height(server_config.chain.network()), - } - .page(server_config), + RuneNotFoundHtml { rune, unlock }.page(server_config), ) .into_response() }); @@ -3295,7 +3297,10 @@ mod tests { StatusCode::NOT_FOUND, RuneNotFoundHtml { rune: Rune(0), - unlock_height: Some(Height(209999)), + unlock: Some(( + Height(209999), + DateTime::from_timestamp(125998800, 0).unwrap(), + )), }, ); } @@ -3314,7 +3319,7 @@ mod tests { StatusCode::NOT_FOUND, RuneNotFoundHtml { rune: Rune(Rune::RESERVED), - unlock_height: None, + unlock: None, }, ); } diff --git a/src/templates/rune_not_found.rs b/src/templates/rune_not_found.rs index e050fa5c80..7a2eceab04 100644 --- a/src/templates/rune_not_found.rs +++ b/src/templates/rune_not_found.rs @@ -3,7 +3,7 @@ use super::*; #[derive(Boilerplate, Debug, PartialEq, Serialize)] pub struct RuneNotFoundHtml { pub rune: Rune, - pub unlock_height: Option, + pub unlock: Option<(Height, DateTime)>, } impl PageContent for RuneNotFoundHtml { @@ -21,12 +21,14 @@ mod tests { assert_regex_match!( RuneNotFoundHtml { rune: Rune(u128::MAX), - unlock_height: Some(Height(111)), + unlock: Some((Height(111), DateTime::default())), }, - "

BCGDENLQRQWDSLRUGSNLBTMFIJAV

+ r"

BCGDENLQRQWDSLRUGSNLBTMFIJAV

unlock height
111
+
unlock time
+
\(expected\)
reserved
false
@@ -39,7 +41,7 @@ mod tests { assert_regex_match!( RuneNotFoundHtml { rune: Rune(Rune::RESERVED), - unlock_height: None, + unlock: None, }, "

AAAAAAAAAAAAAAAAAAAAAAAAAAA

diff --git a/templates/rune-not-found.html b/templates/rune-not-found.html index ede0843104..23f93efab3 100644 --- a/templates/rune-not-found.html +++ b/templates/rune-not-found.html @@ -1,8 +1,10 @@

{{ self.rune }}

-%% if let Some(unlock_height) = self.unlock_height { +%% if let Some((height, time)) = self.unlock {
unlock height
-
{{ unlock_height }}
+
{{ height }}
+
unlock time
+
(expected)
reserved
false
%% } else {