Compare commits
2 Commits
f61f67a37c
...
883f701359
Author | SHA1 | Date |
---|---|---|
ThePendulum | 883f701359 | |
ThePendulum | 88266e5b03 |
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "kanbanmod",
|
"name": "kanbanmod",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "kanbanmod",
|
"name": "kanbanmod",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "kanbanmod",
|
"name": "kanbanmod",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
10
src/app.js
10
src/app.js
|
@ -6,6 +6,10 @@ const bhttp = require('bhttp');
|
||||||
|
|
||||||
const reddit = new snoowrap(config.reddit);
|
const reddit = new snoowrap(config.reddit);
|
||||||
|
|
||||||
|
function log(msg) {
|
||||||
|
console.log(`${new Date().toISOString()} ${msg}`);
|
||||||
|
}
|
||||||
|
|
||||||
async function getWekanActorNames() {
|
async function getWekanActorNames() {
|
||||||
const wekanLoginRes = await bhttp.post(`${config.wekan.url}/users/login`, {
|
const wekanLoginRes = await bhttp.post(`${config.wekan.url}/users/login`, {
|
||||||
username: config.wekan.username,
|
username: config.wekan.username,
|
||||||
|
@ -37,6 +41,8 @@ async function getWekanActorNames() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
log(`Retrieving current configuration from ${config.subreddit}`);
|
||||||
|
|
||||||
const automodConfig = await reddit.getSubreddit(config.subreddit).getWikiPage('config/automoderator').fetch();
|
const automodConfig = await reddit.getSubreddit(config.subreddit).getWikiPage('config/automoderator').fetch();
|
||||||
const automodLines = automodConfig.content_md.split('\n');
|
const automodLines = automodConfig.content_md.split('\n');
|
||||||
const actorLineIndex = automodLines.findIndex((line) => line.includes(config.actorCommentKey)) + 1;
|
const actorLineIndex = automodLines.findIndex((line) => line.includes(config.actorCommentKey)) + 1;
|
||||||
|
@ -55,14 +61,14 @@ async function init() {
|
||||||
reason: 'Synced kanban actor names',
|
reason: 'Synced kanban actor names',
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`${new Date().toISOString()} Sync complete, resyncing in ${config.interval} minutes, set ${newActorLine}`);
|
log(`Sync complete, resyncing in ${config.interval} minutes, set ${newActorLine}`);
|
||||||
|
|
||||||
setTimeout(() => init(), config.interval * 60 * 1000);
|
setTimeout(() => init(), config.interval * 60 * 1000);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`${new Date().toISOString()} Sync complete, set ${newActorLine}`);
|
log(`Sync complete, set ${newActorLine}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
Loading…
Reference in New Issue