Skip to content

Commit

Permalink
Merge pull request #18 from BumpyClock/0.0.8.7
Browse files Browse the repository at this point in the history
Update manifest.json and removed  getting readerview from the server to prevent server getting blacklisted for scraping in modal.js
  • Loading branch information
BumpyClock authored Jan 28, 2024
2 parents cd6a3b4 + 0b28cc6 commit 28f6e1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Calm New Tab Page",

"version": "0.0.8.5",
"version": "0.0.8.7",

"description": "A Clean New Tab Page with a focus on privacy, simplicity and customizability.",
"action": {
Expand Down
22 changes: 1 addition & 21 deletions src/scripts/modal.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
async function showReaderView(url) {
let article = {};
try {
const response = await fetch(`${await getApiUrl()}/getreaderview`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ urls: [url] })
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();
if (data[0].status === "ok") {
article.content = data[0].content;
article.title = data[0].title;
article.textContent = data[0].textContent;
} else {
const response = await fetch(url, {
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
Expand All @@ -38,8 +19,7 @@ async function showReaderView(url) {
const doc = parser.parseFromString(pure, "text/html");
const reader = new Readability(doc);
article = reader.parse();
}
const item = findItemFromUrl(getFeedItems(), url);
const item = findItemFromUrl(getFeedItems(), url);

if (article) {
const readerViewModal = createReaderViewModal(article);
Expand Down

0 comments on commit 28f6e1a

Please sign in to comment.