File tree 2 files changed +41
-2
lines changed
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,48 @@ async function UIDesktop(options){
51
51
channel . onmessage = function ( e ) {
52
52
}
53
53
54
- // channel.postMessage({'hello': 'world'});
55
54
55
+ // Give Camera and Recorder write permissions to Desktop
56
+ puter . kv . get ( 'has_set_default_app_user_permissions' ) . then ( async ( user_permissions ) => {
57
+ if ( ! user_permissions ) {
58
+ // Camera
59
+ try {
60
+ await fetch ( window . api_origin + "/auth/grant-user-app" , {
61
+ "headers" : {
62
+ "Content-Type" : "application/json" ,
63
+ "Authorization" : "Bearer " + window . auth_token ,
64
+ } ,
65
+ "body" : JSON . stringify ( {
66
+ app_uid : 'app-5584fbf7-ed69-41fc-99cd-85da21b1ef51' ,
67
+ permission : `fs:${ html_encode ( window . desktop_path ) } :write`
68
+ } ) ,
69
+ "method" : "POST" ,
70
+ } ) ;
71
+ } catch ( err ) {
72
+ console . error ( err ) ;
73
+ }
74
+
75
+ // Recorder
76
+ try {
77
+ await fetch ( window . api_origin + "/auth/grant-user-app" , {
78
+ "headers" : {
79
+ "Content-Type" : "application/json" ,
80
+ "Authorization" : "Bearer " + window . auth_token ,
81
+ } ,
82
+ "body" : JSON . stringify ( {
83
+ app_uid : 'app-7bdca1a4-6373-4c98-ad97-03ff2d608ca1' ,
84
+ permission : `fs:${ html_encode ( window . desktop_path ) } :write`
85
+ } ) ,
86
+ "method" : "POST" ,
87
+ } ) ;
88
+ } catch ( err ) {
89
+ console . error ( err ) ;
90
+ }
91
+
92
+ // Set flag to true
93
+ puter . kv . set ( 'has_set_default_app_user_permissions' , true ) ;
94
+ }
95
+ } )
56
96
// connect socket.
57
97
window . socket = io ( window . gui_origin + '/' , {
58
98
auth : {
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ window.gui = async function(options){
62
62
// DEV: Load the initgui.js file if we are in development mode
63
63
if ( ! window . gui_env || window . gui_env === "dev" ) {
64
64
await window . loadScript ( '/sdk/puter.dev.js' ) ;
65
- // await window.loadScript(`${options.asset_dir}/initgui.js`, {isModule: true});
66
65
}
67
66
68
67
if ( window . gui_env === 'dev2' ) {
You can’t perform that action at this time.
0 commit comments