Getting ready for 1.2.0 release: many smaller requests implemented
- Implements #7 - Implements #42 and therefore #64 - Improved #53 - Implements #59 - Implements #61 - Implements #63 - Implements #80 - Implements #84 - Added Info page - Removed Help page - Bumped version number to 1.2.0 - Fixed a bug where wide mode was still 720px wide - Created FUNDING.yml - Reorganised arguments in README.MD and documented new options - Updated SECURITY.MD - Added display of last read time and read count - Increased default width to 800px to make UI less cluttered - Reorganised index page - New, better attach file button I want to spend some time testing these changes and let everyone have a look at them before tagging and releasing new artifacts.
This commit is contained in:
parent
769901c895
commit
44b55ae08e
22 changed files with 977 additions and 327 deletions
|
@ -4,7 +4,7 @@
|
|||
<b>Not Found</b>
|
||||
<br>
|
||||
<br>
|
||||
<a href="{{ args.public_path }}/" > Go Home</a>
|
||||
<a href="{{ args.public_path }}/"> Go Home</a>
|
||||
<br>
|
||||
<br>
|
||||
{% include "footer.html" %}
|
||||
{% include "footer.html" %}
|
|
@ -12,13 +12,18 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
|
||||
{% if !args.pure_html %}
|
||||
{% if args.custom_css.as_ref().is_none() %}
|
||||
<link rel="stylesheet" href="{{ args.public_path }}/static/water.css">
|
||||
{%- else %}
|
||||
<link rel="stylesheet" href="{{ args.custom_css.as_ref().unwrap() }}">
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
</head>
|
||||
{% if args.wide %}
|
||||
|
||||
<body style="
|
||||
max-width: 720px;
|
||||
max-width: 1080px;
|
||||
margin: auto;
|
||||
padding-left:0.5rem;
|
||||
padding-right:0.5rem;
|
||||
|
@ -28,7 +33,7 @@
|
|||
{%- else %}
|
||||
|
||||
<body style="
|
||||
max-width: 720px;
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
padding-left:0.5rem;
|
||||
padding-right:0.5rem;
|
||||
|
@ -53,11 +58,12 @@
|
|||
{%- endif %}
|
||||
</b>
|
||||
|
||||
<a href="{{ args.public_path }}/" style="margin-right: 0.5rem; margin-left: 0.5rem">New Pasta</a>
|
||||
<a href="{{ args.public_path }}/" style="margin-right: 0.5rem; margin-left: 0.5rem">New
|
||||
Pasta</a>
|
||||
|
||||
<a href="{{ args.public_path }}/pastalist" style="margin-right: 0.5rem; margin-left: 0.5rem">Pasta List</a>
|
||||
|
||||
<a href="{{ args.public_path }}/help" style="margin-right: 0.5rem; margin-left: 0.5rem">Help</a>
|
||||
<a href="{{ args.public_path }}/info" style="margin-right: 0.5rem; margin-left: 0.5rem">Info</a>
|
||||
|
||||
<hr>
|
||||
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
{% include "header.html" %}
|
||||
|
||||
|
||||
<h2 id="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 <a href="https://github.com/szabodanika/microbin">GitHub repository</a>.</p>
|
||||
<h2 id="1-usage">1 Usage</h2>
|
||||
<h3 id="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>
|
||||
<h3 id="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>
|
||||
<h3 id="creating-a-pasta">Creating a Pasta</h3>
|
||||
<p>Navigate to the root of your server, for example <a href="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>
|
||||
<h3 id="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>
|
||||
<h3 id="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>File contents: <code>curl -d "expiration=10min&content=$( < mypastafile.txt )" -X POST https://microbin.myserver.com/create</code></p>
|
||||
<p>Available expiration options:
|
||||
<code>1min</code>, <code>10min</code>, <code>1hour</code>, <code>24hour</code>, <code>1week</code>, <code>never</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>
|
||||
<h2 id="2-installation">2 Installation</h2>
|
||||
<h3 id="from-cargo">From Cargo</h3>
|
||||
<p>Install from Cargo:</p>
|
||||
<p><code>cargo install microbin</code></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><code>mkdir ~/microbin/</code></p>
|
||||
<p><code>cd ~/microbin/</code></p>
|
||||
<p><code>microbin --port 8080 --highlightsyntax --editable</code></p>
|
||||
<h3 id="building-microbin">Building MicroBin</h3>
|
||||
<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 <a href="https://github.com/szabodanika/microbin/wiki">the Wiki</a>.</p>
|
||||
<pre><code>git clone https:<span class="hljs-comment">//github.com/szabodanika/microbin.git</span>
|
||||
cd microbin
|
||||
cargo build --<span class="hljs-built_in">release</span>
|
||||
./target/<span class="hljs-built_in">release</span>/microbin -p <span class="hljs-number">80</span>
|
||||
</code></pre><h3 id="microbin-as-a-service">MicroBin as a service</h3>
|
||||
<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>
|
||||
<pre><code><span class="hljs-section">[Unit]</span>
|
||||
<span class="hljs-attr">Description</span>=MicroBin
|
||||
<span class="hljs-attr">After</span>=network.target
|
||||
<span class="hljs-section">
|
||||
[Service]</span>
|
||||
<span class="hljs-attr">Type</span>=simple
|
||||
<span class="hljs-attr">Restart</span>=always
|
||||
<span class="hljs-attr">User</span>=[username]
|
||||
<span class="hljs-attr">RootDirectory</span>=/
|
||||
<span class="hljs-attr">WorkingDirectory</span>=[path to installation directory]
|
||||
<span class="hljs-attr">ExecStart</span>=[path to installation directory]/target/release/microbin
|
||||
<span class="hljs-section">
|
||||
[Install]</span>
|
||||
<span class="hljs-attr">WantedBy</span>=multi-user.target
|
||||
</code></pre><p>Here is my <code>microbin.service</code> for example, with some optional arguments:</p>
|
||||
<pre><code><span class="hljs-section">[Unit]</span>
|
||||
<span class="hljs-attr">Description</span>=MicroBin
|
||||
<span class="hljs-attr">After</span>=network.target
|
||||
<span class="hljs-section">
|
||||
[Service]</span>
|
||||
<span class="hljs-attr">Type</span>=simple
|
||||
<span class="hljs-attr">Restart</span>=always
|
||||
<span class="hljs-attr">User</span>=ubuntu
|
||||
<span class="hljs-attr">RootDirectory</span>=/
|
||||
|
||||
<span class="hljs-comment"># This is the directory where I want to run microbin. It will store all the pastas here.</span>
|
||||
<span class="hljs-attr">WorkingDirectory</span>=/home/ubuntu/server/microbin
|
||||
|
||||
<span class="hljs-comment"># This is the location of my executable - I also have 2 optional features enabled</span>
|
||||
<span class="hljs-attr">ExecStart</span>=/home/ubuntu/server/microbin/target/release/microbin --editable --linenumbers --highlightsyntax
|
||||
|
||||
<span class="hljs-comment"># I keep my installation in the home directory, so I need to add this</span>
|
||||
<span class="hljs-attr">ProtectHome</span>=<span class="hljs-literal">off</span>
|
||||
<span class="hljs-section">
|
||||
[Install]</span>
|
||||
<span class="hljs-attr">WantedBy</span>=multi-user.target
|
||||
</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>
|
||||
<h3 id="nginx-configuration">NGINX configuration</h3>
|
||||
<pre><code><span class="hljs-section">server</span> {
|
||||
<span class="hljs-comment"># I have HTTPS enabled using certbot - you can use HTTP of course if you want!</span>
|
||||
<span class="hljs-attribute">listen</span> <span class="hljs-number">443</span> ssl; <span class="hljs-comment"># managed by Certbot</span>
|
||||
|
||||
<span class="hljs-attribute">server_name</span> microbin.myserver.com;
|
||||
|
||||
<span class="hljs-attribute">location</span> / {
|
||||
<span class="hljs-comment"># Make sure to change the port if you are not running MicroBin at 8080!</span>
|
||||
<span class="hljs-attribute">proxy_pass</span> http://127.0.0.1:8080<span class="hljs-variable">$request_uri</span>;
|
||||
<span class="hljs-attribute">proxy_set_header</span> Host <span class="hljs-variable">$host</span>;
|
||||
<span class="hljs-attribute">proxy_set_header</span> X-Forwarded-Proto <span class="hljs-variable">$scheme</span>;
|
||||
<span class="hljs-attribute">proxy_set_header</span> X-Real-IP <span class="hljs-variable">$remote_addr</span>;
|
||||
<span class="hljs-attribute">proxy_set_header</span> X-Forwarded-For <span class="hljs-variable">$proxy_add_x_forwarded_for</span>;
|
||||
}
|
||||
|
||||
<span class="hljs-comment"># Limit content size - I have 1GB because my MicroBin server is private, no one else will use it.</span>
|
||||
<span class="hljs-attribute">client_max_body_size</span> <span class="hljs-number">1024M</span>;
|
||||
|
||||
<span class="hljs-attribute">ssl_certificate</span> /etc/letsencrypt/live/microbin.myserver.com/fullchain.pem; <span class="hljs-comment"># managed by Certbot</span>
|
||||
<span class="hljs-attribute">ssl_certificate_key</span> /etc/letsencrypt/live/microbin.myserver.com/privkey.pem; <span class="hljs-comment"># managed by Certbot</span>
|
||||
<span class="hljs-attribute">include</span> /etc/letsencrypt/options-ssl-nginx.conf; <span class="hljs-comment"># managed by Certbot</span>
|
||||
<span class="hljs-attribute">ssl_dhparam</span> /etc/letsencrypt/ssl-dhparams.pem; <span class="hljs-comment"># managed by Certbot</span>
|
||||
}
|
||||
</code></pre><h2 id="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>
|
||||
<h3 id="-auth-username-auth_username-">--auth-username [AUTH_USERNAME]</h3>
|
||||
<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 <a href="https://username:password@yourserver.net">https://username:password@yourserver.net</a> or <a href="https://username@yourserver.net">https://username@yourserver.net</a> if password is not set instead of typing into the password</p>
|
||||
<h3 id="-auth-password-auth_password-">--auth-password [AUTH_PASSWORD]</h3>
|
||||
<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 <a href="https://username:password@yourserver.net">https://username:password@yourserver.net</a> or <a href="https://username@yourserver.net">https://username@yourserver.net</a> if password is not set instead of typing into the password prompt.</p>
|
||||
<h3 id="-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>
|
||||
<h3 id="-footer_text-text-">--footer_text [TEXT]</h3>
|
||||
<p>Replaces the default footer text with your own. If you want to hide the footer, use --hide-footer instead.</p>
|
||||
<h3 id="-h-help">-h, --help</h3>
|
||||
<p>Show all commands in the terminal.</p>
|
||||
<h3 id="-hide-footer">--hide-footer</h3>
|
||||
<p>Hides the footer on every page.</p>
|
||||
<h3 id="-hide-header">--hide-header</h3>
|
||||
<p>Hides the navigation bar on every page.</p>
|
||||
<h3 id="-hide-logo">--hide-logo</h3>
|
||||
<p>Hides the MicroBin logo from the navigation bar on every page.</p>
|
||||
<h3 id="-no-listing">--no-listing</h3>
|
||||
<p>Disables the /pastalist endpoint, essentially making all pastas private.</p>
|
||||
<h3 id="-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>
|
||||
<h3 id="-p-port-port-">-p, --port [PORT]</h3>
|
||||
<p>Default value: 8080</p>
|
||||
<p>Sets the port for the server will be listening on.</p>
|
||||
<h3 id="-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>
|
||||
<h3 id="-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>
|
||||
<h3 id="-readonly">--readonly</h3>
|
||||
<p>Disables adding/editing/removing pastas entirely.</p>
|
||||
<h3 id="-title-title-">--title [TITLE]</h3>
|
||||
<p>Replaces "MicroBin" with your title of choice in the navigation bar.</p>
|
||||
<h3 id="-t-threads-threads-">-t, --threads [THREADS]</h3>
|
||||
<p>Default value: 1</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>
|
||||
<h3 id="-v-version">-V, --version</h3>
|
||||
<p>Displays your MicroBin's version information.</p>
|
||||
<h3 id="-wide">--wide</h3>
|
||||
<p>Changes the maximum width of the UI from 720 pixels to 1080 pixels.</p>
|
||||
|
||||
{% include "footer.html" %}
|
|
@ -1,26 +1,108 @@
|
|||
{% include "header.html" %}
|
||||
|
||||
<form action="upload" method="POST" enctype="multipart/form-data">
|
||||
<br>
|
||||
<div style="display: grid;
|
||||
grid-gap: 4px;
|
||||
grid-template-columns: repeat(auto-fit, 234px);
|
||||
grid-template-rows: repeat(1, 100px); ">
|
||||
<div id="settings">
|
||||
<div>
|
||||
<label for="expiration">Expiration</label><br>
|
||||
<select style="width: 100%;" name="expiration" id="expiration">
|
||||
<optgroup label="Expire">
|
||||
<option value="1min">1 minute</option>
|
||||
<option value="10min">10 minutes</option>
|
||||
<option value="1hour">1 hour</option>
|
||||
<option selected value="24hour">24 hours</option>
|
||||
<option value="1week">1 week</option>
|
||||
<optgroup label="Expire after">
|
||||
{% if args.default_expiry == "1min" %}
|
||||
<option selected value="1min">
|
||||
{%- else %}
|
||||
<option value="1min">
|
||||
{%- endif %}
|
||||
1 minute
|
||||
</option>
|
||||
{% if args.default_expiry == "10min" %}
|
||||
<option selected value="10min">
|
||||
{%- else %}
|
||||
<option value="10min">
|
||||
{%- endif %}
|
||||
10 minutes
|
||||
</option>
|
||||
{% if args.default_expiry == "1hour" %}
|
||||
<option selected value="1hour">
|
||||
{%- else %}
|
||||
<option value="1hour">
|
||||
{%- endif %}
|
||||
1 hour
|
||||
</option>
|
||||
{% if args.default_expiry == "24hour" %}
|
||||
<option selected value="24hour">
|
||||
{%- else %}
|
||||
<option value="24hour">
|
||||
{%- endif %}
|
||||
24 hours
|
||||
</option>
|
||||
{% if args.default_expiry == "1week" %}
|
||||
<option selected value="1week">
|
||||
{%- else %}
|
||||
<option value="1week">
|
||||
{%- endif %}
|
||||
1 week
|
||||
</option>
|
||||
</optgroup>
|
||||
{% if !args.no_eternal_pasta %}
|
||||
<option value="never">Never Expire</option>
|
||||
{%- endif %}
|
||||
</select>
|
||||
</div>
|
||||
{% if args.enable_burn_after %}
|
||||
<div>
|
||||
<label for="expiration">Burn After</label><br>
|
||||
<select style="width: 100%;" name="burn_after" id="burn_after">
|
||||
<optgroup label="Burn after">
|
||||
{% if args.default_burn_after == 1 %}
|
||||
<option selected value="1">
|
||||
{%- else %}
|
||||
<option value="1">
|
||||
{%- endif %}
|
||||
First Read
|
||||
</option>
|
||||
{% if args.default_burn_after == 10 %}
|
||||
<option selected value="10">
|
||||
{%- else %}
|
||||
<option value="10">
|
||||
{%- endif %}
|
||||
10th Read
|
||||
</option>
|
||||
{% if args.default_burn_after == 100 %}
|
||||
<option selected value="100">
|
||||
{%- else %}
|
||||
<option value="100">
|
||||
{%- endif %}
|
||||
100th Read
|
||||
</option>
|
||||
{% if args.default_burn_after == 1000 %}
|
||||
<option selected value="1000">
|
||||
{%- else %}
|
||||
<option value="1000">
|
||||
{%- endif %}
|
||||
1000th Read
|
||||
</option>
|
||||
{% if args.default_burn_after == 10000 %}
|
||||
<option selected value="10000">
|
||||
{%- else %}
|
||||
<option value="10000">
|
||||
{%- endif %}
|
||||
10000th Read
|
||||
</option>
|
||||
</optgroup>
|
||||
{% if args.default_burn_after == 0 %}
|
||||
<option selected value="0">
|
||||
{%- else %}
|
||||
<option value="0">
|
||||
{%- endif %}
|
||||
No Limit
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{% if args.highlightsyntax %}
|
||||
<div>
|
||||
<label for="syntax-highlight">Syntax Highlighting</label><br>
|
||||
<label for="syntax-highlight">Syntax</label><br>
|
||||
<select style="width: 100%;" name="syntax-highlight" id="syntax-highlight">
|
||||
<option value="none">None</option>
|
||||
<optgroup label="Source Code">
|
||||
|
@ -59,38 +141,38 @@
|
|||
<input type="hidden" name="syntax-highlight" value="none">
|
||||
{%- endif %}
|
||||
|
||||
{% if !args.no_file_upload %}
|
||||
<div>
|
||||
<label>File attachment</label>
|
||||
<br>
|
||||
<div id="input-bg">
|
||||
<input style="width: 100%;" type="file" id="file" name="file">
|
||||
{% if args.editable || args.private %}
|
||||
<label>Other</label>
|
||||
{%- endif %}
|
||||
{% if args.editable %}
|
||||
<div>
|
||||
<input type="checkbox" id="editable" name="editable" value="editable">
|
||||
<label for="editable">Editable</label>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% if args.private %}
|
||||
<div>
|
||||
<input type="checkbox" id="private" name="private" value="private">
|
||||
<label for="private">Private</label>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<label>Content</label>
|
||||
<br>
|
||||
<textarea style="width: 100%; min-height: 100px" name="content" autofocus></textarea>
|
||||
<br>
|
||||
<div style="display: grid;
|
||||
grid-gap: 4px;
|
||||
grid-template-columns: repeat(auto-fit, 120px);
|
||||
grid-template-rows: repeat(1, 50px); ">
|
||||
{% if args.editable %}
|
||||
<div>
|
||||
<input type="checkbox" id="editable" name="editable" value="editable">
|
||||
<label for="editable">Editable</label>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% if args.private %}
|
||||
<div>
|
||||
<input type="checkbox" id="private" name="private" value="private">
|
||||
<label for="private">Private</label>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% if !args.no_file_upload %}
|
||||
<div>
|
||||
<label for="file" id="attach-file-button-label"><a role="button" id="attach-file-button">Attach File</a></label>
|
||||
<br>
|
||||
<input type="file" id="file" name="file" />
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% if args.readonly %}
|
||||
<input style="width: 140px; background-color: limegreen" disabled type="submit" value="Read Only" />
|
||||
{%- else %}
|
||||
|
@ -101,23 +183,40 @@
|
|||
<br>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const hiddenFileButton = document.getElementById('file');
|
||||
const attachFileButton = document.getElementById('attach-file-button');
|
||||
|
||||
hiddenFileButton.addEventListener('change', function () {
|
||||
attachFileButton.textContent = "Attached: " + this.files[0].name;
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
input::file-selector-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#settings {
|
||||
display: grid;
|
||||
grid-gap: 4px;
|
||||
grid-template-columns: repeat(auto-fit, 150px);
|
||||
grid-template-rows: repeat(1, 90px);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
select {
|
||||
height: 3rem;
|
||||
}
|
||||
|
||||
#file {
|
||||
/* max-height: 22px; */
|
||||
padding-top: 7px;
|
||||
padding-bottom: 13px;
|
||||
background: none;
|
||||
#attach-file-button-label {
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#input-bg {
|
||||
background: var(--background);
|
||||
overflow: hidden;
|
||||
height: 3rem;
|
||||
border-radius: 6px;
|
||||
#file {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
42
templates/info.html
Normal file
42
templates/info.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% include "header.html" %}
|
||||
|
||||
<h2>Welcome to MicroBin</h2>
|
||||
<div style="height: 200px;">
|
||||
<div style="float: left">
|
||||
<h4>Links</h4>
|
||||
<a href="https://docs.microbin.eu" style="margin-right: 1rem">Documentation and Help</a>
|
||||
<br>
|
||||
<a href="https://github.com/szabodanika/microbin" style="margin-right: 1rem">Source Code</a>
|
||||
<br>
|
||||
<a href="https://github.com/szabodanika/microbin/issues" style="margin-right: 1rem">Feedback</a>
|
||||
<br>
|
||||
<a href="microbin.eu/sponsor">Sponsor</a>
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<h4>Info</h4>
|
||||
<table style="width: 400px">
|
||||
<tr>
|
||||
<td><b>Version</b></td>
|
||||
<td>{{version_string}} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Status</b></td>
|
||||
<td>{{status}} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pastas</b></td>
|
||||
<td>{{pastas.len()}} </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if message != "" %}
|
||||
<h4>Messages</h4>
|
||||
<p>{{message}}</p>
|
||||
{%- endif %}
|
||||
|
||||
<br>
|
||||
|
||||
{% include "footer.html" %}
|
|
@ -1,26 +1,39 @@
|
|||
{% include "header.html" %}
|
||||
<div style="float: left">
|
||||
<a style="margin-right: 0.5rem" href="{{ args.public_path }}/raw/{{pasta.id_as_animals()}}">Raw Text Content</a>
|
||||
{% if pasta.file.is_some() %}
|
||||
<a style="margin-right: 0.5rem; margin-left: 0.5rem"
|
||||
href="{{ args.public_path }}/file/{{pasta.id_as_animals()}}/{{pasta.file.as_ref().unwrap().name()}}">
|
||||
Attached file'{{pasta.file.as_ref().unwrap().name()}}' [{{pasta.file.as_ref().unwrap().size}}]
|
||||
</a>
|
||||
{% if pasta.content != "No Text Content" %}
|
||||
<button id="copy-text-button" class="copy-text-button" style="margin-right: 0.5rem">
|
||||
Copy Text
|
||||
</button>
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path }}/raw/{{pasta.id_as_animals()}}">Raw Text
|
||||
Content</a>
|
||||
{%- endif %}
|
||||
{% if args.qr && args.public_path.to_string() != "" %}
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path }}/qr/{{pasta.id_as_animals()}}">QR</a>
|
||||
{%- endif %}
|
||||
{% if pasta.editable %}
|
||||
<a style="margin-right: 0.5rem; margin-left: 0.5rem"
|
||||
href="{{ args.public_path }}/edit/{{pasta.id_as_animals()}}">Edit</a>
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path }}/edit/{{pasta.id_as_animals()}}">Edit</a>
|
||||
{%- endif %}
|
||||
<a style="margin-right: 0.5rem; margin-left: 0.5rem"
|
||||
href="{{ args.public_path }}/remove/{{pasta.id_as_animals()}}">Remove</a>
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path }}/remove/{{pasta.id_as_animals()}}">Remove</a>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<a href="{{ args.public_path }}/pasta/{{pasta.id_as_animals()}}"><i>{{pasta.id_as_animals()}}</i></a>
|
||||
<button id="copy-button" class="copy-button">
|
||||
Copy
|
||||
<a style="margin-right: 0.5rem"
|
||||
href="{{ args.public_path }}/pasta/{{pasta.id_as_animals()}}"><i>{{pasta.id_as_animals()}}</i></a>
|
||||
{% if args.public_path.to_string() != "" %}
|
||||
<button id="copy-url-button" class="copy-url-button" style="margin-right: 0">
|
||||
Copy URL
|
||||
</button>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% if pasta.file.is_some() %}
|
||||
<br>
|
||||
<br>
|
||||
<a href="{{ args.public_path }}/file/{{pasta.id_as_animals()}}/{{pasta.file.as_ref().unwrap().name()}}" download>
|
||||
Download attached file: '{{pasta.file.as_ref().unwrap().name()}}' [{{pasta.file.as_ref().unwrap().size}}]
|
||||
</a>
|
||||
{%- endif %}
|
||||
<br>
|
||||
<br>
|
||||
{% if pasta.content != "No Text Content" %}
|
||||
<div class="code-container">
|
||||
<div style="clear: both;">
|
||||
{% if args.highlightsyntax %}
|
||||
|
@ -30,16 +43,33 @@
|
|||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
<div>
|
||||
<p style="font-size: small">Read {{pasta.read_count}} times, last {{pasta.last_read_time_ago_as_string()}}</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<script>
|
||||
const btn = document.getElementById("copy-button")
|
||||
const copyURLBtn = document.getElementById("copy-url-button")
|
||||
const copyTextBtn = document.getElementById("copy-text-button")
|
||||
const content = `{{ pasta.content_escaped() }}`
|
||||
const url = `{{ args.public_path }}/pasta/{{pasta.id_as_animals()}}`
|
||||
|
||||
btn.addEventListener("click", () => {
|
||||
navigator.clipboard.writeText(content)
|
||||
btn.innerHTML = "Copied"
|
||||
copyURLBtn.addEventListener("click", () => {
|
||||
navigator.clipboard.writeText(url)
|
||||
copyURLBtn.innerHTML = "Copied"
|
||||
setTimeout(() => {
|
||||
btn.innerHTML = "Copy"
|
||||
copyURLBtn.innerHTML = "Copy URL"
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
copyTextBtn.addEventListener("click", () => {
|
||||
navigator.clipboard.writeText(content)
|
||||
copyTextBtn.innerHTML = "Copied"
|
||||
setTimeout(() => {
|
||||
copyTextBtn.innerHTML = "Copy Text"
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
|
@ -82,14 +112,11 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
.copy-text-button,
|
||||
.copy-url-button {
|
||||
font-size: small;
|
||||
background-color: var(--links);
|
||||
color: var(--background-body);
|
||||
margin-right: 0.5rem;
|
||||
margin-left: 0.5rem;
|
||||
padding: 4px;
|
||||
width: 4rem;
|
||||
width: 6rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
{{pasta.expiration_as_string()}}
|
||||
</td>
|
||||
<td>
|
||||
<a style="margin-right:1rem" id="copy-button"
|
||||
<a style="margin-right:1rem; cursor: pointer;" id="copy-button"
|
||||
data-url="{{ args.public_path }}/url/{{pasta.id_as_animals()}}">Copy</a>
|
||||
{% if pasta.editable %}
|
||||
<a style="margin-right:1rem" href="{{ args.public_path }}/edit/{{pasta.id_as_animals()}}">Edit</a>
|
||||
|
|
7
templates/qr.html
Normal file
7
templates/qr.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% include "header.html" %}
|
||||
|
||||
<div style="text-align: center">
|
||||
{{qr}}
|
||||
</div>
|
||||
|
||||
{% include "footer.html" %}
|
Loading…
Add table
Add a link
Reference in a new issue