2020-07-06 10:49:18 +02:00
|
|
|
<div class="container">
|
|
|
|
<section class="panel">
|
|
|
|
<h2>Setup a desktop utility</h2>
|
|
|
|
<p>There may be a desktop client at some point. For now, if you're an advanced user, you can setup
|
|
|
|
scripts/macros.</p>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<section>
|
|
|
|
<h3>First alternative: sh script (native on linux)</h3>
|
2020-07-06 11:05:17 +02:00
|
|
|
<p>If you have the sh shell on your machine (i.e. you are on linux, git bash on windows...) and curl, you can
|
|
|
|
download and use these scripts:</p>
|
|
|
|
<table class="data-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Download link</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>upload_file.sh</td>
|
|
|
|
<td><a href="{{ route('file-linux-script') }}">Download</a></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>shorten_url.sh</td>
|
|
|
|
<td><a href="{{ route('url-linux-script') }}">Download</a></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-07-06 10:49:18 +02:00
|
|
|
<p>You must put a valid auth token (generated in the form at the bottom of this page) in a .ily_token
|
2020-07-06 11:05:17 +02:00
|
|
|
file in your home directory (<code>$HOME/.ily_token</code>).</p>
|
2020-07-06 10:49:18 +02:00
|
|
|
<p>Examples:</p>
|
2020-07-06 11:05:17 +02:00
|
|
|
<pre>upload_file.sh path/to/file</pre>
|
|
|
|
<pre>upload_file.sh path/to/file my_very_important_file.png</pre>
|
|
|
|
<pre>shorten_url.sh https://gitlab.com/ArisuOngaku/ilyli</pre>
|
|
|
|
<pre>shorten_url.sh https://gitlab.com/ArisuOngaku/ilyli repo</pre>
|
2020-07-06 10:49:18 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<h3>Second alternative: implement your own client</h3>
|
|
|
|
<p>
|
|
|
|
To upload the file, you must:
|
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>Set the "Authorization" HTTP header to an auth token (generate one with the form below)</li>
|
|
|
|
<li>Make a proper file upload request either with the method "POST" on / (auto-generates a short
|
|
|
|
url) or "PUT" (choose the target url you want, alphanum)
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<table class="data-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Field name</th>
|
|
|
|
<th>Description</th>
|
2020-07-06 11:05:17 +02:00
|
|
|
<th>Required?</th>
|
|
|
|
<th>Value(s)</th>
|
2020-07-06 10:49:18 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
2020-07-06 11:05:17 +02:00
|
|
|
<tr>
|
|
|
|
<th colspan="4">File upload</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>type</td>
|
|
|
|
<td>Request type</td>
|
|
|
|
<td>Yes</td>
|
|
|
|
<td>file</td>
|
|
|
|
</tr>
|
2020-07-06 10:49:18 +02:00
|
|
|
<tr>
|
|
|
|
<td>upload</td>
|
2020-07-06 11:05:17 +02:00
|
|
|
<td>File field</td>
|
|
|
|
<td>Yes</td>
|
|
|
|
<td>The actual file contents</td>
|
2020-07-06 10:49:18 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>ttl</td>
|
|
|
|
<td>How much time (in seconds) to keep the file</td>
|
2020-07-06 11:05:17 +02:00
|
|
|
<td>No</td>
|
2020-07-06 10:49:18 +02:00
|
|
|
<td>0 (never delete), 30 (delete after 30s)</td>
|
|
|
|
</tr>
|
2020-07-06 11:05:17 +02:00
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th colspan="4">URL shorten</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>type</td>
|
|
|
|
<td>Request type</td>
|
|
|
|
<td>Yes</td>
|
|
|
|
<td>url</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>target_url</td>
|
|
|
|
<td>Target url</td>
|
|
|
|
<td>Yes</td>
|
|
|
|
<td>A valid URL starting with https:// or http://</td>
|
|
|
|
</tr>
|
2020-07-06 10:49:18 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-07-06 11:05:17 +02:00
|
|
|
<p>For examples with curl, please download and review the scripts above.</p>
|
2020-07-06 10:49:18 +02:00
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<section class="panel">
|
|
|
|
<h2>Auth tokens</h2>
|
|
|
|
<form action="{{ route('generate-token') }}" method="POST">
|
|
|
|
{{ macros.csrf(getCSRFToken) }}
|
|
|
|
|
|
|
|
<button type="submit"><i data-feather="plus"></i> Generate a new token</button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<table class="data-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th>Secret</th>
|
|
|
|
<th>Created at</th>
|
|
|
|
<th>Last used at</th>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
{% for token in auth_tokens %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ token.id }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="copyable-text">
|
|
|
|
<div class="content">{{ token.secret }}</div>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>{{ token.created_at.toISOString() }}</td>
|
|
|
|
<td>{{ token.used_at.toISOString() }}</td>
|
|
|
|
<td>
|
|
|
|
<form action="{{ route('revoke-token', token.id) }}" method="POST">
|
|
|
|
<button class="button danger"><i data-feather="trash"></i> Revoke</button>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|