``` ___ ,---. ,--,--,--. / (_) | o | .-. || | \__ __| _|_ __ ,_ ' '-' '| | | | / / | | | / \_/ | .`- / `--`--`--' \___/\_/|_/|_/|_/\__/ |_/ `---' gmEditor: v2.0.1 This GMCapsule extension module allows you to easily and powerfully upload to Gemini capsules via the Titan companion protocol. It is configured with the "uploads" key in GMCapsule's config file (see below). * If no configuration is specified, the module does not initialize. * You are not allowed to perform directory traversal. You will be reported and subject to IP ban or certificate removal if you do this. * YOU ARE ON YOUR OWN if you want to use this. Support is not guaranteed and it's more likely that I'll ignore your request if you ask for help. This is not your fault, but you have been warned. * Some clients apparently don't take tokens from redirects and override them if they're in the URL. Be careful about what token is currently active! This is why gmEditor put in various checks, like the path repeated in the delete token, the content checks for move and copy, and the accidental overwrite checks. To set backed-up Gemtext files to render as Gemtext, add the following line to the root ".meta" file: *.gmi-*.bak: text/gemini === CONFIGURATION REFERENCE === [uploads] certs = 23ac... # WHITESPACE separated public key or certificate fingerprints. # These 'certs' apply to all hostnames by default. # REQUIRED unless a per-domain section is configured. [uploads:example.com] # Replace example.com with your actual hostname. # This section is entirely optional. # If it's excluded, the defaults apply. certs = 23ac... # Same as above; but for just this domain, if set. # NOTE: If 'certs' is unset, it defaults to the 'certs' under [uploads]. allow_global_certs = False # set to True to allow both this domain's 'certs' and global 'certs'. exclude = PATH PATH2... # WHITESPACE separated path globs to exclude, i.e. '*.zip' or 'excluded/'. === ACTION TOKEN REFERENCE === Edit the current file, or create it if necessary. The "current file" is the one you're trying to create or edit in your client; typically this shows up after the domain name and port in the URL bar or at the top of your editing form. On success: 30 redirect to the current file on Gemini. about |OR| help This help page! 20 status code with this page in plain-text. The tick-marks at the top force Gemtext-only clients to render this page in preformatted plain text. delete Replace with the path to delete, which must match the request PATH. Include the leading /. This is done as a confirmation step, both to prevent accidental file deletion and to prevent accidentally deleting the wrong file, which might happen when a client tries to re-use a token. If you forget the path or get it wrong, the upload handler will tell you. The content is not checked for this request. To save bandwidth, leave it empty. On success: 52 status code with message "Deleted successfully". copy |OR| cp Replace with the destination to copy the file being edited to. If the leading / is not present, the path is relative to the current file or directory. The contents must be empty or identical to the source file. This is to prevent ambiguity. If you want to edit the current file and copy the original, use the related "backup" token. On success: 30 redirect to the new on Titan, so you can edit it. Token will be unset. move |OR| mv |OR| rename Replace with the new path of this file. If the leading / is not present, the path is relative to the current file or directory, useful for renaming. The contents must be empty or identical to the source file. This is to prevent ambiguity. On success: 30 redirect to the new on Titan, so you can edit it. Token will be unset. backup [PATH] Copy the current version of the edited file to [PATH], or if it's not provided, a timestamped backup version, and apply the contents to the edited file as normal. If the edited contents are empty, the original file is untouched. If the edited file is actually a directory, the directory gets backed up! If the edited contents are not empty, though, and the edited file is a directory, the index.gmi file gets edited and backed up. An autogenerated file name consists of the original filename, a hyphen, the UNIX timestamp at the time of backup, and the suffix ".bak". On success: if empty: 30 redirect to the backed-up file on Titan, with the token unset. if not empty: 30 redirect to the current file on Gemini. import Copy the contents of the provided file path to the current file. The contents must be empty to confirm this action. Future improvements may allow remote lookups by URI. On success: 30 redirect to the current file on Gemini. [e]ls Lists the contents of the current directory (either the current file or the directory it's in). No editing operation is done. The file or directory must already exist. On success: 20 status code with a directory listing in Gemtext. The links are to the Gemini version, unless "els" is used, in which case the Titan paths will be linked to instead for easy editing. WARNING: your browser may not look up the contents of the link before offering the Titan form to you! So this is best paired with action tokens that don't use the content, like copy, ls, import, or delete.