From 6cf7d0ae27be8bd6bf3ea51338faa5a83f506e56 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 23 Aug 2024 15:09:25 -0400 Subject: [PATCH 01/49] doc: update CONTRIBUTING.md --- CONTRIBUTING.md | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b28814b4..40a50189 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,25 +57,44 @@ See [doc/contributors/index.md](./doc/contributors/index.md) for more informatio
+## PR Standards + +We expect the following from pull requests (it makes things easier): +- If you're closing an issue, please reference that issue in the PR description +- Avoid whitespace changes +- No regressions for "appspace" (Puter apps) + +
+ ## Commit Messages -Use the imperative, as is the convention in the Linux kernel: +**Note:** we will squash-merge some PRs so they follow . Large PRs should follow conventional commits also. The instructions below are outdated but suitable for most PRs. -- correct: `Improve performance of readdir` -- incorrect: `Improved readdir` -- incorrect: `Improving readdir` +### Conventional Commits +We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) with the following prefixes: +- `fix:` for bug fixes +- `dev:` instead of `refactor:`; covers more basis +- `tweak:` for small updates +- `sync:` when updating data from another source +- `feat:` for a commit that first introduces a new feature + +Commit messages after the prefix should use the imperative (the same convention used in the repo for Linux, which Git was built for): + +- correct: `dev: improve performance of readdir` +- incorrect: `dev: improved readdir` +- incorrect: `dev: improving readdir` We have the following exceptions to this rule: - If the commit message is in _past tense_, it's a shorthand for the following: - - `Apply changes that would be applied after one had ` + - `dev: apply changes that would be applied after one had ` - If the commit message is in _present tense_, it's shorthand for the following: - - `Apply changes that would be applied after ` + - `dev: apply changes that would be applied after ` For example, the following are correct: -- `Improved readdir` - - interpret this as: `Apply changes that would be applied after one had improved readdir` -- `Improving readdir` - - interpret this as: `Apply changes that would be applied after improving readdir` +- `dev: improved readdir` + - interpret this as: `dev: apply changes that would be applied after one had improved readdir` +- `dev: improving readdir` + - interpret this as: `dev: apply changes that would be applied after improving readdir`
From 7f9d1e90b12f8b3f19b1c2ba3b215313dd24fe47 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 23 Aug 2024 16:09:22 -0400 Subject: [PATCH 02/49] chore(puterai): update model --- package-lock.json | 9 +++++---- src/backend/package.json | 2 +- .../src/modules/puterai/OpenAICompletionService.js | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 27fe8268..094c3213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15371,9 +15371,10 @@ "dev": true }, "node_modules/tiktoken": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/tiktoken/-/tiktoken-1.0.15.tgz", - "integrity": "sha512-sCsrq/vMWUSEW29CJLNmPvWxlVp7yh2tlkAjpJltIKqp5CKf98ZNpdeHRmAlPVFlGEbswDc6SmI8vz64W/qErw==" + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/tiktoken/-/tiktoken-1.0.16.tgz", + "integrity": "sha512-hRcORIGF2YlAgWx3nzrGJOrKSJwLoc81HpXmMQk89632XAgURc7IeV2FgQ2iXo9z/J96fCvpsHg2kWoHcbj9fg==", + "license": "MIT" }, "node_modules/tildify": { "version": "2.0.0", @@ -16719,7 +16720,7 @@ "string-hash": "^1.1.3", "string-length": "^6.0.0", "svgo": "^3.0.2", - "tiktoken": "^1.0.15", + "tiktoken": "^1.0.16", "together-ai": "^0.6.0-alpha.4", "tweetnacl": "^1.0.3", "ua-parser-js": "^1.0.38", diff --git a/src/backend/package.json b/src/backend/package.json index d55ced4e..196807c3 100644 --- a/src/backend/package.json +++ b/src/backend/package.json @@ -70,7 +70,7 @@ "string-hash": "^1.1.3", "string-length": "^6.0.0", "svgo": "^3.0.2", - "tiktoken": "^1.0.15", + "tiktoken": "^1.0.16", "together-ai": "^0.6.0-alpha.4", "tweetnacl": "^1.0.3", "ua-parser-js": "^1.0.38", diff --git a/src/backend/src/modules/puterai/OpenAICompletionService.js b/src/backend/src/modules/puterai/OpenAICompletionService.js index 1de9d572..e9cca41f 100644 --- a/src/backend/src/modules/puterai/OpenAICompletionService.js +++ b/src/backend/src/modules/puterai/OpenAICompletionService.js @@ -91,8 +91,7 @@ class OpenAICompletionService extends BaseService { throw new Error('`messages` must be an array'); } - model = model ?? 'gpt-3.5-turbo'; - // model = model ?? 'gpt-4o'; + model = model ?? 'gpt-4o-mini'; for ( let i = 0; i < messages.length; i++ ) { let msg = messages[i]; From 5a616f67dd22a0dcbb8a380bbbd2347a0029ce31 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 23 Aug 2024 16:39:30 -0400 Subject: [PATCH 03/49] fix(puterjs): fix settings object check --- src/puter-js/src/modules/AI.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/puter-js/src/modules/AI.js b/src/puter-js/src/modules/AI.js index a04a79d9..f6ee7f3d 100644 --- a/src/puter-js/src/modules/AI.js +++ b/src/puter-js/src/modules/AI.js @@ -209,8 +209,13 @@ class AI{ } // if any of the args is an object, assume it's the settings object + const is_object = v => { + return typeof v === 'object' && + !Array.isArray(v) && + v !== null; + }; for (let i = 0; i < args.length; i++) { - if (typeof args[i] === 'object') { + if (is_object(args[i])) { settings = args[i]; break; } From eb18550f411947a0d8ccaf283701596b1386cfe6 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 23 Aug 2024 19:42:53 -0400 Subject: [PATCH 04/49] fix(puterai): close streams --- .../src/modules/puterai/ClaudeService.js | 1 + .../src/modules/puterai/GroqAIService.js | 1 + .../src/modules/puterai/MistralAIService.js | 1 + .../modules/puterai/OpenAICompletionService.js | 1 + .../src/modules/puterai/TogetherAIService.js | 1 + src/puter-js/src/lib/utils.js | 17 +++++++---------- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/backend/src/modules/puterai/ClaudeService.js b/src/backend/src/modules/puterai/ClaudeService.js index f171c466..3d8a82af 100644 --- a/src/backend/src/modules/puterai/ClaudeService.js +++ b/src/backend/src/modules/puterai/ClaudeService.js @@ -90,6 +90,7 @@ class ClaudeService extends BaseService { }); stream.write(str + '\n'); } + stream.end(); })(); return retval; diff --git a/src/backend/src/modules/puterai/GroqAIService.js b/src/backend/src/modules/puterai/GroqAIService.js index 3426d779..f0beab72 100644 --- a/src/backend/src/modules/puterai/GroqAIService.js +++ b/src/backend/src/modules/puterai/GroqAIService.js @@ -54,6 +54,7 @@ class GroqAIService extends BaseService { }); stream.write(str + '\n'); } + stream.end(); })(); return retval; } diff --git a/src/backend/src/modules/puterai/MistralAIService.js b/src/backend/src/modules/puterai/MistralAIService.js index 730dca0d..b57219bb 100644 --- a/src/backend/src/modules/puterai/MistralAIService.js +++ b/src/backend/src/modules/puterai/MistralAIService.js @@ -55,6 +55,7 @@ class MistralAIService extends BaseService { }); stream.write(str + '\n'); } + stream.end(); })(); return retval; } diff --git a/src/backend/src/modules/puterai/OpenAICompletionService.js b/src/backend/src/modules/puterai/OpenAICompletionService.js index e9cca41f..304cc0c2 100644 --- a/src/backend/src/modules/puterai/OpenAICompletionService.js +++ b/src/backend/src/modules/puterai/OpenAICompletionService.js @@ -232,6 +232,7 @@ class OpenAICompletionService extends BaseService { }); stream.write(str + '\n'); } + stream.end(); })(); return retval; } diff --git a/src/backend/src/modules/puterai/TogetherAIService.js b/src/backend/src/modules/puterai/TogetherAIService.js index ab0abf95..9001fb94 100644 --- a/src/backend/src/modules/puterai/TogetherAIService.js +++ b/src/backend/src/modules/puterai/TogetherAIService.js @@ -59,6 +59,7 @@ class TogetherAIService extends BaseService { }); stream.write(str + '\n'); } + stream.end(); })(); return retval; } diff --git a/src/puter-js/src/lib/utils.js b/src/puter-js/src/lib/utils.js index 1d8af33f..212ee6be 100644 --- a/src/puter-js/src/lib/utils.js +++ b/src/puter-js/src/lib/utils.js @@ -279,15 +279,12 @@ async function driverCall_( // =============================================== let is_stream = false; - let got_headers = false; let signal_stream_update = null; let lastLength = 0; let response_complete = false; const parts_received = []; xhr.onreadystatechange = () => { - if ( got_headers ) return; - got_headers = true; - if ( xhr.readyState >= 2 ) { + if ( xhr.readyState === 2 ) { if ( xhr.getResponseHeader("Content-Type") !== 'application/x-ndjson' ) return; @@ -311,6 +308,12 @@ async function driverCall_( return resolve_func(Stream()); } + if ( xhr.readyState === 4 ) { + response_complete = true; + if ( is_stream ) { + signal_stream_update?.(); + } + } }; xhr.onprogress = function() { @@ -323,19 +326,13 @@ async function driverCall_( signal_stream_update(); }; - xhr.addEventListener('load', () => { - response_complete = true; - }); - // ======================== // === END OF STREAMING === // ======================== // load: success or error xhr.addEventListener('load', async function(response){ - response_complete = true; if ( is_stream ) { - signal_stream_update?.(); return; } const resp = await parseResponse(response.target); From 02c28018913198e4b817c2af54040f8e7c272995 Mon Sep 17 00:00:00 2001 From: Atharva Chavan <112580278+Atharva089@users.noreply.github.com> Date: Sat, 24 Aug 2024 10:50:37 +0530 Subject: [PATCH 05/49] Added the README.ro.md file Translated the README.en.md file from English to Romanian language. --- doc/i18n/README.ro.md | 129 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 doc/i18n/README.ro.md diff --git a/doc/i18n/README.ro.md b/doc/i18n/README.ro.md new file mode 100644 index 00000000..62b99909 --- /dev/null +++ b/doc/i18n/README.ro.md @@ -0,0 +1,129 @@ +

Puter.com, Computerul Cloud Personal: Toate fișierele, aplicațiile și jocurile tale într-un singur loc, accesibile de oriunde, oricând.

+ +

Sistemul de Operare Internet! Gratuit, Open-Source și Găzduibil Autonom.

+ +

+ Mărime repo GitHub Versiune GitHub Release Licență GitHub +

+

+ « DEMO LIVE » +
+
+ Puter.com + · + SDK + · + Discord + · + YouTube + · + Reddit + · + X (Twitter) + · + Bug Bounty +

+ +

captură de ecran

+ +
+ +## Puter + +Puter este un sistem de operare pe internet avansat, open-source, proiectat să fie bogat în funcții, extrem de rapid și foarte extensibil. Puter poate fi folosit ca: + +- Un cloud personal axat pe confidențialitate pentru a păstra toate fișierele, aplicațiile și jocurile într-un loc sigur, accesibil de oriunde, oricând. +- O platformă pentru construirea și publicarea de site-uri web, aplicații web și jocuri. +- O alternativă la Dropbox, Google Drive, OneDrive, etc. cu o interfață nouă și caracteristici puternice. +- Un mediu desktop la distanță pentru servere și stații de lucru. +- Un proiect prietenos, open-source și o comunitate pentru a învăța despre dezvoltarea web, cloud computing, sisteme distribuite și multe altele! + +
+ +## Începeți + +### 💻 Dezvoltare Locală + +```bash +git clone https://github.com/HeyPuter/puter +cd puter +npm install +npm start +``` + +Acest lucru va lansa Puter la http://puter.localhost:4100 (sau următorul port disponibil). + +
+ +### 🐳 Docker + +```bash +mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter +``` + +
+ +### 🐙 Docker Compose + +### Linux/macOS + +```bash +mkdir -p puter/config puter/data +sudo chown -R 1000:1000 puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml +docker compose up +``` + +
+ +#### Windows + +```powershell + +mkdir -p puter +cd puter +New-Item -Path "puter\config" -ItemType Directory -Force +New-Item -Path "puter\data" -ItemType Directory -Force +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" +docker compose up +``` + +
+ +### ☁️ Puter.com + +Puter este disponibil ca serviciu găzduit la [**puter.com**](https://puter.com). + +
+ +## Cerințe de Sistem + +- **Sisteme de Operare:** Linux, macOS, Windows +- **RAM:** 2GB minim (4GB recomandat) +- **Spațiu pe Disk:** 1GB spațiu liber +- **Node.js:** Versiunea 16+ (Versiunea 22+ recomandată) +- **npm:** Ultima versiune stabilă + +
+ +## Sprijin + +Conectați-vă cu întreținătorii și comunitatea prin următoarele canale: + +- Aveți o problemă sau doriți o funcționalitate nouă? Vă rugăm [să deschideți o problemă](https://github.com/HeyPuter/puter/issues/new/choose). +- Discord: [discord.com/invite/PQcx7Teh8u](https://discord.com/invite/PQcx7Teh8u) +- X (Twitter): [x.com/HeyPuter](https://x.com/HeyPuter) +- Reddit: [reddit.com/r/puter/](https://www.reddit.com/r/puter/) +- Mastodon: [mastodon.social/@puter](https://mastodon.social/@puter) +- Probleme de securitate? [security@puter.com](mailto:security@puter.com) +- Trimiteți un email întreținătorilor la [hi@puter.com](mailto:hi@puter.com) + +Suntem bucuroși să vă ajutăm cu orice întrebări aveți. Nu ezitați să ne întrebați! + +
+ +## Licență + +Acest depozit, inclusiv toate conținuturile sale, sub-proiectele, modulele și componentele, este licențiat sub [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt), cu excepția cazului în care se menționează altfel în mod explicit. Bibliotecile terțe incluse în acest depozit pot fi supuse propriilor licențe. + +
From b5e4962e71d9080eccce73484e9f322c3346d1eb Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Aug 2024 23:06:10 -0700 Subject: [PATCH 06/49] Update README.ro.md --- doc/i18n/README.ro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/i18n/README.ro.md b/doc/i18n/README.ro.md index 62b99909..d56a663f 100644 --- a/doc/i18n/README.ro.md +++ b/doc/i18n/README.ro.md @@ -3,7 +3,7 @@

Sistemul de Operare Internet! Gratuit, Open-Source și Găzduibil Autonom.

- Mărime repo GitHub Versiune GitHub Release Licență GitHub + Mărime repo GitHub Versiune GitHub Release Licență GitHub

« DEMO LIVE » From 9b0bd4f8205e9fa79ce442a8f419358f6be8d57f Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Aug 2024 23:08:15 -0700 Subject: [PATCH 07/49] Add link to Romanian README in the English README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 196aa976..970b6089 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ This repository, including all its contents, sub-projects, modules, and componen - [Japanese / 日本語](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.jp.md) - [Portuguese / Português](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.pt.md) - [Russian / Русский](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ru.md) +- [Romanian / Română](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ro.md) - [Spanish / Español](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.es.md) - [Tamil / தமிழ்](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ta.md) - [Turkish / Türkçe](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.tr.md) From 852f2ea9441ad350ab9f271ed1e0bdbf4cd95b86 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Aug 2024 23:09:04 -0700 Subject: [PATCH 08/49] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 970b6089..5efe8fe8 100644 --- a/README.md +++ b/README.md @@ -142,8 +142,8 @@ This repository, including all its contents, sub-projects, modules, and componen - [Italian / Italiano](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.it.md) - [Japanese / 日本語](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.jp.md) - [Portuguese / Português](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.pt.md) -- [Russian / Русский](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ru.md) - [Romanian / Română](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ro.md) +- [Russian / Русский](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ru.md) - [Spanish / Español](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.es.md) - [Tamil / தமிழ்](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ta.md) - [Turkish / Türkçe](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.tr.md) From ea87223c46f7ccd9db29241264c757f967db5b18 Mon Sep 17 00:00:00 2001 From: Catalin Date: Sat, 24 Aug 2024 20:31:47 +0300 Subject: [PATCH 09/49] Fixes issue #677: Translate README.md from English to Romanian --- doc/i18n/README.ro.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/i18n/README.ro.md b/doc/i18n/README.ro.md index d56a663f..e2ba40e1 100644 --- a/doc/i18n/README.ro.md +++ b/doc/i18n/README.ro.md @@ -1,9 +1,9 @@ -

Puter.com, Computerul Cloud Personal: Toate fișierele, aplicațiile și jocurile tale într-un singur loc, accesibile de oriunde, oricând.

+

Puter.com, Calculatorul Personal Cloud: Toate fișierele, aplicațiile și jocurile dumneavoastră într-un singur loc, accesibile de oriunde și oricând.

Sistemul de Operare Internet! Gratuit, Open-Source și Găzduibil Autonom.

- Mărime repo GitHub Versiune GitHub Release Licență GitHub + Mărime GitHub repository Versiune GitHub Licență GitHub

« DEMO LIVE » @@ -24,7 +24,7 @@ Bug Bounty

-

captură de ecran

+

screenshot


@@ -32,10 +32,10 @@ Puter este un sistem de operare pe internet avansat, open-source, proiectat să fie bogat în funcții, extrem de rapid și foarte extensibil. Puter poate fi folosit ca: -- Un cloud personal axat pe confidențialitate pentru a păstra toate fișierele, aplicațiile și jocurile într-un loc sigur, accesibil de oriunde, oricând. -- O platformă pentru construirea și publicarea de site-uri web, aplicații web și jocuri. -- O alternativă la Dropbox, Google Drive, OneDrive, etc. cu o interfață nouă și caracteristici puternice. -- Un mediu desktop la distanță pentru servere și stații de lucru. +- Un cloud personal care pune pe primul loc confidențialitatea pentru a păstra toate fișierele, aplicațiile și jocurile tale într-un loc sigur, accesibil de oriunde și oricând. +- O platforma pentru a construi și publica site-uri web, aplicații web și jocuri. +- O alternativă la Dropbox, Google Drive, OneDrive, etc. cu o interfață nouă și funcționalități puternice. +- Un mediu desktop la distanță pentru servere si stații de lucru. - Un proiect prietenos, open-source și o comunitate pentru a învăța despre dezvoltarea web, cloud computing, sisteme distribuite și multe altele!
@@ -51,35 +51,36 @@ npm install npm start ``` -Acest lucru va lansa Puter la http://puter.localhost:4100 (sau următorul port disponibil). +Aceasta va lansa Puter la adresa http://puter.localhost:4100 (sau la următorul port disponibil).
### 🐳 Docker + ```bash mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter ```
+ ### 🐙 Docker Compose -### Linux/macOS +#### Linux/macOS ```bash mkdir -p puter/config puter/data sudo chown -R 1000:1000 puter wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml docker compose up ``` -
#### Windows -```powershell +```powershell mkdir -p puter cd puter New-Item -Path "puter\config" -ItemType Directory -Force @@ -87,7 +88,6 @@ New-Item -Path "puter\data" -ItemType Directory -Force Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" docker compose up ``` -
### ☁️ Puter.com @@ -106,9 +106,9 @@ Puter este disponibil ca serviciu găzduit la [**puter.com**](https://puter.com)
-## Sprijin +## Suport -Conectați-vă cu întreținătorii și comunitatea prin următoarele canale: +Conectați-vă cu cei care asigură mentenanța proiectului și comunitatea prin intermediul acestor canale: - Aveți o problemă sau doriți o funcționalitate nouă? Vă rugăm [să deschideți o problemă](https://github.com/HeyPuter/puter/issues/new/choose). - Discord: [discord.com/invite/PQcx7Teh8u](https://discord.com/invite/PQcx7Teh8u) @@ -116,14 +116,14 @@ Conectați-vă cu întreținătorii și comunitatea prin următoarele canale: - Reddit: [reddit.com/r/puter/](https://www.reddit.com/r/puter/) - Mastodon: [mastodon.social/@puter](https://mastodon.social/@puter) - Probleme de securitate? [security@puter.com](mailto:security@puter.com) -- Trimiteți un email întreținătorilor la [hi@puter.com](mailto:hi@puter.com) +- Trimiteți un email celor care asigură mentenanța proiectul la [hi@puter.com](mailto:hi@puter.com) -Suntem bucuroși să vă ajutăm cu orice întrebări aveți. Nu ezitați să ne întrebați! +Suntem întotdeauna bucuroși să vă ajutăm cu orice întrebări aveți. Nu ezitați să ne întrebați!
## Licență -Acest depozit, inclusiv toate conținuturile sale, sub-proiectele, modulele și componentele, este licențiat sub [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt), cu excepția cazului în care se menționează altfel în mod explicit. Bibliotecile terțe incluse în acest depozit pot fi supuse propriilor licențe. +Acest depozit, inclusiv toate conținuturile sale, sub-proiectele, modulele și componentele, sunt licențiate sub [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt), cu excepția cazului în care se menționează altfel în mod explicit. Bibliotecile terțe incluse în acest depozit pot fi supuse propriilor licențe.
From b43ecb490a4032d385f378b1e140d0cb9b43a9c1 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sat, 24 Aug 2024 11:41:42 -0700 Subject: [PATCH 10/49] Place github link and icon in the toolbar --- src/gui/src/UI/UIDesktop.js | 3 +++ src/gui/src/icons/logo-github-white.svg | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 src/gui/src/icons/logo-github-white.svg diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index 0bfb37db..7959643a 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -994,6 +994,9 @@ async function UIDesktop(options){ ht += `
`; } + // github + ht += ``; + // do not show the fullscreen button on mobile devices since it's broken if(!isMobile.phone){ // fullscreen button diff --git a/src/gui/src/icons/logo-github-white.svg b/src/gui/src/icons/logo-github-white.svg new file mode 100644 index 00000000..430c9d03 --- /dev/null +++ b/src/gui/src/icons/logo-github-white.svg @@ -0,0 +1,6 @@ + \ No newline at end of file From 28a7f0ba1fbeed906c764d7963ef33b96f7c4160 Mon Sep 17 00:00:00 2001 From: Panyakornk Date: Mon, 26 Aug 2024 01:00:44 +0700 Subject: [PATCH 11/49] Create README.th.md --- doc/i18n/README.th.md | 131 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 doc/i18n/README.th.md diff --git a/doc/i18n/README.th.md b/doc/i18n/README.th.md new file mode 100644 index 00000000..1108e397 --- /dev/null +++ b/doc/i18n/README.th.md @@ -0,0 +1,131 @@ +

Puter.com, The Personal Cloud Computer: All your files, apps, and games in one place accessible from anywhere at any time.

+ +

ระบบปฏิบัติการอินเทอร์เน็ต ฟรี, โอเพ่นซอร์ส, และสามารถโฮสต์ได้ด้วยตนเอง

+ +

+ GitHub repo size GitHub Release GitHub License +

+

+ « การสาธิตสด » +
+
+ Puter.com + · + ชุดพัฒนาโปรแกรม + · + ดิสคอร์ด + · + ยูทูบ + · + เรดดิท + · + X (ทวิตเตอร์) + · + นักล่าบั๊ก +

+ +

screenshot

+ +
+ +## พิวเตอร์ + +พิวเตอร์ เป็นระบบปฏิบัติการอินเทอร์เน็ตขั้นสูงแบบโอเพ่นซอร์สที่ออกแบบมาให้มีฟีเจอร์ครบถ้วน ความเร็วสูง และมีความสามารถที่จะขยายได้สูง. พิวเตอร์ สามารถใช้ได้เป็น: + +- คลาวด์ส่วนตัว เพื่อเก็บไฟล์, แอพพลิเคชัน, และเกมทั้งหมดของคุณในที่เดียวที่ปลอดภัยและสามารถเข้าถึงได้ทุกที่ทุกเวลา +- แพลตฟอร์มสำหรับการสร้างและเผยแพร่เว็บไซต์, เว็บแอปพลิเคชัน, และเกม +- ทางเลือกอีกหนึ่งทางที่สามารถใช้แทน Dropbox, Google Drive, OneDrive ฯลฯ โดยที่มีอินเทอร์เฟซใหม่และฟีเจอร์ที่ทรงพลัง +- สภาพแวดล้อมสำหรับเดสก์ท็อประยะไกลที่ใช้กับเซิร์ฟเวอร์และสถานีทำงาน +- โครงการโอเพ่นซอร์สและชุมชนที่เป็นมิตรที่คุณสามารถเรียนรู้เกี่ยวกับการพัฒนาเว็บ, คลาวด์คอมพิวติ้ง, ระบบกระจาย, และอีกมากมาย + +
+ +## การเริ่มต้นใช้งาน + + +### 💻 การพัฒนาภายในเครื่อง + +```bash +git clone https://github.com/HeyPuter/puter +cd puter +npm install +npm start +``` + +พิวเตอร์ จะถูกเปิดใช้งานที่ http://puter.localhost:4100 (หรือพอร์ตถัดไปที่ว่าง). + +
+ +### 🐳 ด็อกเกอร์ + + +```bash +mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter +``` + +
+ + +### 🐙 ด็อกเกอร์ คอมโพส + + +#### ลินุกซ์/แมคโอเอส +```bash +mkdir -p puter/config puter/data +sudo chown -R 1000:1000 puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml +docker compose up +``` +
+ +#### วินโดวส์ + + +```powershell +mkdir -p puter +cd puter +New-Item -Path "puter\config" -ItemType Directory -Force +New-Item -Path "puter\data" -ItemType Directory -Force +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" +docker compose up +``` +
+ +### ☁️ Puter.com + +สามารถใช้งาน พิวเตอร์ ได้ในรูปแบบบริการโฮสต์ที่ [**puter.com**](https://puter.com). + +
+ +## ข้อกำหนดของระบบ + +- **ระบบปฏิบัติการ:** ลินุกซ์ แมคโอเอส วินโดวส์ +- **แรม:** อย่างน้อย 2GB (แนะนำ 4GB) +- **พื้นที่เก็บข้อมูล:** พื้นที่ว่าง 1GB +- **Node.js:** เวอร์ชัน 16+ (แนะนำเวอร์ชัน 22+) +- **npm:** เวอร์ชันล่าสุดที่เสถียร + +
+ +## การช่วยเหลือ + +ติดต่อกับผู้ดูแลระบบและชุมชนผ่านช่องทางเหล่านี้: + +- พบข้อผิดพลาดหรือขอฟีเจอร์ใหม่? กรุณา [เปิดปัญหา](https://github.com/HeyPuter/puter/issues/new/choose). +- ดิสคอร์ด: [discord.com/invite/PQcx7Teh8u](https://discord.com/invite/PQcx7Teh8u) +- X (ทวิตเตอร์): [x.com/HeyPuter](https://x.com/HeyPuter) +- เรดดิท: [reddit.com/r/puter/](https://www.reddit.com/r/puter/) +- มาสตอดอน: [mastodon.social/@puter](https://mastodon.social/@puter) +- ปัญหาด้านความปลอดภัย [security@puter.com](mailto:security@puter.com) +- ส่งอีเมลถึงผู้ดูแลระบบได้ที่ [hi@puter.com](mailto:hi@puter.com) + +เรายินดีเสมอที่จะช่วยเหลือคุณกับทุกทุกคำถามที่คุณมี อย่าลังเลที่จะถาม + +
+ + +## ลิขสิทธิ์ + +ที่เก็บข้อมูลนี้ รวมถึงเนื้อหาทั้งหมด, โครงการย่อย, โมดูล, และส่วนประกอบต่างๆ ได้รับใบอนุญาตภายใต้ [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt) เว้นแต่จะมีการระบุไว้เป็นอย่างอื่นอย่างชัดเจน ไลบรารีจากบุคคลที่สามที่รวมอยู่ในที่เก็บข้อมูลนี้อาจอยู่ภายใต้ใบอนุญาตของตนเอง + +
From cd2eb656a1ab8ab01bb5ad350622154692618be7 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 25 Aug 2024 12:30:42 -0700 Subject: [PATCH 12/49] Add link to Thai README in the English README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5efe8fe8..e626fabe 100644 --- a/README.md +++ b/README.md @@ -146,5 +146,6 @@ This repository, including all its contents, sub-projects, modules, and componen - [Russian / Русский](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ru.md) - [Spanish / Español](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.es.md) - [Tamil / தமிழ்](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ta.md) +- [Thai / ไทย](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.th.md) - [Turkish / Türkçe](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.tr.md) - [Vietnamese / Tiếng Việt](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.vi.md) From d8dc3ac12271091d7c808aad0a3ab79d48f5444f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Dub=C3=A9?= Date: Sun, 25 Aug 2024 16:21:48 -0400 Subject: [PATCH 13/49] Update instructions.md --- doc/self-hosters/instructions.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/self-hosters/instructions.md b/doc/self-hosters/instructions.md index becfeccd..04f82036 100644 --- a/doc/self-hosters/instructions.md +++ b/doc/self-hosters/instructions.md @@ -5,16 +5,12 @@ ### Self-Hosting Differences Currently, the self-hosted version of Puter is different in a few ways from [Puter.com](https://puter.com): -- There is no built-in way to install or create other apps (see below) -- Several "core" apps are missing, such as **Code** or **Draw**, because we can't include them in this repository -- Some icons are different +- There is no built-in way to access apps from puter.com (see below) +- Several "core" apps are missing, such as **Code** or **Draw** +- Some assets are different Work is ongoing to improve the **App Center** and make it available on self-hosted. -Until then, it's possible to add other apps by manually editing the database file. -This process is not recommended unless you know what you are doing. -The file will appear after you first launch Puter, and should be found in `puter/data/puter-database.sqlite` for Docker, -or `volatile/runtime/puter-database.sqlite` otherwise. -You will need a database tool that can understand SQLite databases. +Until then, it is still possible to add apps using the **Dev Center** app.
@@ -55,4 +51,4 @@ A warning will persist in the dev console until this user's password is changed. Please login to this user and change the password as your first step. -
\ No newline at end of file +
From 9a622004ea488783127abd83f3f4caf779a5aabb Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 25 Aug 2024 16:54:19 -0400 Subject: [PATCH 14/49] fix: fix 500 when check-app has bad url --- src/backend/src/api/APIError.js | 4 ++++ src/backend/src/services/auth/AuthService.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/backend/src/api/APIError.js b/src/backend/src/api/APIError.js index 93bee20f..70b9628d 100644 --- a/src/backend/src/api/APIError.js +++ b/src/backend/src/api/APIError.js @@ -482,6 +482,10 @@ module.exports = class APIError { status: 422, message: 'This share can not be applied to this user.', }, + 'no_origin_for_app': { + status: 400, + message: 'Puter apps must have a valid URL.' + }, // Chat // TODO: specifying these errors here might be a violation diff --git a/src/backend/src/services/auth/AuthService.js b/src/backend/src/services/auth/AuthService.js index ea0dfe45..d8ab3eb9 100644 --- a/src/backend/src/services/auth/AuthService.js +++ b/src/backend/src/services/auth/AuthService.js @@ -442,6 +442,9 @@ class AuthService extends BaseService { async app_uid_from_origin (origin) { origin = this._origin_from_url(origin); + if ( origin === null ) { + throw APIError.create('no_origin_for_app'); + } return await this._app_uid_from_origin(origin); } From da5635b576b18fa64947483572fc9868bc979e07 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 25 Aug 2024 14:38:19 -0700 Subject: [PATCH 15/49] Show an error if file containing puter.js is loaded using the `file:` protocol --- src/puter-js/src/modules/PuterDialog.js | 81 +++++++++++++++++++------ 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/puter-js/src/modules/PuterDialog.js b/src/puter-js/src/modules/PuterDialog.js index b1e039a4..1c179031 100644 --- a/src/puter-js/src/modules/PuterDialog.js +++ b/src/puter-js/src/modules/PuterDialog.js @@ -1,4 +1,13 @@ class PuterDialog extends HTMLElement { + /** + * Detects if the current page is loaded using the file:// protocol. + * @returns {boolean} True if using file:// protocol, false otherwise. + */ + isUsingFileProtocol = ()=>{ + return window.location.protocol === 'file:'; + } + + constructor(resolve, reject) { super(); this.attachShadow({ mode: 'open' }); @@ -6,8 +15,9 @@ class PuterDialog extends HTMLElement { this.reject = reject; this.resolve = resolve; + let h; // Dialog - this.shadowRoot.innerHTML = ` + h = ` - -
- - -

This website uses Puter to bring you safe, secure, and private AI and Cloud features.

-
- - + .error-container h1 { + color: #e74c3c; + font-size: 20px; + text-align: center; + } + + .puter-dialog-content a:focus{ + outline: none; + } + `; + // Error message for unsupported protocol + if(window.location.protocol === 'file:'){ + h += ` +
+ +
+

Puter.js Error: Unsupported Protocol

+

It looks like you've opened this file directly in your browser (using the file:/// protocol) which is not supported by Puter.js for security reasons.

+

To view this content properly, you need to serve it through a web server. Here are some options:

+
    +
  • Use a local development server (e.g., Python's built-in server or Node.js http-server)
  • +
  • Upload the files to a web hosting service
  • +
  • Use a local server application like XAMPP or MAMP
  • +
+

If you're not familiar with these options, consider reaching out to your development team or IT support for assistance.

+
+

+ Docs| + Github| + Discord +

+
+
`; + }else{ + h += ` +
+ + +

This website uses Puter to bring you safe, secure, and private AI and Cloud features.

+
+ + +
+

Powered by Puter.js

+

By clicking 'Continue' you agree to Puter's Terms of Service and Privacy Policy.

-

Powered by Puter.js

-

By clicking 'Continue' you agree to Puter's Terms of Service and Privacy Policy.

-
-
`; + `; + } + + + this.shadowRoot.innerHTML = h; // Event listener for the 'message' event this.messageListener = async (event) => { @@ -341,7 +388,7 @@ class PuterDialog extends HTMLElement { connectedCallback() { // Add event listener to the button - this.shadowRoot.querySelector('#launch-auth-popup').addEventListener('click', ()=>{ + this.shadowRoot.querySelector('#launch-auth-popup')?.addEventListener('click', ()=>{ let w = 600; let h = 400; let title = 'Puter'; @@ -356,8 +403,8 @@ class PuterDialog extends HTMLElement { window.addEventListener('message', this.messageListener); // Add event listeners for cancel and close buttons - this.shadowRoot.querySelector('#launch-auth-popup-cancel').addEventListener('click', this.cancelListener); - this.shadowRoot.querySelector('.close-btn').addEventListener('click',this.cancelListener); + this.shadowRoot.querySelector('#launch-auth-popup-cancel')?.addEventListener('click', this.cancelListener); + this.shadowRoot.querySelector('.close-btn')?.addEventListener('click',this.cancelListener); } open() { From 5857248651d521f098d86b9251130274322c7c7f Mon Sep 17 00:00:00 2001 From: Yasmeen Date: Mon, 26 Aug 2024 10:49:51 +0300 Subject: [PATCH 16/49] Add Arabic Translation file --- doc/i18n/README.ar.md | 133 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 doc/i18n/README.ar.md diff --git a/doc/i18n/README.ar.md b/doc/i18n/README.ar.md new file mode 100644 index 00000000..d7c23240 --- /dev/null +++ b/doc/i18n/README.ar.md @@ -0,0 +1,133 @@ +

Puter.com، الحاسوب السحابي الشخصي: جميع ملفاتك وتطبيقاتك وألعابك في مكان واحد يمكن الوصول إليه من أي مكان في أي وقت.

+ +

نظام تشغيل الإنترنت! مجاني ومفتوح المصدر وقابل للاستضافة الذاتية.

+ +

+ GitHub repo size GitHub Release GitHub License +

+

+ « عرض توضيحي مباشر » +
+
+ Puter.com + · + مجموعة أدوات التطوير + · + ديسكورد + · + يوتيوب + · + ريديت + · + إكس (تويتر) + · + مكافأة اكتشاف الثغرات +

+ +

لقطة شاشة

+ +
+ +## بيوتر + +
+

بيوتر هو نظام تشغيل إنترنت متقدم ومفتوح المصدر، مصمم ليكون غنيًا بالميزات وسريعًا بشكل استثنائي وقابلًا للتوسع بدرجة كبيرة. يمكن استخدام بيوتر كـ:

+ +
    +
  • سحابة شخصية تعطي الأولوية للخصوصية لحفظ جميع ملفاتك وتطبيقاتك وألعابك في مكان آمن واحد، يمكن الوصول إليه من أي مكان وفي أي وقت.
  • +
  • منصة لبناء ونشر المواقع الإلكترونية وتطبيقات الويب والألعاب
  • +
  • بديل لـ Dropbox وGoogle Drive وOneDrive وغيرها، مع واجهة جديدة وميزات قوية.
  • +
  • بيئة سطح مكتب عن بُعد للخوادم ومحطات العمل.
  • +
  • مشروع ومجتمع ودود ومفتوح المصدر للتعلم عن تطوير الويب والحوسبة السحابية والأنظمة الموزعة والكثير غير ذلك!
  • +
+
+ +
+ +## البدء + +### 💻 التطوير المحلي + +```bash +git clone https://github.com/HeyPuter/puter +cd puter +npm install +npm start +``` + +سيؤدي هذا إلى تشغيل Puter على http://puter.localhost:4100 (أو المنفذ التالي المتاح). + +
+ +### 🐳 دوكر + +```bash +mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter +``` + +
+ +### 🐙 دوكر كومبوز + +#### لينكس/ماك + +```bash +mkdir -p puter/config puter/data +sudo chown -R 1000:1000 puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml +docker compose up +``` + +
+ +#### ويندوز + +```powershell +mkdir -p puter +cd puter +New-Item -Path "puter\config" -ItemType Directory -Force +New-Item -Path "puter\data" -ItemType Directory -Force +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" +docker compose up +``` + +
+ +### ☁️ موقع Puter.com + +متاح Puter كخدمة مستضافة على[**puter.com**](https://puter.com)الموقع + +
+ +## متطلبات النظام + +- **Operating Systems:** لينكس، ماك، ويندوز +- **RAM** ٢ جيجابايت كحد أدنى (يوصى بـ ٤ جيجابايت) +- **Disk Space:** ١ جيجابايت مساحة حرة +- **Node.js:** الإصدار ١٦+ (يوصى بالإصدار ٢٢+) +- **npm:** أحدث إصدار مستقر + +
+ +## الدعم + +تواصل مع المشرفين والمجتمع من خلال هذه القنوات: + +- تقرير عن خطأ أو طلب ميزة؟ الرجاء [فتح مشكلة](https://github.com/HeyPuter/puter/issues/new/choose) + +- دسكورد: [discord.com/invite/PQcx7Teh8u](https://discord.com/invite/PQcx7Teh8u) +- إكس (تويتر): [x.com/HeyPuter](https://x.com/HeyPuter) +- ريديت: [/reddit.com/r/puter](https://www.reddit.com/r/puter/) +- ماستودون: [mastodon.social/@puter](https://mastodon.social/@puter) +- مشاكل أمنية؟ [security@puter.com](mailto:security@puter.com) +- البريد الإلكتروني للمشرفين [hi@puter.com](mailto:hi@puter.com) + +نحن دائمًا سعداء لمساعدتك في أي أسئلة قد تكون لديك. لا تتردد في السؤال! + +
+ +## الترخيص + +هذا المستودع، بما في ذلك جميع محتوياته ومشاريعه الفرعية ووحداته ومكوناته، مرخص تحت [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt) ما لم ينص على خلاف ذلك صراحةً. قد تخضع المكتبات الخارجية المدرجة في هذا المستودع لتراخيصها الخاصة. + +
From 577e0d4ed93fc3e8c7fa1ec7d7300c43d74b9fb5 Mon Sep 17 00:00:00 2001 From: Yasmeen Albalooshi Date: Mon, 26 Aug 2024 10:54:05 +0300 Subject: [PATCH 17/49] Update README.md to have Arabic Translation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e626fabe..ba0ad162 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ This repository, including all its contents, sub-projects, modules, and componen ## Translations +- [Arabic / العربية](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ar.md) - [Bengali / বাংলা](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.bn.md) - [Chinese / 中文](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.zh.md) - [Danish / Dansk](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.da.md) From 11304d82c3229becc8d7647390397aaddd307510 Mon Sep 17 00:00:00 2001 From: VinayakPaka Date: Mon, 26 Aug 2024 20:34:51 +0530 Subject: [PATCH 18/49] translated README.en.md from English to Polish --- doc/i18n/README.pl.md | 123 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 doc/i18n/README.pl.md diff --git a/doc/i18n/README.pl.md b/doc/i18n/README.pl.md new file mode 100644 index 00000000..0c821054 --- /dev/null +++ b/doc/i18n/README.pl.md @@ -0,0 +1,123 @@ +

Puter.com, Osobisty Komputer Chmurowy: Wszystkie twoje pliki, aplikacje i gry w jednym miejscu, dostępne z dowolnego miejsca o dowolnej porze.

+

System Operacyjny Internetu! Darmowy, Open-Source i Możliwy do Samodzielnego Hostowania.

+

+ Rozmiar repozytorium GitHub Wydanie GitHub Licencja GitHub +

+

+ « DEMO NA ŻYWO » +
+
+ Puter.com + · + SDK + · + Discord + · + YouTube + · + Reddit + · + X (Twitter) + · + Bug Bounty +

+

zrzut ekranu

+
+ +## Puter + +Puter to zaawansowany, open-source'owy system operacyjny internetowy, zaprojektowany tak, aby był bogaty w funkcje, wyjątkowo szybki i wysoce rozszerzalny. Puter może być używany jako: + +- Prywatna chmura osobista do przechowywania wszystkich plików, aplikacji i gier w jednym bezpiecznym miejscu, dostępnym z dowolnego miejsca o dowolnej porze. +- Platforma do budowania i publikowania stron internetowych, aplikacji webowych i gier. +- Alternatywa dla Dropbox, Google Drive, OneDrive itp. ze świeżym interfejsem i potężnymi funkcjami. +- Zdalne środowisko pulpitu dla serwerów i stacji roboczych. +- Przyjazny, open-source'owy projekt i społeczność do nauki o tworzeniu stron internetowych, chmurze obliczeniowej, systemach rozproszonych i wielu innych! + +
+ +## Rozpoczęcie pracy +## 💻 Rozwój lokalny + +```bash +git clone https://github.com/HeyPuter/puter +cd puter +npm install +npm start +``` +To uruchomi Puter na http://puter.localhost:4100 (lub na następnym dostępnym porcie). + +
+ +## 🐳 Docker + +```bash +Copy code +mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter +``` +
+ +## 🐙 Docker Compose +## Linux/macOS + +```bash +Copy code +mkdir -p puter/config puter/data +sudo chown -R 1000:1000 puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml +docker compose up +``` +
+ +## Windows + +```powershell +mkdir -p puter +cd puter +New-Item -Path "puter\config" -ItemType Directory -Force +New-Item -Path "puter\data" -ItemType Directory -Force +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" +docker compose up +``` +
+ +## ☁️ Puter.com +Puter jest dostępny jako usługa hostowana na [**puter.com**](https://puter.com). + +
+ +## Wymagania systemowe + +- **Systemy operacyjne:** Linux, macOS, Windows +- **RAM:** Minimum 2GB (zalecane 4GB) +- **Przestrzeń dyskowa:** 1GB wolnego miejsca +- **Node.js:** Wersja 16+ (zalecana wersja 22+) +- **npm:** Najnowsza stabilna wersja + +
+ +## Wsparcie + +Połącz się z opiekunami i społecznością przez te kanały: + +- Raport o błędzie lub prośba o funkcję? Proszę otworzyć zgłoszenie. +- Discord: discord.com/invite/PQcx7Teh8u +- X (Twitter): x.com/HeyPuter +- Reddit: reddit.com/r/puter/ +- Mastodon: mastodon.social/@puter +- Problemy z bezpieczeństwem? security@puter.com +- Email do opiekunów: hi@puter.com + +Zawsze chętnie pomożemy Ci z wszelkimi pytaniami, jakie możesz mieć. Nie wahaj się pytać! +
+ +## Licencja + +To repozytorium, w tym cała jego zawartość, podprojekty, moduły i komponenty, jest licencjonowane na podstawie [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt), chyba że wyraźnie zaznaczono inaczej. Biblioteki stron trzecich zawarte w tym repozytorium mogą podlegać własnym licencjom. + +
+ + + + + From 683c20ca7f4d50299651e7306c9464b33dafb84f Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Mon, 26 Aug 2024 09:22:39 -0700 Subject: [PATCH 19/49] Add links to Korean and Polish READMEs in the English README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ba0ad162..5c2eaa7b 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ This repository, including all its contents, sub-projects, modules, and componen - [Indonesian / Bahasa Indonesia](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.id.md) - [Italian / Italiano](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.it.md) - [Japanese / 日本語](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.jp.md) +- [Korean / 한국어](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ko.md) +- [Polish / Polski](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.pl.md) - [Portuguese / Português](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.pt.md) - [Romanian / Română](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ro.md) - [Russian / Русский](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ru.md) From d2c7477b3bf170be492a6d5387330645cdf9c33a Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 26 Aug 2024 17:42:15 -0400 Subject: [PATCH 20/49] fix(docker): ensure temp admin pass shows --- .../modules/selfhosted/DefaultUserService.js | 14 ++++++++++++- src/backend/src/services/DevConsoleService.js | 21 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/backend/src/modules/selfhosted/DefaultUserService.js b/src/backend/src/modules/selfhosted/DefaultUserService.js index a5873cec..8afa40d5 100644 --- a/src/backend/src/modules/selfhosted/DefaultUserService.js +++ b/src/backend/src/modules/selfhosted/DefaultUserService.js @@ -90,7 +90,18 @@ class DefaultUserService extends BaseService { if ( ! is_default_password ) return; // show console widget - this.default_user_widget = () => { + this.default_user_widget = ({ is_docker }) => { + if ( is_docker ) { + // In Docker we keep the output as simple as possible because + // we're unable to determine the size of the terminal + return [ + 'Password for `admin`: ' + tmp_password, + // TODO: possible bug + // These blank lines are necessary for it to render and + // I'm not entirely sure why anymore. + '', '', + ]; + } const lines = [ `Your admin user has been created!`, `\x1B[31;1musername:\x1B[0m ${USERNAME}`, @@ -100,6 +111,7 @@ class DefaultUserService extends BaseService { surrounding_box('31;1', lines); return lines; }; + this.default_user_widget.critical = true; this.start_poll_({ tmp_password, user }); const svc_devConsole = this.services.get('dev-console'); svc_devConsole.add_widget(this.default_user_widget); diff --git a/src/backend/src/services/DevConsoleService.js b/src/backend/src/services/DevConsoleService.js index 1556c902..93910ac6 100644 --- a/src/backend/src/services/DevConsoleService.js +++ b/src/backend/src/services/DevConsoleService.js @@ -20,11 +20,26 @@ const { consoleLogManager } = require('../util/consolelog'); const BaseService = require('./BaseService'); class DevConsoleService extends BaseService { + static MODULES = { + fs: require('fs'), + } + _construct () { this.static_lines = []; this.widgets = []; this.identifiers = {}; this.has_updates = false; + + try { + const require = this.require; + const fs = require('fs'); + this.is_docker = fs.existsSync('/.dockerenv'); + } catch (e) { + // if this fails, we assume is_docker should + // be false. + this.log.error(e.message); + this.is_docker = false; + } } turn_on_the_warning_lights () { @@ -60,7 +75,7 @@ class DevConsoleService extends BaseService { let positions = []; for ( const w of this.widgets ) { let output; try { - output = w(); + output = w({ is_docker: this.is_docker }); } catch ( e ) { consoleLogManager.log_raw('error', e); to_remove.push(w); @@ -78,6 +93,7 @@ class DevConsoleService extends BaseService { for ( let i = this.widgets.length-1 ; i >= 0 ; i-- ) { if ( size_ok() ) break; const w = this.widgets[i]; + if ( w.critical ) continue; if ( ! w.unimportant ) continue; n_hidden++; const [start, length] = positions[i]; @@ -89,8 +105,9 @@ class DevConsoleService extends BaseService { } for ( let i = this.widgets.length-1 ; i >= 0 ; i-- ) { if ( size_ok() ) break; - n_hidden++; const w = this.widgets[i]; + if ( w.critical ) continue; + n_hidden++; const [start, length] = positions[i]; this.static_lines.splice(start, length); } From aa61c3009c624099e7bd518870b18b02c008530c Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 26 Aug 2024 17:43:33 -0400 Subject: [PATCH 21/49] fix: typo in a default file --- src/backend/src/modules/selfhosted/DefaultUserService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/src/modules/selfhosted/DefaultUserService.js b/src/backend/src/modules/selfhosted/DefaultUserService.js index 8afa40d5..db1c5d08 100644 --- a/src/backend/src/modules/selfhosted/DefaultUserService.js +++ b/src/backend/src/modules/selfhosted/DefaultUserService.js @@ -42,7 +42,7 @@ const DEFAULT_FILES = { } }, "es": { - "date-limit": { + "rate-limit": { "max": 1000, "period": 30000 } From 45925bacb6375f860484afcbd3881bc483d1395a Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Tue, 27 Aug 2024 17:11:48 -0700 Subject: [PATCH 22/49] Improve the usability of the Settings tab in Dev Center --- src/dev-center/css/style.css | 1 + src/dev-center/js/dev-center.js | 109 ++++++++++++++++++++------------ 2 files changed, 70 insertions(+), 40 deletions(-) diff --git a/src/dev-center/css/style.css b/src/dev-center/css/style.css index 02a9f376..cc32ab3a 100644 --- a/src/dev-center/css/style.css +++ b/src/dev-center/css/style.css @@ -264,6 +264,7 @@ section { label, input[type="text"] { display: block; + user-select: none; } #delete-app { diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index 9be94f51..a603f3d2 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -475,6 +475,7 @@ function generate_edit_app_section(app) {
App has been successfully updated.×
+

Basic Info

@@ -487,45 +488,6 @@ function generate_edit_app_section(app) { -
- - -
- -
- - -
- -
- - -
- -
- - - - -
- -
- - - - -
- -
- - -
- -
- - -
-
Change App Icon
@@ -539,6 +501,47 @@ function generate_edit_app_section(app) {

A comma-separated list of file type specifiers. For example if you include .txt, your apps could be opened when a user clicks on a TXT file.

+

Window Settings

+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + +
+ +
+ + +
+ +
@@ -2084,4 +2087,30 @@ $(document).on('change', '#edit-app-maximize-on-start', function (e) { $('#edit-app-window-width, #edit-app-window-height').prop('disabled', false); $('#edit-app-window-top, #edit-app-window-left').prop('disabled', false); } -}) \ No newline at end of file +}) + +$(document).on('change', '#edit-app-background', function (e) { + if($('#edit-app-background').is(":checked")){ + disable_window_settings() + }else{ + enable_window_settings() + } +}) + +function disable_window_settings(){ + $('#edit-app-maximize-on-start').prop('disabled', true); + $('#edit-app-fullpage-on-landing').prop('disabled', true); + $('#edit-app-window-width, #edit-app-window-height').prop('disabled', true); + $('#edit-app-window-top, #edit-app-window-left').prop('disabled', true); + $('#edit-app-window-resizable').prop('disabled', true); + $('#edit-app-hide-titlebar').prop('disabled', true); +} + +function enable_window_settings(){ + $('#edit-app-maximize-on-start').prop('disabled', false); + $('#edit-app-fullpage-on-landing').prop('disabled', false); + $('#edit-app-window-width, #edit-app-window-height').prop('disabled', false); + $('#edit-app-window-top, #edit-app-window-left').prop('disabled', false); + $('#edit-app-window-resizable').prop('disabled', false); + $('#edit-app-hide-titlebar').prop('disabled', false); +} \ No newline at end of file From b1c91758da455d4c9e1a968b7ff98cdd86ecdbb8 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Tue, 27 Aug 2024 17:27:40 -0700 Subject: [PATCH 23/49] Fix sort bug in dev center --- src/dev-center/js/dev-center.js | 34 ++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index a603f3d2..759eac23 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -519,9 +519,9 @@ function generate_edit_app_section(app) {
- + - +
@@ -1318,11 +1318,31 @@ function sort_apps() { let sorted_apps; // sort - if (sortDirection === 'asc') - sorted_apps = apps.sort((a, b) => a[sortBy] > b[sortBy] ? 1 : -1); - else - sorted_apps = apps.sort((a, b) => a[sortBy] < b[sortBy] ? 1 : -1); - + if (sortDirection === 'asc'){ + sorted_apps = apps.sort((a, b) => { + if(sortBy === 'name'){ + return a[sortBy].localeCompare(b[sortBy]); + }else if(sortBy === 'created_at'){ + return new Date(a[sortBy]) - new Date(b[sortBy]); + } else if(sortBy === 'user_count' || sortBy === 'open_count'){ + return a.stats[sortBy] - b.stats[sortBy]; + }else{ + a[sortBy] > b[sortBy] ? 1 : -1 + } + }); + }else{ + sorted_apps = apps.sort((a, b) => { + if(sortBy === 'name'){ + return b[sortBy].localeCompare(a[sortBy]); + }else if(sortBy === 'created_at'){ + return new Date(b[sortBy]) - new Date(a[sortBy]); + } else if(sortBy === 'user_count' || sortBy === 'open_count'){ + return b.stats[sortBy] - a.stats[sortBy]; + }else{ + b[sortBy] > a[sortBy] ? 1 : -1 + } + }); + } // refresh app list $('.app-card').remove(); sorted_apps.forEach(app => { From d285c2097f1c388ebfb36de25c574b1c9f744262 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Tue, 27 Aug 2024 17:34:09 -0700 Subject: [PATCH 24/49] use flexbox for app navbar in dev center --- src/dev-center/css/style.css | 6 +++++- src/dev-center/js/dev-center.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dev-center/css/style.css b/src/dev-center/css/style.css index cc32ab3a..a63c1496 100644 --- a/src/dev-center/css/style.css +++ b/src/dev-center/css/style.css @@ -855,7 +855,11 @@ ol li:before { float:right; margin-bottom: 10px; } .edit-app-navbar{ - overflow: hidden; margin-bottom: 60px; margin-top: 20px; + overflow: hidden; + margin-bottom: 60px; + margin-top: 20px; + display: flex; + align-items: center; } .app-title{ margin-top:0px; diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index 759eac23..6cda6853 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -440,7 +440,7 @@ function generate_edit_app_section(app) { let h = ``; h += `
-
+

${html_encode(app.title)}

From 2385457d125ce9ccba8b0960e8bddbce18ed020a Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Tue, 27 Aug 2024 18:04:04 -0700 Subject: [PATCH 25/49] Remove the redundant `image/` prefix in base64 encoded app icons in dev center --- src/dev-center/index.html | 2 +- src/dev-center/js/dev-center.js | 2 +- src/gui/src/UI/UIDesktop.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dev-center/index.html b/src/dev-center/index.html index e69ecda5..4046b446 100644 --- a/src/dev-center/index.html +++ b/src/dev-center/index.html @@ -245,7 +245,7 @@ - + diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index 6cda6853..f45e958e 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -1111,7 +1111,7 @@ $(document).on('click', '#edit-app-icon', async function (e) { let mimeType = getMimeType(fileExtension); // Replace MIME type in the data URL - image = image.replace('data:application/octet-stream;base64', `data:image/${mimeType};base64`); + image = image.replace('data:application/octet-stream;base64', `data:${mimeType};base64`); $('#edit-app-icon').css('background-image', `url(${image})`); $('#edit-app-icon').attr('data-base64', image); diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index 7959643a..18d5e4d1 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -986,7 +986,7 @@ async function UIDesktop(options){ // 'show desktop' if(window.is_fullpage_mode){ - ht += `Show Desktop `; + ht += `Show Desktop `; } // refer From 2d1cb0050ddf0db44784f76231c5afa7792015c5 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Tue, 27 Aug 2024 22:20:32 -0400 Subject: [PATCH 26/49] dev: puter-wisp --- src/puter-wisp/README.md | 102 +++++ src/puter-wisp/basic.html | 412 ++++++++++++++++++ .../devlog/unit_test_usefulness/a.js | 297 +++++++++++++ .../devlog/unit_test_usefulness/b.js | 307 +++++++++++++ .../devlog/unit_test_usefulness/test_a_b.diff | 18 + src/puter-wisp/package.json | 15 + src/puter-wisp/src/exports.js | 298 +++++++++++++ src/puter-wisp/test/test.js | 50 +++ 8 files changed, 1499 insertions(+) create mode 100644 src/puter-wisp/README.md create mode 100644 src/puter-wisp/basic.html create mode 100644 src/puter-wisp/devlog/unit_test_usefulness/a.js create mode 100644 src/puter-wisp/devlog/unit_test_usefulness/b.js create mode 100644 src/puter-wisp/devlog/unit_test_usefulness/test_a_b.diff create mode 100644 src/puter-wisp/package.json create mode 100644 src/puter-wisp/src/exports.js create mode 100644 src/puter-wisp/test/test.js diff --git a/src/puter-wisp/README.md b/src/puter-wisp/README.md new file mode 100644 index 00000000..bfbab20d --- /dev/null +++ b/src/puter-wisp/README.md @@ -0,0 +1,102 @@ +# Wisp Utilities + +This is still a work in progress. Thes utilities use my own stream interface +to avoid browser/node compatibility issues and because I found it more +convenient. These streams can by used as async iterator objects just like +other conventional implementations. Currently there is no logic for closing +streams or knowing if a stream has been closed, but this is planned. + +## Classes and Factory Functions + +### WispPacket (class) + +Wraps a Uint8Array containing a Wisp packet. `data` should be a Uint8Array +containing only the Wisp frame, starting at the Packet Type and ending at +the last byte of the payload (inclusive). + +```javascript +const packet = new WispPacket({ + data: new Uint8Array(...), + direction: WispPacket.SEND, // or RECV + + // `extra` is optional, for debugging + extra: { some: 'value', }, +}); + +packet.type; // ex: WispPacket.CONTINUE +``` + +#### Methods + +- `describe()` - outputs a summary string + ```javascript + packet.describe(); + // ex: "INFO v2.0 f000000000" + ``` +- `toVirtioFrame` - prepends the size of the Wisp frame (u32LE) +- `log()` - prints a collapsed console group +- `reflect()` - returns a reflected version of the packet (flips `SEND` and `RECV`) + +### NewCallbackByteStream (function) + +Returns a stream for values that get passed through a callback interface. +The stream object (an async iterator object) has a property called +`listener` which can be passed as a listener or called directly. This +listener expects only one argument which is the data to pass through the +stream (typically a value of type `Uint8Array`). + +```javascript +const byteStream = NewCallbackByteStream(); +emulator.add_listener('virtio-console0-output-bytes', + byteStream.listener); +``` + +### NewVirtioFrameStream (function) + +Takes in a byte stream (stream of `Uint8Array`) and assumes that this byte +stream contains integers (u32LE) describing the length (in bytes) of data, +followed by the data. Returns a stream which outputs a complete chunk of +data (as per the specified length) as each value, excluding the bytes that +describe the length. + +```javascript +const virtioStream = NewVirtioFrameStream(byteStream); +``` + +### NewWispPacketStream (function) + +Takes in a stream of `Uint8Array`s, each containing a complete Wisp packet, +and outputs a stream of instances of **WispPacket** + +## Example Use with v86 + +```javascript +const emulator = new V86(...); + +// Get a byte stream for /dev/hvc0 +const byteStream = NewCallbackByteStream(); +emulator.add_listener('virtio-console0-output-bytes', + byteStream.listener); + +// Get a stream of frames with prepended byte lengths +// (for example, `twisp` uses this format) +const virtioStream = NewVirtioFrameStream(byteStream); + +// Get a stream of WispPacket objects +const wispStream = NewWispPacketStream(virtioStream); + +// Async iterator +(async () => { + for ( const packet of wispStream ) { + console.log('Wisp packet!', packet.describe()); + + // Let's send back a reflected packet for INFO! + if ( packet.type === WispPacket.INFO ) { + emulator.bus.send( + 'virtio-console0-input-bytes', + packet.toVirtioFrame(), + ); + } + } +})(); +``` diff --git a/src/puter-wisp/basic.html b/src/puter-wisp/basic.html new file mode 100644 index 00000000..07bbfb3f --- /dev/null +++ b/src/puter-wisp/basic.html @@ -0,0 +1,412 @@ + +Basic Emulator + + + + + + +
+
+ +
diff --git a/src/puter-wisp/devlog/unit_test_usefulness/a.js b/src/puter-wisp/devlog/unit_test_usefulness/a.js new file mode 100644 index 00000000..75b99e7d --- /dev/null +++ b/src/puter-wisp/devlog/unit_test_usefulness/a.js @@ -0,0 +1,297 @@ +const lib = {}; + +// SO: 40031688 +lib.buf2hex = (buffer) => { // buffer is an ArrayBuffer + return [...new Uint8Array(buffer)] + .map(x => x.toString(16).padStart(2, '0')) + .join(''); +} + +// Tiny inline little-endian integer library +lib.get_int = (n_bytes, array8, signed=false) => { + return (v => signed ? v : v >>> 0)( + array8.slice(0,n_bytes).reduce((v,e,i)=>v|=e<<8*i,0)); +} +lib.to_int = (n_bytes, num) => { + return (new Uint8Array()).map((_,i)=>(num>>8*i)&0xFF); +} + +class ATStream { + constructor ({ delegate, acc, transform, observe }) { + this.delegate = delegate; + if ( acc ) this.acc = acc; + if ( transform ) this.transform = transform; + if ( observe ) this.observe = observe; + this.state = {}; + this.carry = []; + } + [Symbol.asyncIterator]() { return this; } + async next_value_ () { + if ( this.carry.length > 0 ) { + console.log('got from carry!', this.carry); + return { + value: this.carry.shift(), + done: false, + }; + } + return await this.delegate.next(); + } + async acc ({ value }) { + return value; + } + async next_ () { + for (;;) { + const ret = await this.next_value_(); + if ( ret.done ) return ret; + const v = await this.acc({ + state: this.state, + value: ret.value, + carry: v => this.carry.push(v), + }); + if ( this.carry.length >= 0 && v === undefined ) { + throw new Error(`no value, but carry value exists`); + } + if ( v === undefined ) continue; + // We have a value, clear the state! + this.state = {}; + if ( this.transform ) { + const new_value = await this.transform( + { value: ret.value }); + return { ...ret, value: new_value }; + } + return { ...ret, value: v }; + } + } + async next () { + const ret = await this.next_(); + if ( this.observe && !ret.done ) { + this.observe(ret); + } + return ret; + } + async enqueue_ (v) { + this.queue.push(v); + } +} + +const NewCallbackByteStream = () => { + let listener; + let queue = []; + const NOOP = () => {}; + let signal = NOOP; + (async () => { + for (;;) { + const v = await new Promise((rslv, rjct) => { + listener = rslv; + }); + queue.push(v); + signal(); + } + })(); + const stream = { + [Symbol.asyncIterator](){ + return this; + }, + async next () { + if ( queue.length > 0 ) { + return { + value: queue.shift(), + done: false, + }; + } + await new Promise(rslv => { + signal = rslv; + }); + signal = NOOP; + const v = queue.shift(); + return { value: v, done: false }; + } + }; + stream.listener = data => { + listener(data); + }; + return stream; +} + +const NewVirtioFrameStream = byteStream => { + return new ATStream({ + delegate: byteStream, + async acc ({ value, carry }) { + if ( ! this.state.buffer ) { + const size = lib.get_int(4, value); + // 512MiB limit in case of attempted abuse or a bug + // (assuming this won't happen under normal conditions) + if ( size > 512*(1024**2) ) { + throw new Error(`Way too much data! (${size} bytes)`); + } + value = value.slice(4); + this.state.buffer = new Uint8Array(size); + this.state.index = 0; + } + + const needed = this.state.buffer.length - this.state.index; + if ( value.length > needed ) { + const remaining = value.slice(needed); + console.log('we got more bytes than we needed', + needed, + remaining, + value.length, + this.state.buffer.length, + this.state.index, + ); + carry(remaining); + } + + const amount = Math.min(value.length, needed); + const added = value.slice(0, amount); + this.state.buffer.set(added, this.state.index); + this.state.index += amount; + + if ( this.state.index > this.state.buffer.length ) { + throw new Error('WUT'); + } + if ( this.state.index == this.state.buffer.length ) { + return this.state.buffer; + } + } + }); +}; + +const wisp_types = [ + { + id: 3, + label: 'CONTINUE', + describe: ({ payload }) => { + return `buffer: ${lib.get_int(4, payload)}B`; + }, + getAttributes ({ payload }) { + return { + buffer_size: lib.get_int(4, payload), + }; + } + }, + { + id: 5, + label: 'INFO', + describe: ({ payload }) => { + return `v${payload[0]}.${payload[1]} ` + + lib.buf2hex(payload.slice(2)); + }, + getAttributes ({ payload }) { + return { + version_major: payload[0], + version_minor: payload[1], + extensions: payload.slice(2), + } + } + }, +]; + +class WispPacket { + static SEND = Symbol('SEND'); + static RECV = Symbol('RECV'); + constructor ({ data, direction, extra }) { + this.direction = direction; + this.data_ = data; + this.extra = extra ?? {}; + this.types_ = { + 1: { label: 'CONNECT' }, + 2: { label: 'DATA' }, + 4: { label: 'CLOSE' }, + }; + for ( const item of wisp_types ) { + this.types_[item.id] = item; + } + } + get type () { + const i_ = this.data_[0]; + return this.types_[i_]; + } + get attributes () { + if ( ! this.type.getAttributes ) return {}; + const attrs = {}; + Object.assign(attrs, this.type.getAttributes({ + payload: this.data_.slice(5), + })); + Object.assign(attrs, this.extra); + return attrs; + } + toVirtioFrame () { + const arry = new Uint8Array(this.data_.length + 4); + arry.set(lib.to_int(4, this.data_.length), 0); + arry.set(this.data_, 4); + return arry; + } + describe () { + return this.type.label + '(' + + (this.type.describe?.({ + payload: this.data_.slice(5), + }) ?? '?') + ')'; + } + log () { + const arrow = + this.direction === this.constructor.SEND ? '->' : + this.direction === this.constructor.RECV ? '<-' : + '<>' ; + console.groupCollapsed(`WISP ${arrow} ${this.describe()}`); + const attrs = this.attributes; + for ( const k in attrs ) { + console.log(k, attrs[k]); + } + console.groupEnd(); + } + reflect () { + const reflected = new WispPacket({ + data: this.data_, + direction: + this.direction === this.constructor.SEND ? + this.constructor.RECV : + this.direction === this.constructor.RECV ? + this.constructor.SEND : + undefined, + extra: { + reflectedFrom: this, + } + }); + return reflected; + } +} + +for ( const item of wisp_types ) { + WispPacket[item.label] = item; +} + +const NewWispPacketStream = frameStream => { + return new ATStream({ + delegate: frameStream, + transform ({ value }) { + return new WispPacket({ + data: value, + direction: WispPacket.RECV, + }); + }, + observe ({ value }) { + value.log(); + } + }); +} + +class WispClient { + constructor ({ + packetStream, + sendFn, + }) { + this.packetStream = packetStream; + this.sendFn = sendFn; + } + send (packet) { + packet.log(); + this.sendFn(packet); + } +} + +module.exports = { + NewVirtioFrameStream, + NewWispPacketStream, + WispPacket, +}; diff --git a/src/puter-wisp/devlog/unit_test_usefulness/b.js b/src/puter-wisp/devlog/unit_test_usefulness/b.js new file mode 100644 index 00000000..4cadc526 --- /dev/null +++ b/src/puter-wisp/devlog/unit_test_usefulness/b.js @@ -0,0 +1,307 @@ +const lib = {}; + +// SO: 40031688 +lib.buf2hex = (buffer) => { // buffer is an ArrayBuffer + return [...new Uint8Array(buffer)] + .map(x => x.toString(16).padStart(2, '0')) + .join(''); +} + +// Tiny inline little-endian integer library +lib.get_int = (n_bytes, array8, signed=false) => { + return (v => signed ? v : v >>> 0)( + array8.slice(0,n_bytes).reduce((v,e,i)=>v|=e<<8*i,0)); +} +lib.to_int = (n_bytes, num) => { + return (new Uint8Array()).map((_,i)=>(num>>8*i)&0xFF); +} + +class ATStream { + constructor ({ delegate, acc, transform, observe }) { + this.delegate = delegate; + if ( acc ) this.acc = acc; + if ( transform ) this.transform = transform; + if ( observe ) this.observe = observe; + this.state = {}; + this.carry = []; + } + [Symbol.asyncIterator]() { return this; } + async next_value_ () { + if ( this.carry.length > 0 ) { + return { + value: this.carry.shift(), + done: false, + }; + } + return await this.delegate.next(); + } + async acc ({ value }) { + return value; + } + async next_ () { + for (;;) { + const ret = await this.next_value_(); + if ( ret.done ) return ret; + const v = await this.acc({ + state: this.state, + value: ret.value, + carry: v => this.carry.push(v), + }); + if ( this.carry.length > 0 && v === undefined ) { + throw new Error(`no value, but carry value exists`); + } + if ( v === undefined ) continue; + // We have a value, clear the state! + this.state = {}; + if ( this.transform ) { + const new_value = await this.transform( + { value: ret.value }); + return { ...ret, value: new_value }; + } + return { ...ret, value: v }; + } + } + async next () { + const ret = await this.next_(); + if ( this.observe && !ret.done ) { + this.observe(ret); + } + return ret; + } + async enqueue_ (v) { + this.queue.push(v); + } +} + +const NewCallbackByteStream = () => { + let listener; + let queue = []; + const NOOP = () => {}; + let signal = NOOP; + (async () => { + for (;;) { + const v = await new Promise((rslv, rjct) => { + listener = rslv; + }); + queue.push(v); + signal(); + } + })(); + const stream = { + [Symbol.asyncIterator](){ + return this; + }, + async next () { + if ( queue.length > 0 ) { + return { + value: queue.shift(), + done: false, + }; + } + await new Promise(rslv => { + signal = rslv; + }); + signal = NOOP; + const v = queue.shift(); + return { value: v, done: false }; + } + }; + stream.listener = data => { + listener(data); + }; + return stream; +} + +const NewVirtioFrameStream = byteStream => { + return new ATStream({ + delegate: byteStream, + async acc ({ value, carry }) { + if ( ! this.state.buffer ) { + if ( this.state.hold ) { + const old_val = value; + let size = this.state.hold.length + value.length; + value = new Uint8Array(size); + value.set(this.state.hold, 0); + value.set(old_val, this.state.hold.length); + } + if ( value.length < 4 ) { + this.state.hold = value; + return undefined; + } + const size = lib.get_int(4, value); + // 512MiB limit in case of attempted abuse or a bug + // (assuming this won't happen under normal conditions) + if ( size > 512*(1024**2) ) { + throw new Error(`Way too much data! (${size} bytes)`); + } + value = value.slice(4); + this.state.buffer = new Uint8Array(size); + this.state.index = 0; + } + + const needed = this.state.buffer.length - this.state.index; + if ( value.length > needed ) { + const remaining = value.slice(needed); + console.log('we got more bytes than we needed', + needed, + remaining, + value.length, + this.state.buffer.length, + this.state.index, + ); + carry(remaining); + } + + const amount = Math.min(value.length, needed); + const added = value.slice(0, amount); + this.state.buffer.set(added, this.state.index); + this.state.index += amount; + + if ( this.state.index > this.state.buffer.length ) { + throw new Error('WUT'); + } + if ( this.state.index == this.state.buffer.length ) { + return this.state.buffer; + } + } + }); +}; + +const wisp_types = [ + { + id: 3, + label: 'CONTINUE', + describe: ({ payload }) => { + return `buffer: ${lib.get_int(4, payload)}B`; + }, + getAttributes ({ payload }) { + return { + buffer_size: lib.get_int(4, payload), + }; + } + }, + { + id: 5, + label: 'INFO', + describe: ({ payload }) => { + return `v${payload[0]}.${payload[1]} ` + + lib.buf2hex(payload.slice(2)); + }, + getAttributes ({ payload }) { + return { + version_major: payload[0], + version_minor: payload[1], + extensions: payload.slice(2), + } + } + }, +]; + +class WispPacket { + static SEND = Symbol('SEND'); + static RECV = Symbol('RECV'); + constructor ({ data, direction, extra }) { + this.direction = direction; + this.data_ = data; + this.extra = extra ?? {}; + this.types_ = { + 1: { label: 'CONNECT' }, + 2: { label: 'DATA' }, + 4: { label: 'CLOSE' }, + }; + for ( const item of wisp_types ) { + this.types_[item.id] = item; + } + } + get type () { + const i_ = this.data_[0]; + return this.types_[i_]; + } + get attributes () { + if ( ! this.type.getAttributes ) return {}; + const attrs = {}; + Object.assign(attrs, this.type.getAttributes({ + payload: this.data_.slice(5), + })); + Object.assign(attrs, this.extra); + return attrs; + } + toVirtioFrame () { + const arry = new Uint8Array(this.data_.length + 4); + arry.set(lib.to_int(4, this.data_.length), 0); + arry.set(this.data_, 4); + return arry; + } + describe () { + return this.type.label + '(' + + (this.type.describe?.({ + payload: this.data_.slice(5), + }) ?? '?') + ')'; + } + log () { + const arrow = + this.direction === this.constructor.SEND ? '->' : + this.direction === this.constructor.RECV ? '<-' : + '<>' ; + console.groupCollapsed(`WISP ${arrow} ${this.describe()}`); + const attrs = this.attributes; + for ( const k in attrs ) { + console.log(k, attrs[k]); + } + console.groupEnd(); + } + reflect () { + const reflected = new WispPacket({ + data: this.data_, + direction: + this.direction === this.constructor.SEND ? + this.constructor.RECV : + this.direction === this.constructor.RECV ? + this.constructor.SEND : + undefined, + extra: { + reflectedFrom: this, + } + }); + return reflected; + } +} + +for ( const item of wisp_types ) { + WispPacket[item.label] = item; +} + +const NewWispPacketStream = frameStream => { + return new ATStream({ + delegate: frameStream, + transform ({ value }) { + return new WispPacket({ + data: value, + direction: WispPacket.RECV, + }); + }, + observe ({ value }) { + value.log(); + } + }); +} + +class WispClient { + constructor ({ + packetStream, + sendFn, + }) { + this.packetStream = packetStream; + this.sendFn = sendFn; + } + send (packet) { + packet.log(); + this.sendFn(packet); + } +} + +module.exports = { + NewVirtioFrameStream, + NewWispPacketStream, + WispPacket, +}; diff --git a/src/puter-wisp/devlog/unit_test_usefulness/test_a_b.diff b/src/puter-wisp/devlog/unit_test_usefulness/test_a_b.diff new file mode 100644 index 00000000..311e9820 --- /dev/null +++ b/src/puter-wisp/devlog/unit_test_usefulness/test_a_b.diff @@ -0,0 +1,18 @@ +31d30 +< console.log('got from carry!', this.carry); +51c50 +< if ( this.carry.length >= 0 && v === undefined ) { +--- +> if ( this.carry.length > 0 && v === undefined ) { +120a120,130 +> if ( this.state.hold ) { +> const old_val = value; +> let size = this.state.hold.length + value.length; +> value = new Uint8Array(size); +> value.set(this.state.hold, 0); +> value.set(old_val, this.state.hold.length); +> } +> if ( value.length < 4 ) { +> this.state.hold = value; +> return undefined; +> } diff --git a/src/puter-wisp/package.json b/src/puter-wisp/package.json new file mode 100644 index 00000000..bcb02763 --- /dev/null +++ b/src/puter-wisp/package.json @@ -0,0 +1,15 @@ +{ + "name": "puter-wisp", + "version": "1.0.0", + "main": "exports.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "UNLICENSED", + "directories": { + "test": "test" + }, + "description": "" +} diff --git a/src/puter-wisp/src/exports.js b/src/puter-wisp/src/exports.js new file mode 100644 index 00000000..709bb3eb --- /dev/null +++ b/src/puter-wisp/src/exports.js @@ -0,0 +1,298 @@ +const lib = {}; + +// SO: 40031688 +lib.buf2hex = (buffer) => { // buffer is an ArrayBuffer + return [...new Uint8Array(buffer)] + .map(x => x.toString(16).padStart(2, '0')) + .join(''); +} + +// Tiny inline little-endian integer library +lib.get_int = (n_bytes, array8, signed=false) => { + return (v => signed ? v : v >>> 0)( + array8.slice(0,n_bytes).reduce((v,e,i)=>v|=e<<8*i,0)); +} +lib.to_int = (n_bytes, num) => { + return (new Uint8Array()).map((_,i)=>(num>>8*i)&0xFF); +} + +// Accumulator and/or Transformer (and/or Observer) Stream +// The Swiss Army Knife* of Streams! +// (* this code is not affiliated with the Swiss Army Knife corporation) +class ATStream { + constructor ({ delegate, acc, transform, observe }) { + this.delegate = delegate; + if ( acc ) this.acc = acc; + if ( transform ) this.transform = transform; + if ( observe ) this.observe = observe; + this.state = {}; + this.carry = []; + } + [Symbol.asyncIterator]() { return this; } + async next_value_ () { + if ( this.carry.length > 0 ) { + return { + value: this.carry.shift(), + done: false, + }; + } + return await this.delegate.next(); + } + async acc ({ value }) { + return value; + } + async next_ () { + for (;;) { + const ret = await this.next_value_(); + if ( ret.done ) return ret; + const v = await this.acc({ + state: this.state, + value: ret.value, + carry: v => this.carry.push(v), + }); + if ( this.carry.length > 0 && v === undefined ) { + throw new Error(`no value, but carry value exists`); + } + if ( v === undefined ) continue; + // We have a value, clear the state! + this.state = {}; + if ( this.transform ) { + const new_value = await this.transform( + { value: ret.value }); + return { ...ret, value: new_value }; + } + return { ...ret, value: v }; + } + } + async next () { + const ret = await this.next_(); + if ( this.observe && !ret.done ) { + this.observe(ret); + } + return ret; + } + async enqueue_ (v) { + this.queue.push(v); + } +} + +const NewCallbackByteStream = () => { + let listener; + let queue = []; + const NOOP = () => {}; + let signal = NOOP; + (async () => { + for (;;) { + const v = await new Promise((rslv, rjct) => { + listener = rslv; + }); + queue.push(v); + signal(); + } + })(); + const stream = { + [Symbol.asyncIterator](){ + return this; + }, + async next () { + if ( queue.length > 0 ) { + return { + value: queue.shift(), + done: false, + }; + } + await new Promise(rslv => { + signal = rslv; + }); + signal = NOOP; + const v = queue.shift(); + return { value: v, done: false }; + } + }; + stream.listener = data => { + listener(data); + }; + return stream; +} + +const NewVirtioFrameStream = byteStream => { + return new ATStream({ + delegate: byteStream, + async acc ({ value, carry }) { + if ( ! this.state.buffer ) { + if ( this.state.hold ) { + const old_val = value; + let size = this.state.hold.length + value.length; + value = new Uint8Array(size); + value.set(this.state.hold, 0); + value.set(old_val, this.state.hold.length); + } + if ( value.length < 4 ) { + this.state.hold = value; + return undefined; + } + const size = lib.get_int(4, value); + // 512MiB limit in case of attempted abuse or a bug + // (assuming this won't happen under normal conditions) + if ( size > 512*(1024**2) ) { + throw new Error(`Way too much data! (${size} bytes)`); + } + value = value.slice(4); + this.state.buffer = new Uint8Array(size); + this.state.index = 0; + } + + const needed = this.state.buffer.length - this.state.index; + if ( value.length > needed ) { + const remaining = value.slice(needed); + console.log('we got more bytes than we needed', + needed, + remaining, + value.length, + this.state.buffer.length, + this.state.index, + ); + carry(remaining); + } + + const amount = Math.min(value.length, needed); + const added = value.slice(0, amount); + this.state.buffer.set(added, this.state.index); + this.state.index += amount; + + if ( this.state.index > this.state.buffer.length ) { + throw new Error('WUT'); + } + if ( this.state.index == this.state.buffer.length ) { + return this.state.buffer; + } + } + }); +}; + +const wisp_types = [ + { + id: 3, + label: 'CONTINUE', + describe: ({ payload }) => { + return `buffer: ${lib.get_int(4, payload)}B`; + }, + getAttributes ({ payload }) { + return { + buffer_size: lib.get_int(4, payload), + }; + } + }, + { + id: 5, + label: 'INFO', + describe: ({ payload }) => { + return `v${payload[0]}.${payload[1]} ` + + lib.buf2hex(payload.slice(2)); + }, + getAttributes ({ payload }) { + return { + version_major: payload[0], + version_minor: payload[1], + extensions: payload.slice(2), + } + } + }, +]; + +class WispPacket { + static SEND = Symbol('SEND'); + static RECV = Symbol('RECV'); + constructor ({ data, direction, extra }) { + this.direction = direction; + this.data_ = data; + this.extra = extra ?? {}; + this.types_ = { + 1: { label: 'CONNECT' }, + 2: { label: 'DATA' }, + 4: { label: 'CLOSE' }, + }; + for ( const item of wisp_types ) { + this.types_[item.id] = item; + } + } + get type () { + const i_ = this.data_[0]; + return this.types_[i_]; + } + get attributes () { + if ( ! this.type.getAttributes ) return {}; + const attrs = {}; + Object.assign(attrs, this.type.getAttributes({ + payload: this.data_.slice(5), + })); + Object.assign(attrs, this.extra); + return attrs; + } + toVirtioFrame () { + const arry = new Uint8Array(this.data_.length + 4); + arry.set(lib.to_int(4, this.data_.length), 0); + arry.set(this.data_, 4); + return arry; + } + describe () { + return this.type.label + '(' + + (this.type.describe?.({ + payload: this.data_.slice(5), + }) ?? '?') + ')'; + } + log () { + const arrow = + this.direction === this.constructor.SEND ? '->' : + this.direction === this.constructor.RECV ? '<-' : + '<>' ; + console.groupCollapsed(`WISP ${arrow} ${this.describe()}`); + const attrs = this.attributes; + for ( const k in attrs ) { + console.log(k, attrs[k]); + } + console.groupEnd(); + } + reflect () { + const reflected = new WispPacket({ + data: this.data_, + direction: + this.direction === this.constructor.SEND ? + this.constructor.RECV : + this.direction === this.constructor.RECV ? + this.constructor.SEND : + undefined, + extra: { + reflectedFrom: this, + } + }); + return reflected; + } +} + +for ( const item of wisp_types ) { + WispPacket[item.label] = item; +} + +const NewWispPacketStream = frameStream => { + return new ATStream({ + delegate: frameStream, + transform ({ value }) { + return new WispPacket({ + data: value, + direction: WispPacket.RECV, + }); + }, + observe ({ value }) { + // TODO: configurable behavior, or a separate stream decorator + value.log(); + } + }); +} + +module.exports = { + NewCallbackByteStream, + NewVirtioFrameStream, + NewWispPacketStream, + WispPacket, +}; diff --git a/src/puter-wisp/test/test.js b/src/puter-wisp/test/test.js new file mode 100644 index 00000000..be063cee --- /dev/null +++ b/src/puter-wisp/test/test.js @@ -0,0 +1,50 @@ +const assert = require('assert'); +const { + NewVirtioFrameStream, + NewWispPacketStream, + WispPacket, +} = require('../src/exports'); + +const NewTestByteStream = uint8array => { + return (async function * () { + for ( const item of uint8array ) { + yield Uint8Array.from([item]); + } + })(); +}; + +const NewTestFullByteStream = uint8array => { + return (async function * () { + yield uint8array; + })(); +}; + +(async () => { + const stream_behaviors = [ + NewTestByteStream, + NewTestFullByteStream, + ]; + for ( const stream_behavior of stream_behaviors ) { + const byteStream = stream_behavior( + Uint8Array.from([ + 9, 0, 0, 0, // size of frame: 9 bytes (u32-L) + 3, // CONTINUE (u8) + 0, 0, 0, 0, // stream id: 0 (u32-L) + 0x0F, 0x0F, 0, 0, // buffer size (u32-L) + ]) + ); + const virtioStream = NewVirtioFrameStream(byteStream); + const wispStream = NewWispPacketStream(virtioStream); + + const packets = []; + for await ( const packet of wispStream ) { + packets.push(packet); + } + + assert.strictEqual(packets.length, 1); + const packet = packets[0]; + assert.strictEqual(packet.type.id, 3); + assert.strictEqual(packet.type.label, 'CONTINUE'); + assert.strictEqual(packet.type, WispPacket.CONTINUE); + } +})(); \ No newline at end of file From a4766278e449bc793dac02ad6b715e2dcf64f381 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Tue, 27 Aug 2024 22:37:22 -0400 Subject: [PATCH 27/49] tweak: package name for @heyputer/puter-wisp --- src/puter-wisp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/puter-wisp/package.json b/src/puter-wisp/package.json index bcb02763..1aab01e8 100644 --- a/src/puter-wisp/package.json +++ b/src/puter-wisp/package.json @@ -1,5 +1,5 @@ { - "name": "puter-wisp", + "name": "@heyputer/puter-wisp", "version": "1.0.0", "main": "exports.js", "scripts": { From d1d0a9cccca696024c4834d1aee884435a0ba65c Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Tue, 27 Aug 2024 22:40:27 -0400 Subject: [PATCH 28/49] tweak: update license for puter-wisp --- src/puter-wisp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/puter-wisp/package.json b/src/puter-wisp/package.json index 1aab01e8..d4433843 100644 --- a/src/puter-wisp/package.json +++ b/src/puter-wisp/package.json @@ -7,7 +7,7 @@ }, "keywords": [], "author": "", - "license": "UNLICENSED", + "license": "AGPL-3.0-only", "directories": { "test": "test" }, From 18cfef65b865fea536045904808c201b3c123688 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Tue, 27 Aug 2024 20:02:01 -0700 Subject: [PATCH 29/49] Attempt to open apps from URL only if user is authenticated and desktop is loaded --- src/gui/src/UI/UIDesktop.js | 23 +++++++++++++++++++++++ src/gui/src/initgui.js | 26 +------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index 18d5e4d1..8a0ea744 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -1022,6 +1022,29 @@ async function UIDesktop(options){ // adjust window container to take into account the toolbar height $('.window-container').css('top', window.toolbar_height); + + //-------------------------------------------------------------------------------------- + // Determine if an app was launched from URL + // i.e. https://puter.com/app/ + //-------------------------------------------------------------------------------------- + if(window.url_paths[0]?.toLocaleLowerCase() === 'app' && window.url_paths[1]){ + window.app_launched_from_url = window.url_paths[1]; + // get app metadata + try{ + window.app_launched_from_url = await puter.apps.get(window.url_paths[1]) + window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? false; + }catch(e){ + console.error(e); + } + + // get query params, any param that doesn't start with 'puter.' will be passed to the app + window.app_query_params = {}; + for (let [key, value] of window.url_query_params) { + if(!key.startsWith('puter.')) + window.app_query_params[key] = value; + } + } + // --------------------------------------------- // Run apps from insta-login URL // --------------------------------------------- diff --git a/src/gui/src/initgui.js b/src/gui/src/initgui.js index a74763de..b2a3e66b 100644 --- a/src/gui/src/initgui.js +++ b/src/gui/src/initgui.js @@ -188,30 +188,7 @@ window.initgui = async function(options){ // will hold the result of the whoami API call let whoami; - const url_paths = window.location.pathname.split('/').filter(element => element); - - //-------------------------------------------------------------------------------------- - // Determine if an app was launched from URL - // i.e. https://puter.com/app/ - //-------------------------------------------------------------------------------------- - if(url_paths[0]?.toLocaleLowerCase() === 'app' && url_paths[1]){ - window.app_launched_from_url = url_paths[1]; - - // get app metadata - try{ - window.app_launched_from_url = await puter.apps.get(window.app_launched_from_url) - window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? false; - }catch(e){ - console.error(e); - } - - // get query params, any param that doesn't start with 'puter.' will be passed to the app - window.app_query_params = {}; - for (let [key, value] of window.url_query_params) { - if(!key.startsWith('puter.')) - window.app_query_params[key] = value; - } - } + window.url_paths = window.location.pathname.split('/').filter(element => element); //-------------------------------------------------------------------------------------- // Extract 'action' from URL @@ -235,7 +212,6 @@ window.initgui = async function(options){ window.is_fullpage_mode = true; } - // Launch services before any UI is rendered await launch_services(options); From 8e4962beede7ee5de9b34ebb20ed8a5378a7ce16 Mon Sep 17 00:00:00 2001 From: pikagaufre Date: Wed, 28 Aug 2024 20:07:12 +0000 Subject: [PATCH 30/49] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c2eaa7b..3215fc75 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ This repository, including all its contents, sub-projects, modules, and componen - [Chinese / 中文](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.zh.md) - [Danish / Dansk](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.da.md) - [English](https://github.com/HeyPuter/puter/blob/main/README.md) -- [French / Français](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.da.md) +- [French / Français](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.fr.md) - [Hindi / हिंदी](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.hi.md) - [Indonesian / Bahasa Indonesia](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.id.md) - [Italian / Italiano](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.it.md) From a17f8408ebfa664f819591a1d66c06a2cd4df6cd Mon Sep 17 00:00:00 2001 From: EngrAdnanAhmad Date: Thu, 29 Aug 2024 02:26:52 +0500 Subject: [PATCH 31/49] Translated README section to Urdu with correct clickable links --- doc/i18n/README.ur.md | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 doc/i18n/README.ur.md diff --git a/doc/i18n/README.ur.md b/doc/i18n/README.ur.md new file mode 100644 index 00000000..67b061fe --- /dev/null +++ b/doc/i18n/README.ur.md @@ -0,0 +1,125 @@ +

Puter.com, ذاتی کلاؤڈ کمپیوٹر: آپ کی تمام فائلیں، ایپس، اور کھیل ایک جگہ پر، کہیں سے بھی اور کسی بھی وقت قابل رسائی۔

+ +

انٹرنیٹ OS! مفت، اوپن سورس، اور خود میزبان.

+ +

+ GitHub repo size GitHub Release GitHub License +

+

+ « لائیو ڈیمو » +
+
+ Puter.com + · + SDK + · + ڈسکورڈ + · + یوٹیوب + · + ریڈڈٹ + · + ایکس (ٹوئٹر) + · + بگ باؤنٹی +

+ +

اسکرین شاٹ

+ +
+ +## Puter + +ایک جدید، اوپن سورس انٹرنیٹ آپریٹنگ سسٹم ہے جو کہ خصوصیات سے بھرپور، بہت تیز، اور انتہائی توسیع پذیر ہے۔ Puter + +: کو استعمال کیا جا سکتا ہے Puter + +- ایک پرائیویسی فرسٹ ذاتی کلاؤڈ کے طور پر تاکہ آپ کی تمام فائلیں، ایپس، اور کھیل ایک محفوظ جگہ پر رکھی جا سکیں، کہیں سے بھی اور کسی بھی وقت قابل رسائی ہوں۔ +- ویب سائٹس، ویب ایپس، اور کھیل بنانے اور شائع کرنے کے لئے ایک پلیٹ فارم کے طور پر۔ +- وغیرہ کا متبادل، نئے انٹرفیس اور طاقتور خصوصیات کے ساتھ۔ Dropbox، Google Drive، OneDrive +- سرورز اور ورک اسٹیشنز کے لیے ایک ریموٹ ڈیسک ٹاپ ماحول کے طور پر۔ +- ویب ڈویلپمنٹ، کلاؤڈ کمپیوٹنگ، تقسیم شدہ نظاموں، اور بہت کچھ سیکھنے کے لیے ایک دوستانہ، اوپن سورس پروجیکٹ اور کمیونٹی! + +
+ +## شروع کرنے کا طریقہ + +### 💻 مقامی ترقی + +```bash +git clone https://github.com/HeyPuter/puter +cd puter +npm install +npm start +``` + +یہ Puter کو http://puter.localhost:4100 (یا اگلے دستیاب پورٹ) پر لانچ کرے گا۔ + +
+🐳 Docker + +```bash +mkdir puter && cd puter && mkdir -p puter/config puter/data && sudo chown -R 1000:1000 puter && docker run --rm -p 4100:4100 -v `pwd`/puter/config:/etc/puter -v `pwd`/puter/data:/var/puter ghcr.io/heyputer/puter +``` + +
+🐙 Docker Compose +Linux/macOS + +```bash +mkdir -p puter/config puter/data +sudo chown -R 1000:1000 puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml +docker compose up +``` + +
+Windows + +```powershell +mkdir -p puter +cd puter +New-Item -Path "puter\config" -ItemType Directory -Force +New-Item -Path "puter\data" -ItemType Directory -Force +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml" -OutFile "docker-compose.yml" +docker compose up +``` +
+ +### ☁️ Puter.com + +Puter کو [**puter.com**](https://puter.com) پر میزبان سروس کے طور پر دستیاب ہے۔ + +
+ +## نظام کی ضروریات + +- **آپریٹنگ سسٹمز:** لینکس، macOS، ونڈوز +- **RAM:** کم از کم 2GB (4GB تجویز کردہ) +- **ڈسک کی جگہ:** 1GB خالی جگہ +- **Node.js:** ورژن 16+ (ورژن 22+ تجویز کردہ) +- **npm:** تازہ ترین مستحکم ورژن + +
+ +## سپورٹ + +منتظمین اور کمیونٹی سے جڑنے کے لیے یہ چینلز استعمال کریں: + +- بگ رپورٹ یا فیچر درخواست؟ براہ کرم [ایک مسئلہ کھولیں](https://github.com/HeyPuter/puter/issues/new/choose). +- ڈسکورڈ: [discord.com/invite/PQcx7Teh8u](https://discord.com/invite/PQcx7Teh8u) +- ایکس (ٹوئٹر): [x.com/HeyPuter](https://x.com/HeyPuter) +- ریڈڈٹ: [reddit.com/r/puter/](https://www.reddit.com/r/puter/) +- ماسٹڈون: [mastodon.social/@puter](https://mastodon.social/@puter) +- سیکیورٹی کے مسائل؟ [security@puter.com](mailto:security@puter.com) +- منتظمین کو ای میل کریں [hi@puter.com](mailto:hi@puter.com) + +ہم ہمیشہ آپ کی مدد کے لیے خوش ہیں۔ سوالات پوچھنے میں ہچکچاہٹ نہ کریں +! +
+ +## لائسنس + +اس ریپوزٹری، بشمول اس کے تمام مواد، ذیلی پروجیکٹس، ماڈیولز، اور کمپوننٹس، کو [AGPL-3.0](https://github.com/HeyPuter/puter/blob/main/LICENSE.txt) کے تحت لائسنس کیا گیا ہے جب تک کہ واضح طور پر کہیں اور نہ کہا گیا ہو۔ اس ریپوزٹری میں شامل تھرڈ پارٹی لائبریریاں اپنی لائسنس کے تابع ہو سکتی ہیں۔ + +
From fa4bef887333cfa253b7cf0a3c005318c4641597 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Wed, 28 Aug 2024 14:35:39 -0700 Subject: [PATCH 32/49] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3215fc75..a2f05dfb 100644 --- a/README.md +++ b/README.md @@ -151,4 +151,5 @@ This repository, including all its contents, sub-projects, modules, and componen - [Tamil / தமிழ்](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ta.md) - [Thai / ไทย](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.th.md) - [Turkish / Türkçe](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.tr.md) +- [Urdu / اردو](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.ur.md) - [Vietnamese / Tiếng Việt](https://github.com/HeyPuter/puter/blob/main/doc/i18n/README.vi.md) From 813ee95cee6f1fca79a886b12d8fe4603ca0d213 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Tue, 27 Aug 2024 23:23:38 -0400 Subject: [PATCH 33/49] fix: fallback to read access in /sign --- src/backend/src/routers/sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/src/routers/sign.js b/src/backend/src/routers/sign.js index 4a1379a5..1813d098 100644 --- a/src/backend/src/routers/sign.js +++ b/src/backend/src/routers/sign.js @@ -117,7 +117,7 @@ module.exports = eggspress('/sign', { if ( item.action === 'write' ) { if ( ! await svc_acl.check(actor, node, 'write') ) { - throw await svc_acl.get_safe_acl_error(actor, node, 'write'); + item.action = 'read'; } } From c86df11abd98f50b7f495d7746a83c8abc5ce66a Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 28 Aug 2024 06:41:17 -0400 Subject: [PATCH 34/49] dev: launchApp as registered ipc handler Add launchApp as a registered ipc handler, which will allow communication between iframes (apps/puter.js) to be simplified. --- src/gui/src/IPC.js | 31 +++++++++++------------------ src/gui/src/initgui.js | 4 ++++ src/gui/src/services/ExecService.js | 26 ++++++++++++++++++++++++ src/gui/src/services/IPCService.js | 11 ++++++++++ 4 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 src/gui/src/services/ExecService.js create mode 100644 src/gui/src/services/IPCService.js diff --git a/src/gui/src/IPC.js b/src/gui/src/IPC.js index 356e72e0..b9f136bc 100644 --- a/src/gui/src/IPC.js +++ b/src/gui/src/IPC.js @@ -32,6 +32,7 @@ import update_mouse_position from './helpers/update_mouse_position.js'; import launch_app from './helpers/launch_app.js'; import item_icon from './helpers/item_icon.js'; +window.ipc_handlers = {}; /** * In Puter, apps are loaded in iframes and communicate with the graphical user interface (GUI), and each other, using the postMessage API. * The following sets up an Inter-Process Messaging System between apps and the GUI that enables communication @@ -88,6 +89,17 @@ window.addEventListener('message', async (event) => { const msg_id = event.data.uuid; const app_name = $(target_iframe).attr('data-app'); const app_uuid = $el_parent_window.attr('data-app_uuid'); + + if ( window.ipc_handlers.hasOwnProperty(event.data.msg) ) { + console.log('got message to new IPC handler', event.data.msg); + const ipc_context = { + appInstanceId: event.data.appInstanceID, + }; + const spec = window.ipc_handlers[event.data.msg]; + await spec.handler(event.data, { msg_id, ipc_context }); + console.log('^ end of that thing'); + return; + } // todo validate all event.data stuff coming from the client (e.g. event.data.message, .msg, ...) //------------------------------------------------- @@ -846,25 +858,6 @@ window.addEventListener('message', async (event) => { window.watchItems[event.data.item_uid].push(event.data.appInstanceID); } //-------------------------------------------------------- - // launchApp - //-------------------------------------------------------- - else if(event.data.msg === 'launchApp'){ - // TODO: Determine if the app is allowed to launch child apps? We may want to limit this to prevent abuse. - // remember app for launch callback later - const child_instance_id = window.uuidv4(); - window.child_launch_callbacks[child_instance_id] = { - parent_instance_id: event.data.appInstanceID, - launch_msg_id: msg_id, - }; - // launch child app - launch_app({ - name: event.data.app_name ?? app_name, - args: event.data.args ?? {}, - parent_instance_id: event.data.appInstanceID, - uuid: child_instance_id, - }); - } - //-------------------------------------------------------- // readAppDataFile //-------------------------------------------------------- else if(event.data.msg === 'readAppDataFile' && event.data.path !== undefined){ diff --git a/src/gui/src/initgui.js b/src/gui/src/initgui.js index b2a3e66b..df190778 100644 --- a/src/gui/src/initgui.js +++ b/src/gui/src/initgui.js @@ -46,6 +46,8 @@ import update_mouse_position from './helpers/update_mouse_position.js'; import { LaunchOnInitService } from './services/LaunchOnInitService.js'; import item_icon from './helpers/item_icon.js'; import { AntiCSRFService } from './services/AntiCSRFService.js'; +import { IPCService } from './services/IPCService.js'; +import { ExecService } from './services/ExecService.js'; const launch_services = async function (options) { // === Services Data Structures === @@ -75,6 +77,8 @@ const launch_services = async function (options) { globalThis.service_script_api_promise.resolve(service_script_api); // === Builtin Services === + register('ipc', new IPCService()); + register('exec', new ExecService()); register('broadcast', new BroadcastService()); register('theme', new ThemeService()); register('process', new ProcessService()); diff --git a/src/gui/src/services/ExecService.js b/src/gui/src/services/ExecService.js new file mode 100644 index 00000000..62e9f240 --- /dev/null +++ b/src/gui/src/services/ExecService.js @@ -0,0 +1,26 @@ +import { Service } from "../definitions.js"; +import launch_app from "../helpers/launch_app.js"; + +export class ExecService extends Service { + async _init ({ services }) { + const svc_ipc = services.get('ipc'); + svc_ipc.register_ipc_handler('launchApp', { + handler: this.launchApp.bind(this), + }); + } + + launchApp ({ app_name, args }, { ipc_context, msg_id } = {}) { + const child_instance_id = window.uuidv4(); + window.child_launch_callbacks[child_instance_id] = { + parent_instance_id: event.data.appInstanceID, + launch_msg_id: msg_id, + }; + // launch child app + launch_app({ + name: app_name, + args: args ?? {}, + parent_instance_id: ipc_context?.appInstanceId, + uuid: child_instance_id, + }); + } +} diff --git a/src/gui/src/services/IPCService.js b/src/gui/src/services/IPCService.js new file mode 100644 index 00000000..f2f025c8 --- /dev/null +++ b/src/gui/src/services/IPCService.js @@ -0,0 +1,11 @@ +import { Service } from "../definitions.js"; + +export class IPCService extends Service { + async _init () { + // + } + + register_ipc_handler (name, spec) { + window.ipc_handlers[name] = spec; + } +} From 1cd21ee65880e14820ae799b1e916c9fa9b83470 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 28 Aug 2024 21:58:33 -0400 Subject: [PATCH 35/49] tweak: cleanup and comment --- src/gui/src/IPC.js | 12 +++++++++--- src/gui/src/services/ExecService.js | 9 ++++++++- src/gui/src/services/IPCService.js | 4 ++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/gui/src/IPC.js b/src/gui/src/IPC.js index b9f136bc..acae4ce7 100644 --- a/src/gui/src/IPC.js +++ b/src/gui/src/IPC.js @@ -29,7 +29,6 @@ import download from './helpers/download.js'; import path from "./lib/path.js"; import UIContextMenu from './UI/UIContextMenu.js'; import update_mouse_position from './helpers/update_mouse_position.js'; -import launch_app from './helpers/launch_app.js'; import item_icon from './helpers/item_icon.js'; window.ipc_handlers = {}; @@ -90,14 +89,21 @@ window.addEventListener('message', async (event) => { const app_name = $(target_iframe).attr('data-app'); const app_uuid = $el_parent_window.attr('data-app_uuid'); + // New IPC handlers should be registered here. + // Do this by calling `register_ipc_handler` of IPCService. if ( window.ipc_handlers.hasOwnProperty(event.data.msg) ) { - console.log('got message to new IPC handler', event.data.msg); + // The IPC context contains information about the call const ipc_context = { appInstanceId: event.data.appInstanceID, }; + + // Registered IPC handlers are an object with a `handle()` + // method. We call it "spec" here, meaning specification. const spec = window.ipc_handlers[event.data.msg]; await spec.handler(event.data, { msg_id, ipc_context }); - console.log('^ end of that thing'); + + // Early-return to avoid redundant invokation of any + // legacy IPC handler. return; } diff --git a/src/gui/src/services/ExecService.js b/src/gui/src/services/ExecService.js index 62e9f240..5946a075 100644 --- a/src/gui/src/services/ExecService.js +++ b/src/gui/src/services/ExecService.js @@ -2,6 +2,10 @@ import { Service } from "../definitions.js"; import launch_app from "../helpers/launch_app.js"; export class ExecService extends Service { + static description = ` + Manages instances of apps on the Puter desktop. + ` + async _init ({ services }) { const svc_ipc = services.get('ipc'); svc_ipc.register_ipc_handler('launchApp', { @@ -9,13 +13,16 @@ export class ExecService extends Service { }); } + // This method is exposed to apps via IPCService. launchApp ({ app_name, args }, { ipc_context, msg_id } = {}) { + // This mechanism will be replated with xdrpc soon const child_instance_id = window.uuidv4(); window.child_launch_callbacks[child_instance_id] = { parent_instance_id: event.data.appInstanceID, launch_msg_id: msg_id, }; - // launch child app + + // The "body" of this method is in a separate file launch_app({ name: app_name, args: args ?? {}, diff --git a/src/gui/src/services/IPCService.js b/src/gui/src/services/IPCService.js index f2f025c8..83ac0bf3 100644 --- a/src/gui/src/services/IPCService.js +++ b/src/gui/src/services/IPCService.js @@ -1,6 +1,10 @@ import { Service } from "../definitions.js"; export class IPCService extends Service { + static description = ` + Allows other services to expose methods to apps. + ` + async _init () { // } From d43fc62d89d51e5bfd1f1dba42a3002c520e3776 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Thu, 29 Aug 2024 13:33:37 -0700 Subject: [PATCH 36/49] Remove menu-aim from the list of statically linked libs --- src/gui/puter-gui.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/puter-gui.json b/src/gui/puter-gui.json index ef1927c5..97e52025 100644 --- a/src/gui/puter-gui.json +++ b/src/gui/puter-gui.json @@ -10,7 +10,6 @@ "/lib/jquery-ui-1.13.2/jquery-ui.min.js", "/lib/lodash@4.17.21.min.js", "/lib/jquery.dragster.js", - "/lib/jquery.menu-aim.js", "/lib/html-entities.js", "/lib/timeago.min.js", "/lib/iro.min.js", From 5f7d1f589a56b3d3ea2026dcbd5f9c48b8dc9e6d Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 28 Aug 2024 21:42:41 -0400 Subject: [PATCH 37/49] fix: don't var when no var --- src/backend/src/services/runtime-analysis/LogService.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/src/services/runtime-analysis/LogService.js b/src/backend/src/services/runtime-analysis/LogService.js index 860b29a1..5daec8a9 100644 --- a/src/backend/src/services/runtime-analysis/LogService.js +++ b/src/backend/src/services/runtime-analysis/LogService.js @@ -462,6 +462,11 @@ class LogService extends BaseService { { const fs = require('fs'); const path = '/var/puter/logs/heyputer'; + // Making this directory if it doesn't exist causes issues + // for users running with development instructions + if ( ! fs.existsSync('/var/puter') ) { + return; + } try { fs.mkdirSync(path, { recursive: true }); this.log_directory = path; From 3361043b9d507b7944e8c95ba87214c5489f439f Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Thu, 29 Aug 2024 17:13:19 -0400 Subject: [PATCH 38/49] chore: rename putil --- package-lock.json | 35 ++++++++++++------- src/backend/doc/contributors/index.md | 2 +- src/backend/doc/contributors/modules.md | 2 +- src/backend/package.json | 2 +- src/backend/src/CoreModule.js | 2 +- src/backend/src/DatabaseModule.js | 2 +- src/backend/src/Kernel.js | 2 +- src/backend/src/LocalDiskStorageModule.js | 2 +- src/backend/src/PuterDriversModule.js | 2 +- src/backend/src/ThirdPartyDriversModule.js | 2 +- src/backend/src/boot/RuntimeEnvironment.js | 2 +- src/backend/src/config/ConfigLoader.js | 2 +- src/backend/src/definitions/Driver.js | 2 +- .../src/filesystem/FilesystemService.js | 2 +- .../src/filesystem/batch/BatchExecutor.js | 2 +- src/backend/src/filesystem/batch/commands.js | 2 +- .../storage/DatabaseFSEntryService.js | 2 +- .../src/modules/broadcast/BroadcastModule.js | 2 +- .../src/modules/broadcast/BroadcastService.js | 2 +- .../modules/broadcast/connection/BaseLink.js | 2 +- .../broadcast/connection/KeyPairHelper.js | 2 +- .../src/modules/puterai/PuterAIModule.js | 2 +- .../modules/selfhosted/SelfHostedModule.js | 2 +- .../modules/test-drivers/TestDriversModule.js | 2 +- src/backend/src/om/IdentifierUtil.js | 2 +- src/backend/src/om/definitions/Mapping.js | 2 +- src/backend/src/om/definitions/PropType.js | 2 +- src/backend/src/om/definitions/Property.js | 2 +- src/backend/src/om/entitystorage/BaseES.js | 2 +- src/backend/src/om/entitystorage/Entity.js | 2 +- src/backend/src/om/entitystorage/SQLES.js | 2 +- .../src/om/entitystorage/ValidationES.js | 2 +- src/backend/src/om/query/query.js | 2 +- src/backend/src/routers/hosting/puter-site.js | 2 +- src/backend/src/services/BaseService.js | 2 +- src/backend/src/services/Container.js | 2 +- src/backend/src/services/EngPortalService.js | 2 +- .../src/services/OperationTraceService.js | 2 +- src/backend/src/services/RegistryService.js | 2 +- src/backend/src/services/ServicePatch.js | 2 +- src/backend/src/services/StorageService.js | 2 +- src/backend/src/services/WSPushService.js | 2 +- .../abuse-prevention/IdentificationService.js | 2 +- src/backend/src/services/auth/Actor.js | 2 +- .../database/BaseDatabaseAccessService.js | 2 +- .../src/services/drivers/DriverService.js | 2 +- .../src/services/drivers/FileFacade.js | 2 +- .../src/services/drivers/meta/Construct.js | 2 +- .../src/services/drivers/meta/Runtime.js | 2 +- src/backend/src/services/drivers/types.js | 2 +- .../services/file-cache/FileCacheService.js | 2 +- .../src/services/sla/RateLimitService.js | 2 +- .../thumbnails/HTTPThumbnailService.js | 2 +- src/backend/src/util/multivalue.js | 2 +- src/backend/src/util/pathutil.js | 2 +- src/backend/tools/test.js | 2 +- src/git/src/filesystem.js | 2 +- src/phoenix/src/platform/node/filesystem.js | 2 +- src/phoenix/src/platform/puter/filesystem.js | 2 +- .../src/puter-shell/coreutils/errno.js | 2 +- .../src/puter-shell/coreutils/touch.js | 2 +- src/phoenix/test/coreutils/errno.js | 2 +- src/pty/exports.js | 2 +- src/{puter-js-common => putil}/README.md | 0 src/{puter-js-common => putil}/index.js | 0 src/{puter-js-common => putil}/package.json | 2 +- .../src/AdvancedBase.js | 0 .../src/PosixError.js | 0 .../src/bases/BasicBase.js | 0 .../src/bases/FeatureBase.js | 0 .../src/features/NodeModuleDIFeature.js | 0 .../src/features/PropertiesFeature.js | 0 .../src/features/TraitsFeature.js | 0 .../src/libs/invoker.js | 0 .../src/libs/promise.js | 0 src/{puter-js-common => putil}/test/test.js | 0 76 files changed, 85 insertions(+), 76 deletions(-) rename src/{puter-js-common => putil}/README.md (100%) rename src/{puter-js-common => putil}/index.js (100%) rename src/{puter-js-common => putil}/package.json (84%) rename src/{puter-js-common => putil}/src/AdvancedBase.js (100%) rename src/{puter-js-common => putil}/src/PosixError.js (100%) rename src/{puter-js-common => putil}/src/bases/BasicBase.js (100%) rename src/{puter-js-common => putil}/src/bases/FeatureBase.js (100%) rename src/{puter-js-common => putil}/src/features/NodeModuleDIFeature.js (100%) rename src/{puter-js-common => putil}/src/features/PropertiesFeature.js (100%) rename src/{puter-js-common => putil}/src/features/TraitsFeature.js (100%) rename src/{puter-js-common => putil}/src/libs/invoker.js (100%) rename src/{puter-js-common => putil}/src/libs/promise.js (100%) rename src/{puter-js-common => putil}/test/test.js (100%) diff --git a/package-lock.json b/package-lock.json index 094c3213..140dc5a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "dependencies": { "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/puter-js-common": "^1.0.0", + "@heyputer/putil": "^1.0.0", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", "@opentelemetry/exporter-trace-otlp-grpc": "^0.40.0", @@ -195,7 +195,7 @@ "webpack-cli": "^5.1.4" } }, - "asdf/puter-js-common": { + "asdf/putil": { "version": "1.0.0", "extraneous": true, "license": "UNLICENSED" @@ -2597,14 +2597,18 @@ "resolved": "src/phoenix", "link": true }, - "node_modules/@heyputer/puter-js-common": { - "resolved": "src/puter-js-common", + "node_modules/@heyputer/puter-wisp": { + "resolved": "src/puter-wisp", "link": true }, "node_modules/@heyputer/puterjs": { "resolved": "src/puter-js", "link": true }, + "node_modules/@heyputer/putil": { + "resolved": "src/putil", + "link": true + }, "node_modules/@heyputer/terminal": { "resolved": "src/terminal", "link": true @@ -12515,9 +12519,9 @@ "license": "MIT" }, "node_modules/mocha": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.6.0.tgz", - "integrity": "sha512-hxjt4+EEB0SA0ZDygSS015t65lJw/I2yRCS3Ae+SJ5FrbzrXgfYwJr96f0OvIXdj7h4lv/vLCrH3rkiuizFSvw==", + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", + "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", "dev": true, "license": "MIT", "dependencies": { @@ -16442,7 +16446,7 @@ "dependencies": { "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/puter-js-common": "^1.0.0", + "@heyputer/putil": "^1.0.0", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", "@opentelemetry/exporter-trace-otlp-grpc": "^0.40.0", @@ -16617,8 +16621,8 @@ "webpack-cli": "^5.1.4" } }, - "packages/puter-js-common": { - "name": "@heyputer/puter-js-common", + "packages/putil": { + "name": "@heyputer/putil", "version": "1.0.0", "extraneous": true, "license": "UNLICENSED" @@ -16662,7 +16666,7 @@ "@aws-sdk/client-textract": "^3.621.0", "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/puter-js-common": "^1.0.0", + "@heyputer/putil": "^1.0.0", "@mistralai/mistralai": "^1.0.3", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", @@ -16902,8 +16906,13 @@ "webpack-cli": "^5.1.4" } }, - "src/puter-js-common": { - "name": "@heyputer/puter-js-common", + "src/puter-wisp": { + "name": "@heyputer/puter-wisp", + "version": "1.0.0", + "license": "AGPL-3.0-only" + }, + "src/putil": { + "name": "@heyputer/putil", "version": "1.0.0", "license": "UNLICENSED" }, diff --git a/src/backend/doc/contributors/index.md b/src/backend/doc/contributors/index.md index 52bebb8f..a73a5a40 100644 --- a/src/backend/doc/contributors/index.md +++ b/src/backend/doc/contributors/index.md @@ -71,7 +71,7 @@ doing the useless work that reveals what the useful work is. ## Underlying Constructs -- [puter-js-common's README.md](../../packages/puter-js-common/README.md) +- [putil's README.md](../../packages/putil/README.md) - Whenever you see `AdvancedBase`, that's from here - Many things in backend extend this. Anything that doesn't only doesn't because it was written before `AdvancedBase` existed. diff --git a/src/backend/doc/contributors/modules.md b/src/backend/doc/contributors/modules.md index 188c7031..c20816c3 100644 --- a/src/backend/doc/contributors/modules.md +++ b/src/backend/doc/contributors/modules.md @@ -35,7 +35,7 @@ To function properly, Puter needs **CoreModule**, a database module, and a storage module. A module extends -[AdvancedBase](../../../puter-js-common/README.md) +[AdvancedBase](../../../putil/README.md) and implements an `install` method. The install method has one parameter, a [Context](../../src/util/context.js) diff --git a/src/backend/package.json b/src/backend/package.json index 196807c3..ec2f197d 100644 --- a/src/backend/package.json +++ b/src/backend/package.json @@ -12,7 +12,7 @@ "@aws-sdk/client-textract": "^3.621.0", "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/puter-js-common": "^1.0.0", + "@heyputer/putil": "^1.0.0", "@mistralai/mistralai": "^1.0.3", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", diff --git a/src/backend/src/CoreModule.js b/src/backend/src/CoreModule.js index 13558f2c..f9026030 100644 --- a/src/backend/src/CoreModule.js +++ b/src/backend/src/CoreModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const Library = require("./definitions/Library"); const { NotificationES } = require("./om/entitystorage/NotificationES"); const { ProtectedAppES } = require("./om/entitystorage/ProtectedAppES"); diff --git a/src/backend/src/DatabaseModule.js b/src/backend/src/DatabaseModule.js index 27caecf3..1ba54a74 100644 --- a/src/backend/src/DatabaseModule.js +++ b/src/backend/src/DatabaseModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class DatabaseModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/Kernel.js b/src/backend/src/Kernel.js index 01062fdf..abcd1630 100644 --- a/src/backend/src/Kernel.js +++ b/src/backend/src/Kernel.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { Context } = require('./util/context'); const BaseService = require("./services/BaseService"); const useapi = require('useapi'); diff --git a/src/backend/src/LocalDiskStorageModule.js b/src/backend/src/LocalDiskStorageModule.js index a4415df0..65736f9b 100644 --- a/src/backend/src/LocalDiskStorageModule.js +++ b/src/backend/src/LocalDiskStorageModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class LocalDiskStorageModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/PuterDriversModule.js b/src/backend/src/PuterDriversModule.js index a4dfb59b..c828080a 100644 --- a/src/backend/src/PuterDriversModule.js +++ b/src/backend/src/PuterDriversModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class PuterDriversModule extends AdvancedBase { async install () {} diff --git a/src/backend/src/ThirdPartyDriversModule.js b/src/backend/src/ThirdPartyDriversModule.js index 03650753..9c0486a8 100644 --- a/src/backend/src/ThirdPartyDriversModule.js +++ b/src/backend/src/ThirdPartyDriversModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class ThirdPartyDriversModule extends AdvancedBase { // constructor () { diff --git a/src/backend/src/boot/RuntimeEnvironment.js b/src/backend/src/boot/RuntimeEnvironment.js index 195bb7c1..b602a753 100644 --- a/src/backend/src/boot/RuntimeEnvironment.js +++ b/src/backend/src/boot/RuntimeEnvironment.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { quot } = require("../util/strutil"); const { TechnicalError } = require("../errors/TechnicalError"); const { print_error_help } = require("../errors/error_help_details"); diff --git a/src/backend/src/config/ConfigLoader.js b/src/backend/src/config/ConfigLoader.js index a07c2a64..a9ff1e9d 100644 --- a/src/backend/src/config/ConfigLoader.js +++ b/src/backend/src/config/ConfigLoader.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { quot } = require("../util/strutil"); class ConfigLoader extends AdvancedBase { diff --git a/src/backend/src/definitions/Driver.js b/src/backend/src/definitions/Driver.js index ded51255..6eaf3f23 100644 --- a/src/backend/src/definitions/Driver.js +++ b/src/backend/src/definitions/Driver.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { Context } = require('../util/context') const APIError = require("../api/APIError"); const { AppUnderUserActorType, UserActorType } = require("../services/auth/Actor"); diff --git a/src/backend/src/filesystem/FilesystemService.js b/src/backend/src/filesystem/FilesystemService.js index c335efe5..bc47a653 100644 --- a/src/backend/src/filesystem/FilesystemService.js +++ b/src/backend/src/filesystem/FilesystemService.js @@ -27,7 +27,7 @@ const SystemFSEntryService = require('./storage/SystemFSEntryService.js'); const PerformanceMonitor = require('../monitor/PerformanceMonitor.js'); const { NodePathSelector, NodeUIDSelector, NodeInternalIDSelector } = require('./node/selectors.js'); const FSNodeContext = require('./FSNodeContext.js'); -const { AdvancedBase } = require('@heyputer/puter-js-common'); +const { AdvancedBase } = require('@heyputer/putil'); const { Context } = require('../util/context.js'); const { simple_retry } = require('../util/retryutil.js'); const APIError = require('../api/APIError.js'); diff --git a/src/backend/src/filesystem/batch/BatchExecutor.js b/src/backend/src/filesystem/batch/BatchExecutor.js index 6da8e00b..53f6059f 100644 --- a/src/backend/src/filesystem/batch/BatchExecutor.js +++ b/src/backend/src/filesystem/batch/BatchExecutor.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require('@heyputer/puter-js-common'); +const { AdvancedBase } = require('@heyputer/putil'); const PathResolver = require('../../routers/filesystem_api/batch/PathResolver'); const commands = require('./commands').commands; const { WorkUnit } = require('../../services/runtime-analysis/ExpectationService'); diff --git a/src/backend/src/filesystem/batch/commands.js b/src/backend/src/filesystem/batch/commands.js index 0385076a..b0ba0c7b 100644 --- a/src/backend/src/filesystem/batch/commands.js +++ b/src/backend/src/filesystem/batch/commands.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { AsyncProviderFeature } = require("../../traits/AsyncProviderFeature"); const { HLMkdir, QuickMkdir } = require("../hl_operations/hl_mkdir"); const { Context } = require("../../util/context"); diff --git a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js index df84e69d..88adb0f8 100644 --- a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js +++ b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { id2path } = require("../../helpers"); const { PuterPath } = require("../lib/PuterPath"); diff --git a/src/backend/src/modules/broadcast/BroadcastModule.js b/src/backend/src/modules/broadcast/BroadcastModule.js index f7d0dc06..89dc422f 100644 --- a/src/backend/src/modules/broadcast/BroadcastModule.js +++ b/src/backend/src/modules/broadcast/BroadcastModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class BroadcastModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/modules/broadcast/BroadcastService.js b/src/backend/src/modules/broadcast/BroadcastService.js index dd7d6634..1365ab14 100644 --- a/src/backend/src/modules/broadcast/BroadcastService.js +++ b/src/backend/src/modules/broadcast/BroadcastService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const BaseService = require("../../services/BaseService"); const { CLink } = require("./connection/CLink"); const { SLink } = require("./connection/SLink"); diff --git a/src/backend/src/modules/broadcast/connection/BaseLink.js b/src/backend/src/modules/broadcast/connection/BaseLink.js index 0f391886..e0c4b8a2 100644 --- a/src/backend/src/modules/broadcast/connection/BaseLink.js +++ b/src/backend/src/modules/broadcast/connection/BaseLink.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { ChannelFeature } = require("../../../traits/ChannelFeature"); class BaseLink extends AdvancedBase { diff --git a/src/backend/src/modules/broadcast/connection/KeyPairHelper.js b/src/backend/src/modules/broadcast/connection/KeyPairHelper.js index ab508168..8c24d69f 100644 --- a/src/backend/src/modules/broadcast/connection/KeyPairHelper.js +++ b/src/backend/src/modules/broadcast/connection/KeyPairHelper.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require('@heyputer/puter-js-common'); +const { AdvancedBase } = require('@heyputer/putil'); class KeyPairHelper extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/modules/puterai/PuterAIModule.js b/src/backend/src/modules/puterai/PuterAIModule.js index fb88b64e..9b6ac6fa 100644 --- a/src/backend/src/modules/puterai/PuterAIModule.js +++ b/src/backend/src/modules/puterai/PuterAIModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const config = require("../../config"); class PuterAIModule extends AdvancedBase { diff --git a/src/backend/src/modules/selfhosted/SelfHostedModule.js b/src/backend/src/modules/selfhosted/SelfHostedModule.js index 8f1b6e4d..038d6f4c 100644 --- a/src/backend/src/modules/selfhosted/SelfHostedModule.js +++ b/src/backend/src/modules/selfhosted/SelfHostedModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const config = require("../../config"); class SelfHostedModule extends AdvancedBase { diff --git a/src/backend/src/modules/test-drivers/TestDriversModule.js b/src/backend/src/modules/test-drivers/TestDriversModule.js index 609324a1..3f564ec7 100644 --- a/src/backend/src/modules/test-drivers/TestDriversModule.js +++ b/src/backend/src/modules/test-drivers/TestDriversModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class TestDriversModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/om/IdentifierUtil.js b/src/backend/src/om/IdentifierUtil.js index f70245d1..5eb7eea2 100644 --- a/src/backend/src/om/IdentifierUtil.js +++ b/src/backend/src/om/IdentifierUtil.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../traits/WeakConstructorFeature"); const { Eq, And } = require("./query/query"); const { Entity } = require("./entitystorage/Entity"); diff --git a/src/backend/src/om/definitions/Mapping.js b/src/backend/src/om/definitions/Mapping.js index 1f6bc899..47a3587b 100644 --- a/src/backend/src/om/definitions/Mapping.js +++ b/src/backend/src/om/definitions/Mapping.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { instance_ } = require("../../monitor/PerformanceMonitor"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); const { Property } = require("./Property"); diff --git a/src/backend/src/om/definitions/PropType.js b/src/backend/src/om/definitions/PropType.js index b4a964fd..72477819 100644 --- a/src/backend/src/om/definitions/PropType.js +++ b/src/backend/src/om/definitions/PropType.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class PropType extends AdvancedBase { diff --git a/src/backend/src/om/definitions/Property.js b/src/backend/src/om/definitions/Property.js index 76c11ea2..3789da27 100644 --- a/src/backend/src/om/definitions/Property.js +++ b/src/backend/src/om/definitions/Property.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Property extends AdvancedBase { diff --git a/src/backend/src/om/entitystorage/BaseES.js b/src/backend/src/om/entitystorage/BaseES.js index a91d4e90..ddb49b95 100644 --- a/src/backend/src/om/entitystorage/BaseES.js +++ b/src/backend/src/om/entitystorage/BaseES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); const { Context } = require("../../util/context"); diff --git a/src/backend/src/om/entitystorage/Entity.js b/src/backend/src/om/entitystorage/Entity.js index f02bba8c..abaedb33 100644 --- a/src/backend/src/om/entitystorage/Entity.js +++ b/src/backend/src/om/entitystorage/Entity.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Entity extends AdvancedBase { diff --git a/src/backend/src/om/entitystorage/SQLES.js b/src/backend/src/om/entitystorage/SQLES.js index 0a87f5e6..61c901bf 100644 --- a/src/backend/src/om/entitystorage/SQLES.js +++ b/src/backend/src/om/entitystorage/SQLES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { BaseES } = require("./BaseES"); const APIError = require("../../api/APIError"); diff --git a/src/backend/src/om/entitystorage/ValidationES.js b/src/backend/src/om/entitystorage/ValidationES.js index 52cd2f9a..cfcf01b2 100644 --- a/src/backend/src/om/entitystorage/ValidationES.js +++ b/src/backend/src/om/entitystorage/ValidationES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { BaseES } = require("./BaseES"); const APIError = require("../../api/APIError"); diff --git a/src/backend/src/om/query/query.js b/src/backend/src/om/query/query.js index 80d81b38..bdde50a3 100644 --- a/src/backend/src/om/query/query.js +++ b/src/backend/src/om/query/query.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Predicate extends AdvancedBase { diff --git a/src/backend/src/routers/hosting/puter-site.js b/src/backend/src/routers/hosting/puter-site.js index 3e77fedf..251ff8e3 100644 --- a/src/backend/src/routers/hosting/puter-site.js +++ b/src/backend/src/routers/hosting/puter-site.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const api_error_handler = require("../../api/api_error_handler"); const config = require("../../config"); const { get_user, get_app, id2path } = require("../../helpers"); diff --git a/src/backend/src/services/BaseService.js b/src/backend/src/services/BaseService.js index da6c6bae..0455b709 100644 --- a/src/backend/src/services/BaseService.js +++ b/src/backend/src/services/BaseService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const NOOP = async () => {}; diff --git a/src/backend/src/services/Container.js b/src/backend/src/services/Container.js index 72415232..0a55f8fd 100644 --- a/src/backend/src/services/Container.js +++ b/src/backend/src/services/Container.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const config = require("../config"); const { Context } = require("../util/context"); const { CompositeError } = require("../util/errorutil"); diff --git a/src/backend/src/services/EngPortalService.js b/src/backend/src/services/EngPortalService.js index 26d7db56..7e69363a 100644 --- a/src/backend/src/services/EngPortalService.js +++ b/src/backend/src/services/EngPortalService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class EngPortalService extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/services/OperationTraceService.js b/src/backend/src/services/OperationTraceService.js index fd86c8f4..59c6527b 100644 --- a/src/backend/src/services/OperationTraceService.js +++ b/src/backend/src/services/OperationTraceService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { Context } = require("../util/context"); const { ContextAwareFeature } = require("../traits/ContextAwareFeature"); const { OtelFeature } = require("../traits/OtelFeature"); diff --git a/src/backend/src/services/RegistryService.js b/src/backend/src/services/RegistryService.js index 6b93e4ab..fe281471 100644 --- a/src/backend/src/services/RegistryService.js +++ b/src/backend/src/services/RegistryService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const BaseService = require("./BaseService"); class MapCollection extends AdvancedBase { diff --git a/src/backend/src/services/ServicePatch.js b/src/backend/src/services/ServicePatch.js index f5b93b5b..57521585 100644 --- a/src/backend/src/services/ServicePatch.js +++ b/src/backend/src/services/ServicePatch.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class ServicePatch extends AdvancedBase { patch ({ original_service }) { diff --git a/src/backend/src/services/StorageService.js b/src/backend/src/services/StorageService.js index c10f9812..f9dfa08b 100644 --- a/src/backend/src/services/StorageService.js +++ b/src/backend/src/services/StorageService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class StorageService extends AdvancedBase { constructor ({ services }) { diff --git a/src/backend/src/services/WSPushService.js b/src/backend/src/services/WSPushService.js index 95a9bf7e..669c16dc 100644 --- a/src/backend/src/services/WSPushService.js +++ b/src/backend/src/services/WSPushService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); class WSPushService extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/services/abuse-prevention/IdentificationService.js b/src/backend/src/services/abuse-prevention/IdentificationService.js index 4d2cd220..9de738a9 100644 --- a/src/backend/src/services/abuse-prevention/IdentificationService.js +++ b/src/backend/src/services/abuse-prevention/IdentificationService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const BaseService = require("../BaseService"); const { Context } = require("../../util/context"); const config = require("../../config"); diff --git a/src/backend/src/services/auth/Actor.js b/src/backend/src/services/auth/Actor.js index 410da5b1..8c929a4e 100644 --- a/src/backend/src/services/auth/Actor.js +++ b/src/backend/src/services/auth/Actor.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { Context } = require("../../util/context"); const { get_user, get_app } = require("../../helpers"); const config = require("../../config"); diff --git a/src/backend/src/services/database/BaseDatabaseAccessService.js b/src/backend/src/services/database/BaseDatabaseAccessService.js index 4396d16f..3b6fa0c8 100644 --- a/src/backend/src/services/database/BaseDatabaseAccessService.js +++ b/src/backend/src/services/database/BaseDatabaseAccessService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const BaseService = require("../BaseService"); const { DB_WRITE, DB_READ } = require("./consts"); diff --git a/src/backend/src/services/drivers/DriverService.js b/src/backend/src/services/drivers/DriverService.js index 8eb90823..e4f8c176 100644 --- a/src/backend/src/services/drivers/DriverService.js +++ b/src/backend/src/services/drivers/DriverService.js @@ -23,7 +23,7 @@ const { TypedValue } = require("./meta/Runtime"); const BaseService = require("../BaseService"); const { Driver } = require("../../definitions/Driver"); const { PermissionUtil } = require("../auth/PermissionService"); -const { Invoker } = require("@heyputer/puter-js-common/src/libs/invoker"); +const { Invoker } = require("../../../../putil/src/libs/invoker"); const { get_user } = require("../../helpers"); /** diff --git a/src/backend/src/services/drivers/FileFacade.js b/src/backend/src/services/drivers/FileFacade.js index 0a6d1b1a..3dd65f8b 100644 --- a/src/backend/src/services/drivers/FileFacade.js +++ b/src/backend/src/services/drivers/FileFacade.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { Context } = require("../../util/context"); const { MultiValue } = require("../../util/multivalue"); const { stream_to_buffer } = require("../../util/streamutil"); diff --git a/src/backend/src/services/drivers/meta/Construct.js b/src/backend/src/services/drivers/meta/Construct.js index 57f8cf93..9e344b11 100644 --- a/src/backend/src/services/drivers/meta/Construct.js +++ b/src/backend/src/services/drivers/meta/Construct.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { BasicBase } = require("@heyputer/puter-js-common/src/bases/BasicBase"); +const { BasicBase } = require("../../../../../putil/src/bases/BasicBase"); const types = require("../types"); const { hash_serializable_object, stringify_serializable_object } = require("../../../util/datautil"); diff --git a/src/backend/src/services/drivers/meta/Runtime.js b/src/backend/src/services/drivers/meta/Runtime.js index efad76c3..361626fd 100644 --- a/src/backend/src/services/drivers/meta/Runtime.js +++ b/src/backend/src/services/drivers/meta/Runtime.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { BasicBase } = require("@heyputer/puter-js-common/src/bases/BasicBase"); +const { BasicBase } = require("../../../../../putil/src/bases/BasicBase"); const { TypeSpec } = require("./Construct"); class RuntimeEntity extends BasicBase { diff --git a/src/backend/src/services/drivers/types.js b/src/backend/src/services/drivers/types.js index 1c227bd9..fc0f00c8 100644 --- a/src/backend/src/services/drivers/types.js +++ b/src/backend/src/services/drivers/types.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { is_valid_path } = require("../../filesystem/validation"); const { is_valid_url, is_valid_uuid4 } = require("../../helpers"); const { FileFacade } = require("./FileFacade"); diff --git a/src/backend/src/services/file-cache/FileCacheService.js b/src/backend/src/services/file-cache/FileCacheService.js index c46e437e..faefe20d 100644 --- a/src/backend/src/services/file-cache/FileCacheService.js +++ b/src/backend/src/services/file-cache/FileCacheService.js @@ -17,7 +17,7 @@ * along with this program. If not, see . */ const TeePromise = require("@heyputer/multest/src/util/TeePromise"); -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const { FileTracker } = require("./FileTracker"); const { pausing_tee } = require("../../util/streamutil"); diff --git a/src/backend/src/services/sla/RateLimitService.js b/src/backend/src/services/sla/RateLimitService.js index ecaf7a30..86d5b77a 100644 --- a/src/backend/src/services/sla/RateLimitService.js +++ b/src/backend/src/services/sla/RateLimitService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const APIError = require("../../api/APIError"); const { Context } = require("../../util/context"); const BaseService = require("../BaseService"); diff --git a/src/backend/src/services/thumbnails/HTTPThumbnailService.js b/src/backend/src/services/thumbnails/HTTPThumbnailService.js index 805d124e..6c133f66 100644 --- a/src/backend/src/services/thumbnails/HTTPThumbnailService.js +++ b/src/backend/src/services/thumbnails/HTTPThumbnailService.js @@ -22,7 +22,7 @@ const axios = require('axios'); const { TeePromise } = require("../../util/promise"); -const { AdvancedBase } = require('@heyputer/puter-js-common'); +const { AdvancedBase } = require('@heyputer/putil'); const FormData = require("form-data"); const { stream_to_the_void, buffer_to_stream } = require('../../util/streamutil'); const BaseService = require('../BaseService'); diff --git a/src/backend/src/util/multivalue.js b/src/backend/src/util/multivalue.js index c834e506..fdda6630 100644 --- a/src/backend/src/util/multivalue.js +++ b/src/backend/src/util/multivalue.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); /** * MutliValue represents a subject with multiple values or a value with multiple diff --git a/src/backend/src/util/pathutil.js b/src/backend/src/util/pathutil.js index c75d070a..124bfb3a 100644 --- a/src/backend/src/util/pathutil.js +++ b/src/backend/src/util/pathutil.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); /** * PathBuilder implements the builder pattern for building paths. diff --git a/src/backend/tools/test.js b/src/backend/tools/test.js index 4eb44fc0..65fbd419 100644 --- a/src/backend/tools/test.js +++ b/src/backend/tools/test.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/puter-js-common"); +const { AdvancedBase } = require("@heyputer/putil"); const useapi = require("useapi"); const { BaseService } = require("../exports"); const CoreModule = require("../src/CoreModule"); diff --git a/src/git/src/filesystem.js b/src/git/src/filesystem.js index 8ad0cbce..6ef6fe0a 100644 --- a/src/git/src/filesystem.js +++ b/src/git/src/filesystem.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { PosixError } from '@heyputer/puter-js-common/src/PosixError.js'; +import { PosixError } from '@heyputer/putil/src/PosixError.js'; import path_ from 'path-browserify'; let debug = false; diff --git a/src/phoenix/src/platform/node/filesystem.js b/src/phoenix/src/platform/node/filesystem.js index 7ca99309..7e66a170 100644 --- a/src/phoenix/src/platform/node/filesystem.js +++ b/src/phoenix/src/platform/node/filesystem.js @@ -20,7 +20,7 @@ import fs from 'fs'; import path_ from 'path'; import modeString from 'fs-mode-to-string'; -import { ErrorCodes, PosixError } from '@heyputer/puter-js-common/src/PosixError.js'; +import { ErrorCodes, PosixError } from '@heyputer/putil/src/PosixError.js'; // DRY: Almost the same as puter/filesystem.js function wrapAPIs(apis) { diff --git a/src/phoenix/src/platform/puter/filesystem.js b/src/phoenix/src/platform/puter/filesystem.js index 49bc878f..d1188145 100644 --- a/src/phoenix/src/platform/puter/filesystem.js +++ b/src/phoenix/src/platform/puter/filesystem.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { ErrorCodes, PosixError } from '@heyputer/puter-js-common/src/PosixError.js'; +import { ErrorCodes, PosixError } from '@heyputer/putil/src/PosixError.js'; // DRY: Almost the same as node/filesystem.js function wrapAPIs(apis) { diff --git a/src/phoenix/src/puter-shell/coreutils/errno.js b/src/phoenix/src/puter-shell/coreutils/errno.js index 8ea010c1..8ffcde10 100644 --- a/src/phoenix/src/puter-shell/coreutils/errno.js +++ b/src/phoenix/src/puter-shell/coreutils/errno.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { ErrorCodes, ErrorMetadata, errorFromIntegerCode } from '@heyputer/puter-js-common/src/PosixError.js'; +import { ErrorCodes, ErrorMetadata, errorFromIntegerCode } from '@heyputer/putil/src/PosixError.js'; import { Exit } from './coreutil_lib/exit.js'; const maxErrorNameLength = Object.keys(ErrorCodes) diff --git a/src/phoenix/src/puter-shell/coreutils/touch.js b/src/phoenix/src/puter-shell/coreutils/touch.js index d77b09d3..8ebb6531 100644 --- a/src/phoenix/src/puter-shell/coreutils/touch.js +++ b/src/phoenix/src/puter-shell/coreutils/touch.js @@ -18,7 +18,7 @@ */ import { Exit } from './coreutil_lib/exit.js'; import { resolveRelativePath } from '../../util/path.js'; -import { ErrorCodes } from '@heyputer/puter-js-common/src/PosixError.js'; +import { ErrorCodes } from '@heyputer/putil/src/PosixError.js'; export default { name: 'touch', diff --git a/src/phoenix/test/coreutils/errno.js b/src/phoenix/test/coreutils/errno.js index b749de46..036fb8e6 100644 --- a/src/phoenix/test/coreutils/errno.js +++ b/src/phoenix/test/coreutils/errno.js @@ -19,7 +19,7 @@ import assert from 'assert'; import { MakeTestContext } from './harness.js' import builtins from '../../src/puter-shell/coreutils/__exports__.js'; -import { ErrorCodes, ErrorMetadata } from '@heyputer/puter-js-common/src/PosixError.js'; +import { ErrorCodes, ErrorMetadata } from '@heyputer/putil/src/PosixError.js'; export const runErrnoTests = () => { describe('errno', function () { diff --git a/src/pty/exports.js b/src/pty/exports.js index 997fb797..2dcd3197 100644 --- a/src/pty/exports.js +++ b/src/pty/exports.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { libs } from '@heyputer/puter-js-common'; +import { libs } from '@heyputer/putil'; const { TeePromise, raceCase } = libs.promise; const encoder = new TextEncoder(); diff --git a/src/puter-js-common/README.md b/src/putil/README.md similarity index 100% rename from src/puter-js-common/README.md rename to src/putil/README.md diff --git a/src/puter-js-common/index.js b/src/putil/index.js similarity index 100% rename from src/puter-js-common/index.js rename to src/putil/index.js diff --git a/src/puter-js-common/package.json b/src/putil/package.json similarity index 84% rename from src/puter-js-common/package.json rename to src/putil/package.json index f6de28c1..cbe89b9a 100644 --- a/src/puter-js-common/package.json +++ b/src/putil/package.json @@ -1,5 +1,5 @@ { - "name": "@heyputer/puter-js-common", + "name": "@heyputer/putil", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/src/puter-js-common/src/AdvancedBase.js b/src/putil/src/AdvancedBase.js similarity index 100% rename from src/puter-js-common/src/AdvancedBase.js rename to src/putil/src/AdvancedBase.js diff --git a/src/puter-js-common/src/PosixError.js b/src/putil/src/PosixError.js similarity index 100% rename from src/puter-js-common/src/PosixError.js rename to src/putil/src/PosixError.js diff --git a/src/puter-js-common/src/bases/BasicBase.js b/src/putil/src/bases/BasicBase.js similarity index 100% rename from src/puter-js-common/src/bases/BasicBase.js rename to src/putil/src/bases/BasicBase.js diff --git a/src/puter-js-common/src/bases/FeatureBase.js b/src/putil/src/bases/FeatureBase.js similarity index 100% rename from src/puter-js-common/src/bases/FeatureBase.js rename to src/putil/src/bases/FeatureBase.js diff --git a/src/puter-js-common/src/features/NodeModuleDIFeature.js b/src/putil/src/features/NodeModuleDIFeature.js similarity index 100% rename from src/puter-js-common/src/features/NodeModuleDIFeature.js rename to src/putil/src/features/NodeModuleDIFeature.js diff --git a/src/puter-js-common/src/features/PropertiesFeature.js b/src/putil/src/features/PropertiesFeature.js similarity index 100% rename from src/puter-js-common/src/features/PropertiesFeature.js rename to src/putil/src/features/PropertiesFeature.js diff --git a/src/puter-js-common/src/features/TraitsFeature.js b/src/putil/src/features/TraitsFeature.js similarity index 100% rename from src/puter-js-common/src/features/TraitsFeature.js rename to src/putil/src/features/TraitsFeature.js diff --git a/src/puter-js-common/src/libs/invoker.js b/src/putil/src/libs/invoker.js similarity index 100% rename from src/puter-js-common/src/libs/invoker.js rename to src/putil/src/libs/invoker.js diff --git a/src/puter-js-common/src/libs/promise.js b/src/putil/src/libs/promise.js similarity index 100% rename from src/puter-js-common/src/libs/promise.js rename to src/putil/src/libs/promise.js diff --git a/src/puter-js-common/test/test.js b/src/putil/test/test.js similarity index 100% rename from src/puter-js-common/test/test.js rename to src/putil/test/test.js From cf24c3dd2a030e133ec7028e13c373a1431f0373 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Thu, 29 Aug 2024 22:21:07 -0400 Subject: [PATCH 39/49] rename --- package-lock.json | 22 +++++++++---------- src/backend/doc/contributors/index.md | 2 +- src/backend/doc/contributors/modules.md | 2 +- src/backend/package.json | 2 +- src/backend/src/CoreModule.js | 2 +- src/backend/src/DatabaseModule.js | 2 +- src/backend/src/Kernel.js | 2 +- src/backend/src/LocalDiskStorageModule.js | 2 +- src/backend/src/PuterDriversModule.js | 2 +- src/backend/src/ThirdPartyDriversModule.js | 2 +- src/backend/src/boot/RuntimeEnvironment.js | 2 +- src/backend/src/config/ConfigLoader.js | 2 +- src/backend/src/definitions/Driver.js | 2 +- .../src/filesystem/FilesystemService.js | 2 +- .../src/filesystem/batch/BatchExecutor.js | 2 +- src/backend/src/filesystem/batch/commands.js | 2 +- .../storage/DatabaseFSEntryService.js | 2 +- .../src/modules/broadcast/BroadcastModule.js | 2 +- .../src/modules/broadcast/BroadcastService.js | 2 +- .../modules/broadcast/connection/BaseLink.js | 2 +- .../broadcast/connection/KeyPairHelper.js | 2 +- .../src/modules/puterai/PuterAIModule.js | 2 +- .../modules/selfhosted/SelfHostedModule.js | 14 +++++++++++- .../modules/test-drivers/TestDriversModule.js | 2 +- src/backend/src/om/IdentifierUtil.js | 2 +- src/backend/src/om/definitions/Mapping.js | 2 +- src/backend/src/om/definitions/PropType.js | 2 +- src/backend/src/om/definitions/Property.js | 2 +- src/backend/src/om/entitystorage/BaseES.js | 2 +- src/backend/src/om/entitystorage/Entity.js | 2 +- src/backend/src/om/entitystorage/SQLES.js | 2 +- .../src/om/entitystorage/ValidationES.js | 2 +- src/backend/src/om/query/query.js | 2 +- src/backend/src/routers/_default.js | 7 ++++++ src/backend/src/routers/hosting/puter-site.js | 2 +- src/backend/src/services/BaseService.js | 2 +- src/backend/src/services/Container.js | 2 +- src/backend/src/services/EngPortalService.js | 2 +- .../src/services/OperationTraceService.js | 2 +- src/backend/src/services/RegistryService.js | 2 +- src/backend/src/services/ServicePatch.js | 2 +- src/backend/src/services/StorageService.js | 2 +- src/backend/src/services/WSPushService.js | 2 +- .../abuse-prevention/IdentificationService.js | 2 +- src/backend/src/services/auth/Actor.js | 2 +- .../database/BaseDatabaseAccessService.js | 2 +- .../src/services/drivers/DriverService.js | 2 +- .../src/services/drivers/FileFacade.js | 2 +- .../src/services/drivers/meta/Construct.js | 2 +- .../src/services/drivers/meta/Runtime.js | 2 +- src/backend/src/services/drivers/types.js | 2 +- .../services/file-cache/FileCacheService.js | 2 +- .../src/services/sla/RateLimitService.js | 2 +- .../thumbnails/HTTPThumbnailService.js | 2 +- src/backend/src/util/multivalue.js | 2 +- src/backend/src/util/pathutil.js | 2 +- src/backend/tools/test.js | 2 +- src/git/src/filesystem.js | 2 +- src/phoenix/src/platform/node/filesystem.js | 2 +- src/phoenix/src/platform/puter/filesystem.js | 2 +- .../src/puter-shell/coreutils/errno.js | 2 +- .../src/puter-shell/coreutils/touch.js | 2 +- src/phoenix/test/coreutils/errno.js | 2 +- src/pty/exports.js | 2 +- src/putil/package.json | 8 ++++--- 65 files changed, 97 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index 140dc5a2..6a07b082 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "dependencies": { "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/putil": "^1.0.0", + "@heyputer/putility": "^1.0.0", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", "@opentelemetry/exporter-trace-otlp-grpc": "^0.40.0", @@ -195,7 +195,7 @@ "webpack-cli": "^5.1.4" } }, - "asdf/putil": { + "asdf/putility": { "version": "1.0.0", "extraneous": true, "license": "UNLICENSED" @@ -2605,8 +2605,8 @@ "resolved": "src/puter-js", "link": true }, - "node_modules/@heyputer/putil": { - "resolved": "src/putil", + "node_modules/@heyputer/putility": { + "resolved": "src/putility", "link": true }, "node_modules/@heyputer/terminal": { @@ -16446,7 +16446,7 @@ "dependencies": { "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/putil": "^1.0.0", + "@heyputer/putility": "^1.0.0", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", "@opentelemetry/exporter-trace-otlp-grpc": "^0.40.0", @@ -16621,8 +16621,8 @@ "webpack-cli": "^5.1.4" } }, - "packages/putil": { - "name": "@heyputer/putil", + "packages/putility": { + "name": "@heyputer/putility", "version": "1.0.0", "extraneous": true, "license": "UNLICENSED" @@ -16666,7 +16666,7 @@ "@aws-sdk/client-textract": "^3.621.0", "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/putil": "^1.0.0", + "@heyputer/putility": "^1.0.0", "@mistralai/mistralai": "^1.0.3", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", @@ -16911,10 +16911,10 @@ "version": "1.0.0", "license": "AGPL-3.0-only" }, - "src/putil": { - "name": "@heyputer/putil", + "src/putility": { + "name": "@heyputer/putility", "version": "1.0.0", - "license": "UNLICENSED" + "license": "AGPL-3.0-only" }, "src/strataparse": { "version": "0.0.0", diff --git a/src/backend/doc/contributors/index.md b/src/backend/doc/contributors/index.md index a73a5a40..381aeef0 100644 --- a/src/backend/doc/contributors/index.md +++ b/src/backend/doc/contributors/index.md @@ -71,7 +71,7 @@ doing the useless work that reveals what the useful work is. ## Underlying Constructs -- [putil's README.md](../../packages/putil/README.md) +- [putility's README.md](../../packages/putility/README.md) - Whenever you see `AdvancedBase`, that's from here - Many things in backend extend this. Anything that doesn't only doesn't because it was written before `AdvancedBase` existed. diff --git a/src/backend/doc/contributors/modules.md b/src/backend/doc/contributors/modules.md index c20816c3..c19b49d6 100644 --- a/src/backend/doc/contributors/modules.md +++ b/src/backend/doc/contributors/modules.md @@ -35,7 +35,7 @@ To function properly, Puter needs **CoreModule**, a database module, and a storage module. A module extends -[AdvancedBase](../../../putil/README.md) +[AdvancedBase](../../../putility/README.md) and implements an `install` method. The install method has one parameter, a [Context](../../src/util/context.js) diff --git a/src/backend/package.json b/src/backend/package.json index ec2f197d..7794c4ae 100644 --- a/src/backend/package.json +++ b/src/backend/package.json @@ -12,7 +12,7 @@ "@aws-sdk/client-textract": "^3.621.0", "@heyputer/kv.js": "^0.1.3", "@heyputer/multest": "^0.0.2", - "@heyputer/putil": "^1.0.0", + "@heyputer/putility": "^1.0.0", "@mistralai/mistralai": "^1.0.3", "@opentelemetry/api": "^1.4.1", "@opentelemetry/auto-instrumentations-node": "^0.43.0", diff --git a/src/backend/src/CoreModule.js b/src/backend/src/CoreModule.js index f9026030..6f3dc243 100644 --- a/src/backend/src/CoreModule.js +++ b/src/backend/src/CoreModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const Library = require("./definitions/Library"); const { NotificationES } = require("./om/entitystorage/NotificationES"); const { ProtectedAppES } = require("./om/entitystorage/ProtectedAppES"); diff --git a/src/backend/src/DatabaseModule.js b/src/backend/src/DatabaseModule.js index 1ba54a74..02abeb4e 100644 --- a/src/backend/src/DatabaseModule.js +++ b/src/backend/src/DatabaseModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class DatabaseModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/Kernel.js b/src/backend/src/Kernel.js index abcd1630..f3747bb7 100644 --- a/src/backend/src/Kernel.js +++ b/src/backend/src/Kernel.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { Context } = require('./util/context'); const BaseService = require("./services/BaseService"); const useapi = require('useapi'); diff --git a/src/backend/src/LocalDiskStorageModule.js b/src/backend/src/LocalDiskStorageModule.js index 65736f9b..56a25b50 100644 --- a/src/backend/src/LocalDiskStorageModule.js +++ b/src/backend/src/LocalDiskStorageModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class LocalDiskStorageModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/PuterDriversModule.js b/src/backend/src/PuterDriversModule.js index c828080a..7cb6e55e 100644 --- a/src/backend/src/PuterDriversModule.js +++ b/src/backend/src/PuterDriversModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class PuterDriversModule extends AdvancedBase { async install () {} diff --git a/src/backend/src/ThirdPartyDriversModule.js b/src/backend/src/ThirdPartyDriversModule.js index 9c0486a8..ed70278b 100644 --- a/src/backend/src/ThirdPartyDriversModule.js +++ b/src/backend/src/ThirdPartyDriversModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class ThirdPartyDriversModule extends AdvancedBase { // constructor () { diff --git a/src/backend/src/boot/RuntimeEnvironment.js b/src/backend/src/boot/RuntimeEnvironment.js index b602a753..339cca08 100644 --- a/src/backend/src/boot/RuntimeEnvironment.js +++ b/src/backend/src/boot/RuntimeEnvironment.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { quot } = require("../util/strutil"); const { TechnicalError } = require("../errors/TechnicalError"); const { print_error_help } = require("../errors/error_help_details"); diff --git a/src/backend/src/config/ConfigLoader.js b/src/backend/src/config/ConfigLoader.js index a9ff1e9d..0bb2bd76 100644 --- a/src/backend/src/config/ConfigLoader.js +++ b/src/backend/src/config/ConfigLoader.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { quot } = require("../util/strutil"); class ConfigLoader extends AdvancedBase { diff --git a/src/backend/src/definitions/Driver.js b/src/backend/src/definitions/Driver.js index 6eaf3f23..ea1e4425 100644 --- a/src/backend/src/definitions/Driver.js +++ b/src/backend/src/definitions/Driver.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { Context } = require('../util/context') const APIError = require("../api/APIError"); const { AppUnderUserActorType, UserActorType } = require("../services/auth/Actor"); diff --git a/src/backend/src/filesystem/FilesystemService.js b/src/backend/src/filesystem/FilesystemService.js index bc47a653..e6de744c 100644 --- a/src/backend/src/filesystem/FilesystemService.js +++ b/src/backend/src/filesystem/FilesystemService.js @@ -27,7 +27,7 @@ const SystemFSEntryService = require('./storage/SystemFSEntryService.js'); const PerformanceMonitor = require('../monitor/PerformanceMonitor.js'); const { NodePathSelector, NodeUIDSelector, NodeInternalIDSelector } = require('./node/selectors.js'); const FSNodeContext = require('./FSNodeContext.js'); -const { AdvancedBase } = require('@heyputer/putil'); +const { AdvancedBase } = require('@heyputer/putility'); const { Context } = require('../util/context.js'); const { simple_retry } = require('../util/retryutil.js'); const APIError = require('../api/APIError.js'); diff --git a/src/backend/src/filesystem/batch/BatchExecutor.js b/src/backend/src/filesystem/batch/BatchExecutor.js index 53f6059f..f7a50ad1 100644 --- a/src/backend/src/filesystem/batch/BatchExecutor.js +++ b/src/backend/src/filesystem/batch/BatchExecutor.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require('@heyputer/putil'); +const { AdvancedBase } = require('@heyputer/putility'); const PathResolver = require('../../routers/filesystem_api/batch/PathResolver'); const commands = require('./commands').commands; const { WorkUnit } = require('../../services/runtime-analysis/ExpectationService'); diff --git a/src/backend/src/filesystem/batch/commands.js b/src/backend/src/filesystem/batch/commands.js index b0ba0c7b..00459b11 100644 --- a/src/backend/src/filesystem/batch/commands.js +++ b/src/backend/src/filesystem/batch/commands.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { AsyncProviderFeature } = require("../../traits/AsyncProviderFeature"); const { HLMkdir, QuickMkdir } = require("../hl_operations/hl_mkdir"); const { Context } = require("../../util/context"); diff --git a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js index 88adb0f8..5244857f 100644 --- a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js +++ b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { id2path } = require("../../helpers"); const { PuterPath } = require("../lib/PuterPath"); diff --git a/src/backend/src/modules/broadcast/BroadcastModule.js b/src/backend/src/modules/broadcast/BroadcastModule.js index 89dc422f..6b44d715 100644 --- a/src/backend/src/modules/broadcast/BroadcastModule.js +++ b/src/backend/src/modules/broadcast/BroadcastModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class BroadcastModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/modules/broadcast/BroadcastService.js b/src/backend/src/modules/broadcast/BroadcastService.js index 1365ab14..4344b103 100644 --- a/src/backend/src/modules/broadcast/BroadcastService.js +++ b/src/backend/src/modules/broadcast/BroadcastService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const BaseService = require("../../services/BaseService"); const { CLink } = require("./connection/CLink"); const { SLink } = require("./connection/SLink"); diff --git a/src/backend/src/modules/broadcast/connection/BaseLink.js b/src/backend/src/modules/broadcast/connection/BaseLink.js index e0c4b8a2..7b321c7f 100644 --- a/src/backend/src/modules/broadcast/connection/BaseLink.js +++ b/src/backend/src/modules/broadcast/connection/BaseLink.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { ChannelFeature } = require("../../../traits/ChannelFeature"); class BaseLink extends AdvancedBase { diff --git a/src/backend/src/modules/broadcast/connection/KeyPairHelper.js b/src/backend/src/modules/broadcast/connection/KeyPairHelper.js index 8c24d69f..e9fc1da4 100644 --- a/src/backend/src/modules/broadcast/connection/KeyPairHelper.js +++ b/src/backend/src/modules/broadcast/connection/KeyPairHelper.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require('@heyputer/putil'); +const { AdvancedBase } = require('@heyputer/putility'); class KeyPairHelper extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/modules/puterai/PuterAIModule.js b/src/backend/src/modules/puterai/PuterAIModule.js index 9b6ac6fa..5552b390 100644 --- a/src/backend/src/modules/puterai/PuterAIModule.js +++ b/src/backend/src/modules/puterai/PuterAIModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const config = require("../../config"); class PuterAIModule extends AdvancedBase { diff --git a/src/backend/src/modules/selfhosted/SelfHostedModule.js b/src/backend/src/modules/selfhosted/SelfHostedModule.js index 038d6f4c..c35e7f2a 100644 --- a/src/backend/src/modules/selfhosted/SelfHostedModule.js +++ b/src/backend/src/modules/selfhosted/SelfHostedModule.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const config = require("../../config"); class SelfHostedModule extends AdvancedBase { @@ -111,6 +111,18 @@ class SelfHostedModule extends AdvancedBase { 'src/puter-js/dist/puter.dev.js'), route: '/puter.js/v2', }); + services.registerService('__serve-putilityjs-new', ServeSingleFileService, { + path: path_.resolve(__dirname, + RELATIVE_PATH, + 'src/putility/dist/putility.dev.js'), + route: '/putility.js/v1', + }); + services.registerService('__serve-gui-js', ServeSingleFileService, { + path: path_.resolve(__dirname, + RELATIVE_PATH, + 'src/gui/dist/gui.dev.js'), + route: '/putility.js/v1', + }); } } diff --git a/src/backend/src/modules/test-drivers/TestDriversModule.js b/src/backend/src/modules/test-drivers/TestDriversModule.js index 3f564ec7..c30756d9 100644 --- a/src/backend/src/modules/test-drivers/TestDriversModule.js +++ b/src/backend/src/modules/test-drivers/TestDriversModule.js @@ -1,4 +1,4 @@ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class TestDriversModule extends AdvancedBase { async install (context) { diff --git a/src/backend/src/om/IdentifierUtil.js b/src/backend/src/om/IdentifierUtil.js index 5eb7eea2..1e1ab9bb 100644 --- a/src/backend/src/om/IdentifierUtil.js +++ b/src/backend/src/om/IdentifierUtil.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../traits/WeakConstructorFeature"); const { Eq, And } = require("./query/query"); const { Entity } = require("./entitystorage/Entity"); diff --git a/src/backend/src/om/definitions/Mapping.js b/src/backend/src/om/definitions/Mapping.js index 47a3587b..cae78d14 100644 --- a/src/backend/src/om/definitions/Mapping.js +++ b/src/backend/src/om/definitions/Mapping.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { instance_ } = require("../../monitor/PerformanceMonitor"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); const { Property } = require("./Property"); diff --git a/src/backend/src/om/definitions/PropType.js b/src/backend/src/om/definitions/PropType.js index 72477819..201d2700 100644 --- a/src/backend/src/om/definitions/PropType.js +++ b/src/backend/src/om/definitions/PropType.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class PropType extends AdvancedBase { diff --git a/src/backend/src/om/definitions/Property.js b/src/backend/src/om/definitions/Property.js index 3789da27..dc7c87bf 100644 --- a/src/backend/src/om/definitions/Property.js +++ b/src/backend/src/om/definitions/Property.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Property extends AdvancedBase { diff --git a/src/backend/src/om/entitystorage/BaseES.js b/src/backend/src/om/entitystorage/BaseES.js index ddb49b95..b66f18b0 100644 --- a/src/backend/src/om/entitystorage/BaseES.js +++ b/src/backend/src/om/entitystorage/BaseES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); const { Context } = require("../../util/context"); diff --git a/src/backend/src/om/entitystorage/Entity.js b/src/backend/src/om/entitystorage/Entity.js index abaedb33..3094f55c 100644 --- a/src/backend/src/om/entitystorage/Entity.js +++ b/src/backend/src/om/entitystorage/Entity.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Entity extends AdvancedBase { diff --git a/src/backend/src/om/entitystorage/SQLES.js b/src/backend/src/om/entitystorage/SQLES.js index 61c901bf..dc81efa1 100644 --- a/src/backend/src/om/entitystorage/SQLES.js +++ b/src/backend/src/om/entitystorage/SQLES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { BaseES } = require("./BaseES"); const APIError = require("../../api/APIError"); diff --git a/src/backend/src/om/entitystorage/ValidationES.js b/src/backend/src/om/entitystorage/ValidationES.js index cfcf01b2..485a9408 100644 --- a/src/backend/src/om/entitystorage/ValidationES.js +++ b/src/backend/src/om/entitystorage/ValidationES.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { BaseES } = require("./BaseES"); const APIError = require("../../api/APIError"); diff --git a/src/backend/src/om/query/query.js b/src/backend/src/om/query/query.js index bdde50a3..519d8fce 100644 --- a/src/backend/src/om/query/query.js +++ b/src/backend/src/om/query/query.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature"); class Predicate extends AdvancedBase { diff --git a/src/backend/src/routers/_default.js b/src/backend/src/routers/_default.js index 0c843e83..0c764a12 100644 --- a/src/backend/src/routers/_default.js +++ b/src/backend/src/routers/_default.js @@ -87,6 +87,13 @@ router.all('*', async function(req, res, next) { } }); } + if (path === '/putility/v1') { + return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'putility.js/v1.js'), function (err) { + if (err && err.statusCode) { + return res.status(err.statusCode).send('Error /putility.js') + } + }); + } } const db = Context.get('services').get('database').get(DB_READ, 'default'); diff --git a/src/backend/src/routers/hosting/puter-site.js b/src/backend/src/routers/hosting/puter-site.js index 251ff8e3..a2680a6b 100644 --- a/src/backend/src/routers/hosting/puter-site.js +++ b/src/backend/src/routers/hosting/puter-site.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const api_error_handler = require("../../api/api_error_handler"); const config = require("../../config"); const { get_user, get_app, id2path } = require("../../helpers"); diff --git a/src/backend/src/services/BaseService.js b/src/backend/src/services/BaseService.js index 0455b709..e325d7f0 100644 --- a/src/backend/src/services/BaseService.js +++ b/src/backend/src/services/BaseService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const NOOP = async () => {}; diff --git a/src/backend/src/services/Container.js b/src/backend/src/services/Container.js index 0a55f8fd..44878f8f 100644 --- a/src/backend/src/services/Container.js +++ b/src/backend/src/services/Container.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const config = require("../config"); const { Context } = require("../util/context"); const { CompositeError } = require("../util/errorutil"); diff --git a/src/backend/src/services/EngPortalService.js b/src/backend/src/services/EngPortalService.js index 7e69363a..ce507568 100644 --- a/src/backend/src/services/EngPortalService.js +++ b/src/backend/src/services/EngPortalService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class EngPortalService extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/services/OperationTraceService.js b/src/backend/src/services/OperationTraceService.js index 59c6527b..751efee3 100644 --- a/src/backend/src/services/OperationTraceService.js +++ b/src/backend/src/services/OperationTraceService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { Context } = require("../util/context"); const { ContextAwareFeature } = require("../traits/ContextAwareFeature"); const { OtelFeature } = require("../traits/OtelFeature"); diff --git a/src/backend/src/services/RegistryService.js b/src/backend/src/services/RegistryService.js index fe281471..3b1f45a7 100644 --- a/src/backend/src/services/RegistryService.js +++ b/src/backend/src/services/RegistryService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const BaseService = require("./BaseService"); class MapCollection extends AdvancedBase { diff --git a/src/backend/src/services/ServicePatch.js b/src/backend/src/services/ServicePatch.js index 57521585..e34312bd 100644 --- a/src/backend/src/services/ServicePatch.js +++ b/src/backend/src/services/ServicePatch.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class ServicePatch extends AdvancedBase { patch ({ original_service }) { diff --git a/src/backend/src/services/StorageService.js b/src/backend/src/services/StorageService.js index f9dfa08b..77b74007 100644 --- a/src/backend/src/services/StorageService.js +++ b/src/backend/src/services/StorageService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class StorageService extends AdvancedBase { constructor ({ services }) { diff --git a/src/backend/src/services/WSPushService.js b/src/backend/src/services/WSPushService.js index 669c16dc..0ef17302 100644 --- a/src/backend/src/services/WSPushService.js +++ b/src/backend/src/services/WSPushService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); class WSPushService extends AdvancedBase { static MODULES = { diff --git a/src/backend/src/services/abuse-prevention/IdentificationService.js b/src/backend/src/services/abuse-prevention/IdentificationService.js index 9de738a9..75005df7 100644 --- a/src/backend/src/services/abuse-prevention/IdentificationService.js +++ b/src/backend/src/services/abuse-prevention/IdentificationService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const BaseService = require("../BaseService"); const { Context } = require("../../util/context"); const config = require("../../config"); diff --git a/src/backend/src/services/auth/Actor.js b/src/backend/src/services/auth/Actor.js index 8c929a4e..0c35597f 100644 --- a/src/backend/src/services/auth/Actor.js +++ b/src/backend/src/services/auth/Actor.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { Context } = require("../../util/context"); const { get_user, get_app } = require("../../helpers"); const config = require("../../config"); diff --git a/src/backend/src/services/database/BaseDatabaseAccessService.js b/src/backend/src/services/database/BaseDatabaseAccessService.js index 3b6fa0c8..16e5af9c 100644 --- a/src/backend/src/services/database/BaseDatabaseAccessService.js +++ b/src/backend/src/services/database/BaseDatabaseAccessService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const BaseService = require("../BaseService"); const { DB_WRITE, DB_READ } = require("./consts"); diff --git a/src/backend/src/services/drivers/DriverService.js b/src/backend/src/services/drivers/DriverService.js index e4f8c176..bca02abe 100644 --- a/src/backend/src/services/drivers/DriverService.js +++ b/src/backend/src/services/drivers/DriverService.js @@ -23,7 +23,7 @@ const { TypedValue } = require("./meta/Runtime"); const BaseService = require("../BaseService"); const { Driver } = require("../../definitions/Driver"); const { PermissionUtil } = require("../auth/PermissionService"); -const { Invoker } = require("../../../../putil/src/libs/invoker"); +const { Invoker } = require("../../../../putility/src/libs/invoker"); const { get_user } = require("../../helpers"); /** diff --git a/src/backend/src/services/drivers/FileFacade.js b/src/backend/src/services/drivers/FileFacade.js index 3dd65f8b..5fa01fb6 100644 --- a/src/backend/src/services/drivers/FileFacade.js +++ b/src/backend/src/services/drivers/FileFacade.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { Context } = require("../../util/context"); const { MultiValue } = require("../../util/multivalue"); const { stream_to_buffer } = require("../../util/streamutil"); diff --git a/src/backend/src/services/drivers/meta/Construct.js b/src/backend/src/services/drivers/meta/Construct.js index 9e344b11..aebbc57e 100644 --- a/src/backend/src/services/drivers/meta/Construct.js +++ b/src/backend/src/services/drivers/meta/Construct.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { BasicBase } = require("../../../../../putil/src/bases/BasicBase"); +const { BasicBase } = require("../../../../../putility/src/bases/BasicBase"); const types = require("../types"); const { hash_serializable_object, stringify_serializable_object } = require("../../../util/datautil"); diff --git a/src/backend/src/services/drivers/meta/Runtime.js b/src/backend/src/services/drivers/meta/Runtime.js index 361626fd..a830a602 100644 --- a/src/backend/src/services/drivers/meta/Runtime.js +++ b/src/backend/src/services/drivers/meta/Runtime.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { BasicBase } = require("../../../../../putil/src/bases/BasicBase"); +const { BasicBase } = require("../../../../../putility/src/bases/BasicBase"); const { TypeSpec } = require("./Construct"); class RuntimeEntity extends BasicBase { diff --git a/src/backend/src/services/drivers/types.js b/src/backend/src/services/drivers/types.js index fc0f00c8..0afa8701 100644 --- a/src/backend/src/services/drivers/types.js +++ b/src/backend/src/services/drivers/types.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { is_valid_path } = require("../../filesystem/validation"); const { is_valid_url, is_valid_uuid4 } = require("../../helpers"); const { FileFacade } = require("./FileFacade"); diff --git a/src/backend/src/services/file-cache/FileCacheService.js b/src/backend/src/services/file-cache/FileCacheService.js index faefe20d..13378f25 100644 --- a/src/backend/src/services/file-cache/FileCacheService.js +++ b/src/backend/src/services/file-cache/FileCacheService.js @@ -17,7 +17,7 @@ * along with this program. If not, see . */ const TeePromise = require("@heyputer/multest/src/util/TeePromise"); -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const { FileTracker } = require("./FileTracker"); const { pausing_tee } = require("../../util/streamutil"); diff --git a/src/backend/src/services/sla/RateLimitService.js b/src/backend/src/services/sla/RateLimitService.js index 86d5b77a..344e4599 100644 --- a/src/backend/src/services/sla/RateLimitService.js +++ b/src/backend/src/services/sla/RateLimitService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const APIError = require("../../api/APIError"); const { Context } = require("../../util/context"); const BaseService = require("../BaseService"); diff --git a/src/backend/src/services/thumbnails/HTTPThumbnailService.js b/src/backend/src/services/thumbnails/HTTPThumbnailService.js index 6c133f66..ab75ab71 100644 --- a/src/backend/src/services/thumbnails/HTTPThumbnailService.js +++ b/src/backend/src/services/thumbnails/HTTPThumbnailService.js @@ -22,7 +22,7 @@ const axios = require('axios'); const { TeePromise } = require("../../util/promise"); -const { AdvancedBase } = require('@heyputer/putil'); +const { AdvancedBase } = require('@heyputer/putility'); const FormData = require("form-data"); const { stream_to_the_void, buffer_to_stream } = require('../../util/streamutil'); const BaseService = require('../BaseService'); diff --git a/src/backend/src/util/multivalue.js b/src/backend/src/util/multivalue.js index fdda6630..06950b53 100644 --- a/src/backend/src/util/multivalue.js +++ b/src/backend/src/util/multivalue.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); /** * MutliValue represents a subject with multiple values or a value with multiple diff --git a/src/backend/src/util/pathutil.js b/src/backend/src/util/pathutil.js index 124bfb3a..004323f9 100644 --- a/src/backend/src/util/pathutil.js +++ b/src/backend/src/util/pathutil.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); /** * PathBuilder implements the builder pattern for building paths. diff --git a/src/backend/tools/test.js b/src/backend/tools/test.js index 65fbd419..f1f03773 100644 --- a/src/backend/tools/test.js +++ b/src/backend/tools/test.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putil"); +const { AdvancedBase } = require("@heyputer/putility"); const useapi = require("useapi"); const { BaseService } = require("../exports"); const CoreModule = require("../src/CoreModule"); diff --git a/src/git/src/filesystem.js b/src/git/src/filesystem.js index 6ef6fe0a..58bed4cd 100644 --- a/src/git/src/filesystem.js +++ b/src/git/src/filesystem.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { PosixError } from '@heyputer/putil/src/PosixError.js'; +import { PosixError } from '@heyputer/putility/src/PosixError.js'; import path_ from 'path-browserify'; let debug = false; diff --git a/src/phoenix/src/platform/node/filesystem.js b/src/phoenix/src/platform/node/filesystem.js index 7e66a170..c42b2555 100644 --- a/src/phoenix/src/platform/node/filesystem.js +++ b/src/phoenix/src/platform/node/filesystem.js @@ -20,7 +20,7 @@ import fs from 'fs'; import path_ from 'path'; import modeString from 'fs-mode-to-string'; -import { ErrorCodes, PosixError } from '@heyputer/putil/src/PosixError.js'; +import { ErrorCodes, PosixError } from '@heyputer/putility/src/PosixError.js'; // DRY: Almost the same as puter/filesystem.js function wrapAPIs(apis) { diff --git a/src/phoenix/src/platform/puter/filesystem.js b/src/phoenix/src/platform/puter/filesystem.js index d1188145..22d939a2 100644 --- a/src/phoenix/src/platform/puter/filesystem.js +++ b/src/phoenix/src/platform/puter/filesystem.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { ErrorCodes, PosixError } from '@heyputer/putil/src/PosixError.js'; +import { ErrorCodes, PosixError } from '@heyputer/putility/src/PosixError.js'; // DRY: Almost the same as node/filesystem.js function wrapAPIs(apis) { diff --git a/src/phoenix/src/puter-shell/coreutils/errno.js b/src/phoenix/src/puter-shell/coreutils/errno.js index 8ffcde10..65d7e6c4 100644 --- a/src/phoenix/src/puter-shell/coreutils/errno.js +++ b/src/phoenix/src/puter-shell/coreutils/errno.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { ErrorCodes, ErrorMetadata, errorFromIntegerCode } from '@heyputer/putil/src/PosixError.js'; +import { ErrorCodes, ErrorMetadata, errorFromIntegerCode } from '@heyputer/putility/src/PosixError.js'; import { Exit } from './coreutil_lib/exit.js'; const maxErrorNameLength = Object.keys(ErrorCodes) diff --git a/src/phoenix/src/puter-shell/coreutils/touch.js b/src/phoenix/src/puter-shell/coreutils/touch.js index 8ebb6531..e90fab67 100644 --- a/src/phoenix/src/puter-shell/coreutils/touch.js +++ b/src/phoenix/src/puter-shell/coreutils/touch.js @@ -18,7 +18,7 @@ */ import { Exit } from './coreutil_lib/exit.js'; import { resolveRelativePath } from '../../util/path.js'; -import { ErrorCodes } from '@heyputer/putil/src/PosixError.js'; +import { ErrorCodes } from '@heyputer/putility/src/PosixError.js'; export default { name: 'touch', diff --git a/src/phoenix/test/coreutils/errno.js b/src/phoenix/test/coreutils/errno.js index 036fb8e6..47903689 100644 --- a/src/phoenix/test/coreutils/errno.js +++ b/src/phoenix/test/coreutils/errno.js @@ -19,7 +19,7 @@ import assert from 'assert'; import { MakeTestContext } from './harness.js' import builtins from '../../src/puter-shell/coreutils/__exports__.js'; -import { ErrorCodes, ErrorMetadata } from '@heyputer/putil/src/PosixError.js'; +import { ErrorCodes, ErrorMetadata } from '@heyputer/putility/src/PosixError.js'; export const runErrnoTests = () => { describe('errno', function () { diff --git a/src/pty/exports.js b/src/pty/exports.js index 2dcd3197..ece46629 100644 --- a/src/pty/exports.js +++ b/src/pty/exports.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import { libs } from '@heyputer/putil'; +import { libs } from '@heyputer/putility'; const { TeePromise, raceCase } = libs.promise; const encoder = new TextEncoder(); diff --git a/src/putil/package.json b/src/putil/package.json index cbe89b9a..80a2b584 100644 --- a/src/putil/package.json +++ b/src/putil/package.json @@ -1,11 +1,13 @@ { - "name": "@heyputer/putil", + "name": "@heyputer/putility", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start-webpack": "webpack ./index.js --output-filename putility.js --output-library putility && webpack ./index.js --output-filename putility.dev.js --output-library putility --watch --devtool source-map", + "build": "webpack ./index.js --output-filename putility.js --output-library putility && { echo \"// Copyright 2024 Puter Technologies Inc. All rights reserved.\"; echo \"// Generated on $(date '+%Y-%m-%d %H:%M')\n\"; cat ./dist/putility.js; echo \"\"; } > temp && mv temp ./dist/putility.js" }, "author": "Puter Technologies Inc.", - "license": "UNLICENSED" + "license": "AGPL-3.0-only" } From a4e9c7bdd775b5b670176e117dc8f64cfa5b88ae Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Thu, 29 Aug 2024 22:24:55 -0400 Subject: [PATCH 40/49] rename folder --- package-lock.json | 8 +++++++- src/backend/src/services/BaseService.js | 2 +- src/backend/src/services/OperationTraceService.js | 2 +- src/backend/src/services/auth/Actor.js | 2 +- .../src/services/database/BaseDatabaseAccessService.js | 2 +- src/backend/src/services/drivers/FileFacade.js | 2 +- src/backend/src/services/drivers/types.js | 2 +- src/backend/src/util/multivalue.js | 2 +- src/backend/src/util/pathutil.js | 2 +- src/{putil => putility}/README.md | 0 src/{putil => putility}/index.js | 0 src/{putil => putility}/package.json | 0 src/{putil => putility}/src/AdvancedBase.js | 0 src/{putil => putility}/src/PosixError.js | 0 src/{putil => putility}/src/bases/BasicBase.js | 0 src/{putil => putility}/src/bases/FeatureBase.js | 0 .../src/features/NodeModuleDIFeature.js | 0 src/{putil => putility}/src/features/PropertiesFeature.js | 0 src/{putil => putility}/src/features/TraitsFeature.js | 0 src/{putil => putility}/src/libs/invoker.js | 0 src/{putil => putility}/src/libs/promise.js | 0 src/{putil => putility}/test/test.js | 0 22 files changed, 15 insertions(+), 9 deletions(-) rename src/{putil => putility}/README.md (100%) rename src/{putil => putility}/index.js (100%) rename src/{putil => putility}/package.json (100%) rename src/{putil => putility}/src/AdvancedBase.js (100%) rename src/{putil => putility}/src/PosixError.js (100%) rename src/{putil => putility}/src/bases/BasicBase.js (100%) rename src/{putil => putility}/src/bases/FeatureBase.js (100%) rename src/{putil => putility}/src/features/NodeModuleDIFeature.js (100%) rename src/{putil => putility}/src/features/PropertiesFeature.js (100%) rename src/{putil => putility}/src/features/TraitsFeature.js (100%) rename src/{putil => putility}/src/libs/invoker.js (100%) rename src/{putil => putility}/src/libs/promise.js (100%) rename src/{putil => putility}/test/test.js (100%) diff --git a/package-lock.json b/package-lock.json index 6a07b082..56e501e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2606,7 +2606,7 @@ "link": true }, "node_modules/@heyputer/putility": { - "resolved": "src/putility", + "resolved": "src/putil", "link": true }, "node_modules/@heyputer/terminal": { @@ -16911,9 +16911,15 @@ "version": "1.0.0", "license": "AGPL-3.0-only" }, + "src/putil": { + "name": "@heyputer/putility", + "version": "1.0.0", + "license": "AGPL-3.0-only" + }, "src/putility": { "name": "@heyputer/putility", "version": "1.0.0", + "extraneous": true, "license": "AGPL-3.0-only" }, "src/strataparse": { diff --git a/src/backend/src/services/BaseService.js b/src/backend/src/services/BaseService.js index e325d7f0..83ba918a 100644 --- a/src/backend/src/services/BaseService.js +++ b/src/backend/src/services/BaseService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../putility"); const NOOP = async () => {}; diff --git a/src/backend/src/services/OperationTraceService.js b/src/backend/src/services/OperationTraceService.js index 751efee3..7ade53f4 100644 --- a/src/backend/src/services/OperationTraceService.js +++ b/src/backend/src/services/OperationTraceService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../putility"); const { Context } = require("../util/context"); const { ContextAwareFeature } = require("../traits/ContextAwareFeature"); const { OtelFeature } = require("../traits/OtelFeature"); diff --git a/src/backend/src/services/auth/Actor.js b/src/backend/src/services/auth/Actor.js index 0c35597f..b1dde3b0 100644 --- a/src/backend/src/services/auth/Actor.js +++ b/src/backend/src/services/auth/Actor.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../../putility"); const { Context } = require("../../util/context"); const { get_user, get_app } = require("../../helpers"); const config = require("../../config"); diff --git a/src/backend/src/services/database/BaseDatabaseAccessService.js b/src/backend/src/services/database/BaseDatabaseAccessService.js index 16e5af9c..ebac058b 100644 --- a/src/backend/src/services/database/BaseDatabaseAccessService.js +++ b/src/backend/src/services/database/BaseDatabaseAccessService.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../../putility"); const BaseService = require("../BaseService"); const { DB_WRITE, DB_READ } = require("./consts"); diff --git a/src/backend/src/services/drivers/FileFacade.js b/src/backend/src/services/drivers/FileFacade.js index 5fa01fb6..8b3aa355 100644 --- a/src/backend/src/services/drivers/FileFacade.js +++ b/src/backend/src/services/drivers/FileFacade.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../../putility"); const { Context } = require("../../util/context"); const { MultiValue } = require("../../util/multivalue"); const { stream_to_buffer } = require("../../util/streamutil"); diff --git a/src/backend/src/services/drivers/types.js b/src/backend/src/services/drivers/types.js index 0afa8701..031d867e 100644 --- a/src/backend/src/services/drivers/types.js +++ b/src/backend/src/services/drivers/types.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../../putility"); const { is_valid_path } = require("../../filesystem/validation"); const { is_valid_url, is_valid_uuid4 } = require("../../helpers"); const { FileFacade } = require("./FileFacade"); diff --git a/src/backend/src/util/multivalue.js b/src/backend/src/util/multivalue.js index 06950b53..0e696d57 100644 --- a/src/backend/src/util/multivalue.js +++ b/src/backend/src/util/multivalue.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../putility"); /** * MutliValue represents a subject with multiple values or a value with multiple diff --git a/src/backend/src/util/pathutil.js b/src/backend/src/util/pathutil.js index 004323f9..6fd0e134 100644 --- a/src/backend/src/util/pathutil.js +++ b/src/backend/src/util/pathutil.js @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -const { AdvancedBase } = require("@heyputer/putility"); +const { AdvancedBase } = require("../../../putility"); /** * PathBuilder implements the builder pattern for building paths. diff --git a/src/putil/README.md b/src/putility/README.md similarity index 100% rename from src/putil/README.md rename to src/putility/README.md diff --git a/src/putil/index.js b/src/putility/index.js similarity index 100% rename from src/putil/index.js rename to src/putility/index.js diff --git a/src/putil/package.json b/src/putility/package.json similarity index 100% rename from src/putil/package.json rename to src/putility/package.json diff --git a/src/putil/src/AdvancedBase.js b/src/putility/src/AdvancedBase.js similarity index 100% rename from src/putil/src/AdvancedBase.js rename to src/putility/src/AdvancedBase.js diff --git a/src/putil/src/PosixError.js b/src/putility/src/PosixError.js similarity index 100% rename from src/putil/src/PosixError.js rename to src/putility/src/PosixError.js diff --git a/src/putil/src/bases/BasicBase.js b/src/putility/src/bases/BasicBase.js similarity index 100% rename from src/putil/src/bases/BasicBase.js rename to src/putility/src/bases/BasicBase.js diff --git a/src/putil/src/bases/FeatureBase.js b/src/putility/src/bases/FeatureBase.js similarity index 100% rename from src/putil/src/bases/FeatureBase.js rename to src/putility/src/bases/FeatureBase.js diff --git a/src/putil/src/features/NodeModuleDIFeature.js b/src/putility/src/features/NodeModuleDIFeature.js similarity index 100% rename from src/putil/src/features/NodeModuleDIFeature.js rename to src/putility/src/features/NodeModuleDIFeature.js diff --git a/src/putil/src/features/PropertiesFeature.js b/src/putility/src/features/PropertiesFeature.js similarity index 100% rename from src/putil/src/features/PropertiesFeature.js rename to src/putility/src/features/PropertiesFeature.js diff --git a/src/putil/src/features/TraitsFeature.js b/src/putility/src/features/TraitsFeature.js similarity index 100% rename from src/putil/src/features/TraitsFeature.js rename to src/putility/src/features/TraitsFeature.js diff --git a/src/putil/src/libs/invoker.js b/src/putility/src/libs/invoker.js similarity index 100% rename from src/putil/src/libs/invoker.js rename to src/putility/src/libs/invoker.js diff --git a/src/putil/src/libs/promise.js b/src/putility/src/libs/promise.js similarity index 100% rename from src/putil/src/libs/promise.js rename to src/putility/src/libs/promise.js diff --git a/src/putil/test/test.js b/src/putility/test/test.js similarity index 100% rename from src/putil/test/test.js rename to src/putility/test/test.js From 0d01d1f80017ed54b3cc24072f550a3a97f28074 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Thu, 29 Aug 2024 19:45:05 -0700 Subject: [PATCH 41/49] Update package-lock.json --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56e501e5..2ce61209 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2606,7 +2606,7 @@ "link": true }, "node_modules/@heyputer/putility": { - "resolved": "src/putil", + "resolved": "src/putility", "link": true }, "node_modules/@heyputer/terminal": { @@ -16914,12 +16914,12 @@ "src/putil": { "name": "@heyputer/putility", "version": "1.0.0", + "extraneous": true, "license": "AGPL-3.0-only" }, "src/putility": { "name": "@heyputer/putility", "version": "1.0.0", - "extraneous": true, "license": "AGPL-3.0-only" }, "src/strataparse": { From 8ad435a0ea402c5b7c32b309113b08b29512fff3 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Thu, 29 Aug 2024 21:10:22 -0400 Subject: [PATCH 42/49] dev: bundle gui in dev --- package-lock.json | 8 +- .../modules/selfhosted/SelfHostedModule.js | 6 ++ .../src/services/PuterHomepageService.js | 39 +-------- src/gui/doc/webpack_attempts.md | 81 +++++++++++++++++++ src/gui/{src => }/package.json | 3 +- src/gui/src/index.js | 4 +- src/gui/utils.js | 14 ++-- src/gui/webpack.config.cjs | 8 ++ src/gui/webpack/BaseConfig.cjs | 27 +++++++ src/gui/webpack/EmitPlugin.cjs | 78 ++++++++++++++++++ src/gui/webpack/libPaths.cjs | 15 ++++ 11 files changed, 232 insertions(+), 51 deletions(-) create mode 100644 src/gui/doc/webpack_attempts.md rename src/gui/{src => }/package.json (90%) create mode 100644 src/gui/webpack.config.cjs create mode 100644 src/gui/webpack/BaseConfig.cjs create mode 100644 src/gui/webpack/EmitPlugin.cjs create mode 100644 src/gui/webpack/libPaths.cjs diff --git a/package-lock.json b/package-lock.json index 2ce61209..16947f4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2545,6 +2545,10 @@ "resolved": "src/backend", "link": true }, + "node_modules/@heyputer/gui": { + "resolved": "src/gui", + "link": true + }, "node_modules/@heyputer/kv.js": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/@heyputer/kv.js/-/kv.js-0.1.6.tgz", @@ -16790,8 +16794,8 @@ } }, "src/gui": { - "version": "2.3.0", - "extraneous": true, + "name": "@heyputer/gui", + "version": "2.4.0", "license": "AGPL-3.0-only", "workspaces": [ "src/*" diff --git a/src/backend/src/modules/selfhosted/SelfHostedModule.js b/src/backend/src/modules/selfhosted/SelfHostedModule.js index c35e7f2a..9bbd3523 100644 --- a/src/backend/src/modules/selfhosted/SelfHostedModule.js +++ b/src/backend/src/modules/selfhosted/SelfHostedModule.js @@ -48,6 +48,12 @@ class SelfHostedModule extends AdvancedBase { command: 'npm', args: ['run', 'start-webpack'], }, + { + name: 'gui:webpack-watch', + directory: 'src/gui', + command: 'npm', + args: ['run', 'start-webpack'], + }, { name: 'terminal:rollup-watch', directory: 'src/terminal', diff --git a/src/backend/src/services/PuterHomepageService.js b/src/backend/src/services/PuterHomepageService.js index b6236620..ce5238e9 100644 --- a/src/backend/src/services/PuterHomepageService.js +++ b/src/backend/src/services/PuterHomepageService.js @@ -255,46 +255,9 @@ class PuterHomepageService extends BaseService { ? `` : '' } - ${ - ((!bundled && manifest?.lib_paths) - ? manifest.lib_paths.map(path => `\n`) - : []).join('') - } - - - ${ - ((!bundled && manifest?.js_paths) - ? manifest.js_paths.map(path => writeScriptTag(path)) - : []).join('') - } - + +