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]] [[package]]
name = "datatrash" name = "datatrash"
version = "2.2.2" version = "2.3.0"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-governor", "actix-governor",

View File

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

View File

@ -157,6 +157,19 @@ a.button:visited {
color: var(--fg-light); 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 { .large-link {
display: inline-block; display: inline-block;
margin-bottom: 1em; 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> </form>
<details class="usage"> <details class="usage">
<summary>nutzung als api</summary> <summary>nutzung als api</summary>
<pre> <p>
datei hochladen <label for="upload-file">datei hochladen</label>
curl -F 'file=@yourfile.rs' &lt;domain&gt;/upload <code id="upload-file"
>curl -F 'file=@yourfile.rs'
text hochladen <span class="origin">&lt;origin&gt;</span>/upload</code
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>
<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> </details>
</main> </main>
<footer> <footer>
@ -69,5 +88,6 @@ authentifizieren
</a> </a>
</footer> </footer>
<script src="/static/paste.js"></script> <script src="/static/paste.js"></script>
<script src="/static/origin.js"></script>
</body> </body>
</html> </html>