<h2id="welcome-to-the-microbin-wiki-">Welcome to MicroBin!</h2>
<p>This page contains help regarding the installation, configuration and use of MicroBin. If you have questions that are not answered here, head to our <ahref="https://github.com/szabodanika/microbin">GitHub repository</a>.</p>
<h2id="1-usage">1 Usage</h2>
<h3id="what-is-a-pasta-anyway-">What is a "pasta" anyway?</h3>
<p>In microbin, a pasta can be:</p>
<ul>
<li>A text that you want to paste from one machine to another, eg. some code</li>
<li>A file that you want to share, eg. a video that is too large for Discord, a zip with a code project in it or an image</li>
<li>A URL redirect</li>
</ul>
<h3id="when-is-microbin-useful-">When is MicroBin useful?</h3>
<p>You can use MicroBin</p>
<ul>
<li>As a URL shortener/redirect service,</li>
<li>To send long texts to other people,</li>
<li>To send large files to other people,</li>
<li>To serve content on the web, eg. configuration files for testing, images, or any other file content using the Raw functionality,</li>
<li>To move files between your desktop and a server you access from the console,</li>
<li>As a "postbox" service where people can upload their files or texts, but they cannot see or remove what others sent you - just disable the pastalist page</li>
<li>To take notes! Simply create an editable pasta.</li>
</ul>
<p>...and many other things, why not get creative?</p>
<h3id="creating-a-pasta">Creating a Pasta</h3>
<p>Navigate to the root of your server, for example <ahref="https://microbin.myserver.com/">https://microbin.myserver.com/</a>. This should show you a form where you will at the very least see an expiration selector, a file attachment input, a content text field and a green save button. Depending on your configuration there miight also be a syntax highlight selector, an editable checkbox and a private ceckbox.</p>
<p>Use the expiration dropdown to choose how long you want your pasta to exist. When the selected time has expired, it will be removed from the server. The content can be any text, including plain text, code, html, even a URL. A URL is a special case, because when you open the pasta again, it will redirect you to that URL instead of showing it as a text. Entering content is optional, and so is the file attachment. If you want, you can even submit a pasta completely empty.</p>
<p>You will be redirected to the URL of the pasta, which will end with a few animal names. If you remember those animals, you can simply type them in on another machine and open your pasta elsewhere.</p>
<p>If you have editable pastas enabled and you check the editable checkbox, then later on there will be an option to change the text content of your pasta. Selecting the private checkbox will simply prevent your pasta to show up on the pasta list page, if that is enabled.</p>
<p>If you have syntax higlighting enabled, then select your language from the dropdown, or leave it as none if you just want to upload plain with no highlighting.</p>
<h3id="listing-pastas">Listing Pastas</h3>
<p>If you have pasta listing enabled, then there is a pasta list option in the navigation bar, which will list all the pastas on the server in two groups: regular pastas and URL redirects (pastas containing nothing but a URL). If you have private pastas enabled, they will not show up here at all.</p>
<p>From the pasta list page, you will be able to view individual pastas by clicking on their animal identifiers on the lest, view their raw contrent by clicking on the Raw button, remove them, and if you have editable pastas enabled, then open them in edit view.</p>
<h3id="use-microbin-from-the-console-with-curl">Use MicroBin from the console with cURL</h3>
<p>Simple text Pasta: <code>curl -d "expiration=10min&content=This is a test pasta" -X POST https://microbin.myserver.com/create</code></p>
<p>Use cURL to read the pasta: <code>curl https://microbin.myserver.com/rawpasta/fish-pony-crow</code>,</p>
<p>or to download the pasta: <code>curl https://microbin.myserver.com/rawpasta/fish-pony-crow > output.txt</code> (use /file instead of /rawpasta to download attached file).</p>
<p>Remember, MicroBin will create your database and file storage wherever you execute it. I recommend that you create a folder for it first and execute it there:</p>
<p>Simply clone the repository, build it with <code>cargo build --release</code> and run the <code>microbin</code> executable in the created <code>target/release/</code> directory. It will start on port 8080. You can change the port with <code>-p</code> or <code>--port</code> CL arguments. For other arguments see <ahref="https://github.com/szabodanika/microbin/wiki">the Wiki</a>.</p>
<p>To install it as a service on your Linux machine, create a file called <code>/etc/systemd/system/microbin.service</code>, paste this into it with the <code>[username]</code> and <code>[path to installation directory]</code> replaced with the actual values. If you installed MicroBin from Cargo, your executable will be in your system's Cargo directory, e.g. <code>/Users/daniel/.cargo/bin/microbin</code>.</p>
</code></pre><p>Then start the service with <code>systemctl start microbin</code> and enable it on boot with <code>systemctl enable microbin</code>. To update your MicroBin, simply update or clone the repository again, build it again, and then restart the service with <code>systemctl restart microbin</code>. An update will never affect your existing pastas, unless there is a breaking change in the data model (in which case MicroBin just won't be able to import your DB), which will always be mentioned explicitly.</p>
<spanclass="hljs-attribute">ssl_certificate</span> /etc/letsencrypt/live/microbin.myserver.com/fullchain.pem; <spanclass="hljs-comment"># managed by Certbot</span>
<spanclass="hljs-attribute">ssl_certificate_key</span> /etc/letsencrypt/live/microbin.myserver.com/privkey.pem; <spanclass="hljs-comment"># managed by Certbot</span>
<spanclass="hljs-attribute">include</span> /etc/letsencrypt/options-ssl-nginx.conf; <spanclass="hljs-comment"># managed by Certbot</span>
<spanclass="hljs-attribute">ssl_dhparam</span> /etc/letsencrypt/ssl-dhparams.pem; <spanclass="hljs-comment"># managed by Certbot</span>
}
</code></pre><h2id="3-command-line-arguments">3 Command Line Arguments</h2>
<p>There is an ever expanding list of customisations built into MicroBin so you can use it the way you want. Instead of a configuration file, we simply use arguments that you pass to the executable, making the workflow even simpler. Read the following options and if you cannot find what you need, you can always open an issue at our GitHub repository and request a new feature!</p>
<p>Require username for HTTP Basic Authentication when visiting the service. If <code>--auth-username</code> is set but <code>--auth-password</code> is not, just leave the password field empty when logging in. You can also just go to <ahref="https://username:password@yourserver.net">https://username:password@yourserver.net</a> or <ahref="https://username@yourserver.net">https://username@yourserver.net</a> if password is not set instead of typing into the password</p>
<p>Require password for HTTP Basic Authentication when visiting the service. Will not have any affect unless <code>--auth-username</code> is also set. If <code>--auth-username</code> is set but <code>--auth-password</code> is not, just leave the password field empty when logging in. You can also just go to <ahref="https://username:password@yourserver.net">https://username:password@yourserver.net</a> or <ahref="https://username@yourserver.net">https://username@yourserver.net</a> if password is not set instead of typing into the password prompt.</p>
<h3id="-editable">--editable</h3>
<p>Enables editable pastas. You will still be able to make finalised pastas but there will be an extra checkbox to make your new pasta editable from the pasta list or the pasta view page.</p>
<p>Replaces the default footer text with your own. If you want to hide the footer, use --hide-footer instead.</p>
<h3id="-h-help">-h, --help</h3>
<p>Show all commands in the terminal.</p>
<h3id="-hide-footer">--hide-footer</h3>
<p>Hides the footer on every page.</p>
<h3id="-hide-header">--hide-header</h3>
<p>Hides the navigation bar on every page.</p>
<h3id="-hide-logo">--hide-logo</h3>
<p>Hides the MicroBin logo from the navigation bar on every page.</p>
<h3id="-no-listing">--no-listing</h3>
<p>Disables the /pastalist endpoint, essentially making all pastas private.</p>
<h3id="-highlightsyntax">--highlightsyntax</h3>
<p>Enables syntax highlighting support. When creating a new pasta, a new dropdown selector will be added where you can select your pasta's syntax, or just leave it empty for no highlighting.</p>
<h3id="-p-port-port-">-p, --port [PORT]</h3>
<p>Default value: 8080</p>
<p>Sets the port for the server will be listening on.</p>
<h3id="-private">--private</h3>
<p>Enables private pastas. Adds a new checkbox to make your pasta private, which then won't show up on the pastalist page. With the URL to your pasta, it will still be accessible.</p>
<h3id="-pure-html">--pure-html</h3>
<p>Disables main CSS styling, just uses a few in-line stylings for the layout. With this option you will lose dark-mode support.</p>
<p>Number of workers MicroBin is allowed to have. Increase this to the number of CPU cores you have if you want to go beast mode, but for personal use one worker is enough.</p>
<h3id="-v-version">-V, --version</h3>
<p>Displays your MicroBin's version information.</p>
<h3id="-wide">--wide</h3>
<p>Changes the maximum width of the UI from 720 pixels to 1080 pixels.</p>