Added auto fetching web page title when url pasted#411
Added auto fetching web page title when url pasted#411ymtdzzz wants to merge 8 commits intoBoostIO:masterfrom
Conversation
|
I've removed the statement that confirms that editor.origin isn't 'setValue' from the condition that calls the props.onChange(), will this cause any problems? As far as I did some operations, no problems occured. |
|
#411 (comment) Please roll back it. It is needed for CodeMirror editor to distinguish where changes are from. |
- Rollbacked handleCodeMirrorChange() - Implemented another solution which doesn't use setValue()
|
@Rokt33r |
| ch: change.from.ch + pastedText.length, | ||
| }) | ||
|
|
||
| const response = await fetch(urlToFetch, { method: 'get' }) |
There was a problem hiding this comment.
@ZeroX-DG
Thank you for your advice. That's right.
( I overlooked because I allowed cors in my local development environment ...)
To get this feature working on the web version in production environment I think:
(1) CORS permission setting on the Web server side (Access-Control-Allow-Origin *)
or
(2) Communicate via proxy server that CORS is allowed
(1) is not good for security, I think.
(2) is about the server configuration, so it's a little too complicated to solve here.
How about releasing this feature once as a feature for desktop and mobile apps?
If it's OK, I'll fix this feature so that it cannot be used from the Web version.
There was a problem hiding this comment.
@zeroclock sounds good to me. In the future we could do something like this:
https://github.com/Rob--W/cors-anywhere/
But I think we need more discussion on that. Thus, targeting desktop and mobile app is good enough for now and we can disable that feature on web version and take care of it later.
There was a problem hiding this comment.
We need a proxy server to deal with the cors issue for web app. And I don't wanna have the proxy server just for this feature because someone have to pay for it. So I think this feature should be available just for desktop app users(And mobile app users one day)
Gogowitsch
left a comment
There was a problem hiding this comment.
I am new to this repository. I find it surprising that there is no test coverage in this PR, as having multi-target source code is the holy grail of programming. As an outsider I suggest to stop developing features until adding tests for each new feature is straightforward.
| ch: endCursor.ch + 1, | ||
| } | ||
| ) | ||
| return prevChar === '](' && nextChar === ')' |
There was a problem hiding this comment.
Maybe change variable name to prevChars, as it holds 2 characters?
There was a problem hiding this comment.
I agree. I'll change prevChar to prevChars.
| return true | ||
| } | ||
| return false | ||
| } No newline at end of file |
There was a problem hiding this comment.
Maybe add a new line at the end of the file? This makes some code viewing/editing experiences easier.
| res.headers.append('content-type', 'text/javascript') | ||
| expect(isImageResponse(res)).toBeFalsy() | ||
| }) | ||
| }) No newline at end of file |
There was a problem hiding this comment.
Maybe add a new line at the end of the file? This makes some code viewing/editing experiences easier.
| 'preferences.editorKeymap': 'Funções das teclas', | ||
| 'preferences.editorPreview': 'Pré visualização', | ||
| 'preferences.enableAutoFetchWebPageTitle': | ||
| 'Trazer o título da página da Web ao colar a URL no editor', |
There was a problem hiding this comment.
| 'Trazer o título da página da Web ao colar a URL no editor', | |
| 'Trazer o título da página da Web ao colar uma URL no editor', |
Rokt33r
left a comment
There was a problem hiding this comment.
Electron also throws the CORS error too. We should make the http request from nodejs.
|
@fonata , thank you for your advice and code review!
I fixed this problem by fetching url on the nodejs side (main process). Reasons:
Based on @Fonata 's opinion, we should implement this function for single platform first, and if implementing multi-platform features is simpler in the future, we can expand target platform according to people's needs. |
| "appId": "com.boostio.boostnote", | ||
| "artifactName": "boost-note-${os}.${ext}", | ||
| "copyright": "Copyright © 2016-2017 BoostIO", | ||
| "copyright": "Copyright 息 2016-2017 BoostIO", |
There was a problem hiding this comment.
That's strange, can you change the new character back to the old © symbol?
There was a problem hiding this comment.
Maybe this is also just a good point to update the 2017 to 2020?
There was a problem hiding this comment.
It might have been mixed in when I temporarily worked on Windows...I'll fix it.
Maybe this is also just a good point to update the 2017 to 2020?
It sounds good to me, but I don't know if it's okay to deal with it here.
@ZeroX-DG , how do you think?
There was a problem hiding this comment.
Yea, I think it will be alright:) it's just updating the year, it's not gonna break anything I think:)
| if (ipcRenderer !== null) { | ||
| ipcRenderer.on('fetch-page-title-response', async (_, fetchResult: FetchResult) => { | ||
| let replacement = info.pastedText | ||
| if (!isImageResponse(fetchResult.contentType)) { |
There was a problem hiding this comment.
Instead of checking if the response is a image response. Why don't we check for text/html content type only? This will cover other cases for other files such as video and audio.
There was a problem hiding this comment.
I think you're right. I'll change it to check if contentType is simply 'text/html'.
and delete unnecessary function
6a9adf4 to
21bc392
Compare
|
This will be reworked on Nov 11th |

related issue: #410
Description
Added auto fetching web page title when url pasted.
I referred to the old BoostNote source code.
Screenshot
Setting

Behavior
