chore: Linter issues
This commit is contained in:
parent
7aafcead2b
commit
91c70f3e9d
11 changed files with 19 additions and 20 deletions
|
@ -69,9 +69,8 @@ const uploadToCloudflare = async (id, url) => {
|
|||
const form = new FormData()
|
||||
form.append('id', id)
|
||||
form.append('url', url)
|
||||
let result
|
||||
try {
|
||||
result = await axios.post(
|
||||
await axios.post(
|
||||
'https://api.cloudflare.com/client/v4/accounts/edd96e8b19d1be5946c5f7983365bda4/images/v1',
|
||||
form,
|
||||
{ headers }
|
||||
|
@ -80,7 +79,6 @@ const uploadToCloudflare = async (id, url) => {
|
|||
console.log(err.response.data)
|
||||
}
|
||||
|
||||
// Handle result here
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@ import path from 'path'
|
|||
import { fileURLToPath } from 'url'
|
||||
import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-sesv2'
|
||||
|
||||
// Current working directory
|
||||
const cwd = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
export const send = async ({
|
||||
to = ['joost@joost.at'],
|
||||
bcc = [],
|
||||
|
|
|
@ -10,7 +10,7 @@ const runChecks = (req) => {
|
|||
if (req.body.import_token !== process.env.IMPORT_TOKEN) {
|
||||
return [401, { result: 'error', error: 'accessDenied' }]
|
||||
}
|
||||
if (req.body.import_token !== process.env.IMPORT_TOKEN) {
|
||||
if (!Array.isArray(req.body.list)) {
|
||||
return [400, { result: 'error', error: 'listMissing' }]
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { hash, randomString } from '../utils/crypto.mjs'
|
||||
import { hash } from '../utils/crypto.mjs'
|
||||
import { log } from '../utils/log.mjs'
|
||||
import { clean, i18nUrl } from '../utils/index.mjs'
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import jwt from 'jsonwebtoken'
|
||||
import { log } from '../utils/log.mjs'
|
||||
import { hash, hashPassword, randomString, verifyPassword } from '../utils/crypto.mjs'
|
||||
import { storeImage, replaceImage } from '../utils/cloudflare-images.mjs'
|
||||
import { replaceImage } from '../utils/cloudflare-images.mjs'
|
||||
import { clean, asJson, i18nUrl } from '../utils/index.mjs'
|
||||
import { ConfirmationModel } from './confirmation.mjs'
|
||||
import { SetModel } from './set.mjs'
|
||||
|
@ -867,7 +867,7 @@ const migrateUser = (v2) => {
|
|||
initial,
|
||||
imperial: v2.units === 'imperial',
|
||||
language: v2.settings.language,
|
||||
lastSignIn: v2.time.login,
|
||||
lastSignIn: v2.time?.login ? v2.time.login : null,
|
||||
lusername: v2.username.toLowerCase(),
|
||||
mfaEnabled: false,
|
||||
newsletter: false,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { buttonRow, newsletterClosingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
|
||||
import { newsletterClosingRow, headingRow, lead1Row, wrap } from '../shared/blocks.mjs'
|
||||
// Translations
|
||||
import en from './en.json' assert { type: 'json' }
|
||||
import de from './de.json' assert { type: 'json' }
|
||||
|
|
|
@ -21,6 +21,8 @@ const splitArray = (split, batchSize) =>
|
|||
return result
|
||||
}, [])
|
||||
|
||||
/*
|
||||
* Commented out because linter
|
||||
const importSubscribers = async () => {
|
||||
console.log('Importing subscribers')
|
||||
const count = subscribers.length
|
||||
|
@ -42,7 +44,7 @@ const importSubscribers = async () => {
|
|||
console.log(`${total}/${count}`)
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
const lastLoginInDays = (user) => {
|
||||
const now = new Date()
|
||||
const then = new Date(user.time.login)
|
||||
|
@ -52,8 +54,9 @@ const lastLoginInDays = (user) => {
|
|||
|
||||
const usersToImport = () =>
|
||||
users.filter((user) => user.status === 'active' && lastLoginInDays(user) < 370)
|
||||
const usersToNotImport = () =>
|
||||
users.filter((user) => user.status !== 'active' && lastLoginInDays(user) >= 370)
|
||||
// Commented out for linter
|
||||
// const usersToNotImport = () =>
|
||||
// users.filter((user) => user.status !== 'active' && lastLoginInDays(user) >= 370)
|
||||
|
||||
const importUsers = async () => {
|
||||
console.log('Processing users')
|
||||
|
|
|
@ -10,8 +10,9 @@ const lastLoginInDays = (user) => {
|
|||
|
||||
const usersToNotImport = () =>
|
||||
users.filter((user) => user.status !== 'active' || lastLoginInDays(user) >= 370)
|
||||
const usersToImport = () =>
|
||||
users.filter((user) => user.status === 'active' && lastLoginInDays(user) < 370)
|
||||
// Commented about linter
|
||||
//const usersToImport = () =>
|
||||
// users.filter((user) => user.status === 'active' && lastLoginInDays(user) < 370)
|
||||
|
||||
console.log(
|
||||
JSON.stringify(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import path from 'path'
|
||||
//import path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,14 +23,14 @@ const namespaces = nsMerge(pageNs, 'newsletter')
|
|||
*/
|
||||
const NewsletterPage = ({ page, id, ehash }) => {
|
||||
const { t } = useTranslation(namespaces)
|
||||
const { loading, setLoading } = useContext(LoadingContext)
|
||||
const { setLoading } = useContext(LoadingContext)
|
||||
const backend = useBackend()
|
||||
|
||||
const [confirmed, setConfirmed] = useState(false)
|
||||
|
||||
const handler = async () => {
|
||||
setLoading(true)
|
||||
const result = await backend.confirmNewsletterSubscribe({ id, ehash })
|
||||
await backend.confirmNewsletterSubscribe({ id, ehash })
|
||||
setLoading(false)
|
||||
setConfirmed(true)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ const namespaces = nsMerge(pageNs, 'newsletter')
|
|||
*/
|
||||
const NewsletterPage = ({ page, id, ehash }) => {
|
||||
const { t } = useTranslation(namespaces)
|
||||
const { loading, setLoading } = useContext(LoadingContext)
|
||||
const { setLoading } = useContext(LoadingContext)
|
||||
const backend = useBackend()
|
||||
|
||||
const [confirmed, setConfirmed] = useState(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue