copious-mail 0.0.0-stage → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +504 -0
- package/README.md +143 -2
- package/bin/index.js +345 -0
- package/client/copiousLogo.svg +123 -0
- package/client/hosted.html +5259 -0
- package/client/mail_styles.css +40 -0
- package/client/mikado.bundle.debug.js +1406 -0
- package/client/mikado.bundle.min.js +68 -0
- package/client/mikado.bundle.module.debug.js +1401 -0
- package/client/mikado.bundle.module.min.js +67 -0
- package/client/mikado.bundle.profiler.debug.js +1490 -0
- package/client/mikado.es5.debug.js +1995 -0
- package/client/mikado.es5.min.js +85 -0
- package/client/mikado.light.debug.js +535 -0
- package/client/mikado.light.min.js +29 -0
- package/client/mikado.light.module.debug.js +530 -0
- package/data/user_list.db +14 -0
- package/index.html +7242 -0
- package/index.js +5 -0
- package/jsconfig.json +32 -0
- package/lib/mail_repo_bridge_ops.js +1177 -0
- package/lib/utils.js +70 -0
- package/lib/websocket_con.js +249 -0
- package/mail_bridge.conf +10 -0
- package/package.json +41 -5
- package/svelte-src/App.svelte +2513 -0
- package/svelte-src/ContactGrid.svelte +98 -0
- package/svelte-src/FloatWindow.svelte +181 -0
- package/svelte-src/MessageDisplay.svelte +230 -0
- package/svelte-src/MessageEditor.svelte +664 -0
- package/svelte-src/MessageListEditor.svelte +133 -0
- package/svelte-src/Thing.svelte +190 -0
- package/svelte-src/ThingFull.svelte +117 -0
- package/svelte-src/ipfs_profile_proxy.js +923 -0
- package/svelte-src/main.js +10 -0
- package/svelte-src/search_box.js +69 -0
- package/svelte-src/utilities.js +180 -0
- package/test/c +28 -0
- package/test/copiousLogo.svg +123 -0
- package/test/index.html +4408 -0
- package/test/index.js +244 -0
- package/test/mail_styles.css +40 -0
- package/test/mikado.bundle.debug.js +1406 -0
- package/test/mikado.bundle.min.js +68 -0
- package/test/mikado.bundle.module.debug.js +1401 -0
- package/test/mikado.bundle.module.min.js +67 -0
- package/test/mikado.bundle.profiler.debug.js +1490 -0
- package/test/mikado.es5.debug.js +1995 -0
- package/test/mikado.es5.min.js +85 -0
- package/test/mikado.light.debug.js +535 -0
- package/test/mikado.light.min.js +29 -0
- package/test/mikado.light.module.debug.js +530 -0
- package/test/tpl/partial/attachment_edit.es5.js +1 -0
- package/test/tpl/partial/attachment_edit.html +5 -0
- package/test/tpl/partial/attachment_edit.js +1 -0
- package/test/tpl/partial/attachment_view.es5.js +1 -0
- package/test/tpl/partial/attachment_view.html +1 -0
- package/test/tpl/partial/attachment_view.js +1 -0
- package/test/tpl/partial/contact_list.es5.js +1 -0
- package/test/tpl/partial/contact_list.html +9 -0
- package/test/tpl/partial/contact_list.js +1 -0
- package/test/tpl/partial/draft_list.es5.js +1 -0
- package/test/tpl/partial/draft_list.html +8 -0
- package/test/tpl/partial/draft_list.js +1 -0
- package/test/tpl/partial/inbox_list.es5.js +1 -0
- package/test/tpl/partial/inbox_list.html +7 -0
- package/test/tpl/partial/inbox_list.js +1 -0
- package/test/tpl/partial/notify_list.es5.js +1 -0
- package/test/tpl/partial/notify_list.html +8 -0
- package/test/tpl/partial/notify_list.js +1 -0
- package/test/tpl/partial/sent_list.es5.js +1 -0
- package/test/tpl/partial/sent_list.html +7 -0
- package/test/tpl/partial/sent_list.js +1 -0
- package/test/tpl/partial/spam_list.es5.js +1 -0
- package/test/tpl/partial/spam_list.html +8 -0
- package/test/tpl/partial/spam_list.js +1 -0
- package/test/tpl/partial/trash_list.es5.js +1 -0
- package/test/tpl/partial/trash_list.html +7 -0
- package/test/tpl/partial/trash_list.js +1 -0
- package/test/tpl/partial/user.es5.js +1 -0
- package/test/tpl/partial/user.html +18 -0
- package/test/tpl/partial/user.js +1 -0
- package/tools/jsdoc.conf +47 -0
- package/tools/templates/docdash/publish.js +843 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/tools/templates/docdash/static/scripts/collapse.js +67 -0
- package/tools/templates/docdash/static/scripts/commonNav.js +28 -0
- package/tools/templates/docdash/static/scripts/linenumber.js +25 -0
- package/tools/templates/docdash/static/scripts/nav.js +12 -0
- package/tools/templates/docdash/static/scripts/polyfill.js +4 -0
- package/tools/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/tools/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
- package/tools/templates/docdash/static/scripts/prettify/prettify.js +28 -0
- package/tools/templates/docdash/static/scripts/search.js +99 -0
- package/tools/templates/docdash/static/styles/jsdoc.css +803 -0
- package/tools/templates/docdash/static/styles/prettify.css +80 -0
- package/tools/templates/docdash/tmpl/augments.tmpl +10 -0
- package/tools/templates/docdash/tmpl/container.tmpl +203 -0
- package/tools/templates/docdash/tmpl/details.tmpl +152 -0
- package/tools/templates/docdash/tmpl/example.tmpl +2 -0
- package/tools/templates/docdash/tmpl/examples.tmpl +13 -0
- package/tools/templates/docdash/tmpl/exceptions.tmpl +32 -0
- package/tools/templates/docdash/tmpl/layout.tmpl +102 -0
- package/tools/templates/docdash/tmpl/mainpage.tmpl +15 -0
- package/tools/templates/docdash/tmpl/members.tmpl +38 -0
- package/tools/templates/docdash/tmpl/method.tmpl +132 -0
- package/tools/templates/docdash/tmpl/modifies.tmpl +14 -0
- package/tools/templates/docdash/tmpl/namespace.tmpl +133 -0
- package/tools/templates/docdash/tmpl/params.tmpl +132 -0
- package/tools/templates/docdash/tmpl/properties.tmpl +107 -0
- package/tools/templates/docdash/tmpl/returns.tmpl +19 -0
- package/tools/templates/docdash/tmpl/source.tmpl +8 -0
- package/tools/templates/docdash/tmpl/tutorial.tmpl +19 -0
- package/tools/templates/docdash/tmpl/type.tmpl +26 -0
- package/tools/templates/templates/docdash/publish.js +843 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/tools/templates/templates/docdash/static/scripts/collapse.js +67 -0
- package/tools/templates/templates/docdash/static/scripts/commonNav.js +28 -0
- package/tools/templates/templates/docdash/static/scripts/linenumber.js +25 -0
- package/tools/templates/templates/docdash/static/scripts/nav.js +12 -0
- package/tools/templates/templates/docdash/static/scripts/polyfill.js +4 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/prettify.js +28 -0
- package/tools/templates/templates/docdash/static/scripts/search.js +99 -0
- package/tools/templates/templates/docdash/static/styles/jsdoc.css +803 -0
- package/tools/templates/templates/docdash/static/styles/prettify.css +80 -0
- package/tools/templates/templates/docdash/tmpl/augments.tmpl +10 -0
- package/tools/templates/templates/docdash/tmpl/container.tmpl +203 -0
- package/tools/templates/templates/docdash/tmpl/details.tmpl +152 -0
- package/tools/templates/templates/docdash/tmpl/example.tmpl +2 -0
- package/tools/templates/templates/docdash/tmpl/examples.tmpl +13 -0
- package/tools/templates/templates/docdash/tmpl/exceptions.tmpl +32 -0
- package/tools/templates/templates/docdash/tmpl/layout.tmpl +102 -0
- package/tools/templates/templates/docdash/tmpl/mainpage.tmpl +15 -0
- package/tools/templates/templates/docdash/tmpl/members.tmpl +38 -0
- package/tools/templates/templates/docdash/tmpl/method.tmpl +132 -0
- package/tools/templates/templates/docdash/tmpl/modifies.tmpl +14 -0
- package/tools/templates/templates/docdash/tmpl/namespace.tmpl +133 -0
- package/tools/templates/templates/docdash/tmpl/params.tmpl +132 -0
- package/tools/templates/templates/docdash/tmpl/properties.tmpl +107 -0
- package/tools/templates/templates/docdash/tmpl/returns.tmpl +19 -0
- package/tools/templates/templates/docdash/tmpl/source.tmpl +8 -0
- package/tools/templates/templates/docdash/tmpl/tutorial.tmpl +19 -0
- package/tools/templates/templates/docdash/tmpl/type.tmpl +26 -0
- package/tpl/partial/user.es5.js +1 -0
- package/tpl/partial/user.html +10 -0
- package/tpl/partial/user.js +1 -0
package/lib/utils.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function remove_punct(s) {
|
|
5
|
+
let punctuationless = s.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"");
|
|
6
|
+
let finalString = punctuationless.replace(/\s{2,}/g," ");
|
|
7
|
+
return finalString
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
let name_to_url = (human_name) => {
|
|
12
|
+
human_name = human_name.toLowerCase()
|
|
13
|
+
human_name = remove_punct(human_name)
|
|
14
|
+
human_name = human_name.replace(/\s/g,'_')
|
|
15
|
+
human_name = encodeURIComponent(human_name)
|
|
16
|
+
return human_name
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports.to_url = name_to_url
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
module.exports.load_json_file = (src) => {
|
|
24
|
+
try {
|
|
25
|
+
let contents = JSON.parse(fs.readFileSync(src).toString())
|
|
26
|
+
return contents
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.log(e)
|
|
29
|
+
}
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
module.exports.unload_json_file = (dst,contents) => {
|
|
35
|
+
let contents_as_str = JSON.stringify(contents,null,2)
|
|
36
|
+
try {
|
|
37
|
+
fs.writeFileSync(dst,contents_as_str)
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.log(e)
|
|
40
|
+
}
|
|
41
|
+
return undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
module.exports.check_existence = async (human_name,config_otput) => {
|
|
46
|
+
try {
|
|
47
|
+
let namer = name_to_url(human_name)
|
|
48
|
+
await fsPromise.access(`${config_output}/${namer}.html`,fsPromise.constants.R_OK)
|
|
49
|
+
return false
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
module.exports.gen_id = () => {
|
|
59
|
+
let rr = Math.random()
|
|
60
|
+
rr = Math.trunc(rr*10000)
|
|
61
|
+
rr = `${rr}`
|
|
62
|
+
while ( rr.length < 4 ) {
|
|
63
|
+
rr = '0' + rr
|
|
64
|
+
}
|
|
65
|
+
let tt = Date.now()
|
|
66
|
+
let ss = `${tt}${rr}`
|
|
67
|
+
|
|
68
|
+
return ss.substring(4)
|
|
69
|
+
}
|
|
70
|
+
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
|
|
2
|
+
const WSS_PING_INTERVAL = 10000
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const {gen_id} = require('../lib/utils')
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class WebSocketActions {
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
this.going_sessions = {}
|
|
12
|
+
//
|
|
13
|
+
this.checking_pings = false
|
|
14
|
+
this.supects = {} // suspect that the connection might not be alive, so we ping it
|
|
15
|
+
//
|
|
16
|
+
this.app_wss = false
|
|
17
|
+
this.message_handler = false
|
|
18
|
+
this.trans_processor = false
|
|
19
|
+
this.user_processor = false
|
|
20
|
+
this.ws_client_attempt_timeout = null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// ------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
set_socket_server(app_wss,handler) {
|
|
27
|
+
//
|
|
28
|
+
this.app_wss = app_wss
|
|
29
|
+
this.message_handler = handler
|
|
30
|
+
|
|
31
|
+
console.log("setting applicaiton server web sockets")
|
|
32
|
+
|
|
33
|
+
this.app_wss.on("connection", (ws,req) => {
|
|
34
|
+
console.log("connections ws...")
|
|
35
|
+
this.setup_app_ws(ws)
|
|
36
|
+
});
|
|
37
|
+
//
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// ------------------------------------------------------------
|
|
42
|
+
// APPLICATION WS (COM EXCHAGE)
|
|
43
|
+
// ------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// send_to_ws -- websocket wrapper
|
|
47
|
+
send_to_ws(ws,data) {
|
|
48
|
+
if ( ws ) {
|
|
49
|
+
try {
|
|
50
|
+
let message = JSON.stringify(data)
|
|
51
|
+
ws.send(message);
|
|
52
|
+
} catch (e) {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// setup_app_ws
|
|
57
|
+
setup_app_ws(ws) { // ws is the new connection, app_wss is the server
|
|
58
|
+
|
|
59
|
+
if ( !this.app_wss ) return
|
|
60
|
+
//
|
|
61
|
+
this.add_ws_session(ws)
|
|
62
|
+
|
|
63
|
+
ws.on("message", async (data) => {
|
|
64
|
+
try {
|
|
65
|
+
let body = JSON.parse(data.toString());
|
|
66
|
+
//
|
|
67
|
+
let server_id = body.message ? body.message.server_id : false
|
|
68
|
+
if ( server_id && this.message_handler ) { // transitional
|
|
69
|
+
this.message_handler(ws,body.message)
|
|
70
|
+
} else {
|
|
71
|
+
let ping_id = body.ping_id
|
|
72
|
+
if ( ping_id ) {
|
|
73
|
+
this.ponged(ws)
|
|
74
|
+
this.send_to_ws(ws,body.message)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
ws.on("close", () => {
|
|
81
|
+
this.close_wss_session(ws)
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// add_ws_session
|
|
87
|
+
//
|
|
88
|
+
add_ws_session(ws) {
|
|
89
|
+
ws._app_x_isAlive = true;
|
|
90
|
+
let ws_id = gen_id() // make up an id...
|
|
91
|
+
this.going_sessions[ws_id] = ws
|
|
92
|
+
ws._app_x_ws_id = ws_id
|
|
93
|
+
this.send_ws(ws_id,{ "status" : "connected", "type" : "ws_id" })
|
|
94
|
+
//
|
|
95
|
+
if ( !(this.checking_pings) ) {
|
|
96
|
+
this.start_checking_pings()
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ping
|
|
101
|
+
//
|
|
102
|
+
ping(ws) { // send a message to a client to see if it is up
|
|
103
|
+
ws._app_x_isAlive = false;
|
|
104
|
+
let data = {
|
|
105
|
+
"data" : { "type" : "ping", "ping_id" : ws._app_x_ws_id },
|
|
106
|
+
"time" : Date.now(),
|
|
107
|
+
}
|
|
108
|
+
ws.send(JSON.stringify(data));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ponged
|
|
112
|
+
//
|
|
113
|
+
ponged(ws) {
|
|
114
|
+
ws._app_x_isAlive = true;
|
|
115
|
+
if ( this.supects[ws._app_x_ws_id] ) {
|
|
116
|
+
delete this.supects[ws._app_x_ws_id]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// close_wss_session
|
|
121
|
+
//
|
|
122
|
+
close_wss_session(ws) {
|
|
123
|
+
let result = false
|
|
124
|
+
if ( ws ) {
|
|
125
|
+
let ws_id = ws._app_x_ws_id
|
|
126
|
+
try {
|
|
127
|
+
result = ws.close()
|
|
128
|
+
} catch (e) {
|
|
129
|
+
}
|
|
130
|
+
if ( ws_id && this.going_sessions[ws_id]) delete this.going_sessions[ws_id]
|
|
131
|
+
}
|
|
132
|
+
return result
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// send_ws
|
|
136
|
+
//
|
|
137
|
+
send_ws(ws_id,data) {
|
|
138
|
+
let ws = this.going_sessions[ws_id]
|
|
139
|
+
if ( ws ) {
|
|
140
|
+
let message = {
|
|
141
|
+
"ws_id" : ws_id,
|
|
142
|
+
"data" : data
|
|
143
|
+
}
|
|
144
|
+
this.send_to_ws(ws,message)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
send_ws_extract_id(ws,data) {
|
|
149
|
+
let ws_id = ws._app_x_ws_id
|
|
150
|
+
if ( this.going_sessions[ws_id] !== undefined ) {
|
|
151
|
+
let message = {
|
|
152
|
+
"ws_id" : ws_id,
|
|
153
|
+
"data" : data
|
|
154
|
+
}
|
|
155
|
+
this.send_to_ws(ws,message)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
send_to_going_sessions(data) {
|
|
160
|
+
if ( Object.keys(this.going_sessions).length ) {
|
|
161
|
+
for ( let ws_id in this.going_sessions ) {
|
|
162
|
+
this.send_ws(ws_id,data)
|
|
163
|
+
}
|
|
164
|
+
return true
|
|
165
|
+
}
|
|
166
|
+
return false
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// do_pings
|
|
170
|
+
//
|
|
171
|
+
do_pings(caller) {
|
|
172
|
+
for ( let key in this.going_sessions ) {
|
|
173
|
+
let ws = this.going_sessions[key]
|
|
174
|
+
if ( !(ws._app_x_isAlive) ) {
|
|
175
|
+
this.supects[ws._app_x_ws_id] = ws
|
|
176
|
+
} else {
|
|
177
|
+
this.ping(ws)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
setTimeout(() => { caller.do_pings(caller) },WSS_PING_INTERVAL)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// close_suspects
|
|
184
|
+
//
|
|
185
|
+
close_suspects() {
|
|
186
|
+
for ( let wsid in this.supects ) {
|
|
187
|
+
let ws = this.supects[wsid]
|
|
188
|
+
delete this.supects[wsid]
|
|
189
|
+
this.close_wss_session(ws)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// start_checking_pings
|
|
194
|
+
//
|
|
195
|
+
start_checking_pings() {
|
|
196
|
+
this.checking_pings = true
|
|
197
|
+
let self = this
|
|
198
|
+
setTimeout(() => { self.do_pings(self) },WSS_PING_INTERVAL)
|
|
199
|
+
setTimeout(() => { self.close_suspects() },WSS_PING_INTERVAL*2)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class TokenBoundWebSocketActions extends WebSocketActions {
|
|
208
|
+
|
|
209
|
+
constructor() {
|
|
210
|
+
super()
|
|
211
|
+
this.going_ws_sessions = {} // map token to web socket
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//
|
|
215
|
+
send_ws_outofband(token_key,data) {
|
|
216
|
+
if ( token_key ) {
|
|
217
|
+
let ws_list = this.going_ws_sessions[token_key]
|
|
218
|
+
if ( ws_list ) {
|
|
219
|
+
for ( let ws of ws_list ) {
|
|
220
|
+
if ( ws ) {
|
|
221
|
+
this.send_to_ws(ws,data)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
//
|
|
230
|
+
ws_shutdown(ws) {
|
|
231
|
+
let token = null
|
|
232
|
+
for ( let tk in going_ws_sessions ) {
|
|
233
|
+
let ws_dex = going_ws_sessions[tk].indexOf(ws)
|
|
234
|
+
if ( ws_dex >= 0 ) {
|
|
235
|
+
token = tk
|
|
236
|
+
going_ws_sessions[token].splice(ws_dex,1)
|
|
237
|
+
break
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if ( token && (going_ws_sessions[token].length == 0) ) {
|
|
241
|
+
delete going_ws_sessions[token]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
module.exports = WebSocketActions
|
|
249
|
+
module.exports.TokenBoundWebSocketActions = TokenBoundWebSocketActions
|
package/mail_bridge.conf
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"password": "test this",
|
|
3
|
+
"web_page_port": 9989,
|
|
4
|
+
"wss_app_port": 9990,
|
|
5
|
+
"mail_server_name" : "for-humans.net",
|
|
6
|
+
"concerns" : [ "copious", "popsong", "villa-family", "brobots"],
|
|
7
|
+
"contacts" : [ "copious-room", "popsong-room", "villa-family-room", "brobots-room"],
|
|
8
|
+
"repo_bridge": {
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "copious-mail",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "This is a mail interface with some backend support for channeling mail via a few possible gateways.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"email",
|
|
7
|
+
"MUA",
|
|
8
|
+
"citadel",
|
|
9
|
+
"copious",
|
|
10
|
+
"postfix",
|
|
11
|
+
"responsive",
|
|
12
|
+
"human-page-app"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/copious-world/copious-mail#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/copious-world/copious-mail/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/copious-world/copious-mail.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "GPL-2.0-or-later",
|
|
23
|
+
"author": "R. Leddy",
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"main": "index.js",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "node test/index.js",
|
|
28
|
+
"web" : "http-server test/",
|
|
29
|
+
"service": "node bin/index.js",
|
|
30
|
+
"compile" : "npx mikado-compile ./tpl/",
|
|
31
|
+
"compile-test" : "npx mikado-compile ./test/tpl/",
|
|
32
|
+
"gen-docs": "jsdoc --configure ./tools/jsdoc.conf -a all -R README.md --verbose"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"mikado": "^0.8.400",
|
|
36
|
+
"@polka/send-type": "^0.5.2",
|
|
37
|
+
"body-parser": "^1.20.1",
|
|
38
|
+
"cors": "^2.8.5",
|
|
39
|
+
"polka": "^0.5.2",
|
|
40
|
+
"ws": "^8.11.0"
|
|
41
|
+
}
|
|
42
|
+
}
|