diff --git a/app.js b/app.js index 6fc5501..2485e85 100644 --- a/app.js +++ b/app.js @@ -28,7 +28,7 @@ const config = { archiveLength: process.env.ARCHIVE_LENGTH_DAYS && parseInt(process.env.ARCHIVE_LENGTH_DAYS), // Every hour check for new papers and update device statuses - refreshInterval: dayjs.duration({minutes: parseInt(process.env.REFRESH_INTERVAL_MINUTES, 10)}), + refreshInterval: dayjs.duration({minutes: parseInt(process.env.REFRESH_INTERVAL_MINUTES)}), // Although the Visionect 32-inch e-ink display is 2560x1440 we choose a slightly bigger width of 1600px when converting from pdf to png // since it makes it easier to zoom/crop useless white margins around the edges of the newspapers @@ -39,7 +39,7 @@ const config = { }, // Show low battery warning below this - lowBatteryWarning: parseInt(process.env.LOW_BATTERY_WARNING, 10), + lowBatteryWarning: parseInt(process.env.LOW_BATTERY_WARNING), // VSS Settings: See https://github.com/pathikrit/node-visionect // Note: This whole section can be removed and things will still work e.g. if you are using the Joan portal diff --git a/db.js b/db.js index 4522709..828f2bd 100644 --- a/db.js +++ b/db.js @@ -1,8 +1,4 @@ module.exports = { - // Note: An `isSelected: true` item can be added to either an entry in the `newspapers` or `devices` sections below. - // Only one `isSelected` can be added across both sections, and an `isSelected` in the `newspapers` section - // takes priority over an `isSelected` in the `devices` section. - // // List of newspapers we support // and a function for each that given a date returns the url of the pdf of the front page of that newspaper for that date // The Freedom Forum has a large list of papers: https://www.freedomforum.org/todaysfrontpages/ @@ -17,7 +13,7 @@ module.exports = { id: 'LATimes', name: 'Los Angeles Times', url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/CA_LAT.pdf`, - scale: 1.03, + scale: 1.07, }, { id: 'SFChronicle', @@ -33,7 +29,7 @@ module.exports = { }, { id: 'BostonGlobe', - name: 'The Boston Globe', + name: 'Boston Globe', url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/MA_BG.pdf`, scale: 0.98, }, @@ -52,7 +48,7 @@ module.exports = { { id: 'NYT', name: 'New York Times', - isSelected: true, + isSelected: true, // isSelected: True (for either newspaper or device) means we show it as default on the server homepage url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/NY_NYT.pdf`, scale: 1.04, }, @@ -70,19 +66,19 @@ module.exports = { }, { id: 'Haaretz', - name: 'Haaretz - English Edition', + name: 'Haaretz (English Edition)', url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/ISR_HA.pdf`, scale: 1.05, }, { id: 'AsianAge', - name: 'The Asian Age', + name: 'Asian Age', url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/IND_AGE.pdf`, scale: 1.02, }, { id: 'JapanTimes', - name: 'The Japan Times', + name: 'Japan Times', url: date => `https://cdn.freedomforum.org/dfp/pdf${date.format('D')}/JPN_JT.pdf`, scale: 1.02, }, @@ -90,7 +86,7 @@ module.exports = { // Each device has the following attributes: // id: This is the joan device id e.g. from this url https://portal.getjoan.com/manage/devices/2a002800-0c47-3133-3633-333400000000 - // timezone: Since we always try to show the latest newspapers, you may not want to see newspapers from tomorrow based on your timezone. + // timezone: Your local timezone to display correct local time and make sure we don't display newspapers from "tomorrow" // showFahrenheit: Which temperature scale to use for the device temperature display in the page footer. // newspapers: A list of newspapers (from the section above) that will display on your device - in the format: // id: The id of the newspaper (from the section above). diff --git a/views/index.ejs b/views/index.ejs index db752b5..83c0826 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -2,10 +2,8 @@ Newswall - - @@ -83,13 +81,8 @@ $('#emulator').prop('src', url) } - // initialize emulation on load - const db = <%-JSON.stringify(db)%>; - - emulate( - // if there is an `isSelected` newspaper, initialize in newspapers mode, otherwise initialize in devices mode - db.newspapers.some(item => item.isSelected) ? 'newspapers' : 'devices' - ); + // if there is an `isSelected` newspaper, initialize in newspapers mode, otherwise initialize in devices mode + emulate('<%= db.newspapers.some(item => item.isSelected) ? 'newspapers' : 'devices' %>')