chore: improve uploads filter help message

This commit is contained in:
Bobby 2022-09-24 08:39:08 +07:00
parent 216ba12b3e
commit f989558dc2
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09

View File

@ -1146,21 +1146,21 @@ page.uploadFiltersHelp = element => {
content.style = 'text-align: left'
content.innerHTML = `${all
? `There are 2 filter keys, namely <b>user</b> (username) and <b>ip</b>.
These keys can be specified more than once.
<b>user</b> and <b>ip</b> keys can be specified more than once.
For usernames with whitespaces, wrap them with double quotes (<code>"</code>).
Special cases such as uploads by non-registered users or have no IPs respectively, use <code>user:-</code> or <code>ip:-</code>.
To match uploads by non-registered users, or have no IPs respectively, use <code>user:-</code> or <code>ip:-</code>.
To exclude certain users/ips while still listing every other uploads, add negation sign (<code>-</code>) before the keys.
Negation sign can also be used to exclude the special cases mentioned above (i.e. <code>-user:-</code> or <code>-ip:-</code>).
To exclude certain users/IPs while still listing every other uploads, add negation sign (<code>-</code>) before the keys.
Negation signs can also be used to exclude uploads by non-registered users, or have no IPs (i.e. <code>-user:-</code> or <code>-ip:-</code>).
If you know the ID of a user's album, you can list its uploads with <b>albumid</b> key.
Negation sign works for this key as well.`
: `There is only 1 filter key, namely <b>albumid</b>.
This key can be specified more than once.
Special case such as uploads with no albums, use <code>albumid:-</code>.
<b>albumid</b> key can be specified more than once.
To match uploads with no albums, use <code>albumid:-</code>.
To exclude certain albums while still listing every other uploads, add negation sign (<code>-</code>) before the keys.
Negation sign can also be used to exclude the special case mentioned above (i.e. <code>-albumid:-</code>).`}
Negation sign can also be used to exclude uploads with no albums (i.e. <code>-albumid:-</code>).`}
There are 2 range keys: <b>date</b> (upload date) and <b>expiry</b> (expiry date).
Their format is: <code>"YYYY/MM/DD HH:MM:SS-YYYY/MM/DD HH:MM:SS"</code> ("from" date and "to" date respectively),
@ -1171,37 +1171,39 @@ page.uploadFiltersHelp = element => {
If only time is specified, today's date will be used.
If you do not need to specify both date and time, you may omit the double quotes.
In conclusion, the following examples are all valid: <code>date:"2020/01/01 01:23-2018/01/01 06"</code>, <code>expiry:-2020/05</code>, <code>date:12:34:56</code>.
These keys can only be specified once each.
<b>date</b> and <b>expiry</b> keys can only be specified once each.
<b>Timezone?</b> Feel free to query the dates with your own timezone.
<b>What about timezones?</b>
Feel free to query the dates in your own timezone.
API requests to the filter endpoint will attach your browser's timezone offset, so the server will automatically calculate timezone differences.
Matches can also be sorted with <b>sort</b> keys.
Their formats are: <code>sort:columnName[:d[escending]]</code>, where <code>:d[escending]</code> is an optional tag to set the direction to descending.
Their format is: <code>sort:columnName[:d[escending]]</code>, where <code>:d[escending]</code> is an optional tag to set the direction to descending.
This key must be used with internal column names used in the database (<code>id</code>, <code>${all ? 'userid' : 'albumid'}</code>, and so on),
but there are 2 shortcuts available: <b>date</b> for <code>timestamp</code> column and <b>expiry</b> for <code>expirydate</code> column.
This key can also be specified more than once, where their order will decide the sorting steps.
Set your uploads view to "List view", then hover any of the table's column headers to see tooltips displaying their internal column names.
<b>sort</b> key can be specified more than once, where their order will decide the sorting steps.
Finally, there are type-<b>is</b> keys to refine by types.
You can use <code>is:image</code>, <code>is:video</code>, and <code>is:audio</code> to list images, videos, audios respectively.
This will only use image, video and audio extensions that are whitelisted internally in the safe.
For images and videos specifically, they will be the ones whose thumbnails can be generated by the safe.
Negation sign works for this key as well.
Mixing inclusion and exclusion is not allowed (i.e. <code>is:image -is:video</code>, since the second key is redundant).
Mixing inclusion and exclusion is not allowed (i.e. <code>is:image -is:video</code>), since the second key will be redundant.
Any leftover keywords which do not use keys (non-keyed keywords) will be matched against the matches' file names.
Any leftover keywords which do not use keys (non-keyed keywords) will be matched against the matches' randomly generated and original names.
Excluding certain keywords is also supported by adding negation sign before the keywords.
<b>Internal steps:</b>
${all
? `- Query uploads passing ALL exclusion filter keys OR matching ANY filter keys, if any.
- Refine matches`
: '- Filter uploads'} using date key, if any.
- Refine matches using expiry key, if any.
- Refine matches using type-is keys, if any.
: '- Filter uploads'} using <b>date</b> key, if any.
- Refine matches using <b>expiry</b> key, if any.
- Refine matches using type-<b>is</b> keys, if any.
- Refine matches using ANY non-keyed keywords, if any.
- Filter matches using ALL exclusion non-keyed keywords, if any.
- Sort matches using sorting keys, if any.
- Sort matches using <b>sort</b> keys, if any.
<b>Examples:</b>
${all