improve enocoding detection, support images

tzemanovic
Jan 29, 2026, 11:38 AM
IQHXLIIU5M4H6YRKICFPJXDNTLZTUAUWIYTEII6LDUROCZHQ76RQC

Dependencies

  • [2] A5YBC77V record!
  • [3] AMPZ2BXK show changed files diffs (only Edit atm)
  • [4] ZVI4AWER woot contents_diff
  • [5] WI2BVQ6J rm client lib crate
  • [6] BFN2VHZS refactor file stuff into sub-mod
  • [7] 23SFYK4Q big view refactor into a new crate
  • [8] XSZZB47U refactor stuff into lib
  • [9] 3BK22XE5 add a test for hover btn and more refactors
  • [10] GOLHUD6R nav-scrollable: set skip-able sections
  • [11] KWTBNTO3 diffs selection and scrolling
  • [12] WAOGSCOJ very nice refactor, wip adding channels logs
  • [13] G5WLRXOD add screenshots for test
  • [14] OLT666N4 fix screenshot test to include status, fix failed test report
  • [15] F6O6FGOJ improve diffs encoding detection
  • [16] LLUIHLAP improve MIME detection, rm dbg
  • [17] TEDT26JQ add push and pull sub-menus
  • [18] SASAN2XC use nav-scrollable
  • [19] YK3MOJJL chonky refactor, wip other channels logs & diffs
  • [20] FU6P5QLG indicate when a file is a dir with appended '/'
  • [21] 6LF2U2Y6 improve file encoding detection
  • [22] YBJRDOTC make all repo actions async
  • [23] 5O4FWCFP add tests to_record selection and improve it
  • [24] HPSOAD4R fix moved tracked file view
  • [25] K2SQTVJD handle moved dirs
  • [*] SWWE2R6M display basic repo stuff
  • [*] MJDGPSHG WIP contents diff

Change contents

  • edit in libflorescence/src/repo.rs at line 11
    [11.57]
    [2.7]
    use crate::encoding::Encoding;
  • replacement in libflorescence/src/repo.rs at line 22
    [5.194][11.58:164]()
    working_copy, ChannelMutTxnT, ChannelTxnT, Encoding, HashSet, MutTxnT,
    MutTxnTExt, TxnT, TxnTExt,
    [5.194]
    [5.306]
    working_copy, ChannelMutTxnT, ChannelTxnT, HashSet, MutTxnT, MutTxnTExt,
    TxnT, TxnTExt,
  • replacement in libflorescence/src/repo.rs at line 1778
    [3.632][3.632:712]()
    fn try_decode_contents(raw: Vec<u8>, encoding: &Option<Encoding>) -> Contents {
    [3.632]
    [3.712]
    fn try_decode_contents(raw: Vec<u8>, encoding: &Encoding) -> Contents {
  • replacement in libflorescence/src/repo.rs at line 1780
    [3.733][3.733:761]()
    Some(encoding) => {
    [3.733]
    [3.761]
    Encoding::Text(encoding) => {
  • replacement in libflorescence/src/repo.rs at line 1784
    [3.871][3.871:889]()
    None => {
    [3.871]
    [3.889]
    Encoding::Other => {
  • edit in libflorescence/src/repo.rs at line 1793
    [3.1183]
    [3.1183]
    Encoding::Image
    | Encoding::Audio
    | Encoding::Video
    | Encoding::Font => Contents::UnknownEncoding(raw),
  • edit in libflorescence/src/encoding.rs at line 3
    [15.30]
    [15.30]
    #[derive(Debug, Clone)]
    pub enum Encoding {
    Text(pijul::Encoding),
    Image,
    Audio,
    Video,
    Font,
    Other,
    }
  • replacement in libflorescence/src/encoding.rs at line 16
    [16.294][15.200:256](),[15.200][15.200:256]()
    pub fn detect(data: &[u8]) -> Option<pijul::Encoding> {
    [16.294]
    [15.256]
    pub fn detect(data: &[u8]) -> Encoding {
  • replacement in libflorescence/src/encoding.rs at line 18
    [15.299][15.299:357]()
    return Some(pijul::Encoding(encoding_rs::UTF_8));
    [15.299]
    [15.357]
    return Encoding::Text(pijul::Encoding(encoding_rs::UTF_8));
  • replacement in libflorescence/src/encoding.rs at line 35
    [15.939][15.939:981]()
    "application/pdf" => return None,
    [15.939]
    [15.981]
    "application/pdf" => return Encoding::Other,
  • replacement in libflorescence/src/encoding.rs at line 50
    [15.1518][15.1518:1571]()
    | "application/octet-stream" => return None,
    [15.1518]
    [15.1571]
    | "application/octet-stream" => return Encoding::Other,
  • replacement in libflorescence/src/encoding.rs at line 52
    [15.1617][15.1617:1670]()
    v if v.starts_with("image/") => return None,
    [15.1617]
    [15.1670]
    v if v.starts_with("image/") => return Encoding::Image,
  • replacement in libflorescence/src/encoding.rs at line 54
    [15.1716][15.1716:1769]()
    v if v.starts_with("audio/") => return None,
    [15.1716]
    [15.1769]
    v if v.starts_with("audio/") => return Encoding::Audio,
  • replacement in libflorescence/src/encoding.rs at line 56
    [15.1815][15.1815:1868]()
    v if v.starts_with("video/") => return None,
    [15.1815]
    [15.1868]
    v if v.starts_with("video/") => return Encoding::Video,
  • replacement in libflorescence/src/encoding.rs at line 58
    [15.1913][15.1913:1965]()
    v if v.starts_with("font/") => return None,
    [15.1913]
    [15.1965]
    v if v.starts_with("font/") => return Encoding::Font,
  • replacement in libflorescence/src/encoding.rs at line 73
    [15.2483][15.2483:2541]()
    return Some(pijul::Encoding(encoding_rs::UTF_8));
    [15.2483]
    [15.2541]
    return Encoding::Text(pijul::Encoding(encoding_rs::UTF_8));
  • edit in libflorescence/src/encoding.rs at line 78
    [15.2630]
    [15.2630]
    .map(Encoding::Text)
    .unwrap_or(Encoding::Other)
  • edit in libflorescence/src/diff.rs at line 8
    [12.3164]
    [12.3164]
    Image(Vec<u8>),
  • edit in libflorescence/src/diff.rs at line 16
    [8.847]
    [8.847]
    Image(Vec<u8>),
  • replacement in inflorescence_view/src/diff.rs at line 14
    [7.433][7.433:483]()
    use iced::widget::{column, container, row, text};
    [7.433]
    [8.5301]
    use iced::widget::{column, container, image, row, text};
  • edit in inflorescence_view/src/diff.rs at line 41
    [7.3753]
    [7.3753]
    File::Image(bytes) => {
    el(image(image::Handle::from_bytes(bytes.clone())))
    }
  • replacement in inflorescence_view/screenshots/sub_menu_push-wgpu.png at line 3
    [17.10][17.10:138308]()
    [17.10]
    [17.138308]
  • replacement in inflorescence_view/screenshots/sub_menu_push-wgpu.png at line 232
    [17.138363][17.138363:190802]()
    [17.138363]
    [17.190802]
  • replacement in inflorescence_view/screenshots/sub_menu_push-wgpu.png at line 318
    [17.192062][17.192062:349537]()
    [17.192062]
    [17.349537]
  • replacement in inflorescence_view/screenshots/sub_menu_push-wgpu.png at line 843
    [17.349538][17.349538:529948]()
    [17.349538]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 3
    [13.497163][14.1600:3676](),[14.3676][13.499239:635461](),[13.499239][13.499239:635461]()
    [13.497163]
    [13.635461]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 232
    [13.635516][13.635516:687955]()
    [13.635516]
    [13.687955]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 318
    [13.689215][13.689215:782616](),[13.782616][14.3677:22348](),[14.22348][13.801259:801470](),[13.801259][13.801259:801470](),[13.801470][14.22349:106991]()
    [13.689215]
    [14.106991]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 698
    [14.107035][14.107035:216702]()
    [14.107035]
    [13.939358]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 860
    [13.939359][14.216703:247161]()
    [13.939359]
    [14.247161]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 880
    [14.247162][14.247162:268315]()
    [14.247162]
    [14.268315]
  • replacement in inflorescence_view/screenshots/loaded_shown_reports-wgpu.png at line 888
    [14.268316][14.268316:269200]()
    [14.268316]
  • replacement in inflorescence_view/screenshots/loaded_empty_repo-wgpu.png at line 3
    [13.2666237][14.412911:414987](),[14.414987][13.2668313:2804535](),[13.2668313][13.2668313:2804535]()
    [13.2666237]
    [13.2804535]
  • replacement in inflorescence_view/screenshots/loaded_empty_repo-wgpu.png at line 232
    [13.2804590][13.2804590:2857029]()
    [13.2804590]
    [13.2857029]
  • replacement in inflorescence_view/screenshots/loaded_empty_repo-wgpu.png at line 318
    [13.2858289][13.2858289:3153347](),[13.3153347][14.414988:464558]()
    [13.2858289]
  • edit in inflorescence/src/file.rs at line 4
    [15.495635]
    [9.1663]
    use libflorescence::encoding::Encoding;
  • replacement in inflorescence/src/file.rs at line 43
    [6.2561][6.2561:2604]()
    encoding: Option<pijul::Encoding>,
    [6.2561]
    [6.2604]
    /// Some for a file, None for a dir
    encoding: Option<Encoding>,
  • replacement in inflorescence/src/file.rs at line 117
    [6.4637][6.4637:4677]()
    Some(encoding) => {
    [6.4637]
    [6.4677]
    Some(Encoding::Text(encoding)) => {
  • replacement in inflorescence/src/file.rs at line 121
    [6.4821][6.4821:4885]()
    None => diff::FileContent::UnknownEncoding,
    [6.4821]
    [6.4885]
    Some(Encoding::Image) => diff::FileContent::Image(data),
    Some(
    Encoding::Other
    | Encoding::Audio
    | Encoding::Video
    | Encoding::Font,
    )
    | None => diff::FileContent::UnknownEncoding,
  • replacement in inflorescence/src/file.rs at line 211
    [6.6310][6.6310:6332]()
    encoding,
    [6.6310]
    [6.6332]
    encoding: Some(encoding),
  • edit in inflorescence/src/file.rs at line 296
    [6.8393]
    [6.8393]
    diff::File::Image(bytes) => bytes.len(),
  • edit in inflorescence/src/diff.rs at line 39
    [4.20432]
    [4.20432]
    FileContent::Image(bytes) => {
    // TODO: get image with changes unapplied
    File::Image(bytes)
    }
  • replacement in inflorescence/src/diff.rs at line 185
    [10.1859][10.1859:1911]()
    File::Undecodable(_file) => HashSet::new(),
    [10.1859]
    [10.1911]
    File::Undecodable(_) | File::Image(_) => HashSet::new(),