From 2abc2b13f0bcfd715d4552e94b0906dceb1f2794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Wed, 30 Oct 2024 22:47:17 +0100 Subject: [PATCH 01/57] wrap encodeURI in try catch --- client/homebrew/pages/editPage/editPage.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 744e187a6..de71f02a0 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -380,7 +380,15 @@ const EditPage = createClass({ **[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`; - return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title)}&text=${encodeURIComponent(text)}`; + let encodedTitle; + try { + encodedTitle = encodeURIComponent(title); + } catch (error) { + console.error("Error encoding title for Reddit link:", error); + encodedTitle = encodeURIComponent("Check out my homebrew!"); // Fallback title + } + + return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodedTitle}&text=${encodeURIComponent(text)}`; }, renderNavbar : function(){ From 1af13b4e9489e4588c2e0188b3a1efa9e1c454a6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Nov 2024 18:46:59 +1300 Subject: [PATCH 02/57] Fixes #3904 - content negotiation test failure --- server/middleware/content-negotiation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/content-negotiation.js b/server/middleware/content-negotiation.js index a5bc7dc83..9798c60bb 100644 --- a/server/middleware/content-negotiation.js +++ b/server/middleware/content-negotiation.js @@ -6,7 +6,7 @@ module.exports = (req, res, next)=>{ const isImageRequest = req.get('Accept')?.split(',') ?.filter((h)=>!h.includes('q=')) ?.every((h)=>/image\/.*/.test(h)); - if(isImageRequest && !isLocalEnvironment && !req.url?.startsWith('/staticImages')) { + if(isImageRequest && !(isLocalEnvironment && req.url?.startsWith('/staticImages'))) { return res.status(406).send({ message : 'Request for image at this URL is not supported' }); From bd413cfc55e54ffa537470d69dd1583c2787015d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Nov 2024 18:53:20 +1300 Subject: [PATCH 03/57] Add content negotiation test command --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 08473ca05..768303d2f 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "test:api-unit:themes": "jest \"server/.*.spec.js\" -t \"theme bundle\" --verbose", "test:api-unit:css": "jest \"server/.*.spec.js\" -t \"Get CSS\" --verbose", "test:api-unit:notifications": "jest \"server/.*.spec.js\" -t \"Notifications\" --verbose", + "test:content-negotiation": "jest \"server/middleware/.*.spec.js\" --verbose", "test:coverage": "jest --coverage --silent --runInBand", "test:dev": "jest --verbose --watch", "test:basic": "jest tests/markdown/basic.test.js --verbose", From 108d368d452ff3eafdc29f0883aaa5a0a3aa6d2e Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Nov 2024 18:54:23 +1300 Subject: [PATCH 04/57] Add content-negotiation test to CircleCI config --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d405486b5..00cbdf5bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,6 +82,9 @@ jobs: - run: name: Test - Coverage command: npm run test:coverage + - run: + name: Test - Content Negotiation + command: npm run test:content-negotiation workflows: build_and_test: From b45686eb3b22e7f448713bdf1ddb0075a43285f5 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Sat, 23 Nov 2024 11:18:44 -0600 Subject: [PATCH 05/57] Create an element for serial non-breaking spaces as proposed in V4 discussion --- shared/naturalcrit/markdown.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 4c1a2f92a..45d573262 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -391,6 +391,27 @@ const forcedParagraphBreaks = { } }; +const nonbreakingSpaces = { + name : 'nonbreakingSpaces', + level : 'inline', + start(src) { return src.match(/:>+/m)?.index; }, // Hint to Marked.js to stop and check for a match + tokenizer(src, tokens) { + const regex = /:(>+)/ym; + const match = regex.exec(src); + if(match?.length) { + return { + type : 'nonbreakingSpaces', // Should match "name" above + raw : match[0], // Text to consume from the source + length : match[1].length, + text : '' + }; + } + }, + renderer(token) { + return ` `.repeat(token.length).concat('\n'); + } +}; + const definitionListsSingleLine = { name : 'definitionListsSingleLine', level : 'block', @@ -748,11 +769,12 @@ const tableTerminators = [ ]; Marked.use(MarkedVariables()); -Marked.use({ extensions : [definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, superSubScripts, - mustacheSpans, mustacheDivs, mustacheInjectInline] }); +Marked.use({ extensions : [definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, + nonbreakingSpaces, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] }); Marked.use(mustacheInjectBlock); Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false }); -Marked.use(MarkedExtendedTables(tableTerminators), MarkedGFMHeadingId({ globalSlugs: true }), MarkedSmartypantsLite(), MarkedEmojis(MarkedEmojiOptions)); +Marked.use(MarkedExtendedTables(tableTerminators), MarkedGFMHeadingId({ globalSlugs: true }), + MarkedSmartypantsLite(), MarkedEmojis(MarkedEmojiOptions)); function cleanUrl(href) { try { From 596c4ad68dc1764804c1aa36d7702bc016251e1b Mon Sep 17 00:00:00 2001 From: David Bolack Date: Wed, 4 Dec 2024 21:24:48 -0600 Subject: [PATCH 06/57] Add Tests --- shared/naturalcrit/markdown.js | 4 +- tests/markdown/horizontalSpaces.test.js | 49 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 tests/markdown/horizontalSpaces.test.js diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 45d573262..6ceee2b03 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -415,9 +415,9 @@ const nonbreakingSpaces = { const definitionListsSingleLine = { name : 'definitionListsSingleLine', level : 'block', - start(src) { return src.match(/\n[^\n]*?::[^\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match + start(src) { return src.match(/\n[^\n]*?::[^:\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym; + const regex = /^([^\n]*?)::([^\:\>][^\n]*)(?:\n|$)/ym; let match; let endIndex = 0; const definitions = []; diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/horizontalSpaces.test.js new file mode 100644 index 000000000..6789b934c --- /dev/null +++ b/tests/markdown/horizontalSpaces.test.js @@ -0,0 +1,49 @@ +/* eslint-disable max-lines */ + +import Markdown from 'naturalcrit/markdown.js'; + +describe('Hard Breaks', ()=>{ + test('Single Break', function() { + const source = ':>\n\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

 \n

`); + }); + + test('Double Break', function() { + const source = ':>>\n\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  \n

`); + }); + + test('Triple Break', function() { + const source = ':>>>\n\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n

`); + }); + + test('Many Break', function() { + const source = ':>>>>>>>>>>\n\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

          \n

`); + }); + + test('Multiple sets of Breaks', function() { + const source = ':>>>\n:>>>\n:>>>'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n\n   \n\n   \n

`); + }); + + test('Break directly between two paragraphs', function() { + const source = 'Line 1\n:>>\nLine 2'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

Line 1\n  \n\nLine 2

`); + }); + + test('Ignored inside a code block', function() { + const source = '```\n\n:>\n\n```\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
\n:>\n
`); + }); + +}); + From 31a22703c18f7e94bcdf344f55759a14f766acc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 12:05:01 +0100 Subject: [PATCH 07/57] initial commit --- server/app.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/server/app.js b/server/app.js index 8a2e17bbd..fab56e624 100644 --- a/server/app.js +++ b/server/app.js @@ -312,6 +312,34 @@ app.get('/user/:username', async (req, res, next)=>{ return next(); }); +//Rename Brews +app.put('/user/:username/rename-brews', async (req, res) => { + const { username } = req.params; + const { newUsername } = req.body; + + if (!username || !newUsername) { + return res.status(400).json({ error: 'Username and newUsername are required.' }); + } + try { + const brews = await HomebrewModel.getByUser(username, true, ['authors']); + const renamePromises = brews.map(async (brew) => { + const updatedAuthors = brew.authors.map((author) => + author === username ? newUsername : author + ); + return HomebrewModel.updateOne( + { _id: brew._id }, + { $set: { authors: updatedAuthors } } + ); + }); + await Promise.all(renamePromises); + + return res.json({ success: true, message: `Brews for ${username} renamed to ${newUsername}.` }); + } catch (error) { + console.error('Error renaming brews:', error); + return res.status(500).json({ error: 'Failed to rename brews.' }); + } +}); + //Edit Page app.get('/edit/:id', asyncHandler(getBrew('edit')), asyncHandler(async(req, res, next)=>{ req.brew = req.brew.toObject ? req.brew.toObject() : req.brew; From db9212bd12a9837b7882cc1006d6b0b353a96f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 20:45:43 +0100 Subject: [PATCH 08/57] log req --- server/middleware/check-client-version.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/middleware/check-client-version.js b/server/middleware/check-client-version.js index 001995f4e..e72a7fd0b 100644 --- a/server/middleware/check-client-version.js +++ b/server/middleware/check-client-version.js @@ -2,6 +2,9 @@ import packageJSON from '../../package.json' with { type: "json" }; const version = packageJSON.version; export default (req, res, next)=>{ + console.log(req); + //check if req comes from localhost + const userVersion = req.get('Homebrewery-Version'); if(userVersion != version) { From 1b20c008425271897ae81be4da9616705062a4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 20:46:02 +0100 Subject: [PATCH 09/57] log headers --- server/middleware/check-client-version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/check-client-version.js b/server/middleware/check-client-version.js index e72a7fd0b..3cd30582e 100644 --- a/server/middleware/check-client-version.js +++ b/server/middleware/check-client-version.js @@ -2,7 +2,7 @@ import packageJSON from '../../package.json' with { type: "json" }; const version = packageJSON.version; export default (req, res, next)=>{ - console.log(req); + console.log(req.headers); //check if req comes from localhost const userVersion = req.get('Homebrewery-Version'); From ef0ee787583a27748a47c03f149c262f86dbb75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 23:43:06 +0100 Subject: [PATCH 10/57] revert check client version changes --- server/middleware/check-client-version.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/middleware/check-client-version.js b/server/middleware/check-client-version.js index 3cd30582e..19cb40b25 100644 --- a/server/middleware/check-client-version.js +++ b/server/middleware/check-client-version.js @@ -1,10 +1,9 @@ import packageJSON from '../../package.json' with { type: "json" }; const version = packageJSON.version; +//This should be only for internal calls, but right now prevents spam api calls, this should be done with a proper cors policy + export default (req, res, next)=>{ - console.log(req.headers); - //check if req comes from localhost - const userVersion = req.get('Homebrewery-Version'); if(userVersion != version) { From 23910cc94c6002696b436b13c5c332abf6408422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 23:43:32 +0100 Subject: [PATCH 11/57] add cors policy and rename route --- package-lock.json | 14 ++++++++++++++ package.json | 1 + server/app.js | 47 ++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 820e01c46..bcff9a861 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "classnames": "^2.5.1", "codemirror": "^5.65.6", "cookie-parser": "^1.4.7", + "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", "dompurify": "^3.2.2", @@ -4805,6 +4806,19 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "license": "MIT" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cosmiconfig": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", diff --git a/package.json b/package.json index d5ea0b1de..2fa8bce4a 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "classnames": "^2.5.1", "codemirror": "^5.65.6", "cookie-parser": "^1.4.7", + "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", "dompurify": "^3.2.2", diff --git a/server/app.js b/server/app.js index fab56e624..4ec6ecdff 100644 --- a/server/app.js +++ b/server/app.js @@ -55,6 +55,31 @@ app.use(bodyParser.json({ limit: '25mb' })); app.use(cookieParser()); app.use(forceSSL); +import cors from 'cors'; + +// CORS Configuration +const corsOptions = { + + origin: (origin, callback) => { + const allowedOrigins = [ + 'https://homebrewery.naturalcrit.com', + 'http://localhost:8000', + 'http://localhost:8010', + 'https://naturalcrit.com' + ]; //allow natcrit local and live to call + if (!origin || allowedOrigins.includes(origin)) { + callback(null, true); + } else { + console.log(origin, 'not allowed'); + callback(new Error('Not allowed by CORS')); + } + }, + methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], + credentials: true, +}; + +app.use(cors(corsOptions)); + //Account Middleware app.use((req, res, next)=>{ if(req.cookies && req.cookies.nc_session){ @@ -313,9 +338,10 @@ app.get('/user/:username', async (req, res, next)=>{ }); //Rename Brews -app.put('/user/:username/rename-brews', async (req, res) => { - const { username } = req.params; - const { newUsername } = req.body; +app.put('/api/user/rename', async (req, res) => { + const { username, newUsername } = req.body; + + console.log('renaming'); if (!username || !newUsername) { return res.status(400).json({ error: 'Username and newUsername are required.' }); @@ -504,12 +530,15 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{ })); //Send rendered page -app.use(asyncHandler(async (req, res, next)=>{ - if (!req.route) return res.redirect('/'); // Catch-all for invalid routes - - const page = await renderPage(req, res); - if(!page) return; - res.send(page); +app.use(asyncHandler(async (req, res, next) => { + if (!req.route && !req.path.startsWith('/api/')) { + return res.redirect('/'); + } + + const page = await renderPage(req, res); + if (!page) return; + + res.send(page); })); //Render the page From 4eb8abf1e7fdb5351261eccd404899138fa31ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 8 Dec 2024 23:46:27 +0100 Subject: [PATCH 12/57] `Update CORS error message in app.js` --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 4ec6ecdff..46aabc088 100644 --- a/server/app.js +++ b/server/app.js @@ -71,7 +71,7 @@ const corsOptions = { callback(null, true); } else { console.log(origin, 'not allowed'); - callback(new Error('Not allowed by CORS')); + callback(new Error('Not allowed by CORS, if you think this is an error, please contact us')); } }, methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], From 81f56ec91d864c73b41ed797869ac15f939d070d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 9 Dec 2024 18:59:48 +0100 Subject: [PATCH 13/57] add heroku apps to cors --- server/app.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/server/app.js b/server/app.js index 46aabc088..de44f0609 100644 --- a/server/app.js +++ b/server/app.js @@ -59,18 +59,20 @@ import cors from 'cors'; // CORS Configuration const corsOptions = { - origin: (origin, callback) => { const allowedOrigins = [ - 'https://homebrewery.naturalcrit.com', - 'http://localhost:8000', - 'http://localhost:8010', - 'https://naturalcrit.com' - ]; //allow natcrit local and live to call - if (!origin || allowedOrigins.includes(origin)) { + 'https://homebrewery.naturalcrit.com', + 'http://localhost:8000', + 'http://localhost:8010', + 'https://naturalcrit.com' + ]; + + const herokuRegex = /^https:\/\/.*\.herokuapp\.com$/; // Matches any Heroku app + + if (!origin || allowedOrigins.includes(origin) || herokuRegex.test(origin)) { callback(null, true); } else { - console.log(origin, 'not allowed'); + console.log(origin, 'not allowed'); callback(new Error('Not allowed by CORS, if you think this is an error, please contact us')); } }, @@ -78,6 +80,7 @@ const corsOptions = { credentials: true, }; + app.use(cors(corsOptions)); //Account Middleware From 35364c400aca15b2cb8ae7f3cce37c75f2a34ebf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:23:58 +0000 Subject: [PATCH 14/57] Bump react-router-dom from 6.28.0 to 7.0.2 Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.28.0 to 7.0.2. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.0.2/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 69 +++++++++++++++++++++++++++++++---------------- package.json | 2 +- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 257045fc7..ab3810016 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "6.28.0", + "react-router-dom": "7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -2896,14 +2896,6 @@ "node": ">= 8" } }, - "node_modules/@remix-run/router": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz", - "integrity": "sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -2998,6 +2990,11 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -12313,33 +12310,49 @@ "license": "MIT" }, "node_modules/react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.2.tgz", + "integrity": "sha512-m5AcPfTRUcjwmhBzOJGEl6Y7+Crqyju0+TgTQxoS4SO+BkWbhOrcfZNq6wSWdl2BBbJbsAoBUb8ZacOFT+/JlA==", "dependencies": { - "@remix-run/router": "1.21.0" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } } }, "node_modules/react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.2.tgz", + "integrity": "sha512-VJOQ+CDWFDGaWdrG12Nl+d7yHtLaurNgAQZVgaIy7/Xd+DojgmYLosFfZdGz1wpxmjJIAkAMVTKWcvkx1oggAw==", "dependencies": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "react-router": "7.0.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-router/node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "engines": { + "node": ">=18" } }, "node_modules/read-only-stream": { @@ -12899,6 +12912,11 @@ "node": ">= 0.8.0" } }, + "node_modules/set-cookie-parser": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -14391,6 +14409,11 @@ "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", "license": "MIT" }, + "node_modules/turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 17d1b5533..3551db07e 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "6.28.0", + "react-router-dom": "7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From c29e1905bf4a578a42e1dd6fd86b89f3d0621c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 10 Dec 2024 19:24:23 +0100 Subject: [PATCH 15/57] add localhost to allowed origins only if in local, also remake regex --- server/app.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/app.js b/server/app.js index de44f0609..4c6c9ba1f 100644 --- a/server/app.js +++ b/server/app.js @@ -57,17 +57,24 @@ app.use(forceSSL); import cors from 'cors'; -// CORS Configuration +const nodeEnv = config.get('node_env'); +const isLocalEnvironment = config.get('local_environments').includes(nodeEnv); + const corsOptions = { origin: (origin, callback) => { + const allowedOrigins = [ 'https://homebrewery.naturalcrit.com', - 'http://localhost:8000', - 'http://localhost:8010', - 'https://naturalcrit.com' + 'https://naturalcrit.com', + 'https://naturalcrit-stage.herokuapp.com', + 'https://homebrewery-stage.herokuapp.com', ]; - const herokuRegex = /^https:\/\/.*\.herokuapp\.com$/; // Matches any Heroku app + if (isLocalEnvironment) { + allowedOrigins.push('http://localhost:8000', 'http://localhost:8010'); + } + + const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app if (!origin || allowedOrigins.includes(origin) || herokuRegex.test(origin)) { callback(null, true); @@ -80,7 +87,6 @@ const corsOptions = { credentials: true, }; - app.use(cors(corsOptions)); //Account Middleware @@ -505,8 +511,6 @@ app.get('/account', asyncHandler(async (req, res, next)=>{ return next(); })); -const nodeEnv = config.get('node_env'); -const isLocalEnvironment = config.get('local_environments').includes(nodeEnv); // Local only if(isLocalEnvironment){ // Login From 5e5c637c79b252e4d5a1003bb0a9ce8235e4e76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 20:59:51 +0100 Subject: [PATCH 16/57] revert api catch on wrong route middleware --- server/app.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/server/app.js b/server/app.js index 4c6c9ba1f..b10f36c4e 100644 --- a/server/app.js +++ b/server/app.js @@ -346,7 +346,7 @@ app.get('/user/:username', async (req, res, next)=>{ return next(); }); -//Rename Brews +//Change author name on brews app.put('/api/user/rename', async (req, res) => { const { username, newUsername } = req.body; @@ -538,14 +538,11 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{ //Send rendered page app.use(asyncHandler(async (req, res, next) => { - if (!req.route && !req.path.startsWith('/api/')) { - return res.redirect('/'); - } + if (!req.route) return res.redirect('/'); // Catch-all for invalid routes - const page = await renderPage(req, res); - if (!page) return; - - res.send(page); + const page = await renderPage(req, res); + if(!page) return; + res.send(page); })); //Render the page From a1c228b1d1fb03b8b11e6ae1f1089d5c47b9434e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 21:01:38 +0100 Subject: [PATCH 17/57] log req account --- server/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/app.js b/server/app.js index b10f36c4e..6108c380d 100644 --- a/server/app.js +++ b/server/app.js @@ -277,6 +277,7 @@ app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{getCSS(req, res //User Page app.get('/user/:username', async (req, res, next)=>{ const ownAccount = req.account && (req.account.username == req.params.username); + console.log(req.account); req.ogMeta = { ...defaultMetaTags, title : `${req.params.username}'s Collection`, @@ -348,6 +349,7 @@ app.get('/user/:username', async (req, res, next)=>{ //Change author name on brews app.put('/api/user/rename', async (req, res) => { + console.log(req.account); const { username, newUsername } = req.body; console.log('renaming'); From f0c094e9d80459eb9ac9db2e9fb74eff7a1f1740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 21:12:35 +0100 Subject: [PATCH 18/57] logs to account middleware --- server/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 6108c380d..40ec19ab6 100644 --- a/server/app.js +++ b/server/app.js @@ -91,12 +91,16 @@ app.use(cors(corsOptions)); //Account Middleware app.use((req, res, next)=>{ + console.log('passing through acc middleware') if(req.cookies && req.cookies.nc_session){ try { + console.log(`creating req.account equal to "${jwt.decode(req.cookies.nc_session, config.get('secret'))}"`); req.account = jwt.decode(req.cookies.nc_session, config.get('secret')); //console.log("Just loaded up JWT from cookie:"); //console.log(req.account); - } catch (e){} + } catch (e){ + console.log(e); + } } req.config = { From 666a94cd658c0ca71a3546db4f30bf0a1b724b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 21:15:16 +0100 Subject: [PATCH 19/57] fix log --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 40ec19ab6..0b0cfb9d2 100644 --- a/server/app.js +++ b/server/app.js @@ -94,7 +94,7 @@ app.use((req, res, next)=>{ console.log('passing through acc middleware') if(req.cookies && req.cookies.nc_session){ try { - console.log(`creating req.account equal to "${jwt.decode(req.cookies.nc_session, config.get('secret'))}"`); + console.log(`creating req.account equal to "${JSON.stringify(jwt.decode(req.cookies.nc_session, config.get('secret')))}"`); req.account = jwt.decode(req.cookies.nc_session, config.get('secret')); //console.log("Just loaded up JWT from cookie:"); //console.log(req.account); From 4f57f006ce86154fe170e28b9950029295315e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 21:20:39 +0100 Subject: [PATCH 20/57] log cookies at auth middleware --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 0b0cfb9d2..73eb876f8 100644 --- a/server/app.js +++ b/server/app.js @@ -91,7 +91,7 @@ app.use(cors(corsOptions)); //Account Middleware app.use((req, res, next)=>{ - console.log('passing through acc middleware') + console.log('passing through acc middleware, checking for cookies now: does cookies exist? ', !!req.cookies, ', ok, does the session cookie exist? ', !!req.cookies.nc_session); if(req.cookies && req.cookies.nc_session){ try { console.log(`creating req.account equal to "${JSON.stringify(jwt.decode(req.cookies.nc_session, config.get('secret')))}"`); From b26526a2f10626eadb897f530823de73f4853589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 22:24:52 +0100 Subject: [PATCH 21/57] lint and logging pass prepared for in server auth from this end --- server/app.js | 102 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/server/app.js b/server/app.js index 73eb876f8..58132b6f0 100644 --- a/server/app.js +++ b/server/app.js @@ -2,7 +2,7 @@ // Set working directory to project root import { dirname } from 'path'; import { fileURLToPath } from 'url'; -import packageJSON from './../package.json' with { type: "json" }; +import packageJSON from './../package.json' with { type: 'json' }; const __dirname = dirname(fileURLToPath(import.meta.url)); process.chdir(`${__dirname}/..`); @@ -26,7 +26,7 @@ import serveCompressedStaticAssets from './static-assets.mv.js'; import sanitizeFilename from 'sanitize-filename'; import asyncHandler from 'express-async-handler'; import templateFn from '../client/template.js'; -import {model as HomebrewModel } from './homebrew.model.js'; +import { model as HomebrewModel } from './homebrew.model.js'; import { DEFAULT_BREW } from './brewDefaults.js'; import { splitTextStyleAndMetadata } from '../shared/helpers.js'; @@ -47,7 +47,7 @@ const sanitizeBrew = (brew, accessType)=>{ return brew; }; -app.set('trust proxy', 1 /* number of proxies between user and server */) +app.set('trust proxy', 1 /* number of proxies between user and server */); app.use('/', serveCompressedStaticAssets(`build`)); app.use(contentNegotiation); @@ -61,30 +61,30 @@ const nodeEnv = config.get('node_env'); const isLocalEnvironment = config.get('local_environments').includes(nodeEnv); const corsOptions = { - origin: (origin, callback) => { + origin : (origin, callback)=>{ - const allowedOrigins = [ - 'https://homebrewery.naturalcrit.com', - 'https://naturalcrit.com', - 'https://naturalcrit-stage.herokuapp.com', - 'https://homebrewery-stage.herokuapp.com', - ]; + const allowedOrigins = [ + 'https://homebrewery.naturalcrit.com', + 'https://naturalcrit.com', + 'https://naturalcrit-stage.herokuapp.com', + 'https://homebrewery-stage.herokuapp.com', + ]; - if (isLocalEnvironment) { - allowedOrigins.push('http://localhost:8000', 'http://localhost:8010'); - } + if(isLocalEnvironment) { + allowedOrigins.push('http://localhost:8000', 'http://localhost:8010'); + } - const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app + const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app - if (!origin || allowedOrigins.includes(origin) || herokuRegex.test(origin)) { - callback(null, true); - } else { - console.log(origin, 'not allowed'); - callback(new Error('Not allowed by CORS, if you think this is an error, please contact us')); - } - }, - methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], - credentials: true, + if(!origin || allowedOrigins.includes(origin) || herokuRegex.test(origin)) { + callback(null, true); + } else { + console.log(origin, 'not allowed'); + callback(new Error('Not allowed by CORS, if you think this is an error, please contact us')); + } + }, + methods : ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], + credentials : true, }; app.use(cors(corsOptions)); @@ -94,7 +94,6 @@ app.use((req, res, next)=>{ console.log('passing through acc middleware, checking for cookies now: does cookies exist? ', !!req.cookies, ', ok, does the session cookie exist? ', !!req.cookies.nc_session); if(req.cookies && req.cookies.nc_session){ try { - console.log(`creating req.account equal to "${JSON.stringify(jwt.decode(req.cookies.nc_session, config.get('secret')))}"`); req.account = jwt.decode(req.cookies.nc_session, config.get('secret')); //console.log("Just loaded up JWT from cookie:"); //console.log(req.account); @@ -312,7 +311,7 @@ app.get('/user/:username', async (req, res, next)=>{ console.log(err); }); - brews.forEach(brew => brew.stubbed = true); //All brews from MongoDB are "stubbed" + brews.forEach((brew)=>brew.stubbed = true); //All brews from MongoDB are "stubbed" if(ownAccount && req?.account?.googleId){ const auth = await GoogleActions.authCheck(req.account, res); @@ -352,33 +351,32 @@ app.get('/user/:username', async (req, res, next)=>{ }); //Change author name on brews -app.put('/api/user/rename', async (req, res) => { +app.put('/api/user/rename', async (req, res)=>{ console.log(req.account); - const { username, newUsername } = req.body; - + const { username, newUsername } = req.body; + console.log(`is user ${req.account.username} equal to ${username}? ${req.account.username === username} ${req.account.username === username && 'then add the damn auth for renaming!'}`); console.log('renaming'); - if (!username || !newUsername) { - return res.status(400).json({ error: 'Username and newUsername are required.' }); - } - try { - const brews = await HomebrewModel.getByUser(username, true, ['authors']); - const renamePromises = brews.map(async (brew) => { - const updatedAuthors = brew.authors.map((author) => - author === username ? newUsername : author - ); - return HomebrewModel.updateOne( - { _id: brew._id }, - { $set: { authors: updatedAuthors } } - ); - }); - await Promise.all(renamePromises); + if(!username || !newUsername) { + return res.status(400).json({ error: 'Username and newUsername are required.' }); + } + try { + const brews = await HomebrewModel.getByUser(username, true, ['authors']); + const renamePromises = brews.map(async (brew)=>{ + const updatedAuthors = brew.authors.map((author)=>author === username ? newUsername : author + ); + return HomebrewModel.updateOne( + { _id: brew._id }, + { $set: { authors: updatedAuthors } } + ); + }); + await Promise.all(renamePromises); - return res.json({ success: true, message: `Brews for ${username} renamed to ${newUsername}.` }); - } catch (error) { - console.error('Error renaming brews:', error); - return res.status(500).json({ error: 'Failed to rename brews.' }); - } + return res.json({ success: true, message: `Brews for ${username} renamed to ${newUsername}.` }); + } catch (error) { + console.error('Error renaming brews:', error); + return res.status(500).json({ error: 'Failed to rename brews.' }); + } }); //Edit Page @@ -468,7 +466,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r app.get('/account', asyncHandler(async (req, res, next)=>{ const data = {}; data.title = 'Account Information Page'; - + if(!req.account) { res.set('WWW-Authenticate', 'Bearer realm="Authorization Required"'); const error = new Error('No valid account'); @@ -482,7 +480,7 @@ app.get('/account', asyncHandler(async (req, res, next)=>{ let googleCount = []; if(req.account) { if(req.account.googleId) { - auth = await GoogleActions.authCheck(req.account, res, false) + auth = await GoogleActions.authCheck(req.account, res, false); googleCount = await GoogleActions.listGoogleBrews(auth) .catch((err)=>{ @@ -543,8 +541,8 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{ })); //Send rendered page -app.use(asyncHandler(async (req, res, next) => { - if (!req.route) return res.redirect('/'); // Catch-all for invalid routes +app.use(asyncHandler(async (req, res, next)=>{ + if(!req.route) return res.redirect('/'); // Catch-all for invalid routes const page = await renderPage(req, res); if(!page) return; From afc92c4545fd1529daedd7fca5e0dacec29590c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 22:30:24 +0100 Subject: [PATCH 22/57] fix check client version middleware to stop checking outside calls --- server/middleware/check-client-version.js | 26 ++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/server/middleware/check-client-version.js b/server/middleware/check-client-version.js index 19cb40b25..dcb18dace 100644 --- a/server/middleware/check-client-version.js +++ b/server/middleware/check-client-version.js @@ -1,16 +1,22 @@ import packageJSON from '../../package.json' with { type: "json" }; -const version = packageJSON.version; -//This should be only for internal calls, but right now prevents spam api calls, this should be done with a proper cors policy +export default (req, res, next) => { + const origin = req.get('Origin'); + const sameSite = req.get('Host'); -export default (req, res, next)=>{ - const userVersion = req.get('Homebrewery-Version'); + if (origin && origin !== `http://${sameSite}` && origin !== `https://${sameSite}`) { + return next(); // Skip version check if the request is from another site, like naturalcrit.com + } - if(userVersion != version) { - return res.status(412).send({ - message : `Client version ${userVersion} is out of date. Please save your changes elsewhere and refresh to pick up client version ${version}.` - }); - } + const userVersion = req.get('Homebrewery-Version'); + const version = packageJSON.version; - next(); + if (userVersion !== version) { + return res.status(412).send({ + message: `Client version ${userVersion} is out of date. Please save your changes elsewhere and refresh to pick up client version ${version}.` + }); + } + + next(); }; + From 99f2972079561b6f996756b36c2af842e06e7005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 23:34:12 +0100 Subject: [PATCH 23/57] fixes as asked --- server/app.js | 2 -- server/homebrew.api.js | 11 +++++---- server/middleware/check-client-version.js | 27 +++++++++-------------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/server/app.js b/server/app.js index 58132b6f0..0d82642d9 100644 --- a/server/app.js +++ b/server/app.js @@ -280,7 +280,6 @@ app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{getCSS(req, res //User Page app.get('/user/:username', async (req, res, next)=>{ const ownAccount = req.account && (req.account.username == req.params.username); - console.log(req.account); req.ogMeta = { ...defaultMetaTags, title : `${req.params.username}'s Collection`, @@ -352,7 +351,6 @@ app.get('/user/:username', async (req, res, next)=>{ //Change author name on brews app.put('/api/user/rename', async (req, res)=>{ - console.log(req.account); const { username, newUsername } = req.body; console.log(`is user ${req.account.username} equal to ${username}? ${req.account.username === username} ${req.account.username === username && 'then add the damn auth for renaming!'}`); console.log('renaming'); diff --git a/server/homebrew.api.js b/server/homebrew.api.js index a75887742..159c08b47 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -467,12 +467,11 @@ const api = { } }; -router.use('/api', checkClientVersion); -router.post('/api', asyncHandler(api.newBrew)); -router.put('/api/:id', asyncHandler(api.getBrew('edit', true)), asyncHandler(api.updateBrew)); -router.put('/api/update/:id', asyncHandler(api.getBrew('edit', true)), asyncHandler(api.updateBrew)); -router.delete('/api/:id', asyncHandler(api.deleteBrew)); -router.get('/api/remove/:id', asyncHandler(api.deleteBrew)); +router.post('/api', checkClientVersion, asyncHandler(api.newBrew)); +router.put('/api/:id', checkClientVersion, asyncHandler(api.getBrew('edit', true)), asyncHandler(api.updateBrew)); +router.put('/api/update/:id', checkClientVersion, asyncHandler(api.getBrew('edit', true)), asyncHandler(api.updateBrew)); +router.delete('/api/:id', checkClientVersion, asyncHandler(api.deleteBrew)); +router.get('/api/remove/:id', checkClientVersion, asyncHandler(api.deleteBrew)); router.get('/api/theme/:renderer/:id', asyncHandler(api.getThemeBundle)); export default api; \ No newline at end of file diff --git a/server/middleware/check-client-version.js b/server/middleware/check-client-version.js index dcb18dace..45d868a5a 100644 --- a/server/middleware/check-client-version.js +++ b/server/middleware/check-client-version.js @@ -1,22 +1,15 @@ -import packageJSON from '../../package.json' with { type: "json" }; +import packageJSON from '../../package.json' with { type: 'json' }; -export default (req, res, next) => { - const origin = req.get('Origin'); - const sameSite = req.get('Host'); +export default (req, res, next)=>{ + const userVersion = req.get('Homebrewery-Version'); + const version = packageJSON.version; - if (origin && origin !== `http://${sameSite}` && origin !== `https://${sameSite}`) { - return next(); // Skip version check if the request is from another site, like naturalcrit.com - } + if(userVersion !== version) { + return res.status(412).send({ + message : `Client version ${userVersion} is out of date. Please save your changes elsewhere and refresh to pick up client version ${version}.` + }); + } - const userVersion = req.get('Homebrewery-Version'); - const version = packageJSON.version; - - if (userVersion !== version) { - return res.status(412).send({ - message: `Client version ${userVersion} is out of date. Please save your changes elsewhere and refresh to pick up client version ${version}.` - }); - } - - next(); + next(); }; From a9275698faecbc8211311591380dacb872dd4617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 14 Dec 2024 23:41:05 +0100 Subject: [PATCH 24/57] add comment to tell future me to remove logs when feature comes --- server/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/app.js b/server/app.js index 0d82642d9..39086cc21 100644 --- a/server/app.js +++ b/server/app.js @@ -352,6 +352,9 @@ app.get('/user/:username', async (req, res, next)=>{ //Change author name on brews app.put('/api/user/rename', async (req, res)=>{ const { username, newUsername } = req.body; + + //this next logs will be removed in a next PR, as i need to get this live to test if req.account is created when passing the request from naturalcrit.com + console.log(`is user ${req.account.username} equal to ${username}? ${req.account.username === username} ${req.account.username === username && 'then add the damn auth for renaming!'}`); console.log('renaming'); From fdaf9d4808499407489273c45b57ab6abb77e3f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:10:44 +0000 Subject: [PATCH 25/57] Bump react-router-dom from 6.28.0 to 7.0.2 Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.28.0 to 7.0.2. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.0.2/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 69 +++++++++++++++++++++++++++++++---------------- package.json | 2 +- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 949829051..cb0cfc89d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "6.28.0", + "react-router-dom": "7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -2897,14 +2897,6 @@ "node": ">= 8" } }, - "node_modules/@remix-run/router": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz", - "integrity": "sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -2999,6 +2991,11 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -12327,33 +12324,49 @@ "license": "MIT" }, "node_modules/react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.2.tgz", + "integrity": "sha512-m5AcPfTRUcjwmhBzOJGEl6Y7+Crqyju0+TgTQxoS4SO+BkWbhOrcfZNq6wSWdl2BBbJbsAoBUb8ZacOFT+/JlA==", "dependencies": { - "@remix-run/router": "1.21.0" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } } }, "node_modules/react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.2.tgz", + "integrity": "sha512-VJOQ+CDWFDGaWdrG12Nl+d7yHtLaurNgAQZVgaIy7/Xd+DojgmYLosFfZdGz1wpxmjJIAkAMVTKWcvkx1oggAw==", "dependencies": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "react-router": "7.0.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-router/node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "engines": { + "node": ">=18" } }, "node_modules/read-only-stream": { @@ -12913,6 +12926,11 @@ "node": ">= 0.8.0" } }, + "node_modules/set-cookie-parser": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -14405,6 +14423,11 @@ "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", "license": "MIT" }, + "node_modules/turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 690fd7312..7c067d2e7 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "6.28.0", + "react-router-dom": "7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From db0df82202aacf0c2e65c0e5dfa28a9ceee4a4e9 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sat, 14 Dec 2024 21:31:49 -0500 Subject: [PATCH 26/57] Change imports --- client/homebrew/homebrew.jsx | 4 ++-- package-lock.json | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 63cf295fe..a215f7b5d 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -1,8 +1,8 @@ require('./homebrew.less'); const React = require('react'); const createClass = require('create-react-class'); -const { StaticRouter:Router } = require('react-router-dom/server'); -const { Route, Routes, useParams, useSearchParams } = require('react-router-dom'); +const { StaticRouter:Router } = require('react-router'); +const { Route, Routes, useParams, useSearchParams } = require('react-router'); const HomePage = require('./pages/homePage/homePage.jsx'); const EditPage = require('./pages/editPage/editPage.jsx'); diff --git a/package-lock.json b/package-lock.json index ab3810016..cb0cfc89d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "classnames": "^2.5.1", "codemirror": "^5.65.6", "cookie-parser": "^1.4.7", + "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", "dompurify": "^3.2.3", @@ -4802,6 +4803,19 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "license": "MIT" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cosmiconfig": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", From 889f80f53788a1d89c05df7232a21131b1b1ce3b Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sat, 14 Dec 2024 21:48:13 -0500 Subject: [PATCH 27/57] Replace react-router-dom with react-router react-router-dom has been replaced by react-router, so changing packages --- package-lock.json | 28 +++++++++------------------- package.json | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index cb0cfc89d..9f782785a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "7.0.2", + "react-router": "^7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -2994,7 +2994,8 @@ "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", + "license": "MIT" }, "node_modules/@types/estree": { "version": "1.0.6", @@ -12327,6 +12328,7 @@ "version": "7.0.2", "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.2.tgz", "integrity": "sha512-m5AcPfTRUcjwmhBzOJGEl6Y7+Crqyju0+TgTQxoS4SO+BkWbhOrcfZNq6wSWdl2BBbJbsAoBUb8ZacOFT+/JlA==", + "license": "MIT", "dependencies": { "@types/cookie": "^0.6.0", "cookie": "^1.0.1", @@ -12346,25 +12348,11 @@ } } }, - "node_modules/react-router-dom": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.2.tgz", - "integrity": "sha512-VJOQ+CDWFDGaWdrG12Nl+d7yHtLaurNgAQZVgaIy7/Xd+DojgmYLosFfZdGz1wpxmjJIAkAMVTKWcvkx1oggAw==", - "dependencies": { - "react-router": "7.0.2" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - } - }, "node_modules/react-router/node_modules/cookie": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "license": "MIT", "engines": { "node": ">=18" } @@ -12929,7 +12917,8 @@ "node_modules/set-cookie-parser": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", - "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", + "license": "MIT" }, "node_modules/set-function-length": { "version": "1.2.2", @@ -14426,7 +14415,8 @@ "node_modules/turbo-stream": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", - "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==", + "license": "ISC" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/package.json b/package.json index 7c067d2e7..d928490fb 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router-dom": "7.0.2", + "react-router": "^7.0.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From b7c99b2d5232d7d83903c97a925746c340cdbc08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 03:57:07 +0000 Subject: [PATCH 28/57] Bump mongoose from 8.8.4 to 8.9.0 Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.8.4 to 8.9.0. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md) - [Commits](https://github.com/Automattic/mongoose/compare/8.8.4...8.9.0) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 31 +++++++++++++++---------------- package.json | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f782785a..1ce0a75bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.8.4", + "mongoose": "^8.9.0", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", @@ -4333,9 +4333,9 @@ } }, "node_modules/bson": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.9.0.tgz", - "integrity": "sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig==", + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.1.tgz", + "integrity": "sha512-P92xmHDQjSKPLHqFxefqMxASNq/aWJMEZugpCjf+AF/pgcUpMMQCg7t7+ewko0/u8AapvF3luf/FoehddEK+sA==", "engines": { "node": ">=16.20.1" } @@ -10894,14 +10894,13 @@ } }, "node_modules/mongoose": { - "version": "8.8.4", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.8.4.tgz", - "integrity": "sha512-yJbn695qCsqDO+xyPII29x2R7flzXhxCDv09mMZPSGllf0sm4jKw3E9s9uvQ9hjO6bL2xjU8KKowYqcY9eSTMQ==", - "license": "MIT", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.0.tgz", + "integrity": "sha512-b58zY3PLNBcoz6ZXFckr0leJcVVBMAOBvD+7Bj2ZjghAwntXmNnqwlDixTKQU3UYoQIGTv+AQx/0ThsvaeVrCA==", "dependencies": { - "bson": "^6.7.0", + "bson": "^6.10.1", "kareem": "2.6.3", - "mongodb": "~6.10.0", + "mongodb": "~6.12.0", "mpath": "0.9.0", "mquery": "5.0.0", "ms": "2.1.3", @@ -10973,12 +10972,12 @@ } }, "node_modules/mongoose/node_modules/mongodb": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.10.0.tgz", - "integrity": "sha512-gP9vduuYWb9ZkDM546M+MP2qKVk5ZG2wPF63OvSRuUbqCR+11ZCAE1mOfllhlAG0wcoJY5yDL/rV3OmYEwXIzg==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.12.0.tgz", + "integrity": "sha512-RM7AHlvYfS7jv7+BXund/kR64DryVI+cHbVAy9P61fnb1RcWZqOW1/Wj2YhqMCx+MuYhqTRGv7AwHBzmsCKBfA==", "dependencies": { - "@mongodb-js/saslprep": "^1.1.5", - "bson": "^6.7.0", + "@mongodb-js/saslprep": "^1.1.9", + "bson": "^6.10.1", "mongodb-connection-string-url": "^3.0.0" }, "engines": { @@ -10986,7 +10985,7 @@ }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", "gcp-metadata": "^5.2.0", "kerberos": "^2.0.1", "mongodb-client-encryption": ">=6.0.0 <7", diff --git a/package.json b/package.json index d928490fb..599e4776d 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.8.4", + "mongoose": "^8.9.0", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", From 56f348f7ed7dbb9df98e26a38fa5f114647b5c7e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 15 Dec 2024 23:44:56 -0500 Subject: [PATCH 29/57] Replace with `toWellFormed()` --- client/homebrew/pages/editPage/editPage.jsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index de71f02a0..e5f6d909c 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -380,15 +380,7 @@ const EditPage = createClass({ **[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`; - let encodedTitle; - try { - encodedTitle = encodeURIComponent(title); - } catch (error) { - console.error("Error encoding title for Reddit link:", error); - encodedTitle = encodeURIComponent("Check out my homebrew!"); // Fallback title - } - - return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodedTitle}&text=${encodeURIComponent(text)}`; +return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title.toWellFormed())}&text=${encodeURIComponent(text)}`; }, renderNavbar : function(){ From cb16b320167fab3a50446d32855368d120917916 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 15 Dec 2024 23:45:54 -0500 Subject: [PATCH 30/57] tabs --- client/homebrew/pages/editPage/editPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index e5f6d909c..865c4ce2a 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -380,7 +380,7 @@ const EditPage = createClass({ **[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`; -return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title.toWellFormed())}&text=${encodeURIComponent(text)}`; + return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title.toWellFormed())}&text=${encodeURIComponent(text)}`; }, renderNavbar : function(){ From f8fc6f7aa42e5ded148bca76e9c1f63663e68532 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 04:59:23 +0000 Subject: [PATCH 31/57] Bump eslint from 9.16.0 to 9.17.0 Bumps [eslint](https://github.com/eslint/eslint) from 9.16.0 to 9.17.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v9.16.0...v9.17.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 20 +++++++++----------- package.json | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1ce0a75bf..dcabcee61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "devDependencies": { "@stylistic/stylelint-plugin": "^3.1.1", "babel-plugin-transform-import-meta": "^2.2.1", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "eslint-plugin-jest": "^28.9.0", "eslint-plugin-react": "^7.37.2", "globals": "^15.13.0", @@ -1911,11 +1911,10 @@ } }, "node_modules/@eslint/js": { - "version": "9.16.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", - "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", + "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", "dev": true, - "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -5783,18 +5782,17 @@ "license": "MIT" }, "node_modules/eslint": { - "version": "9.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", - "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", + "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.19.0", "@eslint/core": "^0.9.0", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.16.0", + "@eslint/js": "9.17.0", "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -5803,7 +5801,7 @@ "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.5", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.2.0", diff --git a/package.json b/package.json index 599e4776d..dfb8d1cb3 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "devDependencies": { "@stylistic/stylelint-plugin": "^3.1.1", "babel-plugin-transform-import-meta": "^2.2.1", - "eslint": "^9.16.0", + "eslint": "^9.17.0", "eslint-plugin-jest": "^28.9.0", "eslint-plugin-react": "^7.37.2", "globals": "^15.13.0", From 206e4fbda8d6acc95583f91ed703a4ed4bd839da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 05:01:24 +0000 Subject: [PATCH 32/57] Bump stylelint from 16.11.0 to 16.12.0 Bumps [stylelint](https://github.com/stylelint/stylelint) from 16.11.0 to 16.12.0. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/16.11.0...16.12.0) --- updated-dependencies: - dependency-name: stylelint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 928 +++------------------------------------------- package.json | 2 +- 2 files changed, 45 insertions(+), 885 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcabcee61..ac58eded3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,7 +62,7 @@ "jest-expect-message": "^1.1.3", "jsdom-global": "^3.0.2", "postcss-less": "^6.0.0", - "stylelint": "^16.11.0", + "stylelint": "^16.12.0", "stylelint-config-recess-order": "^5.1.1", "stylelint-config-recommended": "^14.0.1", "supertest": "^7.0.0" @@ -2148,22 +2148,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@jest/console/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2181,26 +2165,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/@jest/console/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2272,22 +2236,6 @@ } } }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@jest/core/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2305,26 +2253,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/@jest/core/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2469,22 +2397,6 @@ } } }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@jest/reporters/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2502,26 +2414,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2632,22 +2524,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@jest/transform/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2665,26 +2541,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/@jest/transform/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2726,22 +2582,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@jest/types/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2759,26 +2599,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/@jest/types/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3358,6 +3178,20 @@ "node": ">=8" } }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -3613,7 +3447,6 @@ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -3701,22 +3534,6 @@ "@babel/core": "^7.8.0" } }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/babel-jest/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3734,26 +3551,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/babel-jest/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4618,6 +4415,22 @@ "node": ">=0.10.0" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "node_modules/colord": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", @@ -4908,22 +4721,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/create-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/create-jest/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -4941,26 +4738,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/create-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/create-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/create-jest/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -5957,22 +5734,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/eslint/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -5990,26 +5751,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -6466,11 +6207,10 @@ "license": "MIT" }, "node_modules/fast-uri": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", - "dev": true, - "license": "MIT" + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz", + "integrity": "sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==", + "dev": true }, "node_modules/fastest-levenshtein": { "version": "1.0.16", @@ -8316,22 +8056,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-circus/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-circus/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8349,26 +8073,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-circus/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-circus/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-circus/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8426,22 +8130,6 @@ } } }, - "node_modules/jest-cli/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-cli/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8459,26 +8147,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-cli/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-cli/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-cli/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8548,22 +8216,6 @@ } } }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-config/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8581,26 +8233,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8640,22 +8272,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-diff/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8673,26 +8289,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-diff/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8746,22 +8342,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-each/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8779,26 +8359,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-each/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8913,22 +8473,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-matcher-utils/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8946,26 +8490,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-matcher-utils/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9010,22 +8534,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-message-util/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9043,26 +8551,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-message-util/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9164,22 +8652,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-resolve/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9197,26 +8669,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-resolve/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9273,22 +8725,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-runner/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9306,26 +8742,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-runner/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9383,22 +8799,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-runtime/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9416,26 +8816,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-runtime/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9491,22 +8871,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-snapshot/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9524,26 +8888,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-snapshot/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9598,22 +8942,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-util/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9631,26 +8959,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-util/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9692,22 +9000,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-validate/node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -9738,26 +9030,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-validate/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9801,22 +9073,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/jest-watcher/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -9834,26 +9090,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/jest-watcher/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -10416,8 +9652,7 @@ "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/loose-envify": { "version": "1.4.0", @@ -12600,7 +11835,6 @@ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -13141,7 +12375,6 @@ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -13154,42 +12387,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -13691,9 +12888,9 @@ "license": "ISC" }, "node_modules/stylelint": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.11.0.tgz", - "integrity": "sha512-zrl4IrKmjJQ+h9FoMp69UMCq5SxeHk0URhxUBj4d3ISzo/DplOFBJZc7t7Dr6otB+1bfbbKNLOmCDpzKSlW+Nw==", + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.12.0.tgz", + "integrity": "sha512-F8zZ3L/rBpuoBZRvI4JVT20ZanPLXfQLzMOZg1tzPflRVh9mKpOZ8qcSIhh1my3FjAjZWG4T2POwGnmn6a6hbg==", "dev": true, "funding": [ { @@ -13705,7 +12902,6 @@ "url": "https://github.com/sponsors/stylelint" } ], - "license": "MIT", "dependencies": { "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", @@ -13743,7 +12939,7 @@ "string-width": "^4.2.3", "supports-hyperlinks": "^3.1.0", "svg-tags": "^1.0.0", - "table": "^6.8.2", + "table": "^6.9.0", "write-file-atomic": "^5.0.1" }, "bin": { @@ -14112,11 +13308,10 @@ } }, "node_modules/table": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", - "integrity": "sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", + "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -14133,7 +13328,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, - "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -14149,8 +13343,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/test-exclude": { "version": "6.0.0", @@ -15467,39 +14660,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index dfb8d1cb3..31859cce1 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "jest-expect-message": "^1.1.3", "jsdom-global": "^3.0.2", "postcss-less": "^6.0.0", - "stylelint": "^16.11.0", + "stylelint": "^16.12.0", "stylelint-config-recess-order": "^5.1.1", "stylelint-config-recommended": "^14.0.1", "supertest": "^7.0.0" From 35be1e9b94d7b31260712cd47a5b86dd587db163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 16 Dec 2024 16:43:40 +0100 Subject: [PATCH 33/57] quickfix --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 39086cc21..c54f601eb 100644 --- a/server/app.js +++ b/server/app.js @@ -65,7 +65,7 @@ const corsOptions = { const allowedOrigins = [ 'https://homebrewery.naturalcrit.com', - 'https://naturalcrit.com', + 'https://www.naturalcrit.com', 'https://naturalcrit-stage.herokuapp.com', 'https://homebrewery-stage.herokuapp.com', ]; From efa8f3fedfda7775ffb76fd44ffd8afb32eae857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 16 Dec 2024 22:13:14 +0100 Subject: [PATCH 34/57] remove unnecessary, cluttering logs --- server/app.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/server/app.js b/server/app.js index c54f601eb..c91bbc57f 100644 --- a/server/app.js +++ b/server/app.js @@ -91,7 +91,6 @@ app.use(cors(corsOptions)); //Account Middleware app.use((req, res, next)=>{ - console.log('passing through acc middleware, checking for cookies now: does cookies exist? ', !!req.cookies, ', ok, does the session cookie exist? ', !!req.cookies.nc_session); if(req.cookies && req.cookies.nc_session){ try { req.account = jwt.decode(req.cookies.nc_session, config.get('secret')); @@ -352,12 +351,8 @@ app.get('/user/:username', async (req, res, next)=>{ //Change author name on brews app.put('/api/user/rename', async (req, res)=>{ const { username, newUsername } = req.body; - - //this next logs will be removed in a next PR, as i need to get this live to test if req.account is created when passing the request from naturalcrit.com - - console.log(`is user ${req.account.username} equal to ${username}? ${req.account.username === username} ${req.account.username === username && 'then add the damn auth for renaming!'}`); - console.log('renaming'); - + console.log(req.account); + if(!username || !newUsername) { return res.status(400).json({ error: 'Username and newUsername are required.' }); } From fcf985a115f73ac7eeda67ffdee71abaf9ca193d Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 16 Dec 2024 17:42:06 -0500 Subject: [PATCH 35/57] Restore content-negotiation test --- server/middleware/content-negotiation.spec.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 server/middleware/content-negotiation.spec.js diff --git a/server/middleware/content-negotiation.spec.js b/server/middleware/content-negotiation.spec.js new file mode 100644 index 000000000..018330434 --- /dev/null +++ b/server/middleware/content-negotiation.spec.js @@ -0,0 +1,41 @@ +const contentNegotiationMiddleware = require('./content-negotiation.js'); + +describe('content-negotiation-middleware', ()=>{ + let request; + let response; + let next; + + beforeEach(()=>{ + request = { + get : function(key) { + return this[key]; + } + }; + response = { + status : jest.fn(()=>response), + send : jest.fn(()=>{}) + }; + next = jest.fn(); + }); + + it('should return 406 on image request', ()=>{ + contentNegotiationMiddleware({ + Accept : 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8', + ...request + }, response); + + expect(response.status).toHaveBeenLastCalledWith(406); + expect(response.send).toHaveBeenCalledWith({ + message : 'Request for image at this URL is not supported' + }); + }); + + it('should call next on non-image request', ()=>{ + contentNegotiationMiddleware({ + Accept : 'text,image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8', + ...request + }, response, next); + + expect(next).toHaveBeenCalled(); + }); +}); From bc14246fe7ca1da61a56922144dabd3f833ac49f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 16 Dec 2024 17:58:08 -0500 Subject: [PATCH 36/57] fix import --- server/middleware/content-negotiation.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/content-negotiation.spec.js b/server/middleware/content-negotiation.spec.js index 018330434..80b9e515d 100644 --- a/server/middleware/content-negotiation.spec.js +++ b/server/middleware/content-negotiation.spec.js @@ -1,4 +1,4 @@ -const contentNegotiationMiddleware = require('./content-negotiation.js'); +import contentNegotiationMiddleware from './content-negotiation.js'; describe('content-negotiation-middleware', ()=>{ let request; From a3ec5b8d3b91becf120556ff89c21f4e361f2890 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 03:25:20 +0000 Subject: [PATCH 37/57] Bump mongoose from 8.9.0 to 8.9.1 Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.9.0 to 8.9.1. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md) - [Commits](https://github.com/Automattic/mongoose/compare/8.9.0...8.9.1) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ac58eded3..94178b331 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.9.0", + "mongoose": "^8.9.1", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", @@ -10127,9 +10127,9 @@ } }, "node_modules/mongoose": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.0.tgz", - "integrity": "sha512-b58zY3PLNBcoz6ZXFckr0leJcVVBMAOBvD+7Bj2ZjghAwntXmNnqwlDixTKQU3UYoQIGTv+AQx/0ThsvaeVrCA==", + "version": "8.9.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.1.tgz", + "integrity": "sha512-whM6lWMdeKlUm4d2LSLS/q6cWtTp13lUrL5hy2YTsQdTSN+dsAu8HLdLUQOEgtBE59qp4IqLrjSXCSETbxhkQQ==", "dependencies": { "bson": "^6.10.1", "kareem": "2.6.3", diff --git a/package.json b/package.json index 16277d5d0..38b25bc77 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.9.0", + "mongoose": "^8.9.1", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", From c63b6ffaf0857ef5f9a28e9a070a91133b33ed79 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Tue, 17 Dec 2024 21:38:32 -0600 Subject: [PATCH 38/57] Add test for a pair of inline horizontal breaks --- shared/naturalcrit/markdown.js | 2 +- tests/markdown/horizontalSpaces.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 6ceee2b03..6b737e02f 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -408,7 +408,7 @@ const nonbreakingSpaces = { } }, renderer(token) { - return ` `.repeat(token.length).concat('\n'); + return ` `.repeat(token.length).concat(''); } }; diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/horizontalSpaces.test.js index 6789b934c..1ef8ea043 100644 --- a/tests/markdown/horizontalSpaces.test.js +++ b/tests/markdown/horizontalSpaces.test.js @@ -33,6 +33,12 @@ describe('Hard Breaks', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n\n   \n\n   \n

`); }); + test('Pair of inline Breaks', function() { + const source = ':>>:>>'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  \n  \n

`); + }); + test('Break directly between two paragraphs', function() { const source = 'Line 1\n:>>\nLine 2'; const rendered = Markdown.render(source).trim(); From 912f9f0cf689a34648e00517010b15cbaa63eca1 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Tue, 17 Dec 2024 21:40:56 -0600 Subject: [PATCH 39/57] Remove extraneous linefeeds in horizontalbreaks --- tests/markdown/horizontalSpaces.test.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/horizontalSpaces.test.js index 1ef8ea043..5e5611e0f 100644 --- a/tests/markdown/horizontalSpaces.test.js +++ b/tests/markdown/horizontalSpaces.test.js @@ -6,43 +6,43 @@ describe('Hard Breaks', ()=>{ test('Single Break', function() { const source = ':>\n\n'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

 \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

 

`); }); test('Double Break', function() { const source = ':>>\n\n'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  

`); }); test('Triple Break', function() { const source = ':>>>\n\n'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   

`); }); test('Many Break', function() { const source = ':>>>>>>>>>>\n\n'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

          \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

          

`); }); test('Multiple sets of Breaks', function() { const source = ':>>>\n:>>>\n:>>>'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n\n   \n\n   \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n   \n   

`); }); test('Pair of inline Breaks', function() { const source = ':>>:>>'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  \n  \n

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

    

`); }); test('Break directly between two paragraphs', function() { const source = 'Line 1\n:>>\nLine 2'; const rendered = Markdown.render(source).trim(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

Line 1\n  \n\nLine 2

`); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

Line 1\n  \nLine 2

`); }); test('Ignored inside a code block', function() { From aee5b7a8cce7e13d10ce4d6717dc858eee8c22d2 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 12:14:08 -0500 Subject: [PATCH 40/57] Require user to be logged in to change name --- server/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/app.js b/server/app.js index c91bbc57f..4dec6b4c4 100644 --- a/server/app.js +++ b/server/app.js @@ -351,11 +351,12 @@ app.get('/user/:username', async (req, res, next)=>{ //Change author name on brews app.put('/api/user/rename', async (req, res)=>{ const { username, newUsername } = req.body; - console.log(req.account); + const ownAccount = req.account && (req.account.username == newUsername); - if(!username || !newUsername) { + if(!username || !newUsername) return res.status(400).json({ error: 'Username and newUsername are required.' }); - } + if(!ownAccount) + return res.status(403).json({ error: 'Must be logged in to change your username' }); try { const brews = await HomebrewModel.getByUser(username, true, ['authors']); const renamePromises = brews.map(async (brew)=>{ From 64b792c6450e005229886f0f7a7dcb3cd0ffdba7 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 13:02:14 -0500 Subject: [PATCH 41/57] Fix case where no stub is found When retrieving a Google Brew with no stub yet, if the user is not logged in or has expired credentials, we enter this error handler. However, the error message itself tries to send a list of authors. If there was no stub, we crash here with a 500 error. This adds conditional operator to any stub value so we can send the actual "not logged in" error in case of no stub. --- server/homebrew.api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 159c08b47..7bf10f38d 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -111,7 +111,7 @@ const api = { const isInvited = stub?.invitedAuthors?.includes(req.account?.username); if(accessType === 'edit' && !(isOwner || isAuthor || isInvited)) { - const accessError = { name: 'Access Error', status: 401, authors: stub.authors, brewTitle: stub.title, shareId: stub.shareId }; + const accessError = { name: 'Access Error', status: 401, authors: stub?.authors, brewTitle: stub?.title, shareId: stub?.shareId }; if(req.account) throw { ...accessError, message: 'User is not an Author', HBErrorCode: '03' }; else @@ -119,7 +119,7 @@ const api = { } if(stub?.lock?.locked && accessType != 'edit') { - throw { HBErrorCode: '51', code: stub.lock.code, message: stub.lock.shareMessage, brewId: stub.shareId, brewTitle: stub.title }; + throw { HBErrorCode: '51', code: stub?.lock.code, message: stub?.lock.shareMessage, brewId: stub?.shareId, brewTitle: stub?.title }; } // If there is a google id, try to find the google brew From e61144beb8ba9ddf0d4a5144996311fcb18a1c3b Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 13:45:53 -0500 Subject: [PATCH 42/57] Mark as owner if stub doesn't exist Old Google Drive files without a stub have no author, so if no stub exists, consider the current user the owner. --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 7bf10f38d..56da8872c 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -106,7 +106,7 @@ const api = { stub = stub?.toObject(); googleId ??= stub?.googleId; - const isOwner = stub?.authors?.length === 0 || stub?.authors?.[0] === req.account?.username; + const isOwner = !stub || stub?.authors?.length === 0 || stub?.authors?.[0] === req.account?.username; const isAuthor = stub?.authors?.includes(req.account?.username); const isInvited = stub?.invitedAuthors?.includes(req.account?.username); From 6e8a0d731468cf0f399b97e7bd53fbd6a2394e8f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 17:07:09 -0500 Subject: [PATCH 43/57] current user owns 0-author brew only if edit mode Previous code was treating /share/ visits to google brews with no stub as visits by owner, thus using their own credentials to open the file instead of serviceaccount --- server/homebrew.api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 56da8872c..548346643 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -106,7 +106,7 @@ const api = { stub = stub?.toObject(); googleId ??= stub?.googleId; - const isOwner = !stub || stub?.authors?.length === 0 || stub?.authors?.[0] === req.account?.username; + const isOwner = (accessType == 'edit' && (!stub || stub?.authors?.length === 0)) || stub?.authors?.[0] === req.account?.username; const isAuthor = stub?.authors?.includes(req.account?.username); const isInvited = stub?.invitedAuthors?.includes(req.account?.username); @@ -124,7 +124,7 @@ const api = { // If there is a google id, try to find the google brew if(!stubOnly && googleId) { - const oAuth2Client = isOwner? GoogleActions.authCheck(req.account, res) : undefined; + const oAuth2Client = isOwner ? GoogleActions.authCheck(req.account, res) : undefined; const googleBrew = await GoogleActions.getGoogleBrew(oAuth2Client, googleId, id, accessType) .catch((googleError)=>{ From 5f14f656ef88a20bb4e12033cf3763d53d753f2e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 17:23:38 -0500 Subject: [PATCH 44/57] Logging --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 548346643..5f19f81fb 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -125,7 +125,7 @@ const api = { // If there is a google id, try to find the google brew if(!stubOnly && googleId) { const oAuth2Client = isOwner ? GoogleActions.authCheck(req.account, res) : undefined; - + console.log(`user ${req.account?.username} attempting to get googlebrew ${googleId} as ${isOwner ? 'owner' : 'visitor'}`); const googleBrew = await GoogleActions.getGoogleBrew(oAuth2Client, googleId, id, accessType) .catch((googleError)=>{ const reason = googleError.errors?.[0].reason; From 2dc8a8fbe92f9bfb82dcd7287d21ed594849696f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 19 Dec 2024 16:20:04 +1300 Subject: [PATCH 45/57] Remove req.account from update request --- server/admin.api.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/admin.api.js b/server/admin.api.js index 02cdcb2f7..2febdfebb 100644 --- a/server/admin.api.js +++ b/server/admin.api.js @@ -108,6 +108,9 @@ router.put('/admin/clean/script/:id', asyncHandler(HomebrewAPI.getBrew('admin', req.body = brew; + // Remove Account from request to prevent Admin user from being added to brew as an Author + req.account = undefined; + return await HomebrewAPI.updateBrew(req, res); }); From 7a169cbd9e5fce6ebca6b0c34428fefa27749255 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 19 Dec 2024 16:20:28 +1300 Subject: [PATCH 46/57] Linter clean up --- server/admin.api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/admin.api.js b/server/admin.api.js index 2febdfebb..1a39f020b 100644 --- a/server/admin.api.js +++ b/server/admin.api.js @@ -1,5 +1,5 @@ -import {model as HomebrewModel } from './homebrew.model.js'; -import {model as NotificationModel } from './notifications.model.js'; +import { model as HomebrewModel } from './homebrew.model.js'; +import { model as NotificationModel } from './notifications.model.js'; import express from 'express'; import Moment from 'moment'; import zlib from 'zlib'; From 9dbfb26e6c903afa60575d9dd750bda742eb7c49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 03:47:25 +0000 Subject: [PATCH 47/57] Bump globals from 15.13.0 to 15.14.0 Bumps [globals](https://github.com/sindresorhus/globals) from 15.13.0 to 15.14.0. - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](https://github.com/sindresorhus/globals/compare/v15.13.0...v15.14.0) --- updated-dependencies: - dependency-name: globals dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94178b331..d6300cb8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,7 +57,7 @@ "eslint": "^9.17.0", "eslint-plugin-jest": "^28.9.0", "eslint-plugin-react": "^7.37.2", - "globals": "^15.13.0", + "globals": "^15.14.0", "jest": "^29.7.0", "jest-expect-message": "^1.1.3", "jsdom-global": "^3.0.2", @@ -6714,11 +6714,10 @@ } }, "node_modules/globals": { - "version": "15.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", - "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", + "version": "15.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", + "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", "dev": true, - "license": "MIT", "engines": { "node": ">=18" }, diff --git a/package.json b/package.json index 38b25bc77..3b192214a 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "eslint": "^9.17.0", "eslint-plugin-jest": "^28.9.0", "eslint-plugin-react": "^7.37.2", - "globals": "^15.13.0", + "globals": "^15.14.0", "jest": "^29.7.0", "jest-expect-message": "^1.1.3", "jsdom-global": "^3.0.2", From 57467701d0036fdf488778b85b98db39f688059b Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 18 Dec 2024 23:00:01 -0500 Subject: [PATCH 48/57] Fetch Google Brew if only stub requested but nothing found /update/ requests only the stub for updating. But if no stub exists, we should fetch the full brew so we return *something*. --- server/homebrew.api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 5f19f81fb..9a479732e 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -122,10 +122,10 @@ const api = { throw { HBErrorCode: '51', code: stub?.lock.code, message: stub?.lock.shareMessage, brewId: stub?.shareId, brewTitle: stub?.title }; } - // If there is a google id, try to find the google brew - if(!stubOnly && googleId) { + // If there's a google id, get it if requesting the full brew or if no stub found yet + if(googleId && (!stubOnly || !stub)) { const oAuth2Client = isOwner ? GoogleActions.authCheck(req.account, res) : undefined; - console.log(`user ${req.account?.username} attempting to get googlebrew ${googleId} as ${isOwner ? 'owner' : 'visitor'}`); + const googleBrew = await GoogleActions.getGoogleBrew(oAuth2Client, googleId, id, accessType) .catch((googleError)=>{ const reason = googleError.errors?.[0].reason; From 6301a66fd3e8f583edb08b59e96415f242a955e0 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Thu, 19 Dec 2024 17:44:48 -0600 Subject: [PATCH 49/57] Add additional tests --- tests/markdown/horizontalSpaces.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/horizontalSpaces.test.js index 5e5611e0f..94e1a93b9 100644 --- a/tests/markdown/horizontalSpaces.test.js +++ b/tests/markdown/horizontalSpaces.test.js @@ -51,5 +51,17 @@ describe('Hard Breaks', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
\n:>\n
`); }); + + test('I am actually a definition list!', function() { + const source = 'Term\n::> Definition 1\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
Term
\n
> Definition 1
`); + }); + + test('I am actually a two term definition list!', function() { + const source = 'Term\n::> Definition 1\n::>> Definition 2'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
Term
\n
> Definition 1
\n
>> Definition 2
`); + }); }); From 7e1312805f716295a21c495ab2eda6850e12bdb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 03:38:26 +0000 Subject: [PATCH 50/57] Bump mongoose from 8.9.1 to 8.9.2 Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.9.1 to 8.9.2. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md) - [Commits](https://github.com/Automattic/mongoose/compare/8.9.1...8.9.2) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d6300cb8a..d969bc244 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.9.1", + "mongoose": "^8.9.2", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", @@ -10126,9 +10126,9 @@ } }, "node_modules/mongoose": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.1.tgz", - "integrity": "sha512-whM6lWMdeKlUm4d2LSLS/q6cWtTp13lUrL5hy2YTsQdTSN+dsAu8HLdLUQOEgtBE59qp4IqLrjSXCSETbxhkQQ==", + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.2.tgz", + "integrity": "sha512-mLWynmZS1v8HTeMxyLhskQncS1SkrjW1eLNuFDYGQMQ/5QrFrxTLNwWXeCRZeKT2lXyaxW8bnJC9AKPT9jYMkw==", "dependencies": { "bson": "^6.10.1", "kareem": "2.6.3", diff --git a/package.json b/package.json index 3b192214a..ea541fe26 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.9.1", + "mongoose": "^8.9.2", "nanoid": "5.0.9", "nconf": "^0.12.1", "react": "^18.3.1", From 6e9d293bbe33b900217795a03ea341f1681c6f85 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 19 Dec 2024 23:09:43 -0500 Subject: [PATCH 51/57] Rename tests to "Non-breaking Spaces" Hard Breaks name was leftover from copying the `::::` test file. --- tests/markdown/horizontalSpaces.test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/horizontalSpaces.test.js index 94e1a93b9..20bb8b892 100644 --- a/tests/markdown/horizontalSpaces.test.js +++ b/tests/markdown/horizontalSpaces.test.js @@ -2,44 +2,44 @@ import Markdown from 'naturalcrit/markdown.js'; -describe('Hard Breaks', ()=>{ - test('Single Break', function() { +describe('Non-Breaking Spaces', ()=>{ + test('Single Space', function() { const source = ':>\n\n'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

 

`); }); - test('Double Break', function() { + test('Double Space', function() { const source = ':>>\n\n'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

  

`); }); - test('Triple Break', function() { + test('Triple Space', function() { const source = ':>>>\n\n'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   

`); }); - test('Many Break', function() { + test('Many Space', function() { const source = ':>>>>>>>>>>\n\n'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

          

`); }); - test('Multiple sets of Breaks', function() { + test('Multiple sets of Spaces', function() { const source = ':>>>\n:>>>\n:>>>'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

   \n   \n   

`); }); - test('Pair of inline Breaks', function() { + test('Pair of inline Spaces', function() { const source = ':>>:>>'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

    

`); }); - test('Break directly between two paragraphs', function() { + test('Space directly between two paragraphs', function() { const source = 'Line 1\n:>>\nLine 2'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

Line 1\n  \nLine 2

`); @@ -58,7 +58,7 @@ describe('Hard Breaks', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
Term
\n
> Definition 1
`); }); - test('I am actually a two term definition list!', function() { + test('I am actually a two-term definition list!', function() { const source = 'Term\n::> Definition 1\n::>> Definition 2'; const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
Term
\n
> Definition 1
\n
>> Definition 2
`); From ed8c4d0eef0c7b8e951951f6b679536687699e04 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 19 Dec 2024 23:14:32 -0500 Subject: [PATCH 52/57] Add tests to circleCi --- .circleci/config.yml | 3 +++ package.json | 1 + .../{horizontalSpaces.test.js => non-breaking-spaces.test.js} | 0 3 files changed, 4 insertions(+) rename tests/markdown/{horizontalSpaces.test.js => non-breaking-spaces.test.js} (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 00cbdf5bc..51c598f02 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,6 +70,9 @@ jobs: - run: name: Test - Hard Breaks command: npm run test:hard-breaks + - run: + name: Test - Non-Breaking Spaces + command: npm run test:non-breaking-spaces - run: name: Test - Variables command: npm run test:variables diff --git a/package.json b/package.json index 3b192214a..d084a866b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "test:mustache-syntax:injection": "jest \".*(mustache-syntax).*\" -t '^Injection:.*' --verbose --noStackTrace", "test:definition-lists": "jest tests/markdown/definition-lists.test.js --verbose --noStackTrace", "test:hard-breaks": "jest tests/markdown/hard-breaks.test.js --verbose --noStackTrace", + "test:non-breaking-spaces": "jest tests/markdown/non-breaking-spaces.test.js --verbose --noStackTrace", "test:emojis": "jest tests/markdown/emojis.test.js --verbose --noStackTrace", "test:route": "jest tests/routes/static-pages.test.js --verbose", "test:safehtml": "jest tests/html/safeHTML.test.js --verbose", diff --git a/tests/markdown/horizontalSpaces.test.js b/tests/markdown/non-breaking-spaces.test.js similarity index 100% rename from tests/markdown/horizontalSpaces.test.js rename to tests/markdown/non-breaking-spaces.test.js From fde21868cdb3bd21438ebff2cc8b80e9c0544900 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 19 Dec 2024 23:20:01 -0500 Subject: [PATCH 53/57] Add emoji tests to circleci --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 00cbdf5bc..10264d4d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,6 +73,9 @@ jobs: - run: name: Test - Variables command: npm run test:variables + - run: + name: Test - Emojis + command: npm run test:emojis - run: name: Test - Routes command: npm run test:route From ba83dfacd9bcc34b9e9b9cf54a5250897a3bfdf0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 04:26:51 +0000 Subject: [PATCH 54/57] Bump eslint-plugin-jest from 28.9.0 to 28.10.0 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 28.9.0 to 28.10.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v28.9.0...v28.10.0) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d969bc244..bc4c66238 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "@stylistic/stylelint-plugin": "^3.1.1", "babel-plugin-transform-import-meta": "^2.2.1", "eslint": "^9.17.0", - "eslint-plugin-jest": "^28.9.0", + "eslint-plugin-jest": "^28.10.0", "eslint-plugin-react": "^7.37.2", "globals": "^15.14.0", "jest": "^29.7.0", @@ -5618,9 +5618,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "28.9.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.9.0.tgz", - "integrity": "sha512-rLu1s1Wf96TgUUxSw6loVIkNtUjq1Re7A9QdCCHSohnvXEBAjuL420h0T/fMmkQlNsQP2GhQzEUpYHPfxBkvYQ==", + "version": "28.10.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.10.0.tgz", + "integrity": "sha512-hyMWUxkBH99HpXT3p8hc7REbEZK3D+nk8vHXGgpB+XXsi0gO4PxMSP+pjfUzb67GnV9yawV9a53eUmcde1CCZA==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/package.json b/package.json index ea541fe26..aec34b085 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "@stylistic/stylelint-plugin": "^3.1.1", "babel-plugin-transform-import-meta": "^2.2.1", "eslint": "^9.17.0", - "eslint-plugin-jest": "^28.9.0", + "eslint-plugin-jest": "^28.10.0", "eslint-plugin-react": "^7.37.2", "globals": "^15.14.0", "jest": "^29.7.0", From aae5367ad25d7c41f7ad851a38b95e34609adda6 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 20 Dec 2024 11:01:55 -0500 Subject: [PATCH 55/57] Add test case for single-line definition list --- tests/markdown/non-breaking-spaces.test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/markdown/non-breaking-spaces.test.js b/tests/markdown/non-breaking-spaces.test.js index 20bb8b892..9dad4eb0f 100644 --- a/tests/markdown/non-breaking-spaces.test.js +++ b/tests/markdown/non-breaking-spaces.test.js @@ -51,6 +51,11 @@ describe('Non-Breaking Spaces', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
\n:>\n
`); }); + test('I am actually a single-line definition list!', function() { + const source = 'Term ::> Definition 1\n'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
Term
> Definition 1
\n
`); + }); test('I am actually a definition list!', function() { const source = 'Term\n::> Definition 1\n'; From 50fcffb2538986fa5716f348980679c631e4213a Mon Sep 17 00:00:00 2001 From: David Bolack Date: Fri, 20 Dec 2024 14:06:20 -0600 Subject: [PATCH 56/57] Revert exclusion on single definition list regex This permits `Term ::> Definition` to process as a single line definition list --- shared/naturalcrit/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 6b737e02f..b40887259 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -417,7 +417,7 @@ const definitionListsSingleLine = { level : 'block', start(src) { return src.match(/\n[^\n]*?::[^:\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const regex = /^([^\n]*?)::([^\:\>][^\n]*)(?:\n|$)/ym; + const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym; let match; let endIndex = 0; const definitions = []; From adb1db1d3c28115ede5e8182755b06dcf63c39c7 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 20 Dec 2024 15:39:57 -0500 Subject: [PATCH 57/57] Revert one more regex change --- shared/naturalcrit/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index b40887259..852243d81 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -415,7 +415,7 @@ const nonbreakingSpaces = { const definitionListsSingleLine = { name : 'definitionListsSingleLine', level : 'block', - start(src) { return src.match(/\n[^\n]*?::[^:\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match + start(src) { return src.match(/\n[^\n]*?::[^\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym; let match;