mirror of
https://github.com/szabodanika/microbin
synced 2024-11-10 03:34:17 +00:00
Disabled ediiting for secrets
Realistically this privacy level should not allow modifying the data, but even if we did support that, the UX would be very annoying - it is better to make a new upload
This commit is contained in:
parent
4a7360b90e
commit
7fdc89a48d
3 changed files with 7 additions and 6 deletions
|
@ -157,7 +157,7 @@ pub async fn post_edit_private(
|
|||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
if found && !pastas[index].encrypt_client {
|
||||
let original_content = pastas[index].content.to_owned();
|
||||
|
||||
// decrypt content temporarily
|
||||
|
@ -250,7 +250,7 @@ pub async fn post_submit_edit_private(
|
|||
}
|
||||
}
|
||||
|
||||
if found && pastas[index].editable {
|
||||
if found && pastas[index].editable && !pastas[index].encrypt_client {
|
||||
if pastas[index].readonly {
|
||||
let res = decrypt(pastas[index].encrypted_key.as_ref().unwrap(), &password);
|
||||
if res.is_ok() {
|
||||
|
@ -332,7 +332,7 @@ pub async fn post_edit(
|
|||
|
||||
for (i, pasta) in pastas.iter().enumerate() {
|
||||
if pasta.id == id {
|
||||
if pasta.editable {
|
||||
if pasta.editable && !pasta.encrypt_client {
|
||||
if pastas[i].readonly || pastas[i].encrypt_server {
|
||||
if password != *"" {
|
||||
let res = decrypt(pastas[i].encrypted_key.as_ref().unwrap(), &password);
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
Success!
|
||||
</b> <br>
|
||||
{% endif %}
|
||||
<label for="password"> Please enter the password to open the upload. <sup>
|
||||
<label for="password"> Please enter the
|
||||
password to access or modify this upload. <sup>
|
||||
<a href="/guide#encryption">﹖</a></sup></label>
|
||||
<input id="password-field" required placeholder="Password" type="password" autocomplete="off">
|
||||
<input id="password-hidden" name="password" type="hidden">
|
||||
<button>Open</button>
|
||||
<button>Okay</button>
|
||||
|
||||
{% if status == "incorrect" %}
|
||||
<b>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
Content</a>
|
||||
{%- endif %} {% if args.qr && args.public_path_as_str() != "" %}
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path_as_str() }}/qr/{{pasta.id_as_animals()}}">QR</a>
|
||||
{%- endif %} {% if pasta.editable %}
|
||||
{%- endif %} {% if pasta.editable && !pasta.encrypt_client %}
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path_as_str() }}/edit/{{pasta.id_as_animals()}}">Edit</a>
|
||||
{%- endif %}
|
||||
<a style="margin-right: 1rem" href="{{ args.public_path_as_str() }}/remove/{{pasta.id_as_animals()}}">Remove</a>
|
||||
|
|
Loading…
Reference in a new issue