Commit Graph

488 Commits

Author SHA1 Message Date
KernelDeimos
34d4d606c3 tweak: add more information to errors 2024-06-17 22:45:05 -04:00
KernelDeimos
831c29f23b tweak: report permission for file shares 2024-06-17 22:13:06 -04:00
KernelDeimos
6cdbc92ae3 tweak: add dry-run and tweak response for /share 2024-06-17 18:34:45 -04:00
KernelDeimos
846fdc20d4 feat: multi-recipient multi-file share endpoint 2024-06-17 18:34:45 -04:00
KernelDeimos
f7a054956b fix: add app_uid param to kv interface 2024-06-17 17:33:37 -04:00
KernelDeimos
35cbec43e6 tweak: add full fsentry to share notification 2024-06-16 22:00:15 -04:00
KernelDeimos
31d4eb090e feat: implicit access from apps to shared appdata dirs 2024-06-16 21:09:04 -04:00
KernelDeimos
a2a10b94be fix: do not delegate to select on read like ever that is really dumb 2024-06-16 20:57:32 -04:00
KernelDeimos
9b39309e18 fix: database migration 2024-06-16 18:59:45 -04:00
Nariman Jelveh
6d1c1d3ed2 Add support for the metadata attribute for the App object in puter.js 2024-06-16 15:12:33 -07:00
KernelDeimos
f7216b9567 feat: add app metadata 2024-06-16 16:41:28 -04:00
KernelDeimos
632c536616 fix: correct shown flag behavior 2024-06-16 02:19:37 -04:00
KernelDeimos
8c49ba2553 feat: add share list to stat 2024-06-16 01:54:25 -04:00
KernelDeimos
b648817f27 fix: incorrect error from suggested_apps 2024-06-15 23:21:54 -04:00
KernelDeimos
2f6c428a40 feat: send notification when file gets shared 2024-06-15 22:39:47 -04:00
KernelDeimos
f9d2a87d25 chore: choose end-user-facing name for fs nodes 2024-06-15 22:39:47 -04:00
KernelDeimos
0f05a41ea8 tweak: add improvements to share/file-by-username 2024-06-15 22:39:47 -04:00
KernelDeimos
9ac8535832 Add support for optional auth 2024-06-15 22:39:47 -04:00
Nariman Jelveh
ea84c2f26d Fix issues with inconsistent path formats for owned files vs shared files 2024-06-15 22:39:47 -04:00
KernelDeimos
f2c6e01296 fix: remove legacy permission check in stat 2024-06-15 22:39:47 -04:00
KernelDeimos
d128ceed6f fix: handle subpaths under another user 2024-06-15 22:39:47 -04:00
KernelDeimos
19a5eb0076 feat: add readdir delegate for sharing user homedirs 2024-06-15 22:39:47 -04:00
KernelDeimos
8424d44609 feat: add readdir delegate for shares in a user directory 2024-06-15 22:39:47 -04:00
KernelDeimos
1166e69c76 fix: remove last component when share URL is file 2024-06-15 22:39:47 -04:00
KernelDeimos
079e25a9fe feat: add /show urls 2024-06-15 22:39:47 -04:00
KernelDeimos
5d214c7b52 feat: add /share/file-by-username endpoint 2024-06-15 22:39:47 -04:00
KernelDeimos
d5d987ead6 chore: fix typo because acknowledge is not spelled awknowledge in any variant of the english language 2024-06-15 19:25:09 -04:00
KernelDeimos
20542b0565 tweak: update notification format 2024-06-15 18:59:32 -04:00
KernelDeimos
ef8f4de962 tweak: use timestamps to track notif awks 2024-06-15 18:59:32 -04:00
KernelDeimos
f06cb30447 tweak: set limit to 200 for notification select 2024-06-15 18:59:32 -04:00
KernelDeimos
c5334b0e19 feat: introduce notification selection via driver 2024-06-15 18:59:32 -04:00
KernelDeimos
0101f425d4 feat: add mark-read endpoint 2024-06-15 18:59:32 -04:00
KernelDeimos
02fc4d86b7 feat: re-send unreads on login 2024-06-15 18:59:32 -04:00
KernelDeimos
a1e6887bf9 feat: add service for notifications 2024-06-15 18:59:32 -04:00
KernelDeimos
a623c94728 tweak: set app/subdomain query limit very high 2024-06-15 16:41:51 -04:00
KernelDeimos
ba58c3fbeb Add a debug logger for backend 2024-06-15 16:02:07 -04:00
KernelDeimos
502c9a36c7 chore: cleanup console log in BroadcastService 2024-06-15 13:53:53 -04:00
KernelDeimos
1207a158bd feat: add cross-server event broadcasting 2024-06-14 23:17:58 -04:00
KernelDeimos
2cc1c5ac6c chore: fix linter errors 2024-06-14 22:01:31 -04:00
Nariman Jelveh
72641c66a2 Support the modification of individual items withing a menu bar 2024-06-12 19:18:24 -07:00
KernelDeimos
cdff12e4e0 Remove repo links from Phoenix shell init 2024-06-12 01:50:13 -04:00
KernelDeimos
8e0f150fab Fix ESM-interop issue 2024-06-11 13:57:03 -04:00
KernelDeimos
684b0dc059 Support configurable mod locations 2024-06-10 03:02:17 -04:00
KernelDeimos
8d22276f13 fix(backend): remove a bad thing that really doesn't work 2024-06-09 14:21:07 -04:00
KernelDeimos
eb05fbd2dc feat: add external mod loading
A package called "useapi" is introduced to provide a dynamic import
system. This import system, rather than relying on the state of the
filesystem, is populated as modules are installed into Puter's kernel.

The "useapi" package is then used to add support for loading external
mod directories as Puter kernel modules, making it possible to mod puter
without any tooling.
2024-06-09 13:14:48 -04:00
Eric Dubé
fa7bec3854
refactor: flatten the monorepo 2024-06-08 01:07:42 -04:00
KernelDeimos
f88c4a5c9c doc(backend): document modules, services, and service-scripts 2024-06-06 20:10:23 -04:00
KernelDeimos
30550fcddd feat(backend): add script service
The script service allows other services to register re-runnable tasks
called "scripts". These can be invoked via "script:run" in the console.
2024-06-05 16:17:03 -04:00
Nariman Jelveh
1416807c9d
Merge pull request #454 from eltociear/patch-3
chore: update UI.js
2024-06-05 10:39:43 -07:00
KernelDeimos
0b0707363c Fix potential race condition 2024-06-04 16:28:53 -04:00
Ikko Eltociear Ashimine
de974f0551
chore: update UI.js
occured -> occurred
2024-06-05 01:17:23 +09:00
Eric Dubé
aec5cd5148
Merge pull request #451 from HeyPuter/eric/drivers-1
refactor(backend): de-couple driver registration from DriverService
2024-06-03 18:11:53 -04:00
Eric Dubé
2a2a42c153
Merge pull request #424 from AtkinsSJ/sed
Actually parse sed scripts
2024-06-03 12:22:15 -04:00
Nariman Jelveh
a81f461b54 Implement the contextMenu API for Puter.js 2024-06-02 16:15:35 -07:00
Nariman Jelveh
233a2719c6 Add temp-email driver implementation to the SDK 2024-06-01 16:34:37 -07:00
KernelDeimos
665b2d4e4e refactor(backend): de-couple driver registration from DriverService 2024-06-01 18:20:27 -04:00
KernelDeimos
2d8e6240c6 feat(backend): add tip of day 2024-05-31 20:36:14 -04:00
KernelDeimos
4bdad75766 feat(backend): improve logger and reduce logs 2024-05-31 19:40:13 -04:00
KernelDeimos
522664d415 feat(backend): allow services to provide user properties 2024-05-31 18:10:11 -04:00
Sam Atkins
6de4c89c25 refactor(phoenix): Combine similar sed command classes
These make more sense combined into one Command which is controlled by
constructor parameters:

- b, t and T
- d and D
- g and G
- h and H
- p and P
2024-05-31 15:49:32 +01:00
Sam Atkins
0d4f907b66 feat(phoenix): Implement parsing of sed scripts
Sed is now finally able to actually run scripts, instead of ignoring all
input and running a hard-coded test script!
2024-05-31 15:49:32 +01:00
Sam Atkins
e047b0bf30 fix(phoenix): Add missing newlines to sed command output 2024-05-31 15:49:32 +01:00
Sam Atkins
f250f86446 feat(phoenix): Add --dump and --file options to sed 2024-05-31 15:49:32 +01:00
Sam Atkins
4067c82486 feat(phoenix): Expose parsed arg tokens to apps that request them
Some shell apps care about what order the arguments appear in. When
`parseArgs()` is called with `tokens: true`, it produces this `tokens`
array which represents all the command line options and arguments, in
order, which is useful for these more advanced cases.
2024-05-31 15:49:32 +01:00
Sam Atkins
306014adc7 feat(phoenix): Add more commands to sed, including labels and branching
This is ported over from an old forgotten branch I'd deleted, then
thankfully managed to dig up again. 😅

Instead of making GroupCommand contain child commands, use a flat array
for commands and implement groups as GroupStartCommand and
GroupEndCommand. This makes it much simpler to iterate the commands
list in order to jump to labels.

Then implement those labels and the commands that use them: b, t, and T.

Also add the s SubstituteCommand, and combine the code for the q and Q
commands.
2024-05-31 15:49:32 +01:00
Sam Atkins
6aae8fc63b refactor(phoenix): Split up sed code
Let's organise this a bit.
2024-05-31 15:49:32 +01:00
Sam Atkins
9b4d16fbe9 fix(parsely): Make Repeat parser work when no separator is given 2024-05-31 15:49:32 +01:00
Sam Atkins
d46b043c5d feat(parsely): Add stringUntil() parser
The counterpart of stringOf(), it reads characters until it matches its
parameter.
2024-05-31 15:49:32 +01:00
Sam Atkins
5656d9d42f feat(parsely): Add a fail() parser
I've found this useful for stubbing out parts of a grammar during
development.
2024-05-31 15:49:32 +01:00
KernelDeimos
fccabf1bc0 feat(backend): allow services to provide whoami values 2024-05-30 17:11:06 -04:00
Eric Dubé
895358e6e5
Merge pull request #423 from AtkinsSJ/parsely
Tidy up "newparser" so it can be used properly
2024-05-30 12:42:03 -04:00
Eric Dubé
d57980c6cb
Merge pull request #421 from AtkinsSJ/exit-status
Add exit status codes to `puter.exit()`, and an `exit` builtin to Phoenix
2024-05-30 12:28:36 -04:00
Eric Dubé
0672562c8a
Merge pull request #442 from HeyPuter/eric/extensibility
class registry for service scripts
2024-05-28 20:10:03 -04:00
KernelDeimos
e050506a05 Add class registry (second pass)
ExportService gets removed and instead a global class registry is added.
The `init.js` file is split into `init_sync.js` and `init_async.js`
so that synchronous code that isn't dependent on imports is guarenteed
to run before initgui.js. The globalThis scope and service-script API
now expose `def`, a function for registering class definitions, and
`use`, a function for obtaining registered classes.
2024-05-28 19:06:00 -04:00
KernelDeimos
cd574c87ef Fix the previous fix 2024-05-28 16:10:43 -04:00
KernelDeimos
4e3a24e609 fix: check subdomain earlier for /apps 2024-05-28 15:51:22 -04:00
Eric Dubé
c495ccff65
Merge pull request #408 from AtkinsSJ/git-client
Add a git client
2024-05-28 12:10:01 -04:00
KernelDeimos
51bac4486f Add class registry (first pass)
In the first pass I add a `register` method and update `defineComponent`
so it calls `register` as well. This made it possible to create a
proof-of-concept for registered classes. Additionally ExportService was
added to expose registered classes to service scripts. This first pass
works, but it would be better if all types of classes (components or
otherwise) were registered via the same method.
2024-05-27 21:16:50 -04:00
KernelDeimos
c0cb1cd2b8 refactor: add GetUserService 2024-05-26 00:31:51 -04:00
KernelDeimos
cbfad2ef7a refactor(gui): add service scripts 2024-05-24 19:29:07 -04:00
Sam Atkins
03123faa8a Finish concept JSON parser
This now can parse JSON correctly in various configurations.
2024-05-24 16:23:26 +01:00
Sam Atkins
7fccf79591 Make stringOf() take a callback instead of an array of accepted values
THe `a.stringOf(' \r\n\t'.split('')),` pattern works fine for small sets
of characters, but is horrible for situations like "any alphanumeric".
Instead, let's make it take a callback function that is run on each
character.
2024-05-24 16:23:26 +01:00
Sam Atkins
d3dff8c20e Throw errors if parsing fails
Not consuming all input is now treated as an error, unless the
`must_consume_all_input` flag is set to false when parsing.
2024-05-24 16:23:26 +01:00
Sam Atkins
0bc4c3fde2 Move StringStream into Parsely 2024-05-24 16:23:26 +01:00
Sam Atkins
873dee7e51 Implement 'trailing' parameter for repeat() parser 2024-05-24 13:30:45 +01:00
Sam Atkins
837ec68371 Reorganize and document Parsely classes
- lib.js only holds Parser so rename it parser.js
- Move Symbol and None into terminals.js
- Briefly document all parser classes
2024-05-24 12:26:04 +01:00
Sam Atkins
f8525c6f6c Rename newparser to Parsely
We're going to actually use this so let's give it a more permanent name.
2024-05-24 11:48:34 +01:00
KernelDeimos
a1cfe7aef2 Allow services to register additional js files for gui 2024-05-23 18:41:34 -04:00
KernelDeimos
5042d49935 Simplify debugging runtime config object changes 2024-05-23 18:40:41 -04:00
KernelDeimos
c89b50bf31 Refactor gui loading 2024-05-23 18:13:57 -04:00
Sam Atkins
3184d3482c feat(phoenix): Implement an exit builtin 2024-05-23 15:27:15 +01:00
Sam Atkins
5de3052026 feat(phoenix): Respond to exit status codes
- Detect exit status of Puter apps, now that that's available.
- Store the exit status of each pipeline.
- Display a message when the exit status was non-zero.

That message is temporary, until we have a better way of displaying or
querying it, such as the `$?` shell variable.
2024-05-23 15:26:43 +01:00
Sam Atkins
7674da4cd2 feat: Add exit status code to apps
`puter.exit()` now takes a status code, similar to the exit status on
desktop OSes. This is passed to the appClosed event, so that eg a
parent app can know whether its child app ran successfully.
2024-05-23 12:54:06 +01:00
Eric Dubé
b15dc316d3
Merge pull request #406 from AtkinsSJ/fs-upload-data-type-error
Explicitly reject invalid types for puter.fs.upload() and .write() payloads
2024-05-22 12:13:24 -04:00
Sam Atkins
10f715f726 Implement git show 2024-05-22 16:00:42 +01:00
Sam Atkins
0377015190 Implement git config
This is also basic:

git config key             # To read a value
git config key value       # To set a value
git config --unset key     # To delete a value

As noted, --list is not possible to implement currently.
2024-05-22 16:00:42 +01:00
Sam Atkins
98c33fb3cc Implement git log
This is quite barebones for now.

Commit formatting is done in a separate file, as this is used by other
git commands, such as `show`.
2024-05-22 16:00:42 +01:00
Sam Atkins
b4e2ba4544 Implement git commit 2024-05-22 16:00:42 +01:00
Sam Atkins
32c172d145 Implement git add 2024-05-22 16:00:42 +01:00
Sam Atkins
5a308a2a53 Implement git status 2024-05-22 16:00:42 +01:00
Sam Atkins
71873a9c27 Add a helper function for finding the git repo 2024-05-22 16:00:42 +01:00
Sam Atkins
5e3db870ec Implement git init 2024-05-22 16:00:42 +01:00
Sam Atkins
85b7587c42 Implement git help, git version, and subcommand infrastructure
Each subcommand is its own file, modeled after Phoenix's coreutils.
2024-05-22 16:00:42 +01:00
Sam Atkins
b75c42b39f Implement Puter filesystem wrapper for git app 2024-05-22 08:56:50 +01:00
Sam Atkins
0d2ffdb380 Add boilerplate for empty git app
It does nothing but output a message to the console.
2024-05-22 08:56:50 +01:00
Sam Atkins
8f1c4fcda9 feat(Phoenix): Pass command line arguments and ENV when launching apps 2024-05-22 08:56:50 +01:00
Sam Atkins
bf33fd752d Remove outdated FIXMEs about consuming extra stdin data 2024-05-22 08:56:50 +01:00
Sam Atkins
c08c8bd073 Expose POSIX error name as PosixError.code
This matches the behaviour of Node.JS's errors, and some libraries
expect it.
2024-05-22 08:56:50 +01:00
Sam Atkins
8098dc9dcc Move error-conversion functions into PosixError
Specifically, this makes the Puter->PosixError conversion available to
the in-progress git client.
2024-05-22 08:56:50 +01:00
Sam Atkins
e43b21387c Move PosixError into puter-js-common
The in-progress git client also needs to use this. puter-js-common uses
commonjs modules, so it had to be adjusted for that.
2024-05-22 08:56:50 +01:00
KernelDeimos
1f6a2093fb Disallow negative size values 2024-05-21 18:46:34 -04:00
KernelDeimos
90463a0732 Add support for webhook endpoints 2024-05-21 17:25:28 -04:00
Karan Parmar
cc45a08388 updated the github links displayed in the Terminal welcome message 2024-05-19 11:52:26 +01:00
KernelDeimos
8cca067991 Fix 8688ha84v 2024-05-17 22:55:40 -04:00
Eric Dubé
80b763c47c
Merge pull request #407 from AtkinsSJ/clean-suggested-apps
fix: Remove null or duplicate app entries from suggest_app_for_fsentry()
2024-05-17 15:46:06 -04:00
KernelDeimos
639e40d355 Phoenix shell deployment update 2024-05-17 13:26:44 -04:00
KernelDeimos
f964f06f3f Fix 8688h4bwg 2024-05-17 13:05:13 -04:00
KernelDeimos
e4543c5f35 Fix 8688ggu00 (2) 2024-05-17 12:32:16 -04:00
Sam Atkins
6900233c5a fix: Remove null or duplicate app entries from suggest_app_for_fsentry() 2024-05-17 15:34:36 +01:00
Sam Atkins
03fe3b6a0d Reject invalid types for puter.fs.upload() items or .write() data
Previously, this would crash in upload() when trying to iterate the
`entries` array, which is undefined when the `items` parameter is an
unsupported type.
2024-05-17 14:39:31 +01:00
Sam Atkins
a9c89cef19 refactor: Reduce boilerplate for returning errors from puter.fs.upload() 2024-05-17 14:39:31 +01:00
KernelDeimos
c55b1e4680 Remove verification requirement on contact us form 2024-05-16 19:08:51 -04:00
KernelDeimos
e3f57ee20e Add path builder 2024-05-16 19:02:58 -04:00
KernelDeimos
5031cea040 Update _default.js for deployment purposes 2024-05-16 18:55:59 -04:00
KernelDeimos
49b257ecff fix(security): Move token for socket.io to request body
Currently this commit breaks websocket events and needs to
be updated.
2024-05-16 17:58:44 -04:00
KernelDeimos
f042b095f1 Fix 8688gxkuj 2024-05-16 17:25:41 -04:00
Eric Dubé
f54657a569
Merge pull request #402 from HeyPuter/eric/email-lock
Add locking to save_account
2024-05-15 18:49:03 -04:00
Eric Dubé
1aa27084d0
Merge pull request #396 from AtkinsSJ/xterm-fix
fix(Terminal): Accept input from Chrome on Android
2024-05-15 18:24:02 -04:00
KernelDeimos
691c8f1436 Add locking to save_account 2024-05-15 18:22:54 -04:00
Eric Dubé
b72e5b7e02
Merge pull request #401 from HeyPuter/eric/service-patches
Allow patching services
2024-05-15 15:47:14 -04:00
KernelDeimos
c70e378973 Add error id for expired auth tokens 2024-05-15 15:42:00 -04:00
KernelDeimos
21444daefb Add jsdoc comments to registerService and patchService 2024-05-15 15:41:37 -04:00
KernelDeimos
2e0d7361cb Add method to patch services 2024-05-15 15:32:18 -04:00
Eric Dubé
6e0b6d84d2
Merge pull request #400 from AtkinsSJ/fix-apierror-includes
fix: Correct APIError imports
2024-05-15 13:51:04 -04:00
Sam Atkins
062e23b5c9 fix: Correct APIError imports
APIError is the only thing exported from its file, so we must not wrap
it in {}.
2024-05-15 17:47:15 +01:00
Sam Atkins
a8160a8cdc fix: Add missing file extension to 0009_app-prefix-fix.sql in DB init 2024-05-15 10:18:28 +01:00
KernelDeimos
0b093dd57e Revoke other sessions when password is changed 2024-05-14 19:40:57 -04:00
KernelDeimos
923d5878c3 Prevent enable of 2FA without configure 2024-05-14 17:33:14 -04:00
Sam Atkins
4ef3e53de3 fix(Terminal): Accept input from Chrome on Android
Xterm.js produces two kinds of events: onKey and onData. On a desktop,
these are effectively the same, but on mobile, IME inputs produce data
but not key presses. By listening to onData instead of onKey, we get
that input.

With some experimentation, I also found that we don't need the code to
handle enter, home, end, or Ctrl-Shift-V. All of these function as
expected without that code, so we can remove it and simplify this
further. :^)
2024-05-14 16:10:30 +01:00
Sam Atkins
2656b47640 chore: Update xterm
From version 5.4.0 onwards, xterm scopes its package names as
`@xterm/foo` instead of just `xterm-foo`.

We currently have a copy of xterm.css which we use instead of directly
including the one from the `@xterm/xterm` package, so I've updated the
contents of that too.
2024-05-14 16:10:30 +01:00
Sam Atkins
fafbc292ca Remove xterm dependency from Phoenix
This is used by Terminal, not Phoenix.
2024-05-14 16:10:30 +01:00
KernelDeimos
800aef1942 Implement anti-CSRF for logout 2024-05-13 20:40:27 -04:00
KernelDeimos
da7f73baa6 Add AntiCSRFService 2024-05-13 19:08:51 -04:00
KernelDeimos
afb9d866b5 fix: Fix phoenix app prefix and TokenService test 2024-05-13 18:17:39 -04:00
KernelDeimos
c2f1694107 Require password entry to disable 2FA 2024-05-13 16:00:07 -04:00
KernelDeimos
23215bd6f7 Move change_email/start to password-protected endpoint 2024-05-13 16:00:07 -04:00
KernelDeimos
1493cacb69 Add rate-limiting to new password change endpoint 2024-05-13 16:00:07 -04:00
KernelDeimos
9076fddc0d Add new password change endpoint 2024-05-13 16:00:07 -04:00
KernelDeimos
a89c9d59cf Add UserProtectedEndpointsService 2024-05-13 16:00:07 -04:00
KernelDeimos
15dec21118 doc(backend): Document the boot sequence
Now that the boot sequence is better formalized it may be documented.
2024-05-13 16:00:07 -04:00