feat: poc works
This commit is contained in:
@@ -3,9 +3,7 @@ use base64::engine::general_purpose::STANDARD as standard_base64;
|
||||
use base64::Engine;
|
||||
use digest::Digest;
|
||||
use regex::Regex;
|
||||
use rust_util::{
|
||||
debugging, opt_result, opt_value_result, simple_error, util_cmd, XResult,
|
||||
};
|
||||
use rust_util::{debugging, opt_result, opt_value_result, simple_error, util_cmd, XResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::Sha256;
|
||||
use std::collections::HashMap;
|
||||
@@ -174,10 +172,20 @@ impl Script {
|
||||
}
|
||||
|
||||
fn as_string(&self) -> String {
|
||||
let mut joined_content_liens = self.content_lines.join("\n");
|
||||
match &self.signature {
|
||||
None => self.content_lines.join("\n"),
|
||||
None => joined_content_liens,
|
||||
Some(signature) => {
|
||||
self.content_lines.join("\n") + "\n\n" + &signature.as_string() + "\n"
|
||||
if joined_content_liens.ends_with("\n\n") {
|
||||
// SKIP add \n
|
||||
} else if joined_content_liens.ends_with("\n") {
|
||||
joined_content_liens.push('\n');
|
||||
} else {
|
||||
joined_content_liens.push_str("\n\n");
|
||||
}
|
||||
joined_content_liens.push_str(&signature.as_string());
|
||||
joined_content_liens.push('\n');
|
||||
joined_content_liens
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user