Luzifer / ots

One-Time-Secret sharing platform with a symmetric 256bit AES encryption in the browser
https://ots.fyi
Apache License 2.0
422 stars 67 forks source link

add a value to "Default" expiry #153

Open tchbla opened 7 months ago

tchbla commented 7 months ago

I suggest displaying the default expiry value as text next to the default button, or alternatively, preselecting the default value.

Based on my code analysis, the default value appears to be identical to the configured maximum value. I implemented a frontend workaround that appends the text from the last element of the select list to the default label. You can view the result in the following image: image

Additionally, it might be beneficial to include an option in the specification for defining the default value. For instance, we could specify the shortest available period as the default while still allowing manual selection of longer expiry periods.

Please note that my current implementation is a temporary JavaScript solution, so no pull request is attached to this request. If time permits, I am considering submitting one in the future πŸ˜„.

tchbla commented 7 months ago

In addition I suggest trimming the newline and spaces before adding the values into the html dom. So that these spaces and newlines become removed πŸ˜‰ image

Luzifer commented 7 months ago

In addition I suggest trimming the newline and spaces before adding the values into the html dom. So that these spaces and newlines become removed πŸ˜‰

Autoformatter says: No.

Luzifer commented 7 months ago

Additionally, it might be beneficial to include an option in the specification for defining the default value.

The default value is set through the SECRET_EXPIRY environment variable and is used by the API when there is no value for expiry set which is exactly what the frontend choice "Default Expiry" does: It does not specify any value and therefore leaves the choice to the server.

Having two "defaults" is kinda confusing. On the one hand configuring the default expiry and then also configuring the default-frontend-expiry which is not the value of "Default Expiry" and also must match one of the software-defined choices not deriving by one second.

I suggest displaying the default expiry value as text next to the default button, or alternatively, preselecting the default value.

That's not that easy: How would you display SECRET_EXPIRY=263543? In Go notation that's 73h12m23s or assuming 86400s as a day "3 Days, 1 Hour, 12 Minutes, 23 Seconds". Sure, that's a constructed case but something to be taken into account. The full field text would then be "Default Expiry (3 Days, 1 Hour, 12 Minutes, 23 Seconds)" which is "a little" too long…

In this case also the default value cannot be selected as it simply does not exist in the dropdown.

Based on my code analysis, the default value appears to be identical to the configured maximum value.

The default value is null, which leaves the choice to the server (which can be infinite storage of the secret). Which also is difficult to display ("Default Expiry (Infinity)"? - too confusing for users)…

mshedsilegx commented 2 months ago

@Luzifer What would be the best approach to just display the value of default expiry or the related custom value if overwritten, in the frontend UI ?

Luzifer commented 2 months ago

Well basically part of https://github.com/Luzifer/ots/pull/161 - Just without the unrelated changes (see my last comment before closing the PR). Will have a look at this myself, just need to find the time.

mshedsilegx commented 2 months ago

Yes, that's exactly what I was looking for. Appreciate the response.