[Fix] moved language to logging
This commit is contained in:
parent
6247502807
commit
b37ec732f7
7 changed files with 46 additions and 29 deletions
|
|
@ -4,7 +4,11 @@ version = "0.1.0"
|
|||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
ratatui = "0.30.0"
|
||||
ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" }
|
||||
iota-state = { path = "../iota-state" }
|
||||
iota-util = { path = "../iota-util" }
|
||||
|
||||
ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" }
|
||||
|
||||
ratatui = "0.30.0"
|
||||
json = "0.12.4"
|
||||
once_cell = "1.21.4"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::file_util::save_file;
|
||||
use iota_util::file_util::save_file;
|
||||
|
||||
use json::{self, JsonError, JsonValue};
|
||||
|
||||
pub fn create_languages() -> Result<(), JsonError> {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::file_util::{self};
|
||||
use iota_util::file_util::{self};
|
||||
use json::parse;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashMap;
|
||||
|
|
@ -12,7 +12,8 @@ use ratatui::style::Color;
|
|||
use ttp_core::{CommunicationValue, DataTypes, DataValue};
|
||||
|
||||
use iota_state::{APP_STATE, UNIQUE, UiLogEntry};
|
||||
use iota_util::langu::language_manager;
|
||||
mod language_creator;
|
||||
mod language_manager;
|
||||
|
||||
static LOGGER: OnceLock<mpsc::Sender<LogMessage>> = OnceLock::new();
|
||||
|
||||
|
|
@ -128,22 +129,6 @@ fn fixed_box(content: &str, width: usize) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
fn colorize(kind: PrintType, is_error: bool) -> Color {
|
||||
if is_error {
|
||||
return Color::Red;
|
||||
}
|
||||
|
||||
match kind {
|
||||
PrintType::Call => Color::Magenta,
|
||||
PrintType::Client => Color::Green,
|
||||
PrintType::Iota => Color::Yellow,
|
||||
PrintType::Omikron => Color::Blue,
|
||||
PrintType::Omega => Color::Cyan,
|
||||
PrintType::General => Color::LightCyan,
|
||||
PrintType::Command => Color::LightGreen,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_internal_translated(
|
||||
kind: PrintType,
|
||||
prefix: String,
|
||||
|
|
|
|||
0
iota-updater/Cargo.toml
Normal file
0
iota-updater/Cargo.toml
Normal file
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use semver::Version;
|
||||
use serde::Deserialize;
|
||||
use std::fs::File;
|
||||
use std::io::copy;
|
||||
use tempfile::NamedTempFile;
|
||||
|
|
@ -16,13 +15,13 @@ const API_BASE: &str = "https://git.methanium.net/api/v1";
|
|||
const OWNER: &str = "Tensamin";
|
||||
const REPO: &str = "Iota";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug)]
|
||||
struct Release {
|
||||
tag_name: String,
|
||||
assets: Vec<Asset>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug)]
|
||||
struct Asset {
|
||||
name: String,
|
||||
browser_download_url: String,
|
||||
|
|
@ -39,10 +38,40 @@ async fn latest_release() -> Result<Release> {
|
|||
return Err(anyhow!("release API returned {}", response.status()));
|
||||
}
|
||||
|
||||
Ok(response
|
||||
.json()
|
||||
let text = response
|
||||
.text()
|
||||
.await
|
||||
.context("failed to parse release JSON")?)
|
||||
.context("failed to read response text")?;
|
||||
|
||||
let parsed = json::parse(&text).map_err(|e| anyhow!("failed to parse JSON: {}", e))?;
|
||||
|
||||
let tag_name = parsed["tag_name"]
|
||||
.as_str()
|
||||
.ok_or_else(|| anyhow!("missing tag_name"))?
|
||||
.to_string();
|
||||
|
||||
let assets_json = parsed["assets"].members().collect::<Vec<_>>();
|
||||
|
||||
let mut assets = Vec::new();
|
||||
|
||||
for asset in assets_json {
|
||||
let name = asset["name"]
|
||||
.as_str()
|
||||
.ok_or_else(|| anyhow!("missing asset name"))?
|
||||
.to_string();
|
||||
|
||||
let browser_download_url = asset["browser_download_url"]
|
||||
.as_str()
|
||||
.ok_or_else(|| anyhow!("missing download url"))?
|
||||
.to_string();
|
||||
|
||||
assets.push(Asset {
|
||||
name,
|
||||
browser_download_url,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(Release { tag_name, assets })
|
||||
}
|
||||
|
||||
async fn parse_tag_version(tag: &str) -> Result<Version> {
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
pub mod language_creator;
|
||||
pub mod language_manager;
|
||||
Loading…
Reference in a new issue