feat: update usage info, include actual origin

This commit is contained in:
neri 2023-03-20 20:33:38 +01:00
parent bf2e91a2c5
commit 39e72a8eb6
5 changed files with 55 additions and 18 deletions

2
Cargo.lock generated
View File

@ -424,7 +424,7 @@ dependencies = [
[[package]]
name = "datatrash"
version = "2.2.2"
version = "2.3.0"
dependencies = [
"actix-files",
"actix-governor",

View File

@ -1,6 +1,6 @@
[package]
name = "datatrash"
version = "2.2.2"
version = "2.3.0"
authors = ["neri"]
edition = "2021"

View File

@ -157,6 +157,19 @@ a.button:visited {
color: var(--fg-light);
}
.usage > p {
display: flex;
flex-direction: column;
}
.usage > p > label {
font-weight: 500;
}
.usage > p > code {
margin-left: 1rem;
}
.large-link {
display: inline-block;
margin-bottom: 1em;

4
static/origin.js Normal file
View File

@ -0,0 +1,4 @@
const originSpans = document.querySelectorAll(".origin");
for (const originSpan of originSpans) {
originSpan.textContent = window.location.origin;
}

View File

@ -40,22 +40,41 @@
</form>
<details class="usage">
<summary>nutzung als api</summary>
<pre>
datei hochladen
curl -F 'file=@yourfile.rs' &lt;domain&gt;/upload
text hochladen
curl -F 'text=your text' &lt;domain&gt;/upload
zeitbegrenzung setzen
curl -F 'text=your text' -F 'keep_for=1800' &lt;domain&gt;/upload
nach einem download löschen
curl -F 'text=your text' -F 'delete_on_download=true' &lt;domain&gt;/upload
authentifizieren
curl -F 'text=your text' -F 'password=…' &lt;domain&gt;/upload</pre
>
<p>
<label for="upload-file">datei hochladen</label>
<code id="upload-file"
>curl -F 'file=@yourfile.rs'
<span class="origin">&lt;origin&gt;</span>/upload</code
>
</p>
<p>
<label for="upload-text">text hochladen</label>
<code id="upload-text"
>curl -F 'text=your text'
<span class="origin">&lt;origin&gt;</span>/upload</code
>
</p>
<p>
<label for="upload-with-time">zeitbegrenzung setzen</label>
<code id="upload-with-time"
>curl -F 'text=your text' -F 'keep_for=1800'
<span class="origin">&lt;origin&gt;</span>/upload</code
>
</p>
<p>
<label for="upload-with-delete">nach einem download löschen</label>
<code id="upload-with-delete"
>curl -F 'text=your text' -F 'delete_on_download=true'
<span class="origin">&lt;origin&gt;</span>/upload</code
>
</p>
<p>
<label for="upload-with-auth">authentifizieren</label>
<code id="upload-with-auth"
>curl -F 'text=your text' -F 'password=…'
<span class="origin">&lt;origin&gt;</span>/upload</code
>
</p>
</details>
</main>
<footer>
@ -69,5 +88,6 @@ authentifizieren
</a>
</footer>
<script src="/static/paste.js"></script>
<script src="/static/origin.js"></script>
</body>
</html>