upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/utils.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-24 15:03:58 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-24 19:48:11 +0100
commitd01380f7b3efebc9c40a2e71c2ddd635fa936be4 (patch)
tree58af24e8981bfa4b0c8dc330ea8903dac3bbc479 /src/bin/git_remote_nostr/utils.rs
parent0acc9768c2aff4bf4495c89698f29b56dae2f4b4 (diff)
feat(login): login via nip46 QR code
or nostrconnect url string which is a much better UX flow for nip46
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
-rw-r--r--src/bin/git_remote_nostr/utils.rs14
1 files changed, 0 insertions, 14 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index 7b5c2d2..3ae1bab 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -384,20 +384,6 @@ pub fn error_might_be_authentication_related(error: &anyhow::Error) -> bool {
384 false 384 false
385} 385}
386 386
387fn count_lines_per_msg(width: u16, msg: &str, prefix_len: usize) -> usize {
388 if width == 0 {
389 return 1;
390 }
391 // ((msg_len+prefix) / width).ceil() implemented using Integer Arithmetic
392 ((msg.chars().count() + prefix_len) + (width - 1) as usize) / width as usize
393}
394
395pub fn count_lines_per_msg_vec(width: u16, msgs: &[String], prefix_len: usize) -> usize {
396 msgs.iter()
397 .map(|msg| count_lines_per_msg(width, msg, prefix_len))
398 .sum()
399}
400
401#[cfg(test)] 387#[cfg(test)]
402mod tests { 388mod tests {
403 use super::*; 389 use super::*;