Skip to content

Commit

Permalink
trigger deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pathikrit committed Jul 20, 2023
1 parent 6daec0a commit 1fed4d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 7 additions & 11 deletions db.js
Original file line number Diff line number Diff line change
@@ -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/
Expand All @@ -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',
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -70,27 +66,27 @@ 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,
},
],

// 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).
Expand Down
11 changes: 2 additions & 9 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
<html lang="en">
<head>
<title>Newswall</title>

<!-- Font Awesome Icons -->
<link rel="stylesheet" href="https://kit.fontawesome.com/a22be8527e.css" crossorigin="anonymous">

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
Expand Down Expand Up @@ -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' %>')
</script>
</body>
</html>

0 comments on commit 1fed4d6

Please sign in to comment.