Skip to content

feat(puzzel-dashboard): Puzzel Dashboard App with screenly_inject.js#814

Draft
salmanfarisvp wants to merge 16 commits into
masterfrom
feat/puzzle-dashboard
Draft

feat(puzzel-dashboard): Puzzel Dashboard App with screenly_inject.js#814
salmanfarisvp wants to merge 16 commits into
masterfrom
feat/puzzle-dashboard

Conversation

@salmanfarisvp

@salmanfarisvp salmanfarisvp commented Jun 12, 2026

Copy link
Copy Markdown
Member

PR Type

Enhancement


Description

  • Add Puzzle Dashboard Edge App

  • Load dashboard URL in iframe

  • Configure URL and credential settings

  • Automate dashboard login injection


Diagram Walkthrough

flowchart LR
  manifest["screenly.yml settings"]
  app["index.html iframe app"]
  inject["screenly_inject.js login automation"]
  dashboard["Puzzle Dashboard"]
  manifest -- "provides URL and credentials" --> app
  app -- "loads dashboard URL" --> dashboard
  inject -- "fills login form" --> dashboard
Loading

File Walkthrough

Relevant files
Enhancement
screenly_inject.js
Automate dashboard login form submission                                 

edge-apps/puzzle-dashboard/screenly_inject.js

  • Adds an injected login automation script.
  • Reads username and password from screenly_settings.
  • Fills matching username and password inputs.
  • Submits forms or clicks submit buttons.
+65/-0   
index.html
Render configured dashboard in iframe                                       

edge-apps/puzzle-dashboard/index.html

  • Adds the Puzzle Dashboard HTML entrypoint.
  • Displays configured dashboard URL in fullscreen iframe.
  • Loads Screenly settings via screenly.js.
  • Signals readiness after initialization.
+49/-0   
Configuration changes
screenly.yml
Define Puzzle Dashboard app manifest                                         

edge-apps/puzzle-dashboard/screenly.yml

  • Adds Screenly Edge App manifest.
  • Defines dashboard category and ready signal.
  • Configures dashboard_url, username, and password.
  • Marks password setting as secret.
+40/-0   

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Credential exfiltration:
screenly_inject.js automatically fills and submits the configured credentials into any page containing matching username/password fields, without checking that the current origin matches the intended dashboard. A typo, redirect, or malicious configured URL could receive the saved credentials.

⚡ Recommended focus areas for review

Invalid Manifest

The manifest declares an empty id. If the Screenly manifest validator or app registry requires a unique non-empty app id, this app can fail validation or be registered with an unusable/null identifier.

id:
Credential Leak

The injector fills and submits credentials into the first matching login form without verifying the page origin. If dashboard_url is mistyped, redirected, or changed to a phishing page, the configured username and password will be submitted to that page.

usernameField.value = username;
usernameField.dispatchEvent(new Event('input', { bubbles: true }));
usernameField.dispatchEvent(new Event('change', { bubbles: true }));

passwordField.value = password;
passwordField.dispatchEvent(new Event('input', { bubbles: true }));
passwordField.dispatchEvent(new Event('change', { bubbles: true }));

var form = passwordField.closest('form') || usernameField.closest('form');
if (form) {
  form.submit();
Login Failure

Calling form.submit() bypasses normal submit event handlers and constraint validation. Dashboards that rely on JavaScript submit handlers, such as React/Vue login forms, may have the credentials filled but never execute the login flow; requestSubmit() or clicking the submit button is safer.

var form = passwordField.closest('form') || usernameField.closest('form');
if (form) {
  form.submit();

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Wait for dashboard load

screenly.signalReadyForRendering() is called before the iframe has loaded the
dashboard, so Screenly may capture/render a blank page. Signal readiness from the
iframe load event after assigning src, and keep a fallback for missing url.

edge-apps/puzzle-dashboard/index.html [41-45]

+const dashboard = document.getElementById('dashboard');
+
 if (url) {
-  document.getElementById('dashboard').src = url;
+  dashboard.addEventListener('load', () => {
+    screenly.signalReadyForRendering();
+  }, { once: true });
+
+  dashboard.src = url;
+} else {
+  screenly.signalReadyForRendering();
 }
 
-screenly.signalReadyForRendering();
-
Suggestion importance[1-10]: 8

__

Why: This correctly identifies that screenly.signalReadyForRendering() can fire before the iframe content has loaded, which may cause Screenly to render a blank page. Waiting for the load event is a meaningful functional improvement.

Medium
Preserve form submit behavior

Calling form.submit() bypasses native validation and submit event handlers, which
can break login flows implemented by modern dashboards. Prefer requestSubmit() when
available so the form behaves like a real user submission.

edge-apps/puzzle-dashboard/screenly_inject.js [29-41]

 if (form) {
-  form.submit();
+  if (form.requestSubmit) {
+    form.requestSubmit();
+  } else {
+    var formSubmitButton =
+      form.querySelector('button[type="submit"]') ||
+      form.querySelector('input[type="submit"]');
+
+    if (formSubmitButton) {
+      formSubmitButton.click();
+    } else {
+      form.submit();
+    }
+  }
 } else {
   var submitButton =
     document.querySelector('button[type="submit"]') ||
     document.querySelector('input[type="submit"]') ||
     document.querySelector('button');
   if (submitButton) {
     submitButton.click();
   } else {
     console.log('[screenly_inject] No submit button found, cannot submit form.');
   }
 }
Suggestion importance[1-10]: 7

__

Why: This is a valid issue because form.submit() bypasses native validation and submit handlers that login flows may rely on. Using requestSubmit() with a fallback improves compatibility without changing the broader behavior.

Medium

salmanfarisvp and others added 2 commits June 12, 2026 23:26
- Remove IIFE wrapper and DOMContentLoaded listener (player runs inject after page load)
- Add setValue, setReactValue, and onPath helpers from CLI template
- Target Puzzle Auth0 login page with confirmed selectors (#username, #password, button[data-action-button-primary="true"])
- Add minimal README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Link to puzzle.io and mention Auth0 Universal Login
- Replace generic customisation section with confirmed login page selectors
- Clarify username/password field descriptions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salmanfarisvp salmanfarisvp changed the title Add Puzzle Dashboard App with screenly_inject.js feat(puzzel-dashboard): Add Puzzel Dashboard App with screenly_inject.js Jun 12, 2026
- Reformat markdown table alignment in README
- Remove semicolons and reformat JS in index.html
- Use single quotes in screenly.yml
- Reformat screenly_inject.js for Prettier compliance
@salmanfarisvp salmanfarisvp changed the title feat(puzzel-dashboard): Add Puzzel Dashboard App with screenly_inject.js feat(puzzel-dashboard): Puzzel Dashboard App with screenly_inject.js Jun 12, 2026

@nicomiguelino nicomiguelino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@salmanfarisvp, don't forget to rename the puzzle-dashboard directory to puzzel-dashboard: https://github.com/Screenly/Playground/pull/815/changes

salmanfarisvp and others added 3 commits June 13, 2026 00:26
…globals

- Add /* global */ comment to suppress no-undef errors for player-injected screenly_settings and browser-native Event

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tatic files

- Move inline styles to static/css/style.css
- Move inline script to static/js/main.js
- Link both files from index.html

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… to puzzel

- Rename edge-apps/puzzle-dashboard to edge-apps/puzzel-dashboard
- Update deploy command name in README
- Update icon URL in screenly.yml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@nicomiguelino nicomiguelino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We still need to test this against Puzzel.

@salmanfarisvp

Copy link
Copy Markdown
Member Author

We still need to test this against Puzzel.

Yeah, @nicomiguelino . Once we have a demo account, we can test before merging.

Comment thread edge-apps/puzzel-dashboard/static/js/main.js Outdated
Comment thread edge-apps/puzzel-dashboard/static/js/main.js
Comment thread edge-apps/puzzel-dashboard/screenly.yml
salmanfarisvp and others added 6 commits June 13, 2026 00:56
Co-authored-by: Nico Miguelino <nicomiguelino2014@gmail.com>
Co-authored-by: Nico Miguelino <nicomiguelino2014@gmail.com>
Co-authored-by: Nico Miguelino <nicomiguelino2014@gmail.com>
- Remove misplaced nested if block and duplicate src assignment
- Skip ready signal when dashboard URL is not set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants