Skip to content

Commit

Permalink
add refresh button to Mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
pietheinstrengholt committed Jul 15, 2024
1 parent 5b66ecc commit 12fcaad
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
10 changes: 7 additions & 3 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="row">
<div id="sidebar" class="col-md-3 col-sm-0">
<!-- Sidebar events -->
<app-sidebar @modal="modalClick" @forceReload="forceReload"></app-sidebar>
<app-sidebar ref="sidebar" @modal="modalClick" @forceReload="forceReload"></app-sidebar>
</div>
<div id="home" class="col-md-9 offset-md-3 col-sm-12">
<!-- Quickbar events -->
Expand All @@ -18,7 +18,7 @@
<!-- Modal events -->
<app-modal @modal="modalClick" :modal="modal" :input-category="category" :input-feed="feed"></app-modal>
<!-- Mobile events -->
<app-mobile :mobile="mobile" @mobile="mobileClick" @modal="modalClick"></app-mobile>
<app-mobile :mobile="mobile" @mobile="mobileClick" @modal="modalClick" @refresh="refreshFeeds"></app-mobile>
</div>
</template>

Expand Down Expand Up @@ -322,7 +322,11 @@ export default {
this.getOverview(true);
//invoke ref home child component function to reload content
this.$refs.home.fetchArticleIds(this.store.currentSelection);
}
},
refreshFeeds() {
//call sidebar refreshFeeds function
this.$refs.sidebar.refreshFeeds();
},
},
//watch the store.currentSelection, set local data (category, feed) based on current selection
watch: {
Expand Down
7 changes: 7 additions & 0 deletions client/src/components/Mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<button @click="store.filter = 'full'" type="button" class="btn btn-primary content">Full content</button>
<button @click="store.filter = 'minimal'" type="button" class="btn btn-primary content">Minimal content</button>

<p class="content-header">Refresh feeds</p>
<button @click="refreshFeeds()" type="button" class="btn btn-danger">Refresh feeds</button>
<br>

<p class="content-header">Click the button below to add a new feed</p>
<button @click="showNewFeed()" type="button" class="btn btn-primary">Add new feed</button>
<br>
Expand Down Expand Up @@ -164,6 +168,9 @@ export default {
this.emitClickEvent("mobile", null);
this.$emit("modal", "newfeed");
},
refreshFeeds() {
this.$emit('refresh');
},
subscribeNotifications() {
//register service worker
Notification.requestPermission().then(function(permission) {
Expand Down
9 changes: 2 additions & 7 deletions server/controllers/crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Sequelize from 'sequelize';
import Feed from "../models/feed.js";
import Article from "../models/article.js";

import autodiscover from "../util/autodiscover.js";
import discoverRssLink from "../util/discoverRssLink.js";
import parseFeed from "../util/parser.js";
import language from "../util/language.js";
import { load } from 'cheerio';
Expand Down Expand Up @@ -53,7 +53,7 @@ const crawlRssLinks = catchAsync(async (req, res, next) => {
feeds.forEach(async function(feed) {

//discover RssLink
const url = await autodiscover.discoverRssLink(feed.url);
const url = await discoverRssLink.discoverRssLink(feed.url);

//do not process undefined URLs
if (typeof url !== "undefined") {
Expand All @@ -62,15 +62,10 @@ const crawlRssLinks = catchAsync(async (req, res, next) => {
const feeditem = await parseFeed.process(url);
if (feeditem) {

var articleCount = 0;

//process all feed posts
feeditem.posts.forEach(function(post) {
processArticle(feed, post);
articleCount++;
});

console.log("Discovered " + articleCount + " articles for feed: " + url)

//reset the feed count
feed.update({
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/feed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Feed from "../models/feed.js";
import Article from "../models/article.js";

import autodiscover from "../util/autodiscover.js";
import discoverRssLink from "../util/discoverRssLink.js";
import parseFeed from "../util/parser.js";

const getFeeds = async (req, res, next) => {
Expand Down Expand Up @@ -106,7 +106,7 @@ const deleteFeed = async (req, res, next) => {
const validateFeed = async (req, res, next) => {

//resolve url
const url = await autodiscover.discoverRssLink(req.body.url);
const url = await discoverRssLink.discoverRssLink(req.body.url);
const categoryId = req.body.categoryId;

if (typeof url === "undefined") {
Expand Down
File renamed without changes.

0 comments on commit 12fcaad

Please sign in to comment.