1
0
Fork 0

chore: Linter issues

This commit is contained in:
Joost De Cock 2023-08-08 11:21:21 +02:00
parent 91c70f3e9d
commit fd96e3aa55
8 changed files with 25 additions and 26 deletions

View file

@ -1,4 +1,4 @@
export const wrapper = ({ title = 'FreeSewing', header, content, footer }) => `<!DOCTYPE html>
export const wrapper = ({ title = 'FreeSewing', header, content }) => `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

View file

@ -1,5 +1,5 @@
import { log } from '../utils/log.mjs'
import { storeImage } from '../utils/cloudflare-images.mjs'
import { replaceImage, storeImage } from '../utils/cloudflare-images.mjs'
import yaml from 'js-yaml'
export function SetModel(tools) {
@ -477,12 +477,12 @@ SetModel.prototype.import = async function (v2user, userId) {
'/' +
encodeURIComponent(data.img)
console.log('Grabbing', imgUrl)
const [contentType, imgData] = await downloadImage(imgUrl)
// Do not import the default SVG avatar
if (contentType !== 'image/svg+xml') {
const img = await setSetAvatar(this.record.id, [contentType, imgData], data.name)
data.img = img
}
//const [contentType, imgData] = await downloadImage(imgUrl)
//// Do not import the default SVG avatar
//if (contentType !== 'image/svg+xml') {
// const img = await setSetAvatar(this.record.id, [contentType, imgData], data.name)
// data.img = img
//}
}
}
}

View file

@ -922,12 +922,12 @@ UserModel.prototype.import = async function (list) {
'/' +
encodeURIComponent(data.img)
console.log('Grabbing', imgUrl)
const [contentType, imgData] = await downloadImage(imgUrl)
// Do not import the default SVG avatar
if (contentType !== 'image/svg+xml') {
const img = await setUserAvatar(data.ihash, [contentType, imgData], data.username)
data.img = img
}
//const [contentType, imgData] = await downloadImage(imgUrl)
//// Do not import the default SVG avatar
//if (contentType !== 'image/svg+xml') {
// const img = await setUserAvatar(data.ihash, [contentType, imgData], data.username)
// data.img = img
//}
}
let cloaked = await this.cloak(data)
try {

View file

@ -1,4 +1,6 @@
import axios from 'axios'
import { Blob } from 'node:buffer'
import { log } from './log.mjs'
import { cloudflareImages as config } from '../config.mjs'
// We'll use this a bunch
@ -44,7 +46,10 @@ export async function replaceImage(props) {
// Ignore errors on delete, probably means the image does not exist
try {
await axios.delete(`${config.api}/${props.id}`)
} catch (err) {}
} catch (err) {
// It's fine
log.info(`Could not delete image ${props.id}`)
}
let result
try {
result = await axios.post(config.api, form, { headers })
@ -78,7 +83,5 @@ function getFormData({ id, metadata, url = false, b64 = false, blob = false, not
* Helper method to turn a data-uri into binary data
*/
function b64ToBlob(dataUri) {
const [start, data] = dataUri.split(';base64,')
return new Blob([new Buffer.from(data, 'base64')])
return new Blob([new Buffer.from(dataUri.split(';base64,').pop(), 'base64')])
}

View file

@ -54,7 +54,6 @@ export const accountTests = async (chai, config, expect, store) => {
// Update password - Check with sign in
const password = store.randomString()
it(`${store.icon('user', auth)} Should update the password (${auth})`, (done) => {
const body = {}
chai
.request(config.api)
.patch(`/account/${auth}`)
@ -80,7 +79,6 @@ export const accountTests = async (chai, config, expect, store) => {
'user',
auth
)} Should be able to sign in with the updated password (${auth})`, (done) => {
const body = {}
chai
.request(config.api)
.post(`/signin`)
@ -97,7 +95,6 @@ export const accountTests = async (chai, config, expect, store) => {
})
it(`${store.icon('user', auth)} Better restore the original password (${auth})`, (done) => {
const body = {}
chai
.request(config.api)
.patch(`/account/${auth}`)
@ -123,7 +120,6 @@ export const accountTests = async (chai, config, expect, store) => {
'user',
auth
)} Should be able to sign in with the original password (${auth})`, (done) => {
const body = {}
chai
.request(config.api)
.post(`/signin`)

View file

@ -1,4 +1,4 @@
import subscribers from './v2-newsletters.json' assert { type: 'json' }
//import subscribers from './v2-newsletters.json' assert { type: 'json' }
import users from './v2-users.json' assert { type: 'json' }
import people from './v2-people.json' assert { type: 'json' }

View file

@ -30,7 +30,7 @@ const NewsletterPage = ({ page, id, ehash }) => {
const handler = async () => {
setLoading(true)
const result = await backend.confirmNewsletterUnsubscribe({ id, ehash })
await backend.confirmNewsletterUnsubscribe({ id, ehash })
setLoading(false)
setConfirmed(true)
}

View file

@ -14,7 +14,7 @@ import { Pagination } from 'shared/components/navigation/pagination.mjs'
// Translation namespaces used on this page
const namespaces = [...new Set(['common', 'designs', ...pageNs])]
export const PreviewTile = ({ img, slug, title }) => (
export const PreviewTile = ({ slug, title }) => (
<Link href={`/${slug}`} className="text-center">
<span
style={{
@ -56,7 +56,7 @@ const Posts = ({ posts }) => {
// designs[design].push(post)
// }
previews.push(<PreviewTile img={post.i} slug={post.s} title={post.t} key={post.s} />)
previews.push(<PreviewTile slug={post.s} title={post.t} key={post.s} />)
})
return (