For URLs that will be forced to backend fetch dont send full content from the extension
This is useful with YouTube, which has massive page sizes.
This commit is contained in:
@ -321,7 +321,12 @@ async function saveArticle (tab) {
|
||||
}
|
||||
|
||||
const requestId = uuidv4()
|
||||
const { type, pageInfo, doc, uploadContentObjUrl } = response;
|
||||
var { type } = response;
|
||||
const { pageInfo, doc, uploadContentObjUrl } = response;
|
||||
|
||||
if (type == 'html' && handleBackendUrl(tab.url)) {
|
||||
type = 'url'
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case 'html': {
|
||||
|
||||
@ -98,3 +98,17 @@ window.CREATE_ARTICLE_SAVING_REQUEST_QUERY = `mutation CreateArticleSavingReques
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
function handleBackendUrl(url) {
|
||||
try {
|
||||
const FORCE_CONTENT_FETCH_URLS = [
|
||||
// twitter status url regex
|
||||
/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+)(?:\/.*)?/,
|
||||
/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,
|
||||
]
|
||||
return FORCE_CONTENT_FETCH_URLS.some((regex) => regex.test(url))
|
||||
} catch (error) {
|
||||
console.log('error checking url', url)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@ -187,6 +187,13 @@
|
||||
if (pdfContent) {
|
||||
return pdfContent
|
||||
}
|
||||
try {
|
||||
if (handleBackendUrl(window.location.href)) {
|
||||
return { type: 'url' }
|
||||
}
|
||||
} catch {
|
||||
console.log('error checking url')
|
||||
}
|
||||
|
||||
async function scrollPage () {
|
||||
const scrollingEl = (document.scrollingElement || document.body);
|
||||
|
||||
Reference in New Issue
Block a user