add disk size to neofetch

add local repository to ppm
add MAX_STORAGE constant
lighttpd config
add getFileSystemSize function to fs.js
This commit is contained in:
MeexReay 2025-05-23 18:54:18 +03:00
parent c065cef78b
commit 0abc5e28cb
9 changed files with 49 additions and 13 deletions

View File

@ -1,5 +1,19 @@
# poshlostios
poshlositi os repository
[stable poshlosti](https://poshlostios.meex.lol) \
[unstable poshlosti](https://meexreay.github.io/poshlostios)
# Mirrors
[meex.lol (official)](https://poshlostios.meex.lol) \
[github pages (unstable)](https://meexreay.github.io/poshlostios)
# Local run
You can run PoshlostiOS on your local network with [lighttpd](https://www.lighttpd.net/)
```bash
git clone https://github.com/MeexReay/poshlostios.git
cd poshlostios
lighttpd -f lighttpd.conf -D
```
Then, your server will be available on [127.0.0.1:3000](http://127.0.0.1:3000/index.html)

View File

@ -25,6 +25,11 @@ function getDurationString(start_time) {
return result.join(" ");
}
function getDiskInfo() {
let file_system_size = getFileSystemSize()
return Math.round(file_system_size / 1024)+'KB / '+Math.round(MAX_STORAGE / 1024)+'KB ('+Math.round(file_system_size / MAX_STORAGE * 100)+"%) - pfs"
}
// Function to get CPU, GPU, and memory information
function getSystemInfo() {
const cpuInfo = navigator.hardwareConcurrency;
@ -50,7 +55,7 @@ function getSystemInfo() {
cpuInfo + " cores",
memoryInfo ? memoryInfo * 1024 + ' MB' : 'Not supported',
totalJSHeap.toFixed(2) + ' MB',
gpuInfo ? `${gpuInfo.renderer}` : 'GPU Info not available'
gpuInfo ? `${gpuInfo.renderer}` : 'Poshlosti GGraphics 1.0.233'
]
}
@ -68,7 +73,7 @@ async function main(args) {
Memory: ${now_mem} / ${max_mem}
CPU: ${cpu}
GPU: ${gpu}
Disk (/): ${getDiskInfo()}
@ -79,4 +84,4 @@ async function main(args) {
`)
return 0
}
}

View File

@ -1,8 +1,8 @@
{
"name": "neofetch",
"version": "0.1.1",
"version": "0.1.2",
"description": "neofetch damn",
"author": "MeexReay",
"apps": [ "neofetch.js" ],
"configs": []
}
}

View File

@ -25,6 +25,7 @@ async function processCommand(command, args) {
await writeStdout("\nСтатус код: "+code+"\n")
}
} catch (e) {
console.log(e)
await writeStdout("Не запустилася\n")
}
} else {
@ -87,4 +88,4 @@ async function main(args) {
}
return 0
}
}

View File

@ -1,8 +1,8 @@
{
"name": "ppm",
"version": "0.1.5",
"version": "0.1.6",
"description": "Poshliy Package Manager",
"author": "MeexReay",
"apps": [ "ppm.js" ],
"configs": [ "ppm.json" ]
}
}

View File

@ -1,7 +1,8 @@
{
"repositories": [
"app",
"https://poshlostios.meex.lol/app",
"https://meexreay.github.io/poshlostios/app",
"https://raw.githubusercontent.com/MeexReay/poshlostios/refs/heads/main/app"
]
}
}

2
lighttpd.conf Normal file
View File

@ -0,0 +1,2 @@
server.document-root = var.CWD
server.port = 3000

View File

@ -1,3 +1,4 @@
const MAX_STORAGE = 5120 * 1024 // Limit of local storage size, 5120 KB by default
const APP_REPOSITORY = "app" // Repository url to download apps from
const DEFAULT_APPS = [
"posh", // required
@ -9,4 +10,4 @@ const DEFAULT_APPS = [
"kfc",
"woman"
]
const STARTUP_COMMAND = [ "/app/posh.js" ]
const STARTUP_COMMAND = [ "/app/posh.js" ]

View File

@ -220,4 +220,16 @@ function clearFileSystem() {
callback(fs_mapping)
fs_mapping = {}
saveMapping()
}
}
function getFileSystemSize() {
let total = 0
for (let x in localStorage) {
if (!localStorage.hasOwnProperty(x)) {
continue;
}
let len = ((localStorage[x].length + x.length) * 2)
total += len
}
return total
}