Commit Graph

5153 Commits

Author SHA1 Message Date
KernelDeimos 2cdc211b29 fix: incorrect parameters in UIWindowChangePassword 2026-02-19 16:21:41 -05:00
KernelDeimos 298f1cdb42 fix: incorrect accessor reference in OIDCService
During development a property named `success` was inverted to a property
named `failed` which resulted in an incorrect accessor reference with a
referring piece of code that wasn't updated. This is type error.
2026-02-19 16:21:41 -05:00
KernelDeimos e145f5dcc3 dev(oidc): rewrite "Disable 2FA" window
In lieu of knowing exactly what happened (probably more than one thing),
the "Disable 2FA" window was very broken. It was blank, but then after
fixing that all the actions were broken. There wasn't much value in
keeping the implementation though, because it was already inconsistent
with other flows - instead of fixing what was there it made more sense
to re-use the pattern of UIWindowChangeUsername and UIWindowChangeEmail,
creating UIWindowDisable2FA. After testing this, it works much better
(it actaully works), but there is a caching issue unrelated to the UI
implementation.
2026-02-19 16:21:39 -05:00
KernelDeimos 4d49f5dfa6 fix: allow html property in UIComponentWindow
A component was removed and an html property was passed to
UIComponentWindow. This makes sense because UIWindow accepts an html
property, so rather than update the calling code it made more sense to
update UIComponentWindow to be more intuitive.
2026-02-19 16:13:45 -05:00
KernelDeimos 8ecd6cd13e dev(oidc): confirm email by default for OIDC 2026-02-19 16:13:45 -05:00
KernelDeimos 21e959bbaa dev(oidc): remove button to manually invoke re-auth
This button was useful during manual testing, but the re-authentication
flow for protected endpoints with OIDC users reliably invokes the popup,
so this is no longer necessary. Removing this button reduces clutter on
these screens and might make the flow easier for users to understand.
2026-02-19 16:13:44 -05:00
KernelDeimos e2068e7b9c fix(oidc): fix QR code login issues caused by OIDC
In implementing OIDC it became necessary to introduce the separation of
"GUI Tokens" and "Session Tokens". This breaks QR login because Puter
does not set the HTTP-only session cookie when logging in with this
flow.

Add a middelware to WebServerService to detect QR Code logins and set
the appropriate HTTP-only session cookie.
2026-02-19 16:13:44 -05:00
KernelDeimos 8923bdac95 refactor(oidc): update UIWindowChangePassword
Use the openRevalidatePopup function in util/openid.js within
UIWindowChangePassword instead of re-implementing that functionality.
Additionally, normalize some of the code so it is more similar to
UIWindowChangeUsername and UIWindowChangePassword.
2026-02-19 16:13:44 -05:00
KernelDeimos df1f5c44cc refactor(oidc): extract common (email + username)
There is common functionality between all of the GUI code for actions on
protected endpoints. Update UIWindowChangeEmail and
UIWindowChangeUsername to both use a new utility function called
openRevalidatePopup in util/openid.js.

This file is called `openid.js` instead of `oidc.js` so that it's more
easily recognized by contributors who might be more familiar with the
name of the organization than the name of the standard itself.

After these changes, UIWindowChangePassword and the "disable 2FA" button
in UITabSecurity still need to be updated to use `util/openid.js`
instead of duplicating this functionality.

The justification for following DRY here instead of leaving the
implementation as-is is because these flows are particularly error
prone and will be difficult to maintain without this consistency. Some
subtle bugs I previously wasn't aware of got fixed in the process.
2026-02-19 16:13:44 -05:00
KernelDeimos 0b8eafa128 dev(oidc): re-auth remaining protected endpoints
The OIDC re-authentication flow, which replaces password confirmation
for accounts that were created with OIDC and do not have a password, was
previously added to "change username" for manual testing of the
backend-side implementation. Add the re-authentication flow to the
remaining user-protected endpoints, which are:
- change password
- change email
- disable two-factor authentication

When using "change password" on a new account created via OIDC, the
account changes state to a passworded account which causes these flows
to use password confirmation as before instead of re-authentication.
2026-02-19 16:13:41 -05:00
KernelDeimos 142d745f0a fix: "Popup Closed" message, + excess logs 2026-02-19 16:10:22 -05:00
KernelDeimos 3a9a345600 tweak: make monthly username changes configurable
The monthly number of username changes was hardcoded as `2`. Being able
to configure this value makes it easier to test the username change
flow. Hosters of OSS Puter may also find this configuration beneficial.
2026-02-19 16:10:21 -05:00
KernelDeimos d532b3d47b fix(oidc): session token vs gui token issues 2026-02-19 16:10:21 -05:00
KernelDeimos 5d22ee0517 tweak: re-enable re-auth popup closing 2026-02-19 16:10:21 -05:00
KernelDeimos 4374281070 dev: add re-authentication flow for protect actions
When users make sensitive changes to their account they are asked to
re-enter their password. This prevents a hijacked session from causing
futher damage.

Users created with the new OIDC flow do not necessarily have a password
set on their account, and they need to also be able to make these
changes. While removal of the password entry requirement for these users
would solve this problem, it would also make their accounts more
vulnerable. To solve this problem while maintaining the same security
standard for OIDC users, we need them to confirm via either 2FA or
re-authentication via OIDC. Since users aren't required to have 2FA, the
re-authentication via OIDC approach is also the minimum viable solution.

This commit adds OIDC re-authentication support for all endpoints under
UserProtectedEndpointsService, and makes updates to the
UIWindowChangeUsername dialog for manual testing.

Currently this implementation fails at the final submission to change
the username because of a separate issue with the correct authentication
token not being set; this is related to the separation of GUI tokens vs
http-only tokens.
2026-02-19 16:10:21 -05:00
KernelDeimos 7c8f0d5572 dev(backend): OIDC continued [1]
This commit is rather monolithic. An attempt to split it up into smaller
changes proved too difficult (as well as frustrating) and I realized it
would absolutely increase the chance of having a broken commit (making
bisects more difficult) unless a lot of testing effort between commits
was performed, which would have very little benefit.

The changes in this commit include:
- Outcome utility used by SignupService for error handling
- SignupService, whichs implements re-usable create_user function
- Signup method in OIDCService
- flow-specific callbacks in OIDC (separates login from signup)
- **SEPARATE SESSION COOKIE AND GUI COOKIE**
  - this change "rocks the boat" the most and has the highest likelihood
    of causing problems
2026-02-19 16:10:21 -05:00
KernelDeimos 47b133d512 dev(backend): incomplete oauth2 OIDC impl 2026-02-19 16:10:20 -05:00
Neal Shah 78a4ccb9a4 make image models case insensitive for backwards compatibility reasons (#2512)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
2026-02-18 17:01:50 -05:00
Miika Kuisma 1ec2aec66c Dashboard: Files tab fixes (#2508)
* Fixed issues where file list wasn't scrollable on mobile device, and tap'n'hold on file opened wrong context menu.

* Fixes text color of selected row
- [x] Fixes path navigation button transitions
- [x] Fixes path navigation button colors
- [x] Hide AppData folder
- [x] Hide hidden files
2026-02-18 12:19:46 -08:00
KernelDeimos cecb63b372 fix(backend): ESM/CJS interop is sad
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
Fix ESM/CJS interop issue in unit tests with a hack that checks the
class name as a string instead of just doing an `instanceof` check. This
is assuming that the "rewriter must be a PermissionRewriter" error I'm
seeing on GitHub is because there are two different "copies" of
PermissionWriter due to ESM/CJS interop issues. If this is not the case,
then you're not reading this commit message on `main`; if this commit is
on `main` then that's exactly what went down.
2026-02-17 22:19:52 -05:00
KernelDeimos 05cc4ad477 dev(puter.js): add support to request app dir
Add support for requesting access to the root directory of an app's
associated subdomain.
2026-02-17 22:19:52 -05:00
KernelDeimos bfff2d20f9 dev(backend): add /auth/request-app-root-dir
Add the ability to request an app's root directory. A permission
rewriter is provided so that apps may refer to a permission when
requesting this access without knowing the path of the app's root
directory.
2026-02-17 22:19:52 -05:00
KernelDeimos d21ed31d67 dev(backend): add debug mode for 403 responses 2026-02-17 22:19:52 -05:00
Daniel Salazar 5df1ca88ca feat: sonnet-4.6 support (#2506)
* feat: sonnet-4.6 support

* fix: tests
2026-02-17 12:10:50 -08:00
Miika Kuisma 9d598f7965 Files tab for dashboard view (#2331)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
* Dashboard - Added files tab with basic folder and files listing.

* clearing out some linter errors

* Removed Public folder for now

* Added "modified" column
Subfolder are listed before the files

* Dashboard - files tab: context menu basics

* Dashboard - Files tab: subfolders can be opened. Items can be opened from more-menu or by double clicking on them

* Dashboard - Files tab: use UIContentMenu instead of custom menu for "more menu"

* Dashboard - Files tab: Delete implemented, Trash folder added

* refactored context menu rendering

* Implemented UIItem context menu functionalities
Added path

* Rename files and folders

* Rename fix

* tweaks and fixes

* WIP: Multiple selection, drag and drop, trash folder improvements

* clean

* Files handling improvements

* empty trash fix

* grid view

* grid view improvements

* update icons
context menu for multiple items shows file counts such as: Delete (9)

* Path navifation buttons

* better way to get user's directories

* Added icons for various file types

* Use puter.kv instead of window.user_preferences

* sorting and column resizing

* documentation of the functions

* Style update. Dashboard colors now as CSS variables

* refactored restoring from trash and emptying trash with proper callbacks & refreshing

* select documents folder by default
style tweaking

* Drag to select files and folders

* dark mode

* style tweaks

* removed some dead code..

* Keyboard shortcuts (copied from UIWindow - untested & in progress)

* Add drag-and-drop file upload support to Dashboard

Implement native file drag-and-drop from local filesystem to Dashboard:
- Add dragster handlers for main content area, sidebar folders, and folder rows
- Create uploadFiles() method with progress modal and directory refresh
- Add visual feedback CSS for drop zones (highlight on hover)
- Fix subfolder drop detection to prevent duplicate uploads
- Add callback support to unzipItem/untarItem for directory refresh

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* style tweaks

* Fix cut/paste functionality in Dashboard

The cut operation was storing clipboard items as plain path strings, but
window.move_clipboard_items() looks for .item DOM elements which don't
exist in Dashboard (it uses .row elements). Added a Dashboard-specific
moveClipboardItems() method that calls puter.fs.move() directly with UIDs,
and updated cut to store objects with path and uid like copy does.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add mobile phone layout optimizations for Dashboard

- Add responsive CSS for screens ≤480px with two-row file list layout
- Wrap item-size and item-modified in item-metadata div for mobile grid
- Hide directories sidebar on mobile (use breadcrumbs for navigation)
- Reorganize header with breadcrumbs on top row, nav buttons below
- Add single-tap to open folders on touch devices
- Fix context menu "Open" action in Dashboard by adding onOpen callback
- Hide column headers on mobile since metadata is shown per-item

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add CSS variables to Dashboard bento elements for dark mode support

Replace hardcoded color values with CSS custom properties throughout
the bento card components to enable proper dark mode theming. Adds new
variables for icon shadows, fancy headers, gradients, and usage bars
with appropriate values for both light and dark color schemes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add spacebar image preview feature to Dashboard Files

Pressing spacebar on a selected image file now shows a full-size preview
popover centered over the files container. Features include:
- Toggle behavior: press spacebar again to close
- Auto-switch: selecting another file updates the preview
- Click outside to dismiss
- Works in both grid and list view

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add floating action bar for multi-file selection in Dashboard Files

When 2+ files are selected, a floating action bar appears above the footer
with quick access buttons for common operations:
- Download, Cut, Copy, Delete for normal files
- Restore and Delete Permanently for items in Trash

The bar slides up with a smooth animation and disappears when clicking
the background to deselect. Includes mobile-responsive styling with
icon-only buttons on smaller screens.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add mobile select mode for multi-file selection in Dashboard Files

On mobile devices, users can now tap a select button in the path actions
to enter select mode. In this mode, tapping files toggles their selection
instead of opening them, with checkboxes appearing next to each item.
The floating action bar appears with 1+ selected items (vs 2+ on desktop)
and includes a Done button to exit select mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Center empty directory message in Dashboard Files

Replace row-based layout with centered flex positioning for the
"No files in this directory" message, improving visual presentation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fixed issue where clicking on files background created blue dot (drag rectangle selection bug)

* Image preview size tweak

* Add URL-based routing to Dashboard with hash fragments

Enable shareable/bookmarkable URLs for Dashboard tabs and file paths.
The URL hash reflects current location (e.g., #files/username/Documents,
#usage, #account). Browser back/forward navigation now works for folder
navigation, and direct URL entry loads the correct tab and path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fixing draggable styles

* drag clone fixes

* Add smart column resizing and filename truncation to Dashboard Files

- Add middle-truncation for filenames preserving extensions (e.g., "longfile…name.txt")
- Double-click column resize handles to auto-fit content width
- Reset saved column widths to defaults if they don't fit smaller screens
- Apply truncation to both list and grid views

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Separated dashboard styles into dashboard.css and loading it dynamically only when navigating to /dashboard

* Files and folders can be dropped over path items in order to move them. This is useful when you want to move items into parent folders.

* Use custom context menu component for item-more menu on mobile devices

* Created callback system to undo_last_action so that dashboard file list would always refresh after undo operation

* gray update

* hovering folder while dragging items opens the folder

* Fixed issue with hover-dropping

* Fixed chained drag-over-folder-and-hover system

* dark mode tweak

* - [x] Right clicking on background of an empty folder doesn't trigger context menu
- [x] Right clicking on path should keep path item active
- [x] Sidebar folder don't have context menu
- [x] Drag item should be opaque so I can see through it
- [x] Transition animation issue when hovering path action buttons
- [x] Double clicking on column resizer: add padding
- [x] Load dashboard.css before loading the page content
- [x] Mobile: opening menu, clicking outside menu should close it
- [x] Mobile: on smaller screen there should be still two columns
- [x] Mobile: file name truncation in grid view doesn't work

* Added missing badges

* WIP has_worker

* display worker icon on the .js files which are workers

* Display worker badge on worker files, hovering badge shows worker URL.
Worker URL added to file properties modal.

* disable "publish as website" from context menu for folders that are already published

* Loading spinner for Files

* tweaks and fixes

* Files clean loading spinner

* Files: worker URL in the properties modal is clickable link

* use custom tooltip to display worker URL

* refactored renderDirectory

* Fix Sidebar folder highlighting

* add Beta badge on Files tab

* Implemeting socket based item updating

* Put newly added items into the position where they would land when list is sorted

* restore from trash refresh fix

* Revert "Revert "Adds worker badge to .js files which have been registered as workers. Hovering badge shows popover with worker URL. File properties modal also shows clickable worker URL. (#2462)""

This reverts commit c2750f2ca1.

* worker in stat

* update puterjs and frontend code to support returnWorkers in stat

* Better way of handling worker info

* Fixed issue where right clicking on background opened two instances of a context menu

* Fixes issue where while renaming a file, double clicking on word opened the file

* fixes issue where while dragging multiple items the top-most item was transparent resulting blurry mess

* when opening a folder, update view instantly

* Improved drag-to-select items

* Added feature where typing selects matching file items
Fixed issue where keyboard listener for file list was active when context menu was open

* Fixed issues with File -> New in context menu
Fixes issue where files-selection-actions menu didn't disappear after deleting items

* Improved drag to select behavior
Improved drag items
Improved worker badge handling

* Cancel zone for dragging items (when spring-loading subfolders)

* context menu's submenu tweak

* Fixed issue where resizing window didn't work (when using "Open in New Window" from context menu)

* Disabled buttons on .files-selection-actions while drag-to-select is happening

* Fixes issue where creating new items using right-clicking re-rendered the directory view

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: ProgrammerIn-wonderland <3838shah@gmail.com>
2026-02-17 10:50:08 -08:00
Neal Shah 4279cd92df WebDAV don't fetch thumbs or associated apps (#2505)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
2026-02-17 01:53:59 -05:00
Neal Shah 2fe4ed50c3 WebDAV don't fetch subdomains (#2504) 2026-02-17 01:47:43 -05:00
Neal Shah 562671e498 add extra permission check for granted apps (#2503) 2026-02-17 01:29:54 -05:00
Daniel Salazar 00befdc192 fix: allow b64 srings without mime type for app icons (#2502) 2026-02-16 19:28:44 -08:00
Daniel Salazar 44bb5953b4 fix: app icon origin (#2500)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
* fix: app icon origin

* fix: app icon origin size
2026-02-16 12:35:30 -08:00
Daniel Salazar 32682e73eb perf: improve app open time (#2490)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
2026-02-16 11:00:32 -08:00
KernelDeimos d9167744ef patch(puterfs): limit directory depth to 35
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
This is a temporary measure while we fix a production issue.
2026-02-13 20:53:56 -05:00
Neal Shah c87506c7d8 workers ai realias - to dot (#2493) 2026-02-13 16:40:10 -08:00
Neal Shah 0f97653b4c fix stat options when stat(path, options) (#2492) 2026-02-13 15:38:56 -08:00
Neal Shah a211aa04bc add more alises (#2491) 2026-02-13 13:46:42 -08:00
Neal Shah f65ab05b40 Add workers AI image model support (#2489) 2026-02-13 13:07:50 -08:00
Jatin Sharma 9a47bf16da Bundle docs CDN assets locally for full offline support (#2473)
* docs: bundle CDN assets locally for full offline support

* fix

* fix

* fix

* revert accidental package-lock.json changes

---------

Co-authored-by: Reynaldi Chernando <reynaldichernando@gmail.com>
2026-02-14 02:14:46 +07:00
Daniel Salazar 809d375854 fix: don't stream back bytes for icons (#2486)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
* decrease global check alerts

* fix: don't stream back bytes for icons
2026-02-12 23:34:37 -08:00
Daniel Salazar 4136cb1d24 fix: do not await for puter icon write in db (#2485) 2026-02-12 22:43:23 -08:00
jelveh f1a8fdb5c8 Trigger in-app upgrade flow for app env
Handle upgrade flow when running in the app environment by calling await puter.ui.requestUpgrade() in driverCall_. Added app-specific branches in two places where usage/insufficient-funds were previously handled only for web (which showed a web dialog). This ensures the in-app UI is used for upgrade requests and awaits the result.
2026-02-12 21:45:03 -08:00
jelveh b4c58c4f5c Update UITabUsage.js 2026-02-12 18:09:52 -08:00
jelveh 286895ff66 Disable publish worker UI badge updates
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
Temporarily comment out code in UIWindowPublishWorker that updates item UI after publishing: hiding the lines that show the item website badge, show per-item website-url badges, and set the data-website_url attribute. This prevents the publish worker from automatically modifying those DOM elements/attributes (kept commented for potential rollback or debugging).
2026-02-12 16:45:23 -08:00
Neal Shah a23f272fd2 add sandboxing by default in god mode created workers (#2481)
* add sandboxing by default in god mode workers

* closes #2481

* Update UIWindowPublishWorker.js

* Add sandbox option to worker publish UI

Add a collapsible 'Advanced' section with a 'Sandboxed' checkbox (checked by default) to UIWindowPublishWorker. On publish the code reads the checkbox state and builds createOptions ({ sandbox: true } or { sandbox: false }) and passes it to puter.workers.create as an argument so workers can be created in sandboxed or non-sandboxed mode. Small UI styling and markup for the details/summary block included.

---------

Co-authored-by: jelveh <nj@puter.com>
2026-02-12 16:06:40 -08:00
Daniel Salazar 354ac314a9 feat: subdomain error redirect (#2483) 2026-02-12 15:39:18 -08:00
Daniel Salazar 1292148b41 fix: app-icons protocol (#2480) 2026-02-12 13:47:23 -08:00
jelveh 9991d58613 Refine 'listing-rejected' email copy 2026-02-12 12:49:13 -08:00
Daniel Salazar 8a6d07ec1f fix: app icon again (#2478) 2026-02-12 12:07:03 -08:00
Daniel Salazar bfd8a4e16d fix: app icons saving (#2477) 2026-02-12 11:55:27 -08:00
Neal Shah 36b1499819 Ns/workers in stat attempt 2 (#2476)
* worker in stat

* add returnWorkers to stat

* workers in readdir
2026-02-12 10:45:22 -08:00
Neal Shah b209a94a80 dedup image models (#2475) 2026-02-12 10:39:23 -08:00