diff options
author | RaindropsSys <contact@minteck.org> | 2023-07-02 14:21:30 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-07-02 14:21:30 +0200 |
commit | 611753304d0f72f6c61337202659b79596bd7784 (patch) | |
tree | aaf703fe4b128764cded351e4aa387868ce988bb | |
parent | 893fa41dcac78e35c9fafd60599db4ccb2adbbbd (diff) | |
download | kirinos-611753304d0f72f6c61337202659b79596bd7784.tar.gz kirinos-611753304d0f72f6c61337202659b79596bd7784.tar.bz2 kirinos-611753304d0f72f6c61337202659b79596bd7784.zip |
Updated 11 files and added 33 files (automated)
44 files changed, 379 insertions, 8 deletions
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index edbb1c1..1284cfb 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -17,5 +17,6 @@ </option> <option name="myCustomValuesEnabled" value="true" /> </inspection_tool> + <inspection_tool class="JsonSchemaCompliance" enabled="false" level="WARNING" enabled_by_default="false" /> </profile> </component>
\ No newline at end of file @@ -52,6 +52,7 @@ * [ ] Triggers **- Meadowsys** * [ ] Network API **- Meadowsys** * [ ] Screen API **- Meadowsys** + * [ ] System Information API **- Meadowsys** * [ ] Input API **- Meadowsys** * [ ] Session API **- Meadowsys** * [ ] Disks API **- Meadowsys** @@ -64,6 +65,7 @@ * [ ] Profiling API **- Meadowsys** * [ ] Compression API **- Meadowsys** * [ ] Automation API **- Meadowsys** + * [ ] System Extension API **- Meadowsys** * [ ] Helper libraries **- Raindrops** * [x] <s>`libmangoaudio` **- Raindrops**</s> * *More if needed* diff --git a/apps/I like mangoes.mpi/app.json b/apps/I like mangoes.mpi/app.json index 9e26dfe..6ac7e09 100644 --- a/apps/I like mangoes.mpi/app.json +++ b/apps/I like mangoes.mpi/app.json @@ -1 +1,3 @@ -{}
\ No newline at end of file +{ + "debuggable": true +}
\ No newline at end of file diff --git a/apps/I like mangoes.mpi/index.html b/apps/I like mangoes.mpi/index.html index fac32f9..955cacc 100644 --- a/apps/I like mangoes.mpi/index.html +++ b/apps/I like mangoes.mpi/index.html @@ -6,5 +6,6 @@ </head> <body> <h1>mango</h1> + <button onclick="MangoKit._debugPermissions.request([ 'mangoos.permission.SEND_NOTIFICATIONS', 'mangoos.permission.NETWORK_INTERNET' ])">Test</button> </body> </html>
\ No newline at end of file diff --git a/core/desktop/index.html b/core/desktop/index.html index 21d1eb9..48483d5 100644 --- a/core/desktop/index.html +++ b/core/desktop/index.html @@ -234,6 +234,44 @@ </style> </head> <body> + <script> + function transferError(error) { + console.error(error); + + for (let el of Array.from(document.getElementsByTagName("webview"))) { + el.outerHTML = ""; + } + + for (let el of Array.from(document.getElementsByTagName("iframe"))) { + el.outerHTML = ""; + } + + Array.from(document.getElementsByClassName("full-message-item")).forEach(i => i.style.display = "none"); + document.getElementById("full-message-system").style.display = ""; + document.getElementById("full-message").style.display = ""; + + return false; + } + + window.addEventListener('error', (event, source, lineno, colno, error) => { + console.warn(event, source, lineno, colno); + console.error(error); + + for (let el of Array.from(document.getElementsByTagName("webview"))) { + el.outerHTML = ""; + } + + for (let el of Array.from(document.getElementsByTagName("iframe"))) { + el.outerHTML = ""; + } + + Array.from(document.getElementsByClassName("full-message-item")).forEach(i => i.style.display = "none"); + document.getElementById("full-message-system").style.display = ""; + document.getElementById("full-message").style.display = ""; + + return false; + }); + </script> <div id="bg"></div> <div id="full-message" style="display: none;"> @@ -252,6 +290,24 @@ <span style="display: block; max-width: 75%; margin: 20px auto;text-align: center;">Sorry, a system error occurred and your device needs to restart.</span> <span style="width: max-content; margin: 0 auto; display: block; padding: 5px 10px; border-radius: 5px; background-color: rgba(255, 255, 255, .5); text-align: center;" class="full-message-button" onclick="reboot();">Restart</span> </div> + <div id="full-message-permissions" class="full-message-item" style="display: none;"> + <span style="display: block; font-size: 24px; text-align: center;"><b id="full-message-permissions-app">App</b> is requesting access to the following</span> + <span style="display: block; max-width: 75%; margin: 20px auto;" id="full-message-permissions-list"> + <div class="permission" style="display: grid; grid-template-columns: 32px 1fr; grid-gap: 10px; margin-bottom: 10px;"> + <div style="display: flex; align-items: center; justify-content: center;"> + <img src="./permissions/default.svg" alt="" style="width: 32px; height: 32px;"> + </div> + <div> + <b>Some permission</b><br>This will allow the application to do stuff + </div> + </div> + </span> + <span style="width: max-content; display: block; text-align: center; margin: 30px auto 0;"> + <span style="padding: 5px 10px; border-radius: 5px; background-color: rgba(255, 255, 255, .5);" class="full-message-button" onclick="window.currentPermissionsRequest['accept']();">Allow</span> + <span style="padding: 5px 10px; border-radius: 5px; background-color: rgba(255, 255, 255, .5);" class="full-message-button" onclick="window.currentPermissionsRequest['reject'](false);">Reject</span> + <span style="padding: 5px 10px; border-radius: 5px; background-color: rgba(255, 255, 255, .5);" class="full-message-button" onclick="window.currentPermissionsRequest['reject'](true);">Don't ask again</span> + </span> + </div> </div> <div id="status-outer"> @@ -282,14 +338,14 @@ <script src="./wm.js"></script> <script> const wm = window.wm = new WindowManager(); - wm.createWindow({ + /*wm.createWindow({ title: "Test Window", sandbox: true, frameless: false, debuggable: true, isolatedPath: "/mango/demo", url: "file:///mango/demo/test.html" - }); + });*/ </script> <script> diff --git a/core/desktop/permissions.json b/core/desktop/permissions.json new file mode 100644 index 0000000..ab6650a --- /dev/null +++ b/core/desktop/permissions.json @@ -0,0 +1,122 @@ +{ + "mangoos.permission.CAMERA": { + "name": "Access your camera", + "description": "This application will be able to record video from your camera while it is running." + }, + "mangoos.permission.MICROPHONE": { + "name": "Access your microphone", + "description": "This application will be able to record audio from your microphone will it is running." + }, + "mangoos.permission.SEND_NOTIFICATIONS": { + "name": "Send and display notifications", + "description": "This application will be able to display notifications and run in the background." + }, + "mangoos.permission.NETWORK_INTERNET": { + "name": "Access the internet and your local network", + "description": "This application will be able to connect to the internet and devices in your network." + }, + "mangoos.permission.NETWORK_SERVER": { + "name": "Accept incoming connections from other devices", + "description": "This application will be able to act as a server and listen for connections from devices." + }, + "mangoos.permission.SCREEN_CONFIG": { + "name": "Access the system graphics configuration", + "description": "This application will be able to access information about your graphics and displays." + }, + "mangoos.permission.SIMULATE_INPUT": { + "name": "Control input devices", + "description": "This application will be able to act as if it was an input device." + }, + "mangoos.permission.USER_SESSION": { + "name": "Manage your user account", + "description": "This application will be able to manage your session and user information." + }, + "mangoos.permission.DISKS_RO": { + "name": "Access the system storage configuration", + "description": "This application will be able to access information about the device's disks." + }, + "mangoos.permission.DISKS_RW": { + "name": "Change the system storage configuration", + "description": "This application will be able to repartition, erase and restore your disks." + }, + "mangoos.permission.STARTUP": { + "name": "Run when you log in", + "description": "This application will be able to open as soon as you log into this account." + }, + "mangoos.permission.START_DOWNLOADS": { + "name": "Download files to your device", + "description": "This application will be able to start downloads into your downloads folder." + }, + "mangoos.permission.MANAGE_DOWNLOADS": { + "name": "Manage running downloads", + "description": "This application will be able to access information about all downloads made." + }, + "mangoos.permission.FILES_DOCUMENTS_RO": { + "name": "Read your documents", + "description": "This application will be able to read all files in your documents folder." + }, + "mangoos.permission.FILES_MUSIC_RO": { + "name": "Read your music", + "description": "This application will be able to read all files in your music folder." + }, + "mangoos.permission.FILES_PICTURES_RO": { + "name": "Read your pictures", + "description": "This application will be able to read all files in your pictures folder." + }, + "mangoos.permission.FILES_VIDEOS_RO": { + "name": "Read your videos", + "description": "This application will be able to read all files in your videos folder." + }, + "mangoos.permission.FILES_DOWNLOADS_RO": { + "name": "Read your downloaded files", + "description": "This application will be able to read all files in your downloads folder." + }, + "mangoos.permission.FILES_DOCUMENTS_RW": { + "name": "Change your documents", + "description": "This application will be able to modify all files in your documents folder." + }, + "mangoos.permission.FILES_MUSIC_RW": { + "name": "Change your music", + "description": "This application will be able to modify all files in your music folder." + }, + "mangoos.permission.FILES_PICTURES_RW": { + "name": "Change your pictures", + "description": "This application will be able to modify all files in your pictures folder." + }, + "mangoos.permission.FILES_VIDEOS_RW": { + "name": "Change your videos", + "description": "This application will be able to modify all files in your videos folder." + }, + "mangoos.permission.FILES_DOWNLOADS_RW": { + "name": "Change your downloaded files", + "description": "This application will be able to modify all files in your downloads folder." + }, + "mangoos.permission.FILES_ALL": { + "name": "Fully access all of your files", + "description": "This application will be able to modify all files in your account." + }, + "mangoos.permission.SYSTEM_SETTINGS_RO": { + "name": "Read secure system settings", + "description": "This application will be able to read advanced system settings." + }, + "mangoos.permission.SYSTEM_SETTINGS_RW": { + "name": "Change secure system settings", + "description": "This application will be able to modify advanced system settings." + }, + "mangoos.permission.AUTOMATION": { + "name": "Control other applications on the system", + "description": "This application will be able to control other applications like it was you." + }, + "mangoos.permission.MANAGE_APPLICATIONS": { + "name": "Manage applications running on the system", + "description": "This application will be able to open and close other applications on the system." + }, + "mangoos.permission.APPLICATION_STORE": { + "name": "Install, update and uninstall applications", + "description": "This application will be able to install, modify and uninstall non-system applications." + }, + "mangoos.permission.SYSTEM_INFORMATION": { + "name": "Read system information", + "description": "This application will be able to access real-time system information about your hardware." + } +} diff --git a/core/desktop/permissions/default.svg b/core/desktop/permissions/default.svg new file mode 100644 index 0000000..ab4cdee --- /dev/null +++ b/core/desktop/permissions/default.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M300-370h40v-140h-40v50h-60v40h60v50Zm100-50h320v-40H400v40Zm220-110h40v-50h60v-40h-60v-50h-40v140Zm-380-50h320v-40H240v40Zm90 460v-80H140q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v520q0 24-18 42t-42 18H630v80H330ZM140-260h680v-520H140v520Zm0 0v-520 520Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.APPLICATION_STORE.svg b/core/desktop/permissions/mangoos.permission.APPLICATION_STORE.svg new file mode 100644 index 0000000..080c277 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.APPLICATION_STORE.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M450-154v-309L180-619v309l270 156Zm60 0 270-156v-310L510-463.162V-154Zm-30-360 266-155-266-154-267 154 267 155ZM150-258q-14.25-8.426-22.125-22.213T120-310v-340q0-16 7.875-29.787Q135.75-693.574 150-702l300-173q14.328-8 30.164-8Q496-883 510-875l300 173q14.25 8.426 22.125 22.213T840-650v340q0 16-7.875 29.787Q824.25-266.426 810-258L510-85q-14.328 8-30.164 8Q464-77 450-85L150-258Zm330-222Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.AUTOMATION.svg b/core/desktop/permissions/mangoos.permission.AUTOMATION.svg new file mode 100644 index 0000000..f1cc5fa --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.AUTOMATION.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M226-160q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19ZM226-414q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19ZM226-668q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Zm254 0q-28 0-47-19t-19-47q0-28 19-47t47-19q28 0 47 19t19 47q0 28-19 47t-47 19Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.CAMERA.svg b/core/desktop/permissions/mangoos.permission.CAMERA.svg new file mode 100644 index 0000000..21c1590 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.CAMERA.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M140-160q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h520q24 0 42 18t18 42v215l160-160v410L720-435v215q0 24-18 42t-42 18H140Zm0-60h520v-520H140v520Zm0 0v-520 520Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.DISKS_RO.svg b/core/desktop/permissions/mangoos.permission.DISKS_RO.svg new file mode 100644 index 0000000..908114d --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.DISKS_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M540-200q17 0 28.5-11.5T580-240q0-17-11.5-28.5T540-280q-17 0-28.5 11.5T500-240q0 17 11.5 28.5T540-200Zm140 0q17 0 28.5-11.5T720-240q0-17-11.5-28.5T680-280q-17 0-28.5 11.5T640-240q0 17 11.5 28.5T680-200ZM120-430v-390q0-24 18-42t42-18h600q24 0 42 18t18 42v390h-60v-390H180v390h-60Zm60 60v230h600v-230H180Zm0 290q-24 0-42-18t-18-42v-290h720v290q0 24-18 42t-42 18H180Zm0-350h600-600Zm0 60h600-600Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.DISKS_RW.svg b/core/desktop/permissions/mangoos.permission.DISKS_RW.svg new file mode 100644 index 0000000..908114d --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.DISKS_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M540-200q17 0 28.5-11.5T580-240q0-17-11.5-28.5T540-280q-17 0-28.5 11.5T500-240q0 17 11.5 28.5T540-200Zm140 0q17 0 28.5-11.5T720-240q0-17-11.5-28.5T680-280q-17 0-28.5 11.5T640-240q0 17 11.5 28.5T680-200ZM120-430v-390q0-24 18-42t42-18h600q24 0 42 18t18 42v390h-60v-390H180v390h-60Zm60 60v230h600v-230H180Zm0 290q-24 0-42-18t-18-42v-290h720v290q0 24-18 42t-42 18H180Zm0-350h600-600Zm0 60h600-600Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_ALL.svg b/core/desktop/permissions/mangoos.permission.FILES_ALL.svg new file mode 100644 index 0000000..aeff1a6 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_ALL.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M334-420h412L614-596 504-450l-74-86-96 116ZM100-120q-24.75 0-42.375-17.625T40-180v-560h60v560h740v60H100Zm120-120q-24.75 0-42.375-17.625T160-300v-520q0-24.75 17.625-42.375T220-880h240l80 80h320q24.75 0 42.375 17.625T920-740v440q0 24.75-17.625 42.375T860-240H220Zm0-60h640v-440H515l-80-80H220v520Zm0 0v-520 520Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RO.svg b/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RO.svg new file mode 100644 index 0000000..2b7216f --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M343-420h225v-60H343v60Zm0-90h395v-60H343v60Zm0-90h395v-60H343v60Zm-83 400q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RW.svg b/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RW.svg new file mode 100644 index 0000000..2b7216f --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_DOCUMENTS_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M343-420h225v-60H343v60Zm0-90h395v-60H343v60Zm0-90h395v-60H343v60Zm-83 400q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RO.svg b/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RO.svg new file mode 100644 index 0000000..bda38b2 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m490-383 228-228-42-41-185 186-97-97-42 42 138 138ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RW.svg b/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RW.svg new file mode 100644 index 0000000..bda38b2 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_DOWNLOADS_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m490-383 228-228-42-41-185 186-97-97-42 42 138 138ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RO.svg b/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RO.svg new file mode 100644 index 0000000..44e4679 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M486-333q41 0 70-28.42T585-431v-252h116v-60H545v237q-11-9-26.319-14-15.319-5-32.681-5-39.06 0-66.03 27.366t-26.97 67Q393-391 419.97-362T486-333ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RW.svg b/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RW.svg new file mode 100644 index 0000000..44e4679 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_MUSIC_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M486-333q41 0 70-28.42T585-431v-252h116v-60H545v237q-11-9-26.319-14-15.319-5-32.681-5-39.06 0-66.03 27.366t-26.97 67Q393-391 419.97-362T486-333ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RO.svg b/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RO.svg new file mode 100644 index 0000000..16f5f28 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M345-377h391L609-548 506-413l-68-87-93 123Zm-85 177q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RW.svg b/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RW.svg new file mode 100644 index 0000000..16f5f28 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_PICTURES_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M345-377h391L609-548 506-413l-68-87-93 123Zm-85 177q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RO.svg b/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RO.svg new file mode 100644 index 0000000..0b1df6b --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m424-373 260-167-260-167v334ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RW.svg b/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RW.svg new file mode 100644 index 0000000..0b1df6b --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.FILES_VIDEOS_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m424-373 260-167-260-167v334ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-620h60v620h620v60H140Zm120-740v560-560Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.MANAGE_APPLICATIONS.svg b/core/desktop/permissions/mangoos.permission.MANAGE_APPLICATIONS.svg new file mode 100644 index 0000000..2c87b73 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.MANAGE_APPLICATIONS.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M180-120q-24.75 0-42.375-17.625T120-180v-600q0-24.75 17.625-42.375T180-840h600q24.75 0 42.375 17.625T840-780v600q0 24.75-17.625 42.375T780-120H180Zm0-60h600v-520H180v520Zm300.041-105Q400-285 337-328.152q-63-43.151-92-112Q274-509 336.959-552t143-43Q560-595 623-551.849q63 43.152 92 112.001Q686-371 623.041-328t-143 43ZM480-335q57 0 104.949-27.825T660-440q-27.102-49.35-75.051-77.175Q537-545 480-545t-104.949 27.825Q327.102-489.35 300-440q27.102 49.35 75.051 77.175Q423-335 480-335Zm0-105Zm.118 50Q501-390 515.5-404.618q14.5-14.617 14.5-35.5Q530-461 515.382-475.5q-14.617-14.5-35.5-14.5Q459-490 444.5-475.382q-14.5 14.617-14.5 35.5Q430-419 444.618-404.5q14.617 14.5 35.5 14.5Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.MANAGE_DOWNLOADS.svg b/core/desktop/permissions/mangoos.permission.MANAGE_DOWNLOADS.svg new file mode 100644 index 0000000..56f38b1 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.MANAGE_DOWNLOADS.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M260-120v-73l47-47H140q-24 0-42-18t-18-42v-480q0-24 18-42t42-18h397v60H140v480h680v-139h60v139q0 24-18 42t-42 18H652l48 47v73H260Zm367-226L434-539l42-42 121 120v-379h60v379l121-120 42 42-193 193Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.MICROPHONE.svg b/core/desktop/permissions/mangoos.permission.MICROPHONE.svg new file mode 100644 index 0000000..a1e748e --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.MICROPHONE.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-423q-43 0-72-30.917-29-30.916-29-75.083v-251q0-41.667 29.441-70.833Q437.882-880 479.941-880t71.559 29.167Q581-821.667 581-780v251q0 44.167-29 75.083Q523-423 480-423Zm0-228Zm-30 531v-136q-106-11-178-89t-72-184h60q0 91 64.288 153t155.5 62Q571-314 635.5-376 700-438 700-529h60q0 106-72 184t-178 89v136h-60Zm30-363q18 0 29.5-13.5T521-529v-251q0-17-11.788-28.5Q497.425-820 480-820q-17.425 0-29.212 11.5Q439-797 439-780v251q0 19 11.5 32.5T480-483Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.NETWORK_INTERNET.svg b/core/desktop/permissions/mangoos.permission.NETWORK_INTERNET.svg new file mode 100644 index 0000000..ee32a9b --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.NETWORK_INTERNET.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-43-61v-82q-35 0-59-26t-24-61v-44L149-559q-5 20-7 39.5t-2 39.5q0 130 84.5 227T437-141Zm294-108q22-24 38.5-51t28-56.5q11.5-29.5 17-60.5t5.5-63q0-106-58-192.5T607-799v18q0 35-24 61t-59 26h-87v87q0 17-13.5 28T393-568h-83v88h258q17 0 28 13t11 30v127h43q29 0 51 17t30 44Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.NETWORK_SERVER.svg b/core/desktop/permissions/mangoos.permission.NETWORK_SERVER.svg new file mode 100644 index 0000000..50a2510 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.NETWORK_SERVER.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M286.882-717Q266-717 251.5-702.382q-14.5 14.617-14.5 35.5Q237-646 251.618-631.5q14.617 14.5 35.5 14.5Q308-617 322.5-631.618q14.5-14.617 14.5-35.5Q337-688 322.382-702.5q-14.617-14.5-35.5-14.5Zm0 414Q266-303 251.5-288.382q-14.5 14.617-14.5 35.5Q237-232 251.618-217.5q14.617 14.5 35.5 14.5Q308-203 322.5-217.618q14.5-14.617 14.5-35.5Q337-274 322.382-288.5q-14.617-14.5-35.5-14.5ZM154-839h651q16 0 25.5 9.5t9.5 25.813V-535q0 17.425-9.5 29.212Q821-494 805-494H154q-15 0-24.5-11.788Q120-517.575 120-535v-268.687q0-16.313 9.5-25.813T154-839Zm26 60v225h600v-225H180Zm-26 353h647q15 0 27 12.5t12 28.527V-121q0 20-12 30.5T801-80H159q-16 0-27.5-10.5T120-121v-263.973q0-16.027 9.5-28.527T154-426Zm26 60v226h600v-226H180Zm0-413v225-225Zm0 413v226-226Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SCREEN_CONFIG.svg b/core/desktop/permissions/mangoos.permission.SCREEN_CONFIG.svg new file mode 100644 index 0000000..e0dd633 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SCREEN_CONFIG.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M330-120v-80H140q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v520q0 24-18 42t-42 18H630v80H330ZM140-260h680v-520H140v520Zm0 0v-520 520Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SEND_NOTIFICATIONS.svg b/core/desktop/permissions/mangoos.permission.SEND_NOTIFICATIONS.svg new file mode 100644 index 0000000..fa84e09 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SEND_NOTIFICATIONS.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M160-200v-60h84v-306q0-84 49.5-149.5T424-798v-29q0-23 16.5-38t39.5-15q23 0 39.5 15t16.5 38v29q81 17 131 82.5T717-566v306h83v60H160Zm320-295Zm0 415q-32 0-56-23.5T400-160h160q0 33-23.5 56.5T480-80ZM304-260h353v-306q0-74-51-126t-125-52q-74 0-125.5 52T304-566v306Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SIMULATE_INPUT.svg b/core/desktop/permissions/mangoos.permission.SIMULATE_INPUT.svg new file mode 100644 index 0000000..7ec945b --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SIMULATE_INPUT.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M140-200q-24 0-42-18.5T80-260v-440q0-24 18-42t42-18h680q24 0 42 18t18 42v440q0 23-18 41.5T820-200H140Zm0-60h680v-440H140v440Zm160-65h360v-60H300v60Zm-97-125h60v-60h-60v60Zm124 0h60v-60h-60v60Zm123 0h60v-60h-60v60Zm124 0h60v-60h-60v60Zm123 0h60v-60h-60v60ZM203-575h60v-60h-60v60Zm124 0h60v-60h-60v60Zm123 0h60v-60h-60v60Zm124 0h60v-60h-60v60Zm123 0h60v-60h-60v60ZM140-260v-440 440Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.STARTUP.svg b/core/desktop/permissions/mangoos.permission.STARTUP.svg new file mode 100644 index 0000000..e12cf33 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.STARTUP.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M450-438v-406h60v406h-60Zm30 320q-74 0-139.5-28.5T226-224q-49-49-77.5-114.5T120-478q0-80 34-149.5T250-751l42 42q-53 43-82.5 102.5T180-478.022Q180-353 267.5-265.5 355-178 480-178q125.357 0 212.679-87.5Q780-353 780-478.022 780-547 750.5-607.5 721-668 670-709l43-42q60 51 93.5 122T840-478q0 74-28.5 139.5t-77 114.5q-48.5 49-114 77.5T480-118Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.START_DOWNLOADS.svg b/core/desktop/permissions/mangoos.permission.START_DOWNLOADS.svg new file mode 100644 index 0000000..d47c7eb --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.START_DOWNLOADS.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M220-160q-24 0-42-18t-18-42v-143h60v143h520v-143h60v143q0 24-18 42t-42 18H220Zm260-153L287-506l43-43 120 120v-371h60v371l120-120 43 43-193 193Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SYSTEM_INFORMATION.svg b/core/desktop/permissions/mangoos.permission.SYSTEM_INFORMATION.svg new file mode 100644 index 0000000..93f485c --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SYSTEM_INFORMATION.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M450-298v-256h60v256h-60Zm30.018-300Q466-598 456.5-607.482q-9.5-9.483-9.5-23.5 0-14.018 9.2-23.518T479-664q14.45 0 24.225 9.482 9.775 9.483 9.775 23.5 0 14.018-9.482 23.518-9.483 9.5-23.5 9.5ZM260-40q-24 0-42-18t-18-42v-760q0-24 18-42t42-18h440q24 0 42 18t18 42v760q0 24-18 42t-42 18H260Zm0-90v30h440v-30H260Zm0-60h440v-580H260v580Zm0-640h440v-30H260v30Zm0 0v-30 30Zm0 700v30-30Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RO.svg b/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RO.svg new file mode 100644 index 0000000..dc0d1ec --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M427-120v-225h60v83h353v60H487v82h-60Zm-307-82v-60h247v60H120Zm187-166v-82H120v-60h187v-84h60v226h-60Zm120-82v-60h413v60H427Zm166-165v-225h60v82h187v60H653v83h-60Zm-473-83v-60h413v60H120Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RW.svg b/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RW.svg new file mode 100644 index 0000000..dc0d1ec --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.SYSTEM_SETTINGS_RW.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M427-120v-225h60v83h353v60H487v82h-60Zm-307-82v-60h247v60H120Zm187-166v-82H120v-60h187v-84h60v226h-60Zm120-82v-60h413v60H427Zm166-165v-225h60v82h187v60H653v83h-60Zm-473-83v-60h413v60H120Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/permissions/mangoos.permission.USER_SESSION.svg b/core/desktop/permissions/mangoos.permission.USER_SESSION.svg new file mode 100644 index 0000000..a0bc007 --- /dev/null +++ b/core/desktop/permissions/mangoos.permission.USER_SESSION.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-481q-66 0-108-42t-42-108q0-66 42-108t108-42q66 0 108 42t42 108q0 66-42 108t-108 42ZM160-160v-94q0-38 19-65t49-41q67-30 128.5-45T480-420q62 0 123 15.5t127.921 44.694q31.301 14.126 50.19 40.966Q800-292 800-254v94H160Zm60-60h520v-34q0-16-9.5-30.5T707-306q-64-31-117-42.5T480-360q-57 0-111 11.5T252-306q-14 7-23 21.5t-9 30.5v34Zm260-321q39 0 64.5-25.5T570-631q0-39-25.5-64.5T480-721q-39 0-64.5 25.5T390-631q0 39 25.5 64.5T480-541Zm0-90Zm0 411Z"/></svg>
\ No newline at end of file diff --git a/core/desktop/wm.js b/core/desktop/wm.js index 35dc7bf..c2bfcda 100644 --- a/core/desktop/wm.js +++ b/core/desktop/wm.js @@ -1,6 +1,7 @@ const uuid = require('uuid-v4'); const { ipcRenderer } = require('electron'); const path = require("path"); +const crypto = require("crypto"); class WindowManager { #stack; @@ -217,6 +218,7 @@ class WindowManager { this.#properties[id] = { title: options['title'] ?? "(none)", + application: options['application'] ?? null, isolatedPath: options['isolatedPath'] ?? "", frameless: options['frameless'] ?? false, rounded: options['rounded'] ?? false, @@ -283,8 +285,18 @@ class WindowManager { clearInterval(c); let webContents = i.#properties[id].webContents = require("@electron/remote").webContents.fromId(document.getElementById("window-" + id + "-contents-webview").getWebContentsId()); - let isolatedPath = i.#properties[id].isolatedPath; + let isolatedPath = encodeURI(i.#properties[id].isolatedPath); let name = i.#properties[id]['application'] ?? i.#properties[id]['title']; + let appId = crypto.createHash("sha1").update(isolatedPath).digest("hex"); + + if (!fs.existsSync("/mango/session/config/permissions")) fs.mkdirSync("/mango/session/config/permissions"); + if (!fs.existsSync("/mango/session/config/permissions/" + appId + ".json")) fs.writeFileSync("/mango/session/config/permissions/" + appId + ".json", JSON.stringify({ + allowed: [], + rejected: [] + })); + + let permissions = JSON.parse(fs.readFileSync("/mango/session/config/permissions/" + appId + ".json").toString()); + console.log(permissions); document.getElementById("window-" + id + "-contents-webview").addEventListener('page-title-updated', (event) => { console.info("Updated title for " + id + ": " + event['title'] + " (" + event['explicitSet'] + ")"); @@ -303,6 +315,66 @@ class WindowManager { Array.from(document.getElementsByClassName("full-message-item")).forEach(i => i.style.display = "none"); document.getElementById("full-message-crash").style.display = ""; document.getElementById("full-message").style.display = ""; + } else if (event.channel === "ready") { + document.getElementById("window-" + id + "-contents-webview").send("permissionUpdate", permissions['allowed']); + } else if (event.channel === "run") { + eval(event.args[0]); + } else if (event.channel === "requestPermissions") { + try { + window.currentPermissionsRequest = { + accept: () => { + document.getElementById('full-message').style.display = 'none'; + + for (let permission of event.args[0]['permissions']) { + if (!permissions['allowed'].includes(permission)) permissions['allowed'].push(permission); + } + + fs.writeFileSync("/mango/session/config/permissions/" + appId + ".json", JSON.stringify(permissions)); + + document.getElementById("window-" + id + "-contents-webview").send("permissionUpdate", permissions['allowed']); + }, + reject: (force) => { + document.getElementById('full-message').style.display = 'none'; + + if (force) { + for (let permission of event.args[0]['permissions']) { + if (!permissions['rejected'].includes(permission)) permissions['rejected'].push(permission); + } + + fs.writeFileSync("/mango/session/config/permissions/" + appId + ".json", JSON.stringify(permissions)); + } + } + } + + if (document.getElementById("full-message").style.display === "") return; + + let permList = JSON.parse(fs.readFileSync("./core/desktop/permissions.json").toString()); + let list = event.args[0]['permissions'].filter(i => !permissions['rejected'].includes(i) && !permissions['allowed'].includes(i)); + + if (list.length > 0) { + document.getElementById("full-message-permissions-app").innerText = name; + document.getElementById("full-message-permissions-list").innerHTML = list.map(i => ` + <div class="permission" style="display: grid; grid-template-columns: 32px 1fr; grid-gap: 10px; margin-bottom: 10px;"> + <div style="display: flex; align-items: center; justify-content: center;"> + <img src="./permissions/${fs.existsSync("./core/desktop/permissions/" + i + ".svg") ? i : "default"}.svg" alt="" style="width: 32px; height: 32px;"> + </div> + <div> + <b>${permList[i] ? permList[i]['name'] : i}</b><br>${permList[i] ? permList[i]['description'] : ""} + </div> + </div> + `).join(""); + Array.from(document.getElementsByClassName("full-message-item")).forEach(i => i.style.display = "none"); + document.getElementById("full-message-permissions").style.display = ""; + document.getElementById("full-message").style.display = ""; + } + } catch (e) { + console.error(e); + wm.closeWindow(id); + document.getElementById("full-message-crash-app").innerText = name; + Array.from(document.getElementsByClassName("full-message-item")).forEach(i => i.style.display = "none"); + document.getElementById("full-message-crash").style.display = ""; + document.getElementById("full-message").style.display = ""; + } } }); @@ -644,4 +716,18 @@ class WindowManager { // TODO: Broadcast a maximise AND a resize event to the client } + + getTaskbarItems() { + return Object.keys(this.#properties).map((id) => { + let win = this.#properties[id]; + + return { + id, + title: win.title, + minimised: win.minimised, + focused: wm.getWindow(id).focused, + application: win.application ?? null + } + }); + } }
\ No newline at end of file diff --git a/core/launcher/index.html b/core/launcher/index.html index 0087835..9f61577 100644 --- a/core/launcher/index.html +++ b/core/launcher/index.html @@ -52,6 +52,14 @@ </style> </head> <body> + <script> + window.addEventListener('error', (event, source, lineno, colno, error) => { + parent.transferError(error); + + return false; + }); + </script> + <div id="launcher" style="display: grid; grid-template-columns: 65px 1fr;"> <div style="border-right: 1px solid rgba(0, 0, 0, .05); display: grid; grid-template-rows: max-content 1fr max-content; background-color: rgba(0, 0, 0, .05);"> <div> @@ -101,6 +109,7 @@ <script> function openAbout() { parent.wm.createWindow({ + application: "system", title: "About mangoOS", sandbox: false, frameless: true, diff --git a/core/power/index.html b/core/power/index.html index 051bd7b..9a96add 100644 --- a/core/power/index.html +++ b/core/power/index.html @@ -62,6 +62,14 @@ </style> </head> <body> + <script> + window.addEventListener('error', (event, source, lineno, colno, error) => { + parent.transferError(error); + + return false; + }); + </script> + <div id="options" style="display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 10px; padding: 8px 20px;"> <div onclick="askForConfirm('poweroff');" class="power-option" style="display: flex; width: 96px; align-items: center; justify-content: center;"> <div style="pointer-events: none;"> diff --git a/core/status/index.html b/core/status/index.html index e7a0cd0..066532f 100644 --- a/core/status/index.html +++ b/core/status/index.html @@ -36,6 +36,14 @@ </style> </head> <body> + <script> + window.addEventListener('error', (event, source, lineno, colno, error) => { + parent.transferError(error); + + return false; + }); + </script> + <div id="bg"></div> <div id="status-bar" style="padding: 0 20px;"> <div id="bar-left" style="display: inline-block; height: 100%;"> @@ -44,7 +52,7 @@ </a> </div> <div id="bar-right" style="margin-left: auto; display: inline-block; width: max-content; float: right; height: 100%;"> - <a onclick="parent.statusUpdate({ action: 'clickOn', item: 'volume' });" id="item-volume" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;"> + <a onclick="prout(); parent.statusUpdate({ action: 'clickOn', item: 'volume' });" id="item-volume" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;"> <img id="item-volume-icon" src="" style="width: 24px; pointer-events: none; vertical-align: middle;"> </a><a onclick="parent.statusUpdate({ action: 'clickOn', item: 'network' });" id="item-network" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;"> <img id="item-network-icon" src="" style="width: 24px; pointer-events: none; vertical-align: middle;"> diff --git a/lib/mangokit/index.js b/lib/mangokit/index.js index 493f2ba..9238f09 100644 --- a/lib/mangokit/index.js +++ b/lib/mangokit/index.js @@ -1,8 +1,39 @@ const { contextBridge, ipcRenderer } = require('electron'); +const fs = require('fs'); +const uuid = require('uuid-v4'); + +let list = []; + +function runOnSystem(func) { + ipcRenderer.sendToHost("run", func.toString().match(/[^{]+{([\s\S]*)}$/)[1].trim()); +} + +function sanitiseHTML(html) { + return html.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<>>", "<"); +} + +ipcRenderer.once("permissionUpdate", (event, newList) => { + list = newList; +}); + +const Permissions = { + request: (permissions) => { + ipcRenderer.sendToHost("requestPermissions", { + permissions: permissions.map(i => sanitiseHTML(i).replaceAll("/", ".")), + unique: uuid() + }); + }, + has: (permission) => { + return list.includes(permission); + } +} contextBridge.exposeInMainWorld("MangoKit", { _crash: () => { ipcRenderer.sendToHost("crash"); - } + }, + _debugPermissions: Permissions, // TODO: Remove this, it's only for debugging // TODO: Add stuff -});
\ No newline at end of file +}); + +ipcRenderer.sendToHost("ready");
\ No newline at end of file @@ -47,7 +47,7 @@ else echo $KEY >> /mango/users/0/crypt/secret.sig PASSPHRASE=$(node setup/unwraptest.js) mount -t ecryptfs /mango/users/0/lock /mango/users/0/home -o verbosity=0,key=passphrase:passphrase_passwd=$PASSPHRASE,ecryptfs_sig=$KEY,ecryptfs_fnek_sig=$KEY,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_unlink_sigs - mkdir -p /mango/users/0/home/data /mango/users/0/home/data/Music /mango/users/0/home/data/Downloads /mango/users/0/home/data/Documents /mango/users/0/home/data/Pictures /mango/users/0/home/config /mango/users/0/home/apps + mkdir -p /mango/users/0/home/data /mango/users/0/home/data/Music /mango/users/0/home/data/Downloads /mango/users/0/home/data/Documents /mango/users/0/home/data/Pictures /mango/users/0/home/data/Videos /mango/users/0/home/config /mango/users/0/home/apps umount /mango/users/0/home fi @@ -0,0 +1,14 @@ +const hello = (param) => { + console.log("hello"); + + if (param) { + console.log("yes"); + } else { + console.log("no"); + } +} + +let functionSourceCode = hello.toString(); +let sourceCodeInsideFunction = functionSourceCode.match(/[^{]+{([\s\S]*)}$/)[1]; + +console.log(sourceCodeInsideFunction);
\ No newline at end of file |