-
Notifications
You must be signed in to change notification settings - Fork 12
feat(puzzel-dashboard): Puzzel Dashboard App with screenly_inject.js #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
salmanfarisvp
wants to merge
16
commits into
master
Choose a base branch
from
feat/puzzle-dashboard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b0c7912
add screenly_inject.js method
salmanfarisvp f0688e7
fix(puzzle-dashboard): update screenly_inject.js and add README
salmanfarisvp d8aed99
docs(puzzle-dashboard): update README with Puzzle-specific details
salmanfarisvp 1eadf1d
style(puzzle-dashboard): fix Prettier formatting errors
nicomiguelino 97199b6
lint fixes
salmanfarisvp 2e9680e
relace id name and fix lint on md
salmanfarisvp 23852b9
fix(puzzle-dashboard): declare screenly_settings and Event as ESLint …
salmanfarisvp 6a0fc22
refactor(puzzle-dashboard): extract inline CSS and JS into separate s…
salmanfarisvp b2947bf
rename(puzzel-dashboard): rename directory and references from puzzle…
salmanfarisvp f3f07c9
added icon
salmanfarisvp ae9d8ec
Update edge-apps/puzzel-dashboard/screenly.yml
salmanfarisvp 9f242c6
Update edge-apps/puzzel-dashboard/static/js/main.js
salmanfarisvp 31163b5
Update edge-apps/puzzel-dashboard/static/js/main.js
salmanfarisvp bd4ae41
added qc yml
salmanfarisvp e8a7fae
add missing token
salmanfarisvp 8651100
fix(puzzel-dashboard): fix broken logic in main.js
nicomiguelino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Puzzel Dashboard | ||
|
|
||
| A Screenly Edge App that embeds the [Puzzel](https://www.puzzel.com/) admin dashboard in a full-screen iframe and automatically logs in using injected credentials. | ||
|
|
||
| ## How it works | ||
|
|
||
| 1. The player loads `index.html`, which renders a full-screen iframe pointing at the configured `dashboard_url`. | ||
| 2. On each load the player injects `screenly_inject.js` into the dashboard page and supplies the configured credentials via `screenly_settings`. | ||
| 3. The inject script detects the Puzzel login pages by their input field IDs and fills them automatically — no manual login required on the screen. | ||
|
|
||
| ## Settings | ||
|
|
||
| | Key | Type | Description | | ||
| | --------------- | ------------ | -------------------------------------------------------------------------------------------------- | | ||
| | `dashboard_url` | string (URL) | The URL of the Puzzel dashboard to display (default: `https://app.puzzel.com/admin/app/dashboard`) | | ||
| | `username` | string | Puzzel account email (Puzzel ID) | | ||
| | `password` | secret | Puzzel account password (stored encrypted) | | ||
|
|
||
| ## Login page selectors | ||
|
|
||
| The inject script handles Puzzel's two-step login at `https://app.puzzel.com/id/Account/Login`: | ||
|
|
||
| | Step | Field | Selector | | ||
| | ------------ | ----------------- | -------------------------------------------------- | | ||
| | 1 – Username | Puzzel ID (email) | `#Input_Username` | | ||
| | 1 – Submit | Next button | `button.submit-button[type="submit"]:not(.hidden)` | | ||
| | 2 – Password | Password | `#Input_Password` | | ||
| | 2 – Submit | Sign-in button | `button.submit-button[type="submit"]:not(.hidden)` | | ||
|
|
||
| The script detects which step is active by checking for the presence of `#Input_Username` or `#Input_Password` — no path matching required. | ||
|
|
||
| ## Deploying | ||
|
|
||
| ```shell | ||
| screenly edge-app create --name puzzel-dashboard --in-place | ||
| screenly edge-app deploy | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Puzzel Dashboard - Screenly Edge App</title> | ||
| <link rel="stylesheet" href="static/css/style.css" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <iframe | ||
| id="dashboard" | ||
| src="about:blank" | ||
| title="Puzzel Dashboard" | ||
| allowfullscreen | ||
| ></iframe> | ||
|
|
||
| <script src="screenly.js?version=1"></script> | ||
| <script src="static/js/main.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| syntax: manifest_v1 | ||
| id: | ||
| description: Puzzel Dashboard | ||
| icon: https://playground.srly.io/edge-apps/puzzel-dashboard/static/img/icon.svg | ||
| author: Screenly, Inc. | ||
| categories: | ||
| - Dashboards | ||
| ready_signal: true | ||
| settings: | ||
| dashboard_url: | ||
| type: string | ||
| title: Dashboard URL | ||
| optional: false | ||
| default_value: 'https://app.puzzel.com/admin/app/dashboard' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The URL of the dashboard to display. | ||
| type: url | ||
| password: | ||
| type: secret | ||
| title: Password | ||
| optional: false | ||
| default_value: '' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The password used to log in to the dashboard. | ||
| type: string | ||
| username: | ||
| type: string | ||
| title: Puzzel ID | ||
| optional: false | ||
| default_value: '' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The username used to log in to the dashboard. | ||
| type: string | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // Injected by the player into the dashboard page on every load. | ||
| // `screenly_settings` is provided by the player — no import needed. | ||
| // This script runs AFTER the page has fully loaded; DOMContentLoaded has | ||
| // already fired. Manipulate the DOM directly. | ||
|
|
||
| /* global screenly_settings, Event */ | ||
|
|
||
| // Set an input's value and notify change listeners. | ||
| function setValue(selector, value) { | ||
| const el = document.querySelector(selector) | ||
| if (!el) return false | ||
| el.value = value | ||
| el.dispatchEvent(new Event('change', { bubbles: true })) | ||
| return true | ||
| } | ||
|
|
||
| // ---- Puzzel (app.puzzel.com) ------------------------------------------------ | ||
| // Selectors confirmed against https://app.puzzel.com/id/Account/Login | ||
| // Two-step login: username first, then password on the next page load. | ||
|
|
||
| // Step 1 — username/Puzzel ID field | ||
| if (document.querySelector('#Input_Username')) { | ||
| if (!setValue('#Input_Username', screenly_settings.username)) { | ||
| console.log('[screenly_inject] Username field not found.') | ||
| } else { | ||
| const submitBtn = document.querySelector( | ||
| 'button.submit-button[type="submit"]:not(.hidden)', | ||
| ) | ||
| if (submitBtn) { | ||
| submitBtn.click() | ||
| } else { | ||
| console.log('[screenly_inject] Submit button not found.') | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Step 2 — password field | ||
| if (document.querySelector('#Input_Password')) { | ||
| if (!setValue('#Input_Password', screenly_settings.password)) { | ||
| console.log('[screenly_inject] Password field not found.') | ||
| } else { | ||
| const submitBtn = document.querySelector( | ||
| 'button.submit-button[type="submit"]:not(.hidden)', | ||
| ) | ||
| if (submitBtn) { | ||
| submitBtn.click() | ||
| } else { | ||
| console.log('[screenly_inject] Submit button not found.') | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| syntax: manifest_v1 | ||
| id: | ||
| description: Puzzel Dashboard | ||
| icon: https://playground.srly.io/edge-apps/puzzel-dashboard/static/img/icon.svg | ||
| author: Screenly, Inc. | ||
| categories: | ||
| - Dashboards | ||
| ready_signal: true | ||
| settings: | ||
| dashboard_url: | ||
| type: string | ||
| title: Dashboard URL | ||
| optional: false | ||
| default_value: 'https://app.puzzel.com/admin/app/dashboard' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The URL of the dashboard to display. | ||
| type: url | ||
| password: | ||
| type: secret | ||
| title: Password | ||
| optional: false | ||
| default_value: '' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The password used to log in to the dashboard. | ||
| type: string | ||
| username: | ||
| type: string | ||
| title: Puzzel ID | ||
| optional: false | ||
| default_value: '' | ||
| help_text: | ||
| schema_version: 1 | ||
| properties: | ||
| help_text: The username used to log in to the dashboard. | ||
| type: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| *, | ||
| *::before, | ||
| *::after { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| html, | ||
| body { | ||
| width: 100%; | ||
| height: 100%; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| iframe { | ||
| display: block; | ||
| width: 100%; | ||
| height: 100%; | ||
| border: none; | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* global screenly */ | ||
|
|
||
| document.addEventListener('DOMContentLoaded', async () => { | ||
| const settings = screenly.settings | ||
| const url = settings.dashboard_url | ||
|
|
||
| if (!url) { | ||
| console.error('Please specify a dashboard URL') | ||
| return | ||
| } | ||
|
salmanfarisvp marked this conversation as resolved.
|
||
|
|
||
| document.getElementById('dashboard').src = url | ||
| screenly.signalReadyForRendering() | ||
| }) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.