mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
feat: add appdata permission (if applicable) on app share
This commit is contained in:
parent
13e2f72c9f
commit
9751fd92a5
@ -427,6 +427,12 @@ const v0_2 = async (req, res) => {
|
||||
: { id: { name: thing.name } }
|
||||
});
|
||||
}
|
||||
|
||||
app.metadata = db.case({
|
||||
mysql: () => app.metadata,
|
||||
otherwise: () => JSON.parse(app.metadata ?? '{}')
|
||||
})();
|
||||
|
||||
item.app = app;
|
||||
}
|
||||
|
||||
@ -451,6 +457,21 @@ const v0_2 = async (req, res) => {
|
||||
)
|
||||
}
|
||||
|
||||
// Process: conditionally add permission for AppData
|
||||
for ( const item of shares_work.list() ) {
|
||||
if ( item.type !== 'app' ) continue;
|
||||
if ( ! item.app.metadata?.shared_appdata ) continue;
|
||||
|
||||
const app_owner = await get_user({ id: item.app.owner_user_id });
|
||||
|
||||
const appdatadir =
|
||||
`/${app_owner.username}/AppData/${item.app.uid}`;
|
||||
const appdatadir_perm =
|
||||
PermissionUtil.join('fs', appdatadir, 'write');
|
||||
|
||||
item.share_intent.permissions.push(appdatadir_perm);
|
||||
}
|
||||
|
||||
shares_work.clear_invalid();
|
||||
|
||||
// Mark files as successful; further errors will be
|
||||
|
Loading…
Reference in New Issue
Block a user