Skip to content

Commit

Permalink
Merge pull request #6 from JanluOfficial/main
Browse files Browse the repository at this point in the history
A bunch of additions
  • Loading branch information
MTSyntho authored Dec 21, 2024
2 parents 04c18e4 + d9e649e commit 2174d0d
Show file tree
Hide file tree
Showing 30 changed files with 642 additions and 138 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svg.preview.background": "editor"
}
Binary file added assets/sounds/Different.mp3
Binary file not shown.
Binary file added assets/sounds/#.mp3
Binary file not shown.
3 changes: 2 additions & 1 deletion assets/wallpapers/credits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Richard Horvath on Unsplash (https://unsplash.com/@ricvath)
Li Zhang on Unsplash (https://unsplash.com/@sunx)
LekoArts on Unsplash (https://unsplash.com/@lekoarts)
Daniel Menakhovsky on Unsplash (https://unsplash.com/@menakhovsky)
Shubham Dhage on Unsplash (https://unsplash.com/@theshubhamdhage)
Shubham Dhage on Unsplash (https://unsplash.com/@theshubhamdhage)
Sendlinger_Fotografie from Pixabay (https://pixabay.com/users/sendlinger_fotografie-28774278/)
Binary file added assets/wallpapers/lake next to mountains.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/wallpapers/macos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<!DOCTYPE html>
<html>
<html style="background-color: black !important">
<head>
<title>AzuOS</title>
<link rel="stylesheet" href="stylesheets/boot.css">
Expand Down
80 changes: 80 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,78 @@
import subprocess
import os
import pathlib
# Hardware and Platform Related Imports
import psutil, cpuinfo
import platform
from screeninfo import get_monitors
import base64

class Api:
def collect_platform_info(self):
platform_info = {
"system": platform.system(),
"node": platform.node(),
"release": platform.release(),
"version": platform.version(),
"machine": platform.machine(),
"processor": platform.processor(),
"architecture": platform.architecture(),
"python_version": platform.python_version(),
"python_implementation": platform.python_implementation(),
"python_build": platform.python_build(),
"python_compiler": platform.python_compiler(),
"uname": platform.uname()._asdict()
}
try:
platform_info["platform"] = platform.platform()
except Exception as e:
platform_info["platform"] = f"Error: {str(e)}"

return platform_info

def memory_data(self):
return {
"memoryTotal": round(psutil.virtual_memory().total / (1024**3), 2),
"memoryTotalRaw": psutil.virtual_memory().total,
"memoryAvailable": round(psutil.virtual_memory().available / (1024**3), 2),
"memoryAvailableRaw": psutil.virtual_memory().available,
"memoryUsed": round(psutil.virtual_memory().used / (1024**3), 2),
"memoryUsedRaw": psutil.virtual_memory().used,
"memoryFree": round(psutil.virtual_memory().free / (1024 ** 3), 2),
"memoryFreeRaw": psutil.virtual_memory().free
}

def cpu_data(self):
return cpuinfo.get_cpu_info()

def drive_data(self):
drives = []
for partition in psutil.disk_partitions():
try:
usage = psutil.disk_usage(partition.mountpoint)
drives.append({
"device": partition.device,
"mountpoint": partition.mountpoint,
"totalSpace": round(usage.total / (1024**3), 2),
"usedSpace": round(usage.used / (1024**3), 2),
"freeSpace": round(usage.free / (1024**3), 2),
"totalSpaceRaw": usage.total / (1024**3),
"usedSpaceRaw": usage.used / (1024**3),
"freeSpaceRaw": usage.free / (1024**3),
})
except PermissionError:
pass

return drives

def resolve_full_path(self, path):
return str(pathlib.Path(path).expanduser())

def convert_image_to_data_url(self, image_path):
with open(image_path, "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
return f"data:image/png;base64,{encoded_string}"

def get_wifi_networks(self):
print('not implemented')

Expand Down Expand Up @@ -42,6 +111,17 @@ def fetch_file(self, type, path):
return 'file://' + os.path.expanduser(path)
else:
return 'file://' + path

def save_file(self, path, content):
if type == "plain":
if path.startswith("~/"):
# Open the file in write mode
with open(os.path.expanduser(path), 'w') as file:
file.write(content)
else:
with open(path, 'w') as file:
file.write(content)


primaryMonitor = next((m for m in get_monitors() if
m.is_primary), None)
Expand Down
2 changes: 2 additions & 0 deletions libs/api/systeminfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ azuapi.call = (originalCall => {
"height": heightRatio
}
}
} else if (name === 'platinfo') {
return pywebview.api.collect_platform_info();
}
}

Expand Down
33 changes: 32 additions & 1 deletion libs/loadmodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,35 @@ function unloadCSS(file) {
} else {
console.error(`[CSS Injector] CSS file not found: ${file}`);
}
}
}

function unloadRawPathCSS(file) {
const link = document.querySelector(`link[href="${file}"]`);
if (link) {
link.remove();
console.log(`[CSS Injector] Removed CSS file: ${file}`);
} else {
console.error(`[CSS Injector] CSS file not found: ${file}`);
}
}

// function loadTheme(file) {
// const themesPath = "themes/";
// const link = document.querySelector(`link[href="${themesPath + file}"]`);
// if (!link) {
// loadRawPathCSS(themesPath + file);
// } else {
// console.error(`[CSS Injector] Theme already loaded: ${file}`)
// }
// }

// function reloadTheme(file) {
// const themesPath = "themes/";
// unloadRawPathCSS(themesPath + file);
// loadRawPathCSS(themesPath + file);
// }

// function unloadTheme(file) {
// const themesPath = "themes/";
// unloadRawPathCSS(themesPath + file);
// }
8 changes: 6 additions & 2 deletions libs/system/extensionlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
Opens applications corresponding to their file extension
*/

var extension = document.currentScript.getAttribute('script-arguments').split('.').pop();
var extension = document.currentScript.getAttribute('script-arguments').split('.').pop().toLowerCase();
var azutext = ['txt', 'json', 'md']
var azuimg = ['apng', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'cur', 'jfif', 'pjpeg', 'pjp', 'svg']
var scriptfile = ['js']

if (azutext.includes(extension)) {
loadPackage('apps:azutext.js', document.currentScript.getAttribute('script-arguments'))
console.log(`[Extension Link] Opening ${document.currentScript.getAttribute('script-arguments')} in AzuText`)
};
} else if (azuimg.includes(extension)) {
loadPackage('apps:azuimg.js', document.currentScript.getAttribute('script-arguments'))
console.log(`[Extension Link] Opening ${document.currentScript.getAttribute('script-arguments')} in AzuImage`)
}

if (scriptfile.includes(extension)) {
loadScript(document.currentScript.getAttribute('script-arguments'))
Expand Down
Loading

0 comments on commit 2174d0d

Please # to comment.