/* /share to the HTML artifact publisher (share.c): the conversation's HTML page goes to the
* publisher's HTTP API (POST /api/artifacts) under a token sealed in the credential store as
* "artifacts" (pic login artifacts) or read from HTML_PUBLISHER_TOKEN, at the address the setting
* artifactsUrl names. A page over 256 KB goes up as a blob first, as the publisher's own client
* does. Used by the terminal interface's /share, after the yes. */
#ifndef PIC_SHARE_H
#define PIC_SHARE_H
#include <stddef.h>
#define PIC_SHARE_CRED "artifacts" /* the credential name */
/* Where /share goes now: 1 the artifact publisher, 0 the secret gist. sessionShareDestination
* gist is 0, artifacts is 1 (even when it is not set up: the share then says what is missing);
* auto (the default) is 1 only when a token is stored (or HTML_PUBLISHER_TOKEN is set) and
* artifactsUrl is set. */
int pic_share_artifacts(void);
/* The publisher's address (malloc'd, no trailing slash): the setting artifactsUrl, else the
* variable HTML_PUBLISHER_URL; NULL when neither is set. */
char *pic_share_address(void);
/* Publishes HTML (N bytes) to pic_share_address() and puts the viewer link in URL. When TO is
* non-empty, its origin (scheme, host, port) must match the configured publisher's before any
* credential is read or sent. 0, or -1 with the cause in ERR (never the token). */
int pic_share_publish(const char *to, const char *html, size_t n, char *url, size_t urlcap, char *err, size_t errcap);
#endif