Skip to content

Dash #57 Display DT Home Screen Apps#59

Merged
corsacca merged 5 commits into
DiscipleTools:masterfrom
kodinkat:dash-57-display-dt-home-screen-apps
Jan 13, 2026
Merged

Dash #57 Display DT Home Screen Apps#59
corsacca merged 5 commits into
DiscipleTools:masterfrom
kodinkat:dash-57-display-dt-home-screen-apps

Conversation

@kodinkat

Copy link
Copy Markdown
Contributor

- Introduced a new Home Screen Apps tile in the dashboard, allowing users to view their apps in a horizontally scrolling carousel.
- Registered the new tile in `disciple-tools-dashboard.php` with a priority for display.
- Added JavaScript functionality in `scripts.js` to handle app rendering and user interactions.
- Created accompanying CSS styles in `style.css` for the tile layout and responsiveness.
- Developed a template file `template.php` to structure the tile's HTML output.
- Removed unnecessary whitespace in the `register_tiles` method of `disciple-tools-dashboard.php`.
- Ensured consistent formatting for better code clarity.
- Implemented a debounce function for handling window resize events to improve performance.
- Added dynamic limiting for visible app cards based on the carousel's width.
- Introduced a "Show More" card that links to additional apps, with conditional rendering based on user activation.
- Updated CSS styles for improved layout, including hidden app cards for scrolling and responsive adjustments.
- Modified template to include the "Show More" URL for better user navigation.
@kodinkat

Copy link
Copy Markdown
Contributor Author
Screenshot 2025-12-19 at 11 55 08 Screenshot 2025-12-19 at 11 54 36

- Changed the method of retrieving apps from a filter hook to a direct method call using `DT_Home_Apps::instance()->get_apps_for_frontend( 'app' )`.
- Updated comments to reflect the new approach for clarity.
Comment thread includes/tiles/home-apps/scripts.js Outdated
const appHost = appUrlObj.hostname;
const isCrossDomain = appHost !== currentHost && appHost !== window.location.hostname;

//if (isCrossDomain) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kodinkat what is happening here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't quite follow some of the logic. It looks like sometimes we're opening apps and new tabs and sometimes not?
On my instance, they all opened in new tabs.

@corsacca

corsacca commented Jan 9, 2026

Copy link
Copy Markdown
Member

@kodinkat

Concerns:

  1. XSS Risk in createAppCard (scripts.js:151):
    onClickHandler = onclick="window.open('${appUrl.replace(/'/g, "\\'")}', '_blank'); return false;";
  2. The URL escaping only handles single quotes. A malicious URL like javascript:alert(1) or URLs with double quotes could be problematic. Consider using encodeURI() or validating the URL scheme.
  3. Commented-out code (scripts.js:131-136):
    //if (isCrossDomain) {
    // For cross-domain apps...
    //} else {
    //onClickHandler = ...
    //}
  4. Dead code should be removed before merge.
  5. Template loading safety (template.php:10-14):
    if ( !class_exists( 'DT_Home_Apps' ) ) {
    require_once $home_apps_file;
    }
  6. If the file doesn't exist AND the class doesn't exist, line 18 (DT_Home_Apps::instance()) will fatal error. Consider adding an early return.
  7. CSS specificity - Heavy use of !important (6 occurrences) suggests potential style conflicts

@corsacca

corsacca commented Jan 9, 2026

Copy link
Copy Markdown
Member

@kodinkat
Can we find a different icon for the home screen? maybe the apps icon
image
image

@cairocoder01

Copy link
Copy Markdown
Contributor

@kodinkat

Concerns:

  1. XSS Risk in createAppCard (scripts.js:151):
    onClickHandler = onclick="window.open('${appUrl.replace(/'/g, "\\'")}', '_blank'); return false;";
  2. The URL escaping only handles single quotes. A malicious URL like javascript:alert(1) or URLs with double quotes could be problematic. Consider using encodeURI() or validating the URL scheme.
  3. Commented-out code (scripts.js:131-136):
    //if (isCrossDomain) {
    // For cross-domain apps...
    //} else {
    //onClickHandler = ...
    //}
  4. Dead code should be removed before merge.
  5. Template loading safety (template.php:10-14):
    if ( !class_exists( 'DT_Home_Apps' ) ) {
    require_once $home_apps_file;
    }
  6. If the file doesn't exist AND the class doesn't exist, line 18 (DT_Home_Apps::instance()) will fatal error. Consider adding an early return.
  7. CSS specificity - Heavy use of !important (6 occurrences) suggests potential style conflicts

For these js issues, it might be worth looking at the code updates I made to the home screen scripts that were just merged into develop today. I think the same script file might be able to be included on the dashboard in order to share code.

- Added functions to validate URLs and escape them for safe use in HTML onclick attributes, preventing XSS attacks.
- Updated app card click handling to ensure only validated URLs are used, enhancing security.
- Improved CSS specificity for icon styles and adjusted spinner display properties.
- Refactored template to handle early returns for missing class definitions, preventing potential errors.
@kodinkat

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-01-13 at 14 09 21

@corsacca

Copy link
Copy Markdown
Member

Thanks @kodinkat!

@corsacca corsacca merged commit a97ea9d into DiscipleTools:master Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D.T homescreen apps

3 participants