mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
[API] Improve drive/files
This commit is contained in:
parent
ad181612e6
commit
7b70550ac1
@ -35,6 +35,10 @@ module.exports = async (params, user, app) => {
|
||||
const [folderId = null, folderIdErr] = $(params.folder_id).optional.nullable.id().$;
|
||||
if (folderIdErr) throw 'invalid folder_id param';
|
||||
|
||||
// Get 'type' parameter
|
||||
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).$;
|
||||
if (typeErr) throw 'invalid type param';
|
||||
|
||||
// Construct query
|
||||
const sort = {
|
||||
_id: -1
|
||||
@ -53,6 +57,9 @@ module.exports = async (params, user, app) => {
|
||||
$lt: maxId
|
||||
};
|
||||
}
|
||||
if (type) {
|
||||
query.contentType = new RegExp(`^${type.replace(/\*/g, '.+?')}$`);
|
||||
}
|
||||
|
||||
// Issue query
|
||||
const files = await DriveFile
|
||||
|
Loading…
Reference in New Issue
Block a user