diff --git a/src/backend/controllers/share/ShareController.ts b/src/backend/controllers/share/ShareController.ts index dbd80b5e9..ead80c55c 100644 --- a/src/backend/controllers/share/ShareController.ts +++ b/src/backend/controllers/share/ShareController.ts @@ -246,6 +246,8 @@ export class ShareController extends PuterController { holder: share.holder.username, created_at: share.createdAt, inherited_from: share.inheritedFrom ?? null, + modified: share.modified, + size: share.size, }; } diff --git a/src/docs/src/FS/getShares.md b/src/docs/src/FS/getShares.md index e868ccb1c..1c4fc5af2 100644 --- a/src/docs/src/FS/getShares.md +++ b/src/docs/src/FS/getShares.md @@ -28,7 +28,7 @@ An object with the following properties: ## Return value -A `Promise` that resolves to an array of share objects, each with `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder` and `inheritedFrom`. +A `Promise` that resolves to an array of share objects, each with `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder`, `inheritedFrom`, `modified` and `size`. `inheritedFrom` is the path of the shared ancestor an access comes from, or `null` when the share is on the item itself. Access inherited from a parent folder is **managed on that folder** — withdrawing it here is not possible, because the grant does not live on this item. diff --git a/src/docs/src/FS/listShared.md b/src/docs/src/FS/listShared.md index 3e4e0b0d3..0abedb007 100644 --- a/src/docs/src/FS/listShared.md +++ b/src/docs/src/FS/listShared.md @@ -27,7 +27,7 @@ An object with the following properties: A `Promise` that resolves to an object with: -- `items` (Array) - The shares on this page. Each has `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer` and `holder`. +- `items` (Array) - The shares on this page. Each has `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder`, `modified` and `size`. - `cursor` (String) - Pass to the next call to get the following page. **Present only while more pages remain.** - `total` (Number) - Present only when `includeTotal` was set. diff --git a/src/docs/src/FS/share.md b/src/docs/src/FS/share.md index 3a3ad8eca..892462f2b 100644 --- a/src/docs/src/FS/share.md +++ b/src/docs/src/FS/share.md @@ -56,6 +56,8 @@ A `Promise` that resolves to an array of share objects, one per recipient/item p - `issuer` (String) - Username of whoever granted the share. - `holder` (String) - Username of whoever received it. - `inheritedFrom` (String) - Path of the shared ancestor this access comes from, or `null` when the share is on the item itself. +- `modified` (Number) - Last-modified time of the item, in unix seconds. +- `size` (Number) - Size of the item in bytes; `null` for a directory. Sharing the same item with the same person again **replaces** their access rather than adding a second share, so raising someone from `read` to `write` is just another call. diff --git a/src/puter-js/src/modules/FileSystem/operations/shareUtil.js b/src/puter-js/src/modules/FileSystem/operations/shareUtil.js index 23f26461f..e7cd3c37b 100644 --- a/src/puter-js/src/modules/FileSystem/operations/shareUtil.js +++ b/src/puter-js/src/modules/FileSystem/operations/shareUtil.js @@ -66,4 +66,6 @@ export const toShare = (row) => ({ issuer: /** @type {string | null} */ (row.issuer ?? null), holder: /** @type {string | null} */ (row.holder ?? null), inheritedFrom: /** @type {string | null} */ (row.inherited_from ?? null), + modified: /** @type {number} */ (row.modified ?? 0), + size: /** @type {number | null} */ (row.size ?? null), }); diff --git a/src/puter-js/src/modules/FileSystem/types.js b/src/puter-js/src/modules/FileSystem/types.js index 797648afd..6e3ebb886 100644 --- a/src/puter-js/src/modules/FileSystem/types.js +++ b/src/puter-js/src/modules/FileSystem/types.js @@ -297,6 +297,8 @@ * @property {string | null} issuer Username of whoever granted it. * @property {string | null} holder Username of whoever received it. * @property {string | null} [inheritedFrom] Shared ancestor this access comes from, if any. + * @property {number} modified Last-modified time of the item, unix seconds. + * @property {number | null} size Size of the item in bytes; null for a directory. */ /**