Skip to content

Commit

Permalink
added sentry as settings as per same #182 PR
Browse files Browse the repository at this point in the history
  • Loading branch information
salmanfarisvp committed Sep 17, 2024
1 parent 3c0158c commit 31c113b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edge-apps/countdown-timer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<script src="static/js/moment-timezone-with-data.min.js"></script>
<script src="static/js/offline-geocode-city-1.0.2.min.js"></script>
<script src="static/js/tz.min.js"></script>
<script src="https://browser.sentry-cdn.com/8.30.0/bundle.tracing.min.js" integrity="sha384-whi3vRW+DIBqY2lQQ6oghGXbbA0sL5NJxUL6CMC+LRJ0b4A64Qn7/6YhpeR0+3Nq" crossorigin="anonymous"></script>
<script src="static/js/main.js"></script>
<script src="https://js.sentry-cdn.com/67b32c39620467460c3e5d2b8352074a.min.js" crossorigin="anonymous"></script>
</body>

</html>
6 changes: 6 additions & 0 deletions edge-apps/countdown-timer/screenly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ settings:
title: target_timestamp
optional: false
help_text: Countdown timer value (Format YYYY-MM-DDTHH:MM:SS).
sentry_dsn:
type: secret
title: Sentry Client Key
optional: true
is_global: true
help_text: Sentry Client Key from Sentry SDK for error capturing.
18 changes: 14 additions & 4 deletions edge-apps/countdown-timer/static/js/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
/* global clm, moment, OfflineGeocodeCity, screenly, tzlookup */
/* global clm, moment, OfflineGeocodeCity, screenly, tzlookup, Sentry */
// eslint-disable-next-line no-unused-vars

document.addEventListener('DOMContentLoaded', async () => {
const { getNearestCity } = OfflineGeocodeCity
const allTimezones = moment.tz.names()

async function initApp () {
const sentryDsn = screenly.settings.sentry_dsn
// Initiate Sentry.
if (sentryDsn) {
Sentry.init({
dsn: sentryDsn
})
} else {
console.warn('Sentry DSN is not defined. Sentry will not be initialized.')
}

async function initApp() {
let clockTimer
const { metadata, settings } = screenly
const latitude = metadata.coordinates[0]
Expand Down Expand Up @@ -110,7 +120,7 @@ document.addEventListener('DOMContentLoaded', async () => {
document.documentElement.style.setProperty('--theme-color-background', backgroundColor)

// Function to determine the image format based on the initial bytes
function getImageFormat (buffer) {
function getImageFormat(buffer) {
const arr = new Uint8Array(buffer).subarray(0, 4)
let header = ''
for (let i = 0; i < arr.length; i++) {
Expand All @@ -131,7 +141,7 @@ document.addEventListener('DOMContentLoaded', async () => {
}
}

function setLogoImage () {
function setLogoImage() {
// Brand logo fetch from the setting as without the URL extension, and here we are fining and inserting right extension as per the received image header.
const logoElement = document.getElementById('brandLogo')
const defaultLogo = './static/img/Screenly.svg'
Expand Down

0 comments on commit 31c113b

Please sign in to comment.