Skip to content

Commit

Permalink
Fix notifications and save development docker image data
Browse files Browse the repository at this point in the history
  • Loading branch information
Joedmin committed Aug 5, 2024
1 parent fcaae0e commit a15cf71
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
fresh_rss_data/
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
options:
max-size: 10m
volumes:
- ./fresh_rss_data:/var/www/FreshRSS/data
- ./:/var/www/FreshRSS/extensions/freshrss-readeck-button
ports:
- 8080:80
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Readeck Button",
"author": "Joedmin",
"description": "Add articles to Readeck with one simple button click or a keyboard shortcut.",
"version": 0.2,
"version": 0.3,
"entrypoint": "ReadeckButton",
"type": "user"
}
}
33 changes: 15 additions & 18 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function documentReady()
for (var i = 0; i < readeckButtons.length; i++)
{
let readeckButton = readeckButtons[i];
readeckButton.addEventListener('click', function (e)
readeckButton.addEventListener('click', async function (e)
{
if (!readeckButton)
{
Expand All @@ -28,7 +28,7 @@ async function documentReady()
e.preventDefault();
e.stopPropagation();

add_to_readeck(readeckButton, active);
await add_to_readeck(readeckButton, active);
}, false);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ async function add_to_readeck(readeckButton, active)
_csrf: context.csrf,
})
})
.then(response =>
.then(async response =>
{
delete pending_entries[activeId];

Expand All @@ -113,30 +113,27 @@ async function add_to_readeck(readeckButton, active)

if (!response.ok)
{
if (response.status === 404)
{
openNotification(readeck_button_vars.i18n.article_not_found, 'readeck_button_bad');
}
requestFailed(activeId, readeckButtonImg, loadingAnimation);
return;
}

let json = response.json();
let json = await response.json();
if (!json)
{
requestFailed(activeId, readeckButtonImg, loadingAnimation);
openNotification(readeck_button_vars.i18n.failed_to_add_article_to_readeck.replace('%s', json.errorCode), 'readeck_button_bad');
return;
}

if (response.status === 200)
{
readeckButtonImg.setAttribute("src", readeck_button_vars.icons.added_to_readeck);
openNotification(readeck_button_vars.i18n.added_article_to_readeck.replace('%s', response.response.title), 'readeck_button_good');
return;
}

if (response.status === 404)
{
openNotification(readeck_button_vars.i18n.article_not_found, 'readeck_button_bad');
return;
}
openNotification(readeck_button_vars.i18n.failed_to_add_article_to_readeck.replace('%s', response.errorCode), 'readeck_button_bad');
readeckButtonImg.setAttribute("src", readeck_button_vars.icons.added_to_readeck);
openNotification(readeck_button_vars.i18n.added_article_to_readeck.replace('%s', json.response.title), 'readeck_button_good');
})
.catch(() => requestFailed(activeId, readeckButtonImg, loadingAnimation));
.catch((e) =>
{
requestFailed(activeId, readeckButtonImg, loadingAnimation);
});
}

0 comments on commit a15cf71

Please sign in to comment.