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