Skip to content

refactor(app): modernize and tidy up public entrypoint#7463

Open
joshtrichards wants to merge 8 commits intomainfrom
jtr/refactor-app-public
Open

refactor(app): modernize and tidy up public entrypoint#7463
joshtrichards wants to merge 8 commits intomainfrom
jtr/refactor-app-public

Conversation

@joshtrichards
Copy link
Member

Code was already pretty tidy; this just elevates it a bit more while cleaning up some minor tidbits.

  • Refactored php/public/index.php for improved readability, maintainability, and adherence to best practices
  • Introduced config constants; added type hints to all route closures
  • Grouped variables by domain/context for template clarity
  • Used route grouping with $group in Slim
  • Switched to consistent namespace usage
  • Added/updated comments
  • Ensured root route type hints ServerRequestInterface rather than RequestInterface
  • Dropped unused (and erroneous AFAIK) profile alias for the /containers/ route

Not offended if you don't merge this, but I was reading through it anyhow. ;-)

Shouldn't be any breaking changes; largely cosmetic. If something is broken it's probably a typo on my part. ;-)

@szaimen szaimen added this to the next milestone Jan 21, 2026
@szaimen szaimen added 2. developing Work in progress enhancement New feature or request technical debt labels Jan 21, 2026
@joshtrichards joshtrichards force-pushed the jtr/refactor-app-public branch from 895a860 to 4a2d5bb Compare January 23, 2026 15:54
@joshtrichards joshtrichards marked this pull request as ready for review January 23, 2026 22:25
@joshtrichards joshtrichards added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 23, 2026
@szaimen szaimen requested a review from pabzm January 26, 2026 09:27
@szaimen
Copy link
Collaborator

szaimen commented Jan 28, 2026

There are unfortunately some conflicts now, so this needs a rebase

@szaimen szaimen added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jan 28, 2026
@pabzm
Copy link
Member

pabzm commented Jan 29, 2026

I like some of these changes, e.g. adding type hints. But having all changes in one commit makes it really hard to review, especially if actual changes are mixed with reordering lines.

For a proper review I would need this cleaned up into smaller commits, or at least stripped by the reordering.

@szaimen szaimen modified the milestones: v12.6.0, next Jan 30, 2026
@szaimen szaimen modified the milestones: v12.6.1, next Feb 2, 2026
@szaimen szaimen modified the milestones: v12.7.0, next Feb 13, 2026
@szaimen szaimen marked this pull request as draft February 13, 2026 13:40
@joshtrichards joshtrichards force-pushed the jtr/refactor-app-public branch from 4a2d5bb to 2d75a54 Compare February 16, 2026 14:16
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
@joshtrichards joshtrichards force-pushed the jtr/refactor-app-public branch from a825df9 to 2cc9f67 Compare February 16, 2026 15:01
@joshtrichards
Copy link
Member Author

@pabzm:

I like some of these changes, e.g. adding type hints. But having all changes in one commit makes it really hard to review, especially if actual changes are mixed with reordering lines.

For a proper review I would need this cleaned up into smaller commits, or at least stripped by the reordering.

Fixed.

@joshtrichards joshtrichards marked this pull request as ready for review February 16, 2026 15:03
@joshtrichards joshtrichards added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 16, 2026
//-------------------------------------------------

// TODO: Figure out why the default plain text renderer is being used by logging
// TODO: Change logging to not generate stack traces for 404s
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pabzm didnt you find a solution to this already? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, and I had meant to post it, which I forgot. Thank you for the reminder!

See #7631

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I guess this todo can after the merge of #7631 then be removed, right? :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshtrichards please remove this todo here after #7631 is merged. Thanks! :)

//-------------------------------------------------

// TODO: Figure out why the default plain text renderer is being used by logging
// TODO: Change logging to not generate stack traces for 404s
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshtrichards please remove this todo here after #7631 is merged. Thanks! :)

});

// Auth Redirector
$app->get('/', function (\Psr\Http\Message\RequestInterface $request, Response $response, array $args) use ($container) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\Psr\Http\Message\RequestInterface is not the same as Request, which is taken from Psr\Http\Message\ServerRequestInterface, please don't change that.

Copy link
Member

@pabzm pabzm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this effort! I would be willing to merge it if you address the small issues.

Comment on lines +35 to +38
ini_set('max_execution_time', AIO_MAX_EXECUTION_TIME); // Prevent timeouts on slow networks
ini_set('session.cookie_lifetime', AIO_COOKIE_LIFETIME); // Auto-logout on browser close
ini_set('session.gc_maxlifetime', AIO_SESSION_MAX_LIFETIME); // 24h session duration
ini_set('log_errors_max_len', AIO_LOG_ERRORS_MAX_LEN); // Full error logs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the abstractions of the values in constants we cannot refer to the default values in comments here. If they ever get changed, the comments would get confusing.

'is_dri_device_enabled' => $configurationManager->nextcloudEnableDriDevice,
'is_nvidia_gpu_enabled' => $configurationManager->enableNvidiaGpu,
'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled,
'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation here (should be spaces, not a tab)

'was_start_button_clicked' => $configurationManager->wasStartButtonClicked,
'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(),
'is_mastercontainer_update_available' => ( $bypass_mastercontainer_update ? false : $dockerActionManager->IsMastercontainerUpdateAvailable() ),
'is_mastercontainer_update_available' => ( $bypassMastercontainerUpdate ? false : $dockerActionManager->IsMastercontainerUpdateAvailable() ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole commit is a fixup for f88957a#r2851763584, isn't it?

For next time I'd like to ask you to squash such commits before requesting a review. Or even better: split off the variable renaming into a separate commit, so it stays atomic. Thanks!

@szaimen szaimen added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Feb 25, 2026
@szaimen szaimen modified the milestones: v12.8.0, next Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement New feature or request technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants