diff --git a/sites/backend/src/html/shared.mjs b/sites/backend/src/html/shared.mjs index ccb7701d133..9304c1377b0 100644 --- a/sites/backend/src/html/shared.mjs +++ b/sites/backend/src/html/shared.mjs @@ -1,4 +1,4 @@ -export const wrapper = ({ title = 'FreeSewing', header, content, footer }) => ` +export const wrapper = ({ title = 'FreeSewing', header, content }) => `
diff --git a/sites/backend/src/models/set.mjs b/sites/backend/src/models/set.mjs index afcae49a85c..792cd09735c 100644 --- a/sites/backend/src/models/set.mjs +++ b/sites/backend/src/models/set.mjs @@ -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 + //} } } } diff --git a/sites/backend/src/models/user.mjs b/sites/backend/src/models/user.mjs index 2b83083b2f4..f17e92f3674 100644 --- a/sites/backend/src/models/user.mjs +++ b/sites/backend/src/models/user.mjs @@ -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 { diff --git a/sites/backend/src/utils/cloudflare-images.mjs b/sites/backend/src/utils/cloudflare-images.mjs index 6abff757691..2202a3385f8 100644 --- a/sites/backend/src/utils/cloudflare-images.mjs +++ b/sites/backend/src/utils/cloudflare-images.mjs @@ -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')]) } diff --git a/sites/backend/tests/account.mjs b/sites/backend/tests/account.mjs index a5335275da0..b950e9dec1b 100644 --- a/sites/backend/tests/account.mjs +++ b/sites/backend/tests/account.mjs @@ -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`) diff --git a/sites/backend/v2-v3/import.mjs b/sites/backend/v2-v3/import.mjs index bb973932f76..9ea11284faa 100644 --- a/sites/backend/v2-v3/import.mjs +++ b/sites/backend/v2-v3/import.mjs @@ -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' } diff --git a/sites/org/pages/newsletter/unsubscribe/[...tokens].mjs b/sites/org/pages/newsletter/unsubscribe/[...tokens].mjs index 951fa825696..c28b41899e4 100644 --- a/sites/org/pages/newsletter/unsubscribe/[...tokens].mjs +++ b/sites/org/pages/newsletter/unsubscribe/[...tokens].mjs @@ -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) } diff --git a/sites/org/pages/showcase/page/[page].mjs b/sites/org/pages/showcase/page/[page].mjs index 7a5cbbf50d8..3c63604c623 100644 --- a/sites/org/pages/showcase/page/[page].mjs +++ b/sites/org/pages/showcase/page/[page].mjs @@ -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 }) => ( { // designs[design].push(post) // } - previews.push(