diff --git a/GNUmakefile b/GNUmakefile index 0c16956d..046dd888 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1483,6 +1483,18 @@ help: ## Display this help message. .PHONY: help .DEFAULT_GOAL := help +docs: debug docs: ## Build HTML docs. + @echo '# CLI Usage' > docs/usage.md + @echo "## tildefriends -h" >> docs/usage.md + @echo '```' >> docs/usage.md + @out/debug/tildefriends -h >> docs/usage.md + @echo '```' >> docs/usage.md + @for command in $$(out/debug/tildefriends -h | grep -Po '[A-Za-z_]*(?= - )'); do + @ echo "## tildefriends $$command -h" >> docs/usage.md + @ echo '```' >> docs/usage.md + @ out/debug/tildefriends $$command -h >> docs/usage.md + @ echo '```' >> docs/usage.md + @done @doxygen .PHONY: docs diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 00000000..5a690257 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,222 @@ +# CLI Usage +## tildefriends -h +``` +Usage: out/debug/tildefriends command [command-options] +commands: + run - Run tildefriends (default). + sandbox - Run a sandboxed tildefriends sandbox process (used internally). + import - Import apps to SSB. + export - Export apps from SSB. + publish - Append a message to a feed. + private - Append a private post message to a feed. + create_invite - Create an invite. + get_sequence - Get the last sequence number for a feed. + get_identity - Get the server account identity. + get_profile - Get profile information for the given identity. + get_contacts - Get information about followed, blocked, and friend identities. + has_blob - Check whether a blob is in the blob store. + get_blob - Read a file from the blob store. + store_blob - Write a file to the blob store. + verify - Verify a feed. + test - Test SSB. +``` +## tildefriends run -h +``` + +out/debug/tildefriends run [options] + +options + -s, --script script Script to run (default: core/core.js). + -d, --db-path path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -k, --ssb-network-key key SSB network key to use. + -n, --count count Number of instances to run. + -a, --args args Arguments of the format key=value,foo=bar,verbose=true (note: these are persisted to the database). + code_of_conduct (default: ""): Code of conduct presented at sign-in. + ssb_port (default: 8008): Port on which to listen for SSB secure handshake connections. + http_local_only (default: false): Whether to bind http(s) to the loopback address. Otherwise any. + http_port (default: 12345): Port on which to listen for HTTP connections. + https_port (default: 0): Port on which to listen for secure HTTP connections. + out_http_port_file (default: ""): File to which to write bound HTTP port. + blob_fetch_age_seconds (default: -1): Only blobs mentioned more recently than this age will be automatically fetched. + blob_expire_age_seconds (default: -1): Blobs older than this will be automatically deleted. + fetch_hosts (default: ""): Comma-separated list of host names to which HTTP fetch requests are allowed. None if empty. + http_redirect (default: ""): If connecting by HTTP and HTTPS is configured, Location header prefix (ie, "http://example.com") + index (default: "/~core/intro/"): Default path. + index_map (default: ""): Mappings from hostname to redirect path, one per line, as in: "www.tildefriends.net=/~core/index/" + peer_exchange (default: false): Enable discovery of, sharing of, and connecting to internet peer strangers, including announcing this instance. + replicator (default: true): Enable message and blob replication. + room (default: true): Enable peers to tunnel through this instance as a room. + room_name (default: "tilde friends tunnel"): Name of the room. + seeds_host (default: "seeds.tildefriends.net"): Hostname for seed connections. + account_registration (default: true): Allow registration of new accounts. + replication_hops (default: 2): Number of hops to replicate (1 = direct follows, 2 = follows of follows, etc.). + delete_stale_feeds (default: false): Periodically delete feeds that aren't visible from local accounts or related follows. + talk_to_strangers (default: true): Whether connections are accepted from accounts that aren't in the replication range or otherwise already known. + autologin (default: false): Whether mobile autologin is supported. + broadcast (default: true): Send network discovery broadcasts. + discovery (default: true): Receive network discovery broadcasts. + -o, --one-proc Run everything in one process (unsafely!). + -z, --zip path Zip archive from which to load files. + -v, --verbose Log raw messages. + -h, --help Show this usage information. +``` +## tildefriends sandbox -h +``` + +Usage: out/debug/tildefriends sandbox [options] + +options: + -h, --help Show this usage information. + -f, --fd File descriptor with which to communicate with parent process. +``` +## tildefriends import -h +``` + +out/debug/tildefriends import [options] [paths...] + +options: + -u, --user user User into whose account apps will be imported (default: "import"). + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -h, --help Show this usage information. +``` +## tildefriends export -h +``` + +out/debug/tildefriends export [options] [paths...] + +options: + -u, --user user User from whose account apps will be exported (default: "core"). + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -h, --help Show this usage information. + +paths Paths of apps to export (example: /~core/ssb /~user/app). +``` +## tildefriends publish -h +``` + +out/debug/tildefriends publish [options] + +options: + -u, --user user User owning identity with which to publish. + -i, --id identity Identity with which to publish message. + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -c, --content json JSON content of message to publish. + -h, --help Show this usage information. +``` +## tildefriends private -h +``` + +out/debug/tildefriends private [options] + +options: + -u, --user user User owning identity with which to publish (optional). + -i, --id identity Identity with which to publish message. + -r, --recipients recipients Recipient identities. + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -t, --text text Private post text. + -h, --help Show this usage information. +``` +## tildefriends create_invite -h +``` + +out/debug/tildefriends get_sequence [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -i, --identity identity Account from which to get latest sequence number. + -a, --address address Address to which the recipient will connect. + -p, --port port Port to which the recipient will connect. + -u, --use_count count Number of times this invite may be used (default: 1). + -e, --expires seconds How long this invite is valid in seconds (-1 for indefinitely, default: 1 hour). + -h, --help Show this usage information. +``` +## tildefriends get_sequence -h +``` + +out/debug/tildefriends get_sequence [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -i, --identity identity Account from which to get latest sequence number. + -h, --help Show this usage information. +``` +## tildefriends get_identity -h +``` + +out/debug/tildefriends get_identity [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -h, --help Show this usage information. +``` +## tildefriends get_profile -h +``` + +out/debug/tildefriends get_profile [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -i, --identity identity Account for which to get profile information. + -h, --help Show this usage information. +``` +## tildefriends get_contacts -h +``` + +out/debug/tildefriends get_contacts [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -i, --identity identity Account from which to get contact information. + -h, --help Show this usage information. +``` +## tildefriends has_blob -h +``` + +out/debug/tildefriends has_blob [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -b, --blob_id blob_id ID of blob to query. + -h, --help Show this usage information. +``` +## tildefriends get_blob -h +``` + +out/debug/tildefriends store_blob [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -b, --blob blob_id Blob identifier to retrieve. + -o, --output file_path Location to write the retrieved blob. + -h, --help Show this usage information. +``` +## tildefriends store_blob -h +``` + +out/debug/tildefriends store_blob [options] + +options: + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -f, --file file_path Path to file to add to the blob store. + -h, --help Show this usage information. +``` +## tildefriends verify -h +``` + +out/debug/tildefriends import [options] [paths...] + +options: + -i, --identity identity Identity to verify. + -s, --sequence sequence Sequence number to debug. + -d, --db-path db_path SQLite database path (default: /home/cory/.local/share/tildefriends/db.sqlite). + -h, --help Show this usage information. +``` +## tildefriends test -h +``` + +out/debug/tildefriends test [options] + +options + -t, --tests tests Comma-separated list of tests to run. (default: all) + -h, --help Show this usage information. +``` diff --git a/src/httpd.js.h b/src/httpd.js.h index 8c44ca88..2ceba460 100644 --- a/src/httpd.js.h +++ b/src/httpd.js.h @@ -11,6 +11,7 @@ ** @{ */ +/** A JS context. */ typedef struct JSContext JSContext; /**