Skip to content

Commit

Permalink
small fixes for server
Browse files Browse the repository at this point in the history
  • Loading branch information
pietheinstrengholt committed Jul 12, 2024
1 parent 70ce037 commit c8bfaff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions client/src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export default {
//get content if the container is not empty
if (this.container.length > 0) {
this.getContent();
} else {
this.hasLoaded = true;
}
});
},
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Article from "../models/article.js";
import autodiscover from "../util/autodiscover.js";
import parseFeed from "../util/parser.js";
import language from "../util/language.js";
import cheerio from "cheerio";
import { load } from 'cheerio'
import * as htmlparser2 from "htmlparser2";
import cache from '../util/cache.js';
import striptags from "striptags";
Expand Down Expand Up @@ -119,7 +119,7 @@ const processArticle = async (feed, post) => {

//htmlparser2 has error-correcting mechanisms, which may be useful when parsing non-HTML content.
const dom = htmlparser2.parseDocument(post.description);
const $ = cheerio.load(dom, { _useHtmlParser2: true });
const $ = load(dom, { _useHtmlParser2: true });

//dismiss undefined errors
if (typeof $ !== 'undefined') {
Expand Down
5 changes: 3 additions & 2 deletions server/controllers/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,17 @@ export const feedChangeCategory = async (req, res, next) => {
const feedId = req.body.feedId;
const categoryId = req.body.categoryId;

if (feedId === undefined || feedId === categoryId) {
if (feedId === undefined || categoryId === undefined) {
return res.status(404).json({
message: "feedId or categoryId is not set"
});
}

try {
const feed = await Feed.findByPk(feedId);
const category = await Category.findByPk(categoryId);

if (feed) {
if (feed && category) {
feed
.update({
categoryId: req.body.categoryId
Expand Down

0 comments on commit c8bfaff

Please sign in to comment.