Compare commits
8 Commits
52353ec1fb
...
#27-rss-fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfb2765f39 | ||
|
|
33680209ba | ||
|
|
f70ea4229a | ||
|
|
acadc9faee | ||
|
|
f725ec88f9 | ||
|
|
8d34b93527 | ||
|
|
918cfe06e4 | ||
|
|
e2f276e65b |
@@ -7,6 +7,10 @@ on:
|
|||||||
# schedule:
|
# schedule:
|
||||||
# - cron: '0 0 * * 1' # Every Monday at midnight (UTC)
|
# - cron: '0 0 * * 1' # Every Monday at midnight (UTC)
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_ENV: development
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-wiki:
|
update-wiki:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -31,6 +35,11 @@ jobs:
|
|||||||
repository: logan/drb-server.wiki # Replace with your wiki repository
|
repository: logan/drb-server.wiki # Replace with your wiki repository
|
||||||
path: wiki
|
path: wiki
|
||||||
|
|
||||||
|
- name: Output Generated Documentation
|
||||||
|
run: |
|
||||||
|
cat Home.md
|
||||||
|
ls
|
||||||
|
|
||||||
- name: Update wiki
|
- name: Update wiki
|
||||||
run: |
|
run: |
|
||||||
cp -rf Home.md wiki/Home.md
|
cp -rf Home.md wiki/Home.md
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"source": {
|
"source": {
|
||||||
"includePattern": ".+\\.([mc]?js(doc|x)?)$"
|
"includePattern": ".+([mc]?js(doc|x)?)$"
|
||||||
|
},
|
||||||
|
"plugins": ["node_modules/jsdoc-babel"],
|
||||||
|
"babel": {
|
||||||
|
"presets": [ "es2015" ],
|
||||||
|
"plugins": [ "transform-async-to-generator" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1327
package-lock.json
generated
1327
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docs": "jsdoc2md -c jsdoc.conf src/**/*.mjs >> Home.md",
|
"docs": "jsdoc2md -c jsdoc.conf src/*js > Home.md",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint --fix .",
|
"lint:fix": "eslint --fix .",
|
||||||
"test": "mocha --timeout 5000",
|
"test": "mocha --timeout 5000",
|
||||||
@@ -14,11 +14,14 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-plugin-transform-async-to-generator": "^6.24.1",
|
||||||
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"chai": "^5.1.1",
|
"chai": "^5.1.1",
|
||||||
"eslint": "^9.9.0",
|
"eslint": "^9.9.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-unused-imports": "^4.1.3",
|
"eslint-plugin-unused-imports": "^4.1.3",
|
||||||
|
"jsdoc-babel": "^0.5.0",
|
||||||
"jsdoc-to-markdown": "^8.0.3",
|
"jsdoc-to-markdown": "^8.0.3",
|
||||||
"mocha": "^10.4.0",
|
"mocha": "^10.4.0",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
|
|||||||
@@ -71,6 +71,22 @@ export const updateFeedByLink = async (link, updatedFields) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Wrapper for deactivating a feed by link
|
||||||
|
export const deactivateFeedByLink = async (link) => {
|
||||||
|
try {
|
||||||
|
const updatedCount = await updateDocumentByField(
|
||||||
|
feedCollectionName,
|
||||||
|
"link",
|
||||||
|
link,
|
||||||
|
[{'active':false}]
|
||||||
|
);
|
||||||
|
return updatedCount;
|
||||||
|
} catch (error) {
|
||||||
|
log.ERROR("Error deleting feed by link:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Wrapper for deleting a feed by link
|
// Wrapper for deleting a feed by link
|
||||||
export const deleteFeedByLink = async (link) => {
|
export const deleteFeedByLink = async (link) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ export const updateFeeds = async (client) => {
|
|||||||
|
|
||||||
const sourcePromiseArray = records.map(async (source) => {
|
const sourcePromiseArray = records.map(async (source) => {
|
||||||
log.DEBUG("Processing source:", source.title);
|
log.DEBUG("Processing source:", source.title);
|
||||||
|
// Check if the feed is active
|
||||||
|
if (!source.active) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsedFeed = await parser.parseURL(source.link);
|
const parsedFeed = await parser.parseURL(source.link);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const log = new DebugBuilder("server", "sourceManager");
|
|||||||
import {
|
import {
|
||||||
createFeed,
|
createFeed,
|
||||||
getFeedByLink,
|
getFeedByLink,
|
||||||
deleteFeedByLink,
|
deactivateFeedByLink,
|
||||||
} from "../modules/mongo-wrappers/mongoFeedsWrappers.mjs";
|
} from "../modules/mongo-wrappers/mongoFeedsWrappers.mjs";
|
||||||
|
|
||||||
class SourceManager {
|
class SourceManager {
|
||||||
@@ -48,7 +48,7 @@ class SourceManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = await deleteFeedByLink(sourceURL);
|
const results = await deactivateFeedByLink(sourceURL);
|
||||||
if (!results) {
|
if (!results) {
|
||||||
log.WARN(`Failed to remove source: ${sourceURL}`);
|
log.WARN(`Failed to remove source: ${sourceURL}`);
|
||||||
return;
|
return;
|
||||||
@@ -70,6 +70,7 @@ class SourceManager {
|
|||||||
category,
|
category,
|
||||||
guild_id: guildId,
|
guild_id: guildId,
|
||||||
channel_id: channelId,
|
channel_id: channelId,
|
||||||
|
active: true
|
||||||
};
|
};
|
||||||
const record = await createFeed(feed);
|
const record = await createFeed(feed);
|
||||||
log.DEBUG("Source added:", record);
|
log.DEBUG("Source added:", record);
|
||||||
|
|||||||
Reference in New Issue
Block a user