From 347ebcde438253c1123a8786bd954d814510e910 Mon Sep 17 00:00:00 2001 From: Martin Miranda Date: Thu, 4 Aug 2022 19:05:58 +1000 Subject: [PATCH 1/5] fix: Drawer does not close Passing `open` to the Styled component doesn't refresh the `transform` CSS property. Resolves: Issue #106 --- packages/extension/src/ui/containers/App/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/extension/src/ui/containers/App/index.js b/packages/extension/src/ui/containers/App/index.js index 441fae7..92f44d4 100644 --- a/packages/extension/src/ui/containers/App/index.js +++ b/packages/extension/src/ui/containers/App/index.js @@ -118,7 +118,13 @@ const App = () => { }, [getPlayer, history, open, pathname]); return ( - +
From 3a927065c4307552e5ae011da9eddf3ec5d3b038 Mon Sep 17 00:00:00 2001 From: Martin Miranda Date: Thu, 4 Aug 2022 19:08:41 +1000 Subject: [PATCH 2/5] refactor: Removes metadata from the window title from the export filename Transforms `(123) My super video - YouTube` into just `My super video` --- .../src/options/containers/Page/Toolbar/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/extension/src/options/containers/Page/Toolbar/index.js b/packages/extension/src/options/containers/Page/Toolbar/index.js index 12dc933..16800ab 100644 --- a/packages/extension/src/options/containers/Page/Toolbar/index.js +++ b/packages/extension/src/options/containers/Page/Toolbar/index.js @@ -98,7 +98,13 @@ const Toolbar = () => { const handleExportMarkdown = () => { const data = MarkdownService.pagesToMarkdown([{ meta, notes }]); - return FileService.exportMarkdownFile(data, `yinote_${meta.title}.md`); + + // Removing notifications count and " - Youtube" at the end + const fileName = meta.title + .replace(/^\(.*\) /g, '') + .replace(/ - YouTube$/g, ''); + + return FileService.exportMarkdownFile(data, `${fileName}.md`); }; const handleOpenPage = () => { From 795372ad2fe1d279b4551eeaf4ec02cd0ef7d896 Mon Sep 17 00:00:00 2001 From: Martin Miranda Date: Thu, 4 Aug 2022 19:14:04 +1000 Subject: [PATCH 3/5] fix: Fixes deprecated error when using `fromString` and `isUuid` Also fixes exporting markdown files with links without the video ID nor the `t=` query param. --- packages/common/package.json | 1 + packages/common/services/storage/BrowserStorage.js | 4 ++-- packages/common/store/page.js | 4 ++-- packages/common/utils/generatePageId.js | 8 +++++--- yarn.lock | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 2e0a216..9eba430 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -30,6 +30,7 @@ "marked": "^1.1.0", "md5": "^2.2.1", "page-metadata-parser": "^1.1.4", + "uuid": "^8.3.2", "uuidv4": "^6.0.0" } } diff --git a/packages/common/services/storage/BrowserStorage.js b/packages/common/services/storage/BrowserStorage.js index 2c2cf61..210b19e 100644 --- a/packages/common/services/storage/BrowserStorage.js +++ b/packages/common/services/storage/BrowserStorage.js @@ -1,4 +1,4 @@ -import { isUuid } from 'uuidv4'; +import { validate } from 'uuid'; import Storage from './Storage'; import { addNoteToList, addTagToList } from '../../utils'; @@ -11,7 +11,7 @@ export default class BrowserStorage extends Storage { _getPages() { return this.storage.get().then(pages => { return Object.keys(pages) - .filter(key => isUuid(key)) + .filter(key => validate(key)) .map(key => pages[key]); }); } diff --git a/packages/common/store/page.js b/packages/common/store/page.js index 6c87e96..677befb 100644 --- a/packages/common/store/page.js +++ b/packages/common/store/page.js @@ -1,6 +1,6 @@ import { action, thunk } from 'easy-peasy'; import { getMetadata } from 'page-metadata-parser'; -import { fromString } from 'uuidv4'; +import { v5 } from 'uuid'; import { storage as StorageService } from '../services'; import { generatePageId, addTagToList, addNoteToList } from '../utils'; @@ -45,7 +45,7 @@ const pageModel = { }), saveNote: thunk(async (actions, note, { getState, getStoreState }) => { const { url } = getStoreState().app; - const id = note.id || fromString(note.content + note.timestamp); + const id = note.id || v5(note.content + note.timestamp); let { data: page } = getState(); if (!page.id) { diff --git a/packages/common/utils/generatePageId.js b/packages/common/utils/generatePageId.js index c0e8ef4..c1e2d13 100644 --- a/packages/common/utils/generatePageId.js +++ b/packages/common/utils/generatePageId.js @@ -1,8 +1,10 @@ -import { fromString } from 'uuidv4'; +import { v5 } from 'uuid'; import compose from 'compose-function'; import videoUrlParser from 'js-video-url-parser'; import { PROVIDER_YOUTUBE } from '../constants'; +const NAMESPACE = 'e1433c8f-bc34-431d-99b1-2a78abdd7f35'; + const getUrlWithoutHash = url => { const parsedUrl = new URL(url); parsedUrl.hash = ''; @@ -20,8 +22,8 @@ export default url => { getUrlWithoutHash )(url); if (provider === PROVIDER_YOUTUBE) { - return fromString(`${provider}-${id}`); + return v5(`${provider}-${id}`, NAMESPACE); } - return fromString(urlWithoutHash); + return v5(urlWithoutHash, NAMESPACE); }; diff --git a/yarn.lock b/yarn.lock index b28075e..9b2371c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16679,7 +16679,7 @@ uuid@3.4.0, uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@8.3.2: +uuid@8.3.2, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== From f9eb58637fb5a5cc32b5f0a6e36fec0cbdc218fc Mon Sep 17 00:00:00 2001 From: Martin Miranda Date: Thu, 4 Aug 2022 19:49:24 +1000 Subject: [PATCH 4/5] fix: Moves uuid to a separate file --- packages/common/store/page.js | 3 ++- packages/common/utils/generatePageId.js | 7 +++---- packages/common/utils/uuid-namespace.js | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 packages/common/utils/uuid-namespace.js diff --git a/packages/common/store/page.js b/packages/common/store/page.js index 677befb..bd02d98 100644 --- a/packages/common/store/page.js +++ b/packages/common/store/page.js @@ -3,6 +3,7 @@ import { getMetadata } from 'page-metadata-parser'; import { v5 } from 'uuid'; import { storage as StorageService } from '../services'; import { generatePageId, addTagToList, addNoteToList } from '../utils'; +import uuidNamespace from '../utils/uuid-namespace'; export const defaultPage = { id: '', @@ -45,7 +46,7 @@ const pageModel = { }), saveNote: thunk(async (actions, note, { getState, getStoreState }) => { const { url } = getStoreState().app; - const id = note.id || v5(note.content + note.timestamp); + const id = note.id || v5(note.content + note.timestamp, uuidNamespace); let { data: page } = getState(); if (!page.id) { diff --git a/packages/common/utils/generatePageId.js b/packages/common/utils/generatePageId.js index c1e2d13..a8a47a0 100644 --- a/packages/common/utils/generatePageId.js +++ b/packages/common/utils/generatePageId.js @@ -2,8 +2,7 @@ import { v5 } from 'uuid'; import compose from 'compose-function'; import videoUrlParser from 'js-video-url-parser'; import { PROVIDER_YOUTUBE } from '../constants'; - -const NAMESPACE = 'e1433c8f-bc34-431d-99b1-2a78abdd7f35'; +import uuidNamespace from './uuid-namespace'; const getUrlWithoutHash = url => { const parsedUrl = new URL(url); @@ -22,8 +21,8 @@ export default url => { getUrlWithoutHash )(url); if (provider === PROVIDER_YOUTUBE) { - return v5(`${provider}-${id}`, NAMESPACE); + return v5(`${provider}-${id}`, uuidNamespace); } - return v5(urlWithoutHash, NAMESPACE); + return v5(urlWithoutHash, uuidNamespace); }; diff --git a/packages/common/utils/uuid-namespace.js b/packages/common/utils/uuid-namespace.js new file mode 100644 index 0000000..32f047f --- /dev/null +++ b/packages/common/utils/uuid-namespace.js @@ -0,0 +1 @@ +export default 'e1433c8f-bc34-431d-99b1-2a78abdd7f35'; From 6fff3933a2b57a2227f493544f6b8b4b4f489b68 Mon Sep 17 00:00:00 2001 From: Sacmanxman2 Date: Mon, 12 Feb 2024 13:40:16 -0600 Subject: [PATCH 5/5] fix:Add yinote_ prefix back to title Added the yinote prefix to the fileName constant, resolving feedback on #113 --- packages/extension/src/options/containers/Page/Toolbar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/options/containers/Page/Toolbar/index.js b/packages/extension/src/options/containers/Page/Toolbar/index.js index 16800ab..c3f0271 100644 --- a/packages/extension/src/options/containers/Page/Toolbar/index.js +++ b/packages/extension/src/options/containers/Page/Toolbar/index.js @@ -100,7 +100,7 @@ const Toolbar = () => { const data = MarkdownService.pagesToMarkdown([{ meta, notes }]); // Removing notifications count and " - Youtube" at the end - const fileName = meta.title + const fileName = 'yinote_' + meta.title .replace(/^\(.*\) /g, '') .replace(/ - YouTube$/g, '');