chore: Linter issues
This commit is contained in:
parent
91c70f3e9d
commit
fd96e3aa55
8 changed files with 25 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
||||||
export const wrapper = ({ title = 'FreeSewing', header, content, footer }) => `<!DOCTYPE html>
|
export const wrapper = ({ title = 'FreeSewing', header, content }) => `<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { log } from '../utils/log.mjs'
|
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'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
export function SetModel(tools) {
|
export function SetModel(tools) {
|
||||||
|
@ -477,12 +477,12 @@ SetModel.prototype.import = async function (v2user, userId) {
|
||||||
'/' +
|
'/' +
|
||||||
encodeURIComponent(data.img)
|
encodeURIComponent(data.img)
|
||||||
console.log('Grabbing', imgUrl)
|
console.log('Grabbing', imgUrl)
|
||||||
const [contentType, imgData] = await downloadImage(imgUrl)
|
//const [contentType, imgData] = await downloadImage(imgUrl)
|
||||||
// Do not import the default SVG avatar
|
//// Do not import the default SVG avatar
|
||||||
if (contentType !== 'image/svg+xml') {
|
//if (contentType !== 'image/svg+xml') {
|
||||||
const img = await setSetAvatar(this.record.id, [contentType, imgData], data.name)
|
// const img = await setSetAvatar(this.record.id, [contentType, imgData], data.name)
|
||||||
data.img = img
|
// data.img = img
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -922,12 +922,12 @@ UserModel.prototype.import = async function (list) {
|
||||||
'/' +
|
'/' +
|
||||||
encodeURIComponent(data.img)
|
encodeURIComponent(data.img)
|
||||||
console.log('Grabbing', imgUrl)
|
console.log('Grabbing', imgUrl)
|
||||||
const [contentType, imgData] = await downloadImage(imgUrl)
|
//const [contentType, imgData] = await downloadImage(imgUrl)
|
||||||
// Do not import the default SVG avatar
|
//// Do not import the default SVG avatar
|
||||||
if (contentType !== 'image/svg+xml') {
|
//if (contentType !== 'image/svg+xml') {
|
||||||
const img = await setUserAvatar(data.ihash, [contentType, imgData], data.username)
|
// const img = await setUserAvatar(data.ihash, [contentType, imgData], data.username)
|
||||||
data.img = img
|
// data.img = img
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
let cloaked = await this.cloak(data)
|
let cloaked = await this.cloak(data)
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { Blob } from 'node:buffer'
|
||||||
|
import { log } from './log.mjs'
|
||||||
import { cloudflareImages as config } from '../config.mjs'
|
import { cloudflareImages as config } from '../config.mjs'
|
||||||
|
|
||||||
// We'll use this a bunch
|
// 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
|
// Ignore errors on delete, probably means the image does not exist
|
||||||
try {
|
try {
|
||||||
await axios.delete(`${config.api}/${props.id}`)
|
await axios.delete(`${config.api}/${props.id}`)
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
// It's fine
|
||||||
|
log.info(`Could not delete image ${props.id}`)
|
||||||
|
}
|
||||||
let result
|
let result
|
||||||
try {
|
try {
|
||||||
result = await axios.post(config.api, form, { headers })
|
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
|
* Helper method to turn a data-uri into binary data
|
||||||
*/
|
*/
|
||||||
function b64ToBlob(dataUri) {
|
function b64ToBlob(dataUri) {
|
||||||
const [start, data] = dataUri.split(';base64,')
|
return new Blob([new Buffer.from(dataUri.split(';base64,').pop(), 'base64')])
|
||||||
|
|
||||||
return new Blob([new Buffer.from(data, 'base64')])
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ export const accountTests = async (chai, config, expect, store) => {
|
||||||
// Update password - Check with sign in
|
// Update password - Check with sign in
|
||||||
const password = store.randomString()
|
const password = store.randomString()
|
||||||
it(`${store.icon('user', auth)} Should update the password (${auth})`, (done) => {
|
it(`${store.icon('user', auth)} Should update the password (${auth})`, (done) => {
|
||||||
const body = {}
|
|
||||||
chai
|
chai
|
||||||
.request(config.api)
|
.request(config.api)
|
||||||
.patch(`/account/${auth}`)
|
.patch(`/account/${auth}`)
|
||||||
|
@ -80,7 +79,6 @@ export const accountTests = async (chai, config, expect, store) => {
|
||||||
'user',
|
'user',
|
||||||
auth
|
auth
|
||||||
)} Should be able to sign in with the updated password (${auth})`, (done) => {
|
)} Should be able to sign in with the updated password (${auth})`, (done) => {
|
||||||
const body = {}
|
|
||||||
chai
|
chai
|
||||||
.request(config.api)
|
.request(config.api)
|
||||||
.post(`/signin`)
|
.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) => {
|
it(`${store.icon('user', auth)} Better restore the original password (${auth})`, (done) => {
|
||||||
const body = {}
|
|
||||||
chai
|
chai
|
||||||
.request(config.api)
|
.request(config.api)
|
||||||
.patch(`/account/${auth}`)
|
.patch(`/account/${auth}`)
|
||||||
|
@ -123,7 +120,6 @@ export const accountTests = async (chai, config, expect, store) => {
|
||||||
'user',
|
'user',
|
||||||
auth
|
auth
|
||||||
)} Should be able to sign in with the original password (${auth})`, (done) => {
|
)} Should be able to sign in with the original password (${auth})`, (done) => {
|
||||||
const body = {}
|
|
||||||
chai
|
chai
|
||||||
.request(config.api)
|
.request(config.api)
|
||||||
.post(`/signin`)
|
.post(`/signin`)
|
||||||
|
|
|
@ -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 users from './v2-users.json' assert { type: 'json' }
|
||||||
import people from './v2-people.json' assert { type: 'json' }
|
import people from './v2-people.json' assert { type: 'json' }
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ const NewsletterPage = ({ page, id, ehash }) => {
|
||||||
|
|
||||||
const handler = async () => {
|
const handler = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const result = await backend.confirmNewsletterUnsubscribe({ id, ehash })
|
await backend.confirmNewsletterUnsubscribe({ id, ehash })
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setConfirmed(true)
|
setConfirmed(true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { Pagination } from 'shared/components/navigation/pagination.mjs'
|
||||||
// Translation namespaces used on this page
|
// Translation namespaces used on this page
|
||||||
const namespaces = [...new Set(['common', 'designs', ...pageNs])]
|
const namespaces = [...new Set(['common', 'designs', ...pageNs])]
|
||||||
|
|
||||||
export const PreviewTile = ({ img, slug, title }) => (
|
export const PreviewTile = ({ slug, title }) => (
|
||||||
<Link href={`/${slug}`} className="text-center">
|
<Link href={`/${slug}`} className="text-center">
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
|
@ -56,7 +56,7 @@ const Posts = ({ posts }) => {
|
||||||
// designs[design].push(post)
|
// 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 (
|
return (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue