mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-24 06:50:22 +08:00
fix: give camera and recorder write permission to Desktop
This commit is contained in:
parent
01725ffebf
commit
65e6d6c09f
@ -51,8 +51,48 @@ async function UIDesktop(options){
|
||||
channel.onmessage = function(e){
|
||||
}
|
||||
|
||||
// channel.postMessage({'hello': 'world'});
|
||||
|
||||
// Give Camera and Recorder write permissions to Desktop
|
||||
puter.kv.get('has_set_default_app_user_permissions').then(async (user_permissions) => {
|
||||
if(!user_permissions){
|
||||
// Camera
|
||||
try{
|
||||
await fetch( window.api_origin + "/auth/grant-user-app", {
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + window.auth_token,
|
||||
},
|
||||
"body": JSON.stringify({
|
||||
app_uid: 'app-5584fbf7-ed69-41fc-99cd-85da21b1ef51',
|
||||
permission: `fs:${html_encode(window.desktop_path)}:write`
|
||||
}),
|
||||
"method": "POST",
|
||||
});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Recorder
|
||||
try{
|
||||
await fetch( window.api_origin + "/auth/grant-user-app", {
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + window.auth_token,
|
||||
},
|
||||
"body": JSON.stringify({
|
||||
app_uid: 'app-7bdca1a4-6373-4c98-ad97-03ff2d608ca1',
|
||||
permission: `fs:${html_encode(window.desktop_path)}:write`
|
||||
}),
|
||||
"method": "POST",
|
||||
});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Set flag to true
|
||||
puter.kv.set('has_set_default_app_user_permissions', true);
|
||||
}
|
||||
})
|
||||
// connect socket.
|
||||
window.socket = io(window.gui_origin + '/', {
|
||||
auth: {
|
||||
|
@ -62,7 +62,6 @@ window.gui = async function(options){
|
||||
// DEV: Load the initgui.js file if we are in development mode
|
||||
if(!window.gui_env || window.gui_env === "dev"){
|
||||
await window.loadScript('/sdk/puter.dev.js');
|
||||
// await window.loadScript(`${options.asset_dir}/initgui.js`, {isModule: true});
|
||||
}
|
||||
|
||||
if (window.gui_env === 'dev2') {
|
||||
|
Loading…
Reference in New Issue
Block a user