2022-11-01 17:59:22 +01:00
|
|
|
let text_dir = Filename.concat (File_store.txtdir ()) "peers"
|
2021-03-13 19:40:07 +01:00
|
|
|
|
2022-12-15 22:25:18 +01:00
|
|
|
type t = { path: string; pack: Header_pack.t }
|
2022-11-18 14:41:55 +01:00
|
|
|
|
- Removed 'txt init'
Format
- New B32 ID
Index
- New option: txt index --print
- Move scheme to peers
- Replace peer.*.conf files with index packed locations
Instead of adding a URL to peers.*.conf, run `txt pull <url>`
Conversion
- Rewritten converters
- txt-convert looks for a .convert.conf containing `key: value` lines.
- Specifiable topic-roots from .convert.conf.
- Added `Topics:` key, with comma seperated topics.
If set only those topics will appear in the main index and used as topic roots.
Other topics will have sub-indices generated, but won't be listed in the main index.
- HTML converter header & footer options
- HTML-index renamed to HTM-index
Internal
- Change types: uuid:Uuid -> id:string
- File_store merges identical texts
- Use peer ID for store path, store peers' texts in .local/share/texts
- Simple URN resolution for converter
Continue to next feed if parsing one fails
- Phasing-out Archive, replaced by improved packs
- Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies
- Lock version for Cmdliner, fix dune-project
- Optional resursive store
- Improve header_pack
- Fix recursive mkdir
2022-04-01 17:35:56 +02:00
|
|
|
let fold fn init = match Sys.readdir text_dir with
|
2022-11-18 14:41:55 +01:00
|
|
|
| exception (Sys_error msg) -> prerr_endline msg; init
|
- Removed 'txt init'
Format
- New B32 ID
Index
- New option: txt index --print
- Move scheme to peers
- Replace peer.*.conf files with index packed locations
Instead of adding a URL to peers.*.conf, run `txt pull <url>`
Conversion
- Rewritten converters
- txt-convert looks for a .convert.conf containing `key: value` lines.
- Specifiable topic-roots from .convert.conf.
- Added `Topics:` key, with comma seperated topics.
If set only those topics will appear in the main index and used as topic roots.
Other topics will have sub-indices generated, but won't be listed in the main index.
- HTML converter header & footer options
- HTML-index renamed to HTM-index
Internal
- Change types: uuid:Uuid -> id:string
- File_store merges identical texts
- Use peer ID for store path, store peers' texts in .local/share/texts
- Simple URN resolution for converter
Continue to next feed if parsing one fails
- Phasing-out Archive, replaced by improved packs
- Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies
- Lock version for Cmdliner, fix dune-project
- Optional resursive store
- Improve header_pack
- Fix recursive mkdir
2022-04-01 17:35:56 +02:00
|
|
|
| dirs ->
|
2022-11-18 14:41:55 +01:00
|
|
|
let read_pack init path =
|
|
|
|
let fullpath = Filename.concat text_dir path in
|
|
|
|
if Sys.is_directory fullpath then begin
|
|
|
|
let pack_path = Filename.concat fullpath "index.pck" in
|
|
|
|
match Sys.file_exists pack_path with
|
|
|
|
| false -> Printf.eprintf "Missing index.pck for %s\n" path; init
|
|
|
|
| true -> match Header_pack.of_string (File_store.to_string pack_path) with
|
|
|
|
| Error s -> Printf.eprintf "%s %s\n" s pack_path; init
|
2022-12-15 22:25:18 +01:00
|
|
|
| Ok pack -> fn init { path; pack }
|
2022-11-18 14:41:55 +01:00
|
|
|
end else init
|
- Removed 'txt init'
Format
- New B32 ID
Index
- New option: txt index --print
- Move scheme to peers
- Replace peer.*.conf files with index packed locations
Instead of adding a URL to peers.*.conf, run `txt pull <url>`
Conversion
- Rewritten converters
- txt-convert looks for a .convert.conf containing `key: value` lines.
- Specifiable topic-roots from .convert.conf.
- Added `Topics:` key, with comma seperated topics.
If set only those topics will appear in the main index and used as topic roots.
Other topics will have sub-indices generated, but won't be listed in the main index.
- HTML converter header & footer options
- HTML-index renamed to HTM-index
Internal
- Change types: uuid:Uuid -> id:string
- File_store merges identical texts
- Use peer ID for store path, store peers' texts in .local/share/texts
- Simple URN resolution for converter
Continue to next feed if parsing one fails
- Phasing-out Archive, replaced by improved packs
- Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies
- Lock version for Cmdliner, fix dune-project
- Optional resursive store
- Improve header_pack
- Fix recursive mkdir
2022-04-01 17:35:56 +02:00
|
|
|
in
|
2022-11-18 14:41:55 +01:00
|
|
|
Array.fold_left read_pack init dirs
|
- Removed 'txt init'
Format
- New B32 ID
Index
- New option: txt index --print
- Move scheme to peers
- Replace peer.*.conf files with index packed locations
Instead of adding a URL to peers.*.conf, run `txt pull <url>`
Conversion
- Rewritten converters
- txt-convert looks for a .convert.conf containing `key: value` lines.
- Specifiable topic-roots from .convert.conf.
- Added `Topics:` key, with comma seperated topics.
If set only those topics will appear in the main index and used as topic roots.
Other topics will have sub-indices generated, but won't be listed in the main index.
- HTML converter header & footer options
- HTML-index renamed to HTM-index
Internal
- Change types: uuid:Uuid -> id:string
- File_store merges identical texts
- Use peer ID for store path, store peers' texts in .local/share/texts
- Simple URN resolution for converter
Continue to next feed if parsing one fails
- Phasing-out Archive, replaced by improved packs
- Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies
- Lock version for Cmdliner, fix dune-project
- Optional resursive store
- Improve header_pack
- Fix recursive mkdir
2022-04-01 17:35:56 +02:00
|
|
|
|
|
|
|
let scheme url =
|
|
|
|
let colon_idx = String.index_from url 0 ':' in
|
|
|
|
let scheme = String.sub url 0 colon_idx in
|
|
|
|
(* let remain = String.(sub url (colon_idx+1) (length url - length scheme - 1)) in*)
|
|
|
|
scheme
|