@axium/storage 0.18.6 → 0.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/api.js +5 -5
- package/dist/server/raw.js +2 -2
- package/package.json +1 -1
package/dist/server/api.js
CHANGED
|
@@ -44,14 +44,14 @@ addRoute({
|
|
|
44
44
|
async GET(request, { id: itemId }) {
|
|
45
45
|
if (!getConfig('@axium/storage').enabled)
|
|
46
46
|
error(503, 'User storage is disabled');
|
|
47
|
-
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true });
|
|
47
|
+
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true }, true);
|
|
48
48
|
return parseItem(item);
|
|
49
49
|
},
|
|
50
50
|
async PATCH(request, { id: itemId }) {
|
|
51
51
|
if (!getConfig('@axium/storage').enabled)
|
|
52
52
|
error(503, 'User storage is disabled');
|
|
53
53
|
const body = await parseBody(request, StorageItemUpdate);
|
|
54
|
-
await authRequestForItem(request, 'storage', itemId, { manage: true });
|
|
54
|
+
await authRequestForItem(request, 'storage', itemId, { manage: true }, true);
|
|
55
55
|
const values = {};
|
|
56
56
|
if ('trash' in body)
|
|
57
57
|
values.trashedAt = body.trash ? new Date() : null;
|
|
@@ -72,7 +72,7 @@ addRoute({
|
|
|
72
72
|
async DELETE(request, { id: itemId }) {
|
|
73
73
|
if (!getConfig('@axium/storage').enabled)
|
|
74
74
|
error(503, 'User storage is disabled');
|
|
75
|
-
const auth = await authRequestForItem(request, 'storage', itemId, { manage: true });
|
|
75
|
+
const auth = await authRequestForItem(request, 'storage', itemId, { manage: true }, true);
|
|
76
76
|
const item = parseItem(auth.item);
|
|
77
77
|
await deleteRecursive(item.type != 'inode/directory', itemId);
|
|
78
78
|
return item;
|
|
@@ -84,7 +84,7 @@ addRoute({
|
|
|
84
84
|
async GET(request, { id: itemId }) {
|
|
85
85
|
if (!getConfig('@axium/storage').enabled)
|
|
86
86
|
error(503, 'User storage is disabled');
|
|
87
|
-
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true });
|
|
87
|
+
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true }, true);
|
|
88
88
|
if (item.type != 'inode/directory')
|
|
89
89
|
error(409, 'Item is not a directory');
|
|
90
90
|
const items = await database
|
|
@@ -103,7 +103,7 @@ addRoute({
|
|
|
103
103
|
async GET(request, { id: itemId }) {
|
|
104
104
|
if (!getConfig('@axium/storage').enabled)
|
|
105
105
|
error(503, 'User storage is disabled');
|
|
106
|
-
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true });
|
|
106
|
+
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true }, true);
|
|
107
107
|
if (item.type != 'inode/directory')
|
|
108
108
|
error(409, 'Item is not a directory');
|
|
109
109
|
const items = await Array.fromAsync(getRecursive(itemId)).catch(withError('Could not get some directory items'));
|
package/dist/server/raw.js
CHANGED
|
@@ -142,7 +142,7 @@ addRoute({
|
|
|
142
142
|
try {
|
|
143
143
|
if (!getConfig('@axium/storage').enabled)
|
|
144
144
|
error(503, 'User storage is disabled');
|
|
145
|
-
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true });
|
|
145
|
+
const { item } = await authRequestForItem(request, 'storage', itemId, { read: true }, true);
|
|
146
146
|
if (item.trashedAt)
|
|
147
147
|
error(410, 'Trashed items can not be downloaded');
|
|
148
148
|
const path = join(getConfig('@axium/storage').data, item.id);
|
|
@@ -189,7 +189,7 @@ addRoute({
|
|
|
189
189
|
async POST(request, { id: itemId }) {
|
|
190
190
|
if (!getConfig('@axium/storage').enabled)
|
|
191
191
|
error(503, 'User storage is disabled');
|
|
192
|
-
const { item, session } = await authRequestForItem(request, 'storage', itemId, { write: true });
|
|
192
|
+
const { item, session } = await authRequestForItem(request, 'storage', itemId, { write: true }, true);
|
|
193
193
|
if (item.immutable)
|
|
194
194
|
error(405, 'Item is immutable');
|
|
195
195
|
if (item.type == 'inode/directory')
|