source: code/trunk/lib/peers.ml@ 24

Last change on this file since 24 was 21, checked in by fox, 2 years ago

Moved conversion file, conf -> pack, fixes

Conversion:

  • Configuration sought in: txt.conf, ~/.config/txt/txt.conf
  • logarion.conf to produce index and target formats

Publication:

  • publish <ids>: copies txt with ID into Pubdir/public_{html,gemini,gopher} (Pubdir fromtxt.conf), if dirs exist, and runs convert <pubdir>

Fixes:

  • Feed <nav> regression
File size: 774 bytes
Line 
1let text_dir = Filename.concat (File_store.txtdir ()) "peers"
2
3let fold fn init = match Sys.readdir text_dir with
4 | exception (Sys_error msg) -> prerr_endline msg
5 | dirs ->
6 let read_pack path =
7 let pack_path = Filename.(concat text_dir @@ concat path "index.pck") in
8 match Sys.file_exists pack_path with false -> () | true ->
9 match Header_pack.of_string (File_store.to_string pack_path) with
10 | Error s -> Printf.eprintf "%s %s\n" s pack_path
11 | Ok p -> ignore @@ List.fold_left fn init Header_pack.(p.info.locations)
12 in
13 Array.iter read_pack dirs
14
15let scheme url =
16 let colon_idx = String.index_from url 0 ':' in
17 let scheme = String.sub url 0 colon_idx in
18(* let remain = String.(sub url (colon_idx+1) (length url - length scheme - 1)) in*)
19 scheme
Note: See TracBrowser for help on using the repository browser.