Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,8 @@ const logIn = ({ userId, req, next, deviceLoginLimit }) => {
let sessions = [];
try {
sessions = JSON.parse(value) || [];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return;
} catch {
// Do nothing
}

if (!sessions.includes(req.sessionID)) {
Expand Down Expand Up @@ -496,9 +495,8 @@ const ensureAuthenticated = async (req, res, next) => {
let sessions = [];
try {
sessions = JSON.parse(value) || [];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return;
} catch {
// Do nothing
}

if (!sessions.includes(req.sessionID)) {
Expand Down Expand Up @@ -726,9 +724,8 @@ app.use(function (req, res, next) {
req.query.cookieOverride ||
JSON.parse(req.body.RelayState).cookieOverride ||
req.headers.cookie;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
return;
} catch {
// Do nothing
}
next();
});
Expand Down
4 changes: 2 additions & 2 deletions crons/xapi_posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ module.exports = async () => {
let json = 'No response JSON'
try {
json = await res.json()
} catch(err) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}
log(['Cron: Bad xapi post for idp id #' + row.id, json.warnings || json, JSON.stringify(statements), cronRunUid], 2);
markDone();
Expand Down
8 changes: 4 additions & 4 deletions src/routes/admin_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ module.exports = function (app, s3, ensureAuthenticatedAndCheckIDP) {
`}`
)
res.end()
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

} catch(err) {
Expand All @@ -573,8 +573,8 @@ module.exports = function (app, s3, ensureAuthenticatedAndCheckIDP) {
next,
})
}
} catch(err) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

try {
Expand Down
10 changes: 6 additions & 4 deletions src/routes/user_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const { log } = require('../utils/logger')
const util = require('../utils/util')
const sendEmail = require("../utils/sendEmail")

const cloudFront = process.env.IS_DEV ? null : new AWS.CloudFront.Signer(
process.env.CLOUDFRONT_KEY_PAIR_ID,
process.env.CLOUDFRONT_PRIVATE_KEY.replace(/\\n/g, "\n"),
)
const cloudFront = process.env.IS_DEV
? null
: new AWS.CloudFront.Signer(
process.env.CLOUDFRONT_KEY_PAIR_ID,
process.env.CLOUDFRONT_PRIVATE_KEY?.replace(/\\n/g, '\n'),
);

const getSignedCookieAsync = params => new Promise((resolve, reject) => {
cloudFront.getSignedCookie(params, (err, data) => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getShopifyUserInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const getShopifyUserInfo = async ({ email, idp, waitToExecuteIfNecessary }) => {
const { value } = metafields.find(({ key, namespace }) => (namespace === `custom` && key === `toad_reader_info`)) || {}
customerMetafieldLines = `customer:\n${JSON.parse(value).join(`\n`)}`
processedAtTimeById[`customer:`] = 1
} catch(err) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

// bookIds
Expand Down
12 changes: 6 additions & 6 deletions src/utils/indexEpub.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const getIndexedBook = async ({ baseUri, spines }) => {
try {
process.stdout.clearLine()
process.stdout.cursorTo(0)
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}
throw new Error(`Search indexing taking too long. Got through ${spineIndex} of ${spines.length} spines. Giving up: ${baseUri}`)
}
Expand All @@ -79,8 +79,8 @@ const getIndexedBook = async ({ baseUri, spines }) => {
try {
process.stdout.clearLine()
process.stdout.cursorTo(0)
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

log(`Collect garbage as memory exceeding ${garbageCollectionThresholdInMebibyte} MiB (currently ~${memoryUsageInMebibyte} MiB)...`)
Expand All @@ -92,8 +92,8 @@ const getIndexedBook = async ({ baseUri, spines }) => {
try {
process.stdout.clearLine()
process.stdout.cursorTo(0)
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

log(`SearchIndexing: parsing done // Current memory usage: ${parseInt(process.memoryUsage().rss / mebibyte)} MiB`)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/parseEpub.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ module.exports = async ({ baseUri }) => {
return true
}
})
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

} catch(e) {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ const util = {
let responseText
try {
responseText = await response.text()
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}
log([`User not found (401) response from userInfoEndpoint`, responseText], 3)
return res.send({
Expand Down Expand Up @@ -1150,8 +1150,8 @@ const util = {
)
: null
)
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}

return {
Expand Down Expand Up @@ -1302,8 +1302,8 @@ const util = {
if(row[col] !== undefined) {
try {
row[col] = JSON.parse(row[col])
} catch(e) { // eslint-disable-line @typescript-eslint/no-unused-vars
return;
} catch {
// Do nothing
}
}
})
Expand Down
Loading