summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/chromebot.ini10
-rw-r--r--contrib/chromebot.json16
-rw-r--r--contrib/dashboard.html5
-rw-r--r--contrib/dashboard.js36
4 files changed, 38 insertions, 29 deletions
diff --git a/contrib/chromebot.ini b/contrib/chromebot.ini
deleted file mode 100644
index a302356..0000000
--- a/contrib/chromebot.ini
+++ /dev/null
@@ -1,10 +0,0 @@
-[irc]
-host = irc.example.com
-port = 6667
-ssl = False
-tempdir = /path/to/warc
-destdir = /path/to/tmp
-nick = chromebot
-channel = #testchannel
-process_limit = 1
-
diff --git a/contrib/chromebot.json b/contrib/chromebot.json
new file mode 100644
index 0000000..214b770
--- /dev/null
+++ b/contrib/chromebot.json
@@ -0,0 +1,16 @@
+{
+ "irc": {
+ "host": "irc.example.com",
+ "port": 6667,
+ "ssl": false,
+ "nick": "chromebot",
+ "channels": ["#testchannel"]
+ },
+ "tempdir": "/path/to/tmp",
+ "destdir": "/path/to/warc",
+ "process_limit": 1
+ "blacklist": {
+ "^https?://(.+\\.)?local(host)?/": "Not acceptable"
+ },
+ "need_voice": false
+}
diff --git a/contrib/dashboard.html b/contrib/dashboard.html
index cc09d50..49a15bc 100644
--- a/contrib/dashboard.html
+++ b/contrib/dashboard.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>chromebot dashboard</title>
- <!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
+ <!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.7/css/bulma.min.css">
<link rel="stylesheet" href="dashboard.css">
@@ -13,8 +13,9 @@
<noscript>Please enable JavaScript.</noscript>
<section id="app" class="section">
<h1 class="title">chromebot dashboard</h1>
+ <bot-status v-bind:jobs="jobs"></bot-status>
<div class="jobs">
- <job-item v-for="j in jobs" v-bind:job="j" v-bind:jobs="jobs" v-bind:ignored="ignored" v-bind:key="j.id"></job-item>
+ <job-item v-for="j in jobs" v-bind:job="j" v-bind:jobs="jobs" v-bind:key="j.id"></job-item>
</div>
</section>
<script src="dashboard.js"></script>
diff --git a/contrib/dashboard.js b/contrib/dashboard.js
index eb34d43..b5520dc 100644
--- a/contrib/dashboard.js
+++ b/contrib/dashboard.js
@@ -1,5 +1,5 @@
/* configuration */
-let socket = "ws://localhost:6789/",
+let socket = "wss://localhost:6789/",
urllogMax = 100;
function formatSize (bytes) {
@@ -35,19 +35,12 @@ class Job {
}
let jobs = {};
-/* list of ignored job ids, i.e. those the user deleted from the dashboard */
-let ignored = [];
let ws = new WebSocket(socket);
ws.onmessage = function (event) {
var msg = JSON.parse (event.data);
let msgdate = new Date (Date.parse (msg.date));
var j = undefined;
- console.log (msg);
if (msg.job) {
- if (ignored.includes (msg.job)) {
- console.log ("job ignored", msg.job);
- return;
- }
j = jobs[msg.job];
if (j === undefined) {
j = new Job (msg.job, 'unknown', '<unknown>', new Date ());
@@ -79,7 +72,7 @@ ws.onmessage = function (event) {
} else if (rmsg.uuid == '5b8498e4-868d-413c-a67e-004516b8452c') {
/* recursion status */
Object.assign (j.stats, rmsg);
- } else if (rmsg.uuid == '1680f384-744c-4b8a-815b-7346e632e8db') {
+ } else if (rmsg.uuid == 'd1288fbe-8bae-42c8-af8c-f2fa8b41794f') {
/* fetch */
j.addUrl (rmsg.url);
}
@@ -91,14 +84,8 @@ ws.onerror = function (event) {
};
Vue.component('job-item', {
- props: ['job', 'jobs', 'ignored'],
- template: '<div class="job box" :id="job.id"><ul class="columns"><li class="jid column is-narrow"><a :href="\'#\' + job.id">{{ job.id }}</a></li><li class="url column"><a :href="job.url">{{ job.url }}</a></li><li class="status column is-narrow"><job-status v-bind:job="job"></job-status></li><li class="column is-narrow"><a class="delete" v-on:click="del(job.id)"></a></li></ul><job-stats v-bind:job="job"></job-stats></div>',
- methods: {
- del: function (id) {
- Vue.delete(this.jobs, id);
- this.ignored.push (id);
- }
- }
+ props: ['job', 'jobs'],
+ template: '<div class="job box" :id="job.id"><ul class="columns"><li class="jid column is-narrow"><a :href="\'#\' + job.id">{{ job.id }}</a></li><li class="url column"><a :href="job.url">{{ job.url }}</a></li><li class="status column is-narrow"><job-status v-bind:job="job"></job-status></li></ul><job-stats v-bind:job="job"></job-stats></div>',
});
Vue.component('job-status', {
props: ['job'],
@@ -117,6 +104,21 @@ Vue.component('filesize', {
template: '<span class="filesize">{{ fvalue }}</span>',
computed: { fvalue: function () { return formatSize (this.value); } }
});
+Vue.component('bot-status', {
+ props: ['jobs'],
+ template: '<nav class="level"><div class="level-item has-text-centered"><div><p class="heading">Pending</p><p class="title">{{ stats.pending }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Running</p><p class="title">{{ stats.running }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Finished</p><p class="title">{{ stats.finished+stats.aborted }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Transferred</p><p class="title"><filesize v-bind:value="stats.totalBytes"></filesize></p></div></div></nav>',
+ computed: {
+ stats: function () {
+ let s = {pending: 0, running: 0, finished: 0, aborted: 0, totalBytes: 0};
+ for (let k in this.jobs) {
+ let j = this.jobs[k];
+ s[j.status]++;
+ s.totalBytes += j.stats.bytesRcv;
+ }
+ return s;
+ }
+ }
+});
let app = new Vue({
el: '#app',