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.
Files changed (182) hide show
  1. package/LICENSE +504 -0
  2. package/README.md +143 -2
  3. package/bin/index.js +345 -0
  4. package/client/copiousLogo.svg +123 -0
  5. package/client/hosted.html +5259 -0
  6. package/client/mail_styles.css +40 -0
  7. package/client/mikado.bundle.debug.js +1406 -0
  8. package/client/mikado.bundle.min.js +68 -0
  9. package/client/mikado.bundle.module.debug.js +1401 -0
  10. package/client/mikado.bundle.module.min.js +67 -0
  11. package/client/mikado.bundle.profiler.debug.js +1490 -0
  12. package/client/mikado.es5.debug.js +1995 -0
  13. package/client/mikado.es5.min.js +85 -0
  14. package/client/mikado.light.debug.js +535 -0
  15. package/client/mikado.light.min.js +29 -0
  16. package/client/mikado.light.module.debug.js +530 -0
  17. package/data/user_list.db +14 -0
  18. package/index.html +7242 -0
  19. package/index.js +5 -0
  20. package/jsconfig.json +32 -0
  21. package/lib/mail_repo_bridge_ops.js +1177 -0
  22. package/lib/utils.js +70 -0
  23. package/lib/websocket_con.js +249 -0
  24. package/mail_bridge.conf +10 -0
  25. package/package.json +41 -5
  26. package/svelte-src/App.svelte +2513 -0
  27. package/svelte-src/ContactGrid.svelte +98 -0
  28. package/svelte-src/FloatWindow.svelte +181 -0
  29. package/svelte-src/MessageDisplay.svelte +230 -0
  30. package/svelte-src/MessageEditor.svelte +664 -0
  31. package/svelte-src/MessageListEditor.svelte +133 -0
  32. package/svelte-src/Thing.svelte +190 -0
  33. package/svelte-src/ThingFull.svelte +117 -0
  34. package/svelte-src/ipfs_profile_proxy.js +923 -0
  35. package/svelte-src/main.js +10 -0
  36. package/svelte-src/search_box.js +69 -0
  37. package/svelte-src/utilities.js +180 -0
  38. package/test/c +28 -0
  39. package/test/copiousLogo.svg +123 -0
  40. package/test/index.html +4408 -0
  41. package/test/index.js +244 -0
  42. package/test/mail_styles.css +40 -0
  43. package/test/mikado.bundle.debug.js +1406 -0
  44. package/test/mikado.bundle.min.js +68 -0
  45. package/test/mikado.bundle.module.debug.js +1401 -0
  46. package/test/mikado.bundle.module.min.js +67 -0
  47. package/test/mikado.bundle.profiler.debug.js +1490 -0
  48. package/test/mikado.es5.debug.js +1995 -0
  49. package/test/mikado.es5.min.js +85 -0
  50. package/test/mikado.light.debug.js +535 -0
  51. package/test/mikado.light.min.js +29 -0
  52. package/test/mikado.light.module.debug.js +530 -0
  53. package/test/tpl/partial/attachment_edit.es5.js +1 -0
  54. package/test/tpl/partial/attachment_edit.html +5 -0
  55. package/test/tpl/partial/attachment_edit.js +1 -0
  56. package/test/tpl/partial/attachment_view.es5.js +1 -0
  57. package/test/tpl/partial/attachment_view.html +1 -0
  58. package/test/tpl/partial/attachment_view.js +1 -0
  59. package/test/tpl/partial/contact_list.es5.js +1 -0
  60. package/test/tpl/partial/contact_list.html +9 -0
  61. package/test/tpl/partial/contact_list.js +1 -0
  62. package/test/tpl/partial/draft_list.es5.js +1 -0
  63. package/test/tpl/partial/draft_list.html +8 -0
  64. package/test/tpl/partial/draft_list.js +1 -0
  65. package/test/tpl/partial/inbox_list.es5.js +1 -0
  66. package/test/tpl/partial/inbox_list.html +7 -0
  67. package/test/tpl/partial/inbox_list.js +1 -0
  68. package/test/tpl/partial/notify_list.es5.js +1 -0
  69. package/test/tpl/partial/notify_list.html +8 -0
  70. package/test/tpl/partial/notify_list.js +1 -0
  71. package/test/tpl/partial/sent_list.es5.js +1 -0
  72. package/test/tpl/partial/sent_list.html +7 -0
  73. package/test/tpl/partial/sent_list.js +1 -0
  74. package/test/tpl/partial/spam_list.es5.js +1 -0
  75. package/test/tpl/partial/spam_list.html +8 -0
  76. package/test/tpl/partial/spam_list.js +1 -0
  77. package/test/tpl/partial/trash_list.es5.js +1 -0
  78. package/test/tpl/partial/trash_list.html +7 -0
  79. package/test/tpl/partial/trash_list.js +1 -0
  80. package/test/tpl/partial/user.es5.js +1 -0
  81. package/test/tpl/partial/user.html +18 -0
  82. package/test/tpl/partial/user.js +1 -0
  83. package/tools/jsdoc.conf +47 -0
  84. package/tools/templates/docdash/publish.js +843 -0
  85. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  86. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  87. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  88. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  89. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  90. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  91. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  92. package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  93. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  94. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  95. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  96. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  97. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  98. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  99. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  100. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  101. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  102. package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  103. package/tools/templates/docdash/static/scripts/collapse.js +67 -0
  104. package/tools/templates/docdash/static/scripts/commonNav.js +28 -0
  105. package/tools/templates/docdash/static/scripts/linenumber.js +25 -0
  106. package/tools/templates/docdash/static/scripts/nav.js +12 -0
  107. package/tools/templates/docdash/static/scripts/polyfill.js +4 -0
  108. package/tools/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
  109. package/tools/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
  110. package/tools/templates/docdash/static/scripts/prettify/prettify.js +28 -0
  111. package/tools/templates/docdash/static/scripts/search.js +99 -0
  112. package/tools/templates/docdash/static/styles/jsdoc.css +803 -0
  113. package/tools/templates/docdash/static/styles/prettify.css +80 -0
  114. package/tools/templates/docdash/tmpl/augments.tmpl +10 -0
  115. package/tools/templates/docdash/tmpl/container.tmpl +203 -0
  116. package/tools/templates/docdash/tmpl/details.tmpl +152 -0
  117. package/tools/templates/docdash/tmpl/example.tmpl +2 -0
  118. package/tools/templates/docdash/tmpl/examples.tmpl +13 -0
  119. package/tools/templates/docdash/tmpl/exceptions.tmpl +32 -0
  120. package/tools/templates/docdash/tmpl/layout.tmpl +102 -0
  121. package/tools/templates/docdash/tmpl/mainpage.tmpl +15 -0
  122. package/tools/templates/docdash/tmpl/members.tmpl +38 -0
  123. package/tools/templates/docdash/tmpl/method.tmpl +132 -0
  124. package/tools/templates/docdash/tmpl/modifies.tmpl +14 -0
  125. package/tools/templates/docdash/tmpl/namespace.tmpl +133 -0
  126. package/tools/templates/docdash/tmpl/params.tmpl +132 -0
  127. package/tools/templates/docdash/tmpl/properties.tmpl +107 -0
  128. package/tools/templates/docdash/tmpl/returns.tmpl +19 -0
  129. package/tools/templates/docdash/tmpl/source.tmpl +8 -0
  130. package/tools/templates/docdash/tmpl/tutorial.tmpl +19 -0
  131. package/tools/templates/docdash/tmpl/type.tmpl +26 -0
  132. package/tools/templates/templates/docdash/publish.js +843 -0
  133. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  134. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  135. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  136. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  137. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  138. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  139. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  140. package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  141. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  142. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  143. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  144. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  145. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  146. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  147. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  148. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  149. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  150. package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  151. package/tools/templates/templates/docdash/static/scripts/collapse.js +67 -0
  152. package/tools/templates/templates/docdash/static/scripts/commonNav.js +28 -0
  153. package/tools/templates/templates/docdash/static/scripts/linenumber.js +25 -0
  154. package/tools/templates/templates/docdash/static/scripts/nav.js +12 -0
  155. package/tools/templates/templates/docdash/static/scripts/polyfill.js +4 -0
  156. package/tools/templates/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
  157. package/tools/templates/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
  158. package/tools/templates/templates/docdash/static/scripts/prettify/prettify.js +28 -0
  159. package/tools/templates/templates/docdash/static/scripts/search.js +99 -0
  160. package/tools/templates/templates/docdash/static/styles/jsdoc.css +803 -0
  161. package/tools/templates/templates/docdash/static/styles/prettify.css +80 -0
  162. package/tools/templates/templates/docdash/tmpl/augments.tmpl +10 -0
  163. package/tools/templates/templates/docdash/tmpl/container.tmpl +203 -0
  164. package/tools/templates/templates/docdash/tmpl/details.tmpl +152 -0
  165. package/tools/templates/templates/docdash/tmpl/example.tmpl +2 -0
  166. package/tools/templates/templates/docdash/tmpl/examples.tmpl +13 -0
  167. package/tools/templates/templates/docdash/tmpl/exceptions.tmpl +32 -0
  168. package/tools/templates/templates/docdash/tmpl/layout.tmpl +102 -0
  169. package/tools/templates/templates/docdash/tmpl/mainpage.tmpl +15 -0
  170. package/tools/templates/templates/docdash/tmpl/members.tmpl +38 -0
  171. package/tools/templates/templates/docdash/tmpl/method.tmpl +132 -0
  172. package/tools/templates/templates/docdash/tmpl/modifies.tmpl +14 -0
  173. package/tools/templates/templates/docdash/tmpl/namespace.tmpl +133 -0
  174. package/tools/templates/templates/docdash/tmpl/params.tmpl +132 -0
  175. package/tools/templates/templates/docdash/tmpl/properties.tmpl +107 -0
  176. package/tools/templates/templates/docdash/tmpl/returns.tmpl +19 -0
  177. package/tools/templates/templates/docdash/tmpl/source.tmpl +8 -0
  178. package/tools/templates/templates/docdash/tmpl/tutorial.tmpl +19 -0
  179. package/tools/templates/templates/docdash/tmpl/type.tmpl +26 -0
  180. package/tpl/partial/user.es5.js +1 -0
  181. package/tpl/partial/user.html +10 -0
  182. package/tpl/partial/user.js +1 -0
@@ -0,0 +1,2513 @@
1
+ <!-- https://eugenkiss.github.io/7guis/tasks#crud -->
2
+ <script>
3
+ //
4
+ import Tab, { Label } from '@smui/tab';
5
+ import TabBar from '@smui/tab-bar';
6
+ import { onMount } from 'svelte';
7
+ import FloatWindow from './FloatWindow.svelte';
8
+ import MessageDisplay from './MessageDisplay.svelte'
9
+ import MessageEditor from './MessageEditor.svelte'
10
+ import MessageListEdit from './MessageListEditor.svelte'
11
+ //
12
+ import * as ipfs_profiles from './ipfs_profile_proxy.js'
13
+ import * as utils from './utilities.js'
14
+
15
+ let active_profile_image = ""; //"/favicon.png" ; // "/brent-fox-jane-18-b.jpg"
16
+ let active_profile_biometric = ""
17
+ //
18
+ let src_1_name = "Drop a picture here"
19
+ let src_biometric_instruct = "Drop binary biometric file here"
20
+ //
21
+ let active_cid = ""
22
+ let clear_cid = ""
23
+ let dir_view = false
24
+
25
+ let signup_status = "OK"
26
+ //
27
+ let start_of_messages = 0
28
+ let messages_per_page = 100
29
+
30
+ let prefix = '';
31
+ let man_prefix = '';
32
+ let i = 0;
33
+ let c_i = 0;
34
+ let i_i = 0;
35
+ let p_i = 0;
36
+ let form_index = 0
37
+
38
+ let j_cid = false
39
+
40
+ let name = ''
41
+ let DOB = ''
42
+ let place_of_origin = ''
43
+ let cool_public_info = ''
44
+ let business = false
45
+ let biometric_blob = ''
46
+
47
+ let c_name = ''
48
+ let c_DOB = ''
49
+ let c_place_of_origin = ''
50
+ let c_cool_public_info = ''
51
+ let c_business = false
52
+ let c_public_key = "testesttesttest"
53
+ let c_signer_public_key = "testesttesttest"
54
+ let c_cid = "testesttesttest"
55
+ let c_answer_message = ''
56
+ let c_biometric_blob = ''
57
+
58
+ let c_empty_fields = false
59
+
60
+ let today = (new Date()).toUTCString()
61
+
62
+ let active_user = false
63
+ let active_identity = false
64
+ let known_users = [false]
65
+ let known_identities = [false]
66
+ let u_index = 0
67
+
68
+ let adding_new = false
69
+
70
+ let manifest_selected_entry = false
71
+ let manifest_selected_form = false
72
+ let manifest_contact_form_list = [false]
73
+ //
74
+ let manifest_obj = {}
75
+ let manifest_index = 0
76
+ let man_title = ''
77
+ let man_cid = ''
78
+ let man_wrapped_key = ''
79
+ let man_html = ''
80
+ let man_max_preference = 1.0
81
+ let man_preference = 1.0
82
+ //
83
+ let man_sel_not_customized = true
84
+ let man_contact_is_default = false
85
+
86
+ //
87
+ let man_encrypted = false
88
+
89
+ let message_edit_from_contact = false
90
+
91
+ let profile_image_el
92
+ let biometric_data_el
93
+
94
+ //
95
+ let active = 'Identify';
96
+ let prev_active = active
97
+ let first_message = 0
98
+
99
+ let green = false // an indicator telling if this user ID is set
100
+ let todays_date = (new Date()).toLocaleString()
101
+
102
+ let filtered_cc_list = []
103
+
104
+ let message_op_category = "read"
105
+ let source_category = "messages"
106
+ let processed_category = "Use Op to Select"
107
+
108
+ // This is just a default... It will be used until the user picks something else
109
+ // when editing the manifest.
110
+ let selected_form_link_types = {
111
+ "business" : {
112
+ "link" : "latest-contact",
113
+ "from_cid" : "QmTfD2LyTy8WGgdUkKE1Z1vAfb6HwNgmZA5kMaFAiy4fuz"
114
+ },
115
+ "profile" : {
116
+ "link" : "latest-contact",
117
+ "from_cid" : "QmTfD2LyTy8WGgdUkKE1Z1vAfb6HwNgmZA5kMaFAiy4fuz"
118
+ }
119
+ }
120
+
121
+ let selected_form_link = selected_form_link_types["profile"]
122
+
123
+
124
+ //
125
+ let individuals = [
126
+ { "name": 'Hans Solo', "DOB" : "1000", "place_of_origin" : "alpha centauri", "cool_public_info" : "He is a Master Jedi", "business" : false, "public_key" : "testesttesttest", "signer_public_key" : "ha ha ha ha ha ha ha ", "cid" : "4504385938", "answer_message" : "", "biometric" : "53535" }
127
+ ];
128
+
129
+ let cid_individuals_map = {}
130
+
131
+ let selected = individuals[0]
132
+
133
+ let inbound_solicitation_messages = [ { "name": 'Darth Vadar', "user_cid" : "869968609", "subject" : "Hans Solo is Mean", "date" : todays_date, "readers" : "luke,martha,chewy", "business" : false, "public_key" : false, "message" : "this is a message 4" , "reply_with" : "default"} ]
134
+ let inbound_contact_messages = [
135
+ { "name": 'Hans Solo', "user_cid" : "4504385938", "subject" : "Darth Vadier Attacks", "date" : todays_date, "readers" : "joe,jane,harry", "business" : false, "public_key" : false, "message" : "this is a message 1" }
136
+ ]
137
+
138
+
139
+ let processed_messages = []
140
+
141
+ let message_selected = { "name": 'Admin', "subject" : "Hello From copious.world", "date" : today, "readers" : "you", "business" : false, "public_key" : false }
142
+
143
+
144
+
145
+ let message_edit_list_name = ""
146
+ let message_edit_type = "message"
147
+ let message_edit_list = []
148
+ let message_edit_source = false
149
+
150
+ function reinitialize_user_context() {
151
+ active_cid = ""
152
+ clear_cid = ""
153
+ dir_view = false
154
+ signup_status = "OK"
155
+ //
156
+ start_of_messages = 0
157
+ messages_per_page = 100
158
+ //
159
+ active_profile_image = ""
160
+ //
161
+ prefix = '';
162
+ man_prefix = '';
163
+ i = 0;
164
+ c_i = 0;
165
+ i_i = 0;
166
+ p_i = 0;
167
+ form_index = 0
168
+ //
169
+ c_name = ''
170
+ c_DOB = ''
171
+ c_place_of_origin = ''
172
+ c_cool_public_info = ''
173
+ c_business = false
174
+ c_public_key = "testesttesttest"
175
+ c_signer_public_key = "testesttesttest"
176
+ c_cid = "testesttesttest"
177
+ c_answer_message = ''
178
+ c_empty_fields = false
179
+ //
180
+ today = (new Date()).toUTCString()
181
+ adding_new = false
182
+ manifest_selected_entry = false
183
+ manifest_selected_form = false
184
+ manifest_contact_form_list = [false]
185
+ manifest_obj = {}
186
+ manifest_index = 0
187
+ man_title = ''
188
+ man_cid = ''
189
+ man_wrapped_key = ''
190
+ man_html = ''
191
+ man_max_preference = 1.0
192
+ man_preference = 1.0
193
+ man_encrypted = false
194
+ first_message = 0
195
+ green = false // an indicator telling if this user ID is set
196
+ todays_date = (new Date()).toLocaleString()
197
+ individuals = [
198
+ { "name": 'Hans Solo', "DOB" : "1000", "place_of_origin" : "alpha centauri", "cool_public_info" : "He is a Master Jedi", "business" : false, "public_key" : "testesttesttest", "signer_public_key" : "ha ha ha ha ha ha ha ", "cid" : "4504385938", "answer_message" : "", "biometric" : "53535" }
199
+ ];
200
+ cid_individuals_map = {}
201
+ inbound_solicitation_messages = [ {
202
+ "name": 'Darth Vadar',
203
+ "user_cid" : "869968609",
204
+ "subject" : "Hans Solo is Mean",
205
+ "date" : todays_date,
206
+ "readers" : "luke,martha,chewy",
207
+ "business" : false,
208
+ "public_key" : false,
209
+ "message" : "this is a message 4",
210
+ "reply_with" : "default" } ]
211
+ inbound_contact_messages = [
212
+ { "name": 'Hans Solo', "user_cid" : "4504385938", "subject" : "Darth Vadier Attacks", "date" : todays_date, "readers" : "joe,jane,harry", "business" : false, "public_key" : false, "message" : "this is a message 1" }
213
+ ]
214
+
215
+ processed_messages = []
216
+
217
+ message_selected = { "name": 'Admin', "subject" : "Hello From copious.world", "date" : today, "readers" : "you", "business" : false, "public_key" : false }
218
+
219
+ update_selected_form_links()
220
+ }
221
+
222
+ async function handle_message(evt) {
223
+ let cmd = evt.detail.cmd
224
+ switch ( cmd ) {
225
+ case "new-contact" : {
226
+ // from display -- sender initiated -- got sender public keys
227
+ // -- send yours automatically since you already accepted
228
+ let signer_pk = evt.detail.signer_public_key
229
+ let added = await auto_add_contact(evt.detail.cid,signer_pk,true,message_selected)
230
+ message_selected.is_in_contacts = added
231
+ break;
232
+ }
233
+ case "reply": {
234
+ selected.answer_message = true
235
+ message_edit_from_contact = false
236
+ start_floating_window(1);
237
+ }
238
+ case "view-processed-messages": {
239
+ message_op_category = evt.detail.category
240
+ processed_category = message_op_category
241
+ source_category = message_op_category
242
+ processed_messages = await fetch_category_messages(active_identity,message_op_category)
243
+ break;
244
+ }
245
+ case 'move-messages': {
246
+ if ( !active_identity ) return
247
+ let cat = evt.detail.category
248
+ if ( (cat === source_category) && !(message_op_category === 'intros' || message_op_category === 'messages')) return
249
+ let user_cid = active_identity.cid
250
+ if ( active === 'Introductions' ) {
251
+ user_cid = active_identity.clear_cid
252
+ }
253
+ let dst_cid = active_identity.cid
254
+ let business = active_identity.user_info.business
255
+ //
256
+ // message_edit_list containes message from message_op_category
257
+ // they are being sent to cat
258
+ //
259
+ let src_cat = false
260
+ if ( (message_op_category !== 'messages') && (message_op_category !== 'intros') ) {
261
+ src_cat = message_op_category
262
+ }
263
+ await ipfs_profiles.message_list_ops(user_cid,dst_cid,'move',cat,business,message_edit_list,src_cat)
264
+ //
265
+ //message_edit_source
266
+ let status = remove_from_source_list(message_edit_source,message_edit_list)
267
+ if ( status == false ) {
268
+ console.log("no message removed")
269
+ }
270
+ break;
271
+ }
272
+ default: {
273
+ console.log("message cmd not handled")
274
+ }
275
+ }
276
+ }
277
+
278
+ /*
279
+ "wrapped_key" : false,
280
+ "encoding" : "uri",
281
+ "when" ... whereas"date" is a human readable string...
282
+ */
283
+
284
+ //
285
+ class Contact {
286
+ //
287
+ constructor() {
288
+ this.empty_identity = {
289
+ "name": '',
290
+ "DOB" : "",
291
+ "place_of_origin" : "",
292
+ "cool_public_info" : "",
293
+ "business" : false,
294
+ "public_key" : false,
295
+ "signer_public_key" : false,
296
+ "biometric" : false
297
+ }
298
+ this.data = this.empty_identity
299
+ }
300
+ //
301
+ set(name,DOB,place_of_origin,cool_public_info,business,public_key,signer_public_key,biometric_blob) {
302
+ let user_data = {
303
+ "name": name,
304
+ "DOB" : DOB,
305
+ "place_of_origin" : place_of_origin,
306
+ "cool_public_info" : cool_public_info,
307
+ "business" : (business === undefined) ? false : business,
308
+ "public_key" : public_key,
309
+ "signer_public_key" : signer_public_key,
310
+ "biometric" : biometric_blob
311
+ }
312
+ this.data = user_data
313
+ }
314
+
315
+ copy(contact_info) {
316
+ let data = {}
317
+ for ( let ky in this.empty_identity ) {
318
+ data[ky] = contact_info[ky]
319
+ }
320
+ this.data = data
321
+ }
322
+
323
+ match(contact_info) {
324
+ let f_match = true
325
+ f_match = f_match && ( this.data.name === contact_info.name )
326
+ f_match = f_match && ( this.data.DOB === contact_info.DOB )
327
+ f_match = f_match && ( this.data.place_of_origin === contact_info.place_of_origin )
328
+ f_match = f_match && ( this.data.cool_public_info === contact_info.cool_public_info )
329
+ f_match = f_match && ( this.data.business === contact_info.business )
330
+ return f_match
331
+ }
332
+
333
+ extend_contact(field,value) {
334
+ this.data[field] = value;
335
+ }
336
+
337
+ get_field(field) {
338
+ return this.data[field]
339
+ }
340
+
341
+ identity() {
342
+ let id_obj = Object.assign(this.empty_identity,this.data)
343
+ return id_obj
344
+ }
345
+
346
+ clear_identity() {
347
+ let id_obj = {
348
+ "name": this.data.name,
349
+ "DOB" : this.data.DOB,
350
+ "place_of_origin" : this.data.place_of_origin,
351
+ "cool_public_info" : this.data.cool_public_info,
352
+ "business" : this.data.business,
353
+ }
354
+ return id_obj
355
+ }
356
+
357
+ }
358
+
359
+ let empty_identity = new Contact()
360
+
361
+ //
362
+
363
+
364
+ // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
365
+
366
+ $: filteredIndviduals = prefix
367
+ ? individuals.filter(individual => {
368
+ const name = `${individual.name}`;
369
+ return name.toLowerCase().startsWith(prefix.toLowerCase());
370
+ })
371
+ : individuals;
372
+
373
+ $: selected = (i >= 0) ? filteredIndviduals[i] : empty_identity.identity()
374
+
375
+ $: reset_inputs(selected)
376
+
377
+ $: if ( active_identity ) {
378
+ filtered_cc_list = individuals.filter(ident => {
379
+ if ( ident.cid !== active_identity.cid ) {
380
+ return true
381
+ }
382
+ return false
383
+ })
384
+ }
385
+
386
+ //
387
+ //
388
+ $: active_user = known_users[u_index]
389
+ $: active_identity = known_identities[u_index]
390
+ $: green = ( active_identity ) ? active_identity.stored_externally : false
391
+ $: {
392
+ if ( active_user ) {
393
+ window.set_user_title(active_user.name)
394
+ }
395
+ }
396
+
397
+ let current_index = -1
398
+
399
+
400
+ $: {
401
+ if ( (active_user !== undefined) && active_user ) {
402
+ name = active_user.name
403
+ DOB = active_user.DOB
404
+ place_of_origin = active_user.place_of_origin
405
+ cool_public_info = active_user.cool_public_info
406
+ business = active_user.business
407
+ adding_new = false
408
+ }
409
+ }
410
+
411
+ $: {
412
+ if ( current_index !== u_index ) {
413
+ current_index = u_index
414
+ reinitialize_user_context()
415
+ }
416
+ if ( active_identity ) {
417
+ load_user_info(active_identity)
418
+ }
419
+ }
420
+
421
+ $: filtered_manifest_contact_form_list = man_prefix
422
+ ? manifest_contact_form_list.filter(man_contact => {
423
+ const name = `${man_contact.name}`;
424
+ return name.toLowerCase().startsWith(man_prefix.toLowerCase());
425
+ })
426
+ : manifest_contact_form_list;
427
+
428
+ $: {
429
+ manifest_selected_entry = filtered_manifest_contact_form_list[manifest_index]
430
+ if ( (manifest_selected_entry !== undefined) && manifest_selected_entry ) {
431
+ manifest_selected_form = manifest_selected_entry.html
432
+ man_title = manifest_selected_entry.info
433
+ man_max_preference = manifest_obj.max_preference
434
+ man_preference = manifest_selected_entry.preference
435
+ man_cid = manifest_selected_entry.cid
436
+
437
+ man_contact_is_default = ( man_cid === manifest_obj.default_contact_form)
438
+ }
439
+ }
440
+
441
+ $: c_empty_fields = ((!c_name || (c_name.length == 0) )
442
+ || (!c_DOB || (c_DOB.length == 0) )
443
+ || (!c_place_of_origin
444
+ || (c_place_of_origin.length == 0) )
445
+ || (c_cool_public_info.length == 0))
446
+
447
+
448
+ $: {
449
+ if ( prev_active !== active ) {
450
+ message_edit_list = []
451
+ message_edit_source = false
452
+ if ( active == "Introductions" ) {
453
+ message_op_category = "intros"
454
+ } else if ( active == "Messages" ) {
455
+ message_op_category = "messages"
456
+ }
457
+ }
458
+ prev_active = active
459
+ }
460
+ // ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
461
+
462
+ let creator_disabled = false
463
+ let creation_to_do = false
464
+ $: {
465
+ creation_to_do = ( (u_index === false) || (active_user && (active_user.biometric === undefined)) )
466
+ if ( (typeof active_cid === "string") && (active_cid.length === 0) ) {
467
+ creation_to_do = true
468
+ }
469
+ creator_disabled = !creation_to_do
470
+ console.log(active_cid)
471
+ }
472
+
473
+ let window_scale = { "w" : 0.4, "h" : 0.8 }
474
+ let edit_popup_scale = { "w" : 0.45, "h" : 0.3}
475
+
476
+ let all_window_scales = []
477
+ all_window_scales.push(window_scale)
478
+ all_window_scales.push(window_scale)
479
+ all_window_scales.push(edit_popup_scale)
480
+
481
+
482
+ function popup_size() {
483
+ let smallest_w = 200 // smallest and bigget willing to accomodate
484
+ let biggest_w = 3000
485
+
486
+ let smallest_h = 600
487
+ let biggest_h = 1000
488
+
489
+ // bounded window width
490
+ let w = Math.max(smallest_w,window.innerWidth)
491
+ w = Math.min(biggest_w,w)
492
+
493
+ // bounded window height
494
+ let h = Math.max(smallest_h,window.innerHeight)
495
+ h = Math.min(biggest_h,h)
496
+
497
+ let p_range
498
+ let P
499
+ // percentage h range
500
+ let h_p_max = 0.96
501
+ let h_p_min = 0.75
502
+ p_range = h_p_max - h_p_min
503
+ P = (biggest_h - h)/(biggest_h - smallest_h)
504
+ //console.log("P h: " + P)
505
+ let h_scale = P*(p_range) + h_p_min
506
+
507
+ // percentage w range
508
+ let w_p_max = 0.96
509
+ let w_p_min = 0.20
510
+ p_range = w_p_max - w_p_min
511
+ P = (biggest_w - w)/(biggest_w - smallest_w)
512
+ //console.log("P w: " + P)
513
+ let w_scale = P*(p_range) + w_p_min
514
+
515
+ // Setting the current height & width
516
+ // to the elements
517
+
518
+ return { "w" : w_scale, "h" : h_scale }
519
+ }
520
+
521
+ //
522
+ window_scale = popup_size()
523
+ all_window_scales[0] = window_scale
524
+ all_window_scales[1] = window_scale
525
+
526
+ //
527
+ onMount(async () => {
528
+ //
529
+ window.addEventListener("resize", (e) => {
530
+ //
531
+ let scale = popup_size()
532
+ //
533
+ window_scale.h = scale.h;
534
+ window_scale.w = scale.w;
535
+ all_window_scales[0] = window_scale
536
+ all_window_scales[1] = window_scale
537
+ //
538
+ })
539
+
540
+ await startup()
541
+ // initialize
542
+ await get_active_users() // updates login page and initializes the view of this user.
543
+ })
544
+
545
+ async function update_selected_form_link(type) {
546
+ let form_link = selected_form_link_types[type]
547
+ if ( !(form_link.from_cid) ) {
548
+ let template_name = form_link.link
549
+ let cid = await ipfs_profiles.get_named_contact_template_cid(template_name,type)
550
+ form_link.from_cid = cid
551
+ }
552
+ }
553
+
554
+
555
+ async function update_selected_form_links() {
556
+ await update_selected_form_link("profile")
557
+ await update_selected_form_link("business")
558
+ }
559
+
560
+
561
+ // PROFILE PROFILE PROFILE PROFILE PROFILE PROFILE PROFILE
562
+ // PROFILE PROFILE PROFILE PROFILE PROFILE PROFILE PROFILE
563
+
564
+ let g_required_user_fields = [ "name", "DOB", "place_of_origin", "cool_public_info", "biometric" ]
565
+ let g_renamed_user_fields = {
566
+ "DOB" : "Year of inception",
567
+ "place_of_origin" : "Main Office",
568
+ }
569
+ let g_last_inspected_field = false
570
+ function check_required_fields(object,required_fields) {
571
+ g_last_inspected_field = false
572
+ for ( let field of required_fields ) {
573
+ let value = object[field]
574
+ g_last_inspected_field = field
575
+ if (( value === undefined) || (value.length === 0) ) return false
576
+ }
577
+ return true
578
+ }
579
+
580
+ function missing_fields(activity,app_rename,do_rename) {
581
+ let l_field = g_last_inspected_field
582
+ //
583
+ if ( do_rename ) {
584
+ let r_field = app_rename[l_field]
585
+ if ( r_field ) {
586
+ l_field = r_field
587
+ }
588
+ }
589
+ let message = `Missing field: ${l_field}, when ${activity}`
590
+ return(message);
591
+ }
592
+
593
+
594
+ // ADD PROFILE.....
595
+ async function add_profile() {
596
+ //
597
+ let contact = new Contact() // contact of self... Stores the same info as a contact plus some special fields for local db
598
+ contact.set(name,DOB,place_of_origin,cool_public_info,business,false,false,biometric_blob)
599
+ //
600
+ selected_form_link = selected_form_link_types[ (business ? "business" : "profile") ]
601
+ contact.extend_contact("form_link",selected_form_link)
602
+ contact.extend_contact("answer_message","")
603
+ //
604
+ let user_data = contact.identity()
605
+ //
606
+ signup_status = "OK"
607
+ if ( !check_required_fields(user_data,g_required_user_fields) ) {
608
+ signup_status = missing_fields("creating contact page",g_renamed_user_fields,business)
609
+ return;
610
+ }
611
+
612
+ await gen_public_key(user_data) // by ref // stores keys in DB // converts biometric to signature (calls protect_hash)
613
+ try {
614
+ green = await ipfs_profiles.add_profile(user_data) // will fetch the key (it is not riding along yet.)
615
+ } catch (e) {
616
+ }
617
+ //
618
+ await get_active_users() // updates login page and initializes the view of this user.
619
+ u_index = (known_users.length - 1) // user was added to the end...
620
+ //
621
+ }
622
+
623
+ async function load_user_info(identity) {
624
+ active_cid = identity.cid
625
+ clear_cid = identity.clear_cid
626
+
627
+ await fix_keys(identity)
628
+
629
+ await fetch_contacts(identity)
630
+ //
631
+ fetch_messages(identity)
632
+ fetch_manifest(identity)
633
+
634
+ if ( identity.profile_image ) {
635
+ let img_cid = identity.profile_image
636
+ active_profile_image = await ipfs_profiles.load_blob_as_url(img_cid)
637
+ }
638
+
639
+ /*
640
+ let manifest_cid = identity.files.cid
641
+ let contacts_cid = identity.files.cid
642
+
643
+ let dir_contact_pages_cid = identity.dirs.cid
644
+ let dir_spool_cid = identity.dirs.cid
645
+ */
646
+ }
647
+
648
+ async function get_active_users() {
649
+ try {
650
+ let known_user_lists = await window.get_known_users()
651
+ known_users = known_user_lists[0]
652
+ known_identities = known_user_lists[1]
653
+ } catch (e) {}
654
+ }
655
+
656
+
657
+ function clear_identify_form() {
658
+ name = ''
659
+ DOB = ''
660
+ place_of_origin = ''
661
+ cool_public_info = ''
662
+ biometric_blob = ''
663
+ business = false
664
+ active_user = false
665
+ active_identity = false
666
+ u_index = false
667
+ adding_new = true
668
+ }
669
+
670
+ async function remove_identify_seen_in_form() {
671
+ let identity = active_identity
672
+ const index = known_users.indexOf(active_user);
673
+ if ( index >= 0 ) {
674
+ known_users = [...known_users.slice(0, index), ...known_users.slice(index + 1)];
675
+ u_index = Math.min(u_index, known_users.length - 1);
676
+ await unstore_user(identity)
677
+ }
678
+ }
679
+
680
+ async function drop_picture(ev) {
681
+ ev.preventDefault();
682
+ try {
683
+ let files = ev.dataTransfer.files ? ev.dataTransfer.files : false
684
+ let items = ev.dataTransfer.items ? ev.dataTransfer.items : false
685
+ let [fname,blob64] = await utils.drop(items,files)
686
+ //
687
+ fname = `images/contact`
688
+ let identity = active_identity
689
+ if ( identity ) {
690
+ active_profile_image = blob64
691
+ //
692
+ let fcid = await ipfs_profiles.upload_data_file(fname,blob64)
693
+ if ( fcid ) {
694
+ identity.profile_image = fcid
695
+ await update_identity(identity)
696
+ }
697
+ }
698
+ } catch (e) {
699
+ console.log(e)
700
+ }
701
+ }
702
+
703
+ async function drop_biometric(ev) {
704
+ ev.preventDefault();
705
+ try {
706
+ let files = ev.dataTransfer.files ? ev.dataTransfer.files : false
707
+ let items = ev.dataTransfer.items ? ev.dataTransfer.items : false
708
+ let [fname,blob64] = await utils.drop(items,files)
709
+ biometric_blob = blob64
710
+ src_biometric_instruct = "Biometric has been dropped."
711
+ //
712
+ } catch (e) {
713
+ console.log(e)
714
+ }
715
+ }
716
+
717
+ function dragover_picture(ev) {
718
+ ev.preventDefault();
719
+ }
720
+
721
+
722
+ // MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES
723
+ // MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES MESSAGES
724
+
725
+
726
+ function pop_editor() {
727
+ message_edit_from_contact = true
728
+ selected.answer_message = false
729
+ filtered_cc_list = filtered_cc_list.filter(ident => {
730
+ return ident.cid !== selected.cid
731
+ })
732
+ start_floating_window(1);
733
+ }
734
+
735
+ function show_subject() {
736
+
737
+ }
738
+
739
+
740
+ // ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
741
+
742
+
743
+ function clear_checks(pattern,n) {
744
+ let i = 0
745
+ let el = false
746
+ do {
747
+ let el_id = `${pattern}${i}`
748
+ el = document.getElementById(el_id)
749
+ if ( el ) {
750
+ el.checked = false
751
+ }
752
+ i++
753
+ } while ( el )
754
+ }
755
+
756
+
757
+ function get_selected_message(dom_el,parts_of_0) {
758
+ let found_message = false
759
+ if ( dom_el && (dom_el.id.length === 0) ) {
760
+ do {
761
+ dom_el = dom_el.parentNode;
762
+ } while ( dom_el && (dom_el.id.length === 0) )
763
+ }
764
+ if ( dom_el && (dom_el.id.length !== 0) ) {
765
+ let parts = dom_el.id.split('_')
766
+ if ( parts[0] === parts_of_0 ) {
767
+ if ( parts[1] === 'contact' ) {
768
+ let index = parseInt(parts[2])
769
+ message_edit_source = inbound_contact_messages
770
+ found_message = inbound_contact_messages[index]
771
+ } else if ( parts[1] === 'intro' ) {
772
+ let index = parseInt(parts[2])
773
+ message_edit_source = inbound_solicitation_messages
774
+ found_message = inbound_solicitation_messages[index]
775
+ } else if ( parts[1] === 'category' ) { // category
776
+ let index = parseInt(parts[2])
777
+ message_edit_source = processed_messages
778
+ found_message = processed_messages[index]
779
+ }
780
+ }
781
+ }
782
+ return found_message
783
+ }
784
+
785
+
786
+ function remove_from_source_list(m_source,m_changed) {
787
+ //
788
+ let op_list = []
789
+ if ( active == "Messages" ) {
790
+ op_list = inbound_contact_messages
791
+ if ( m_source !== op_list ) return false;
792
+ } else if ( active == "Introductions" ) {
793
+ op_list = inbound_solicitation_messages
794
+ if ( m_source !== op_list ) return false;
795
+ } else {
796
+ op_list = processed_messages
797
+ if ( m_source !== op_list ) return false;
798
+ }
799
+ //
800
+ let changed_list = op_list.filter(m_el => {
801
+ let cid = m_el.f_cid
802
+ if ( cid ) {
803
+ if ( m_changed.indexOf(cid) >= 0 ) return false
804
+ }
805
+ return true
806
+ })
807
+ //
808
+ if ( active === "Messages" ) {
809
+ inbound_contact_messages = changed_list
810
+ clear_checks("doop-m_contact_",changed_list.length)
811
+ } else if ( active === "Introductions" ) {
812
+ inbound_solicitation_messages = changed_list
813
+ clear_checks("doop-m_intro_",changed_list.length)
814
+ } else {
815
+ processed_messages = changed_list
816
+ clear_checks("doop-m_category_",changed_list.length)
817
+ }
818
+ //
819
+ }
820
+
821
+ // ---- check_box_block
822
+ // ----
823
+ function check_box_block(ev) {
824
+ ev.stopPropagation()
825
+ // enter or remove element into the operation list....
826
+ let dom_el = ev.target
827
+ let m = get_selected_message(dom_el,'doop-m')
828
+ if ( m ) {
829
+ if ( dom_el.checked ) {
830
+ message_edit_list.push(m.f_cid)
831
+ } else {
832
+ const index = message_edit_list.indexOf(m.f_cid);
833
+ message_edit_list = [...message_edit_list.slice(0, index), ...message_edit_list.slice(index + 1)];
834
+ }
835
+ }
836
+ console.log(message_edit_list)
837
+ }
838
+
839
+
840
+ function doops_messages(ev) {
841
+ //
842
+ message_edit_list_name = "Message Ops"
843
+ message_edit_type = "message"
844
+
845
+ //
846
+ start_floating_window(2);
847
+ }
848
+
849
+
850
+ function doops_processed(ev) {
851
+ message_edit_list_name = "Processed Message Ops"
852
+ message_edit_type = "message"
853
+ //
854
+ start_floating_window(2);
855
+ }
856
+
857
+ function doops_intros(ev) {
858
+ message_edit_list_name = "Introduction Ops"
859
+ message_edit_type = "introduction"
860
+ //
861
+ start_floating_window(2);
862
+ }
863
+
864
+ function full_message(ev) {
865
+ if ( ev ) {
866
+ let dom_el = ev.target;
867
+ let m = get_selected_message(dom_el,'m')
868
+ if ( m ) {
869
+ message_selected = m
870
+ let contact = find_contact_from_message(message_selected)
871
+ if ( contact ) {
872
+ contact.answer_message = `&lt;subject ${message_selected.subject}&gt;<br>` + message_selected.message
873
+ }
874
+ start_floating_window(0);
875
+ }
876
+ }
877
+ }
878
+
879
+
880
+ async function fetch_messages(identify) {
881
+ if ( identify ) {
882
+ let all_inbound_messages = await ipfs_profiles.get_message_files(identify,start_of_messages,messages_per_page)
883
+ inbound_contact_messages = all_inbound_messages[0]
884
+ inbound_solicitation_messages = all_inbound_messages[1]
885
+
886
+ if ( inbound_contact_messages === false ) {
887
+ inbound_contact_messages = []
888
+ }
889
+ if ( inbound_solicitation_messages === false ) {
890
+ inbound_solicitation_messages = []
891
+ }
892
+ //
893
+ await check_contacts(inbound_contact_messages,false)
894
+ let auto_responses = await check_contacts(inbound_solicitation_messages,true)
895
+ inbound_solicitation_messages = inbound_solicitation_messages.filter(m => {
896
+ return (auto_responses.indexOf(m) < 0)
897
+ })
898
+ }
899
+ }
900
+
901
+ async function fetch_category_messages(identify,op_category) {
902
+ if ( identify ) {
903
+ let start = start_of_messages ? start_of_messages : 0
904
+ let count = messages_per_page ? messages_per_page : 100
905
+ let inbound_messages = await ipfs_profiles.get_categorized_message_files(identify,op_category,start,count)
906
+ return inbound_messages
907
+ }
908
+ }
909
+
910
+
911
+ function messages_update_contacts(cid,bval) {
912
+ if ( Array.isArray(inbound_contact_messages) ) {
913
+ for ( let m of inbound_contact_messages ) {
914
+ if ( m.user_cid === cid ) {
915
+ m.is_in_contacts = bval
916
+ }
917
+ }
918
+ }
919
+ if ( Array.isArray(inbound_contact_messages) ) {
920
+ for ( let m of inbound_solicitation_messages ) {
921
+ if ( m.user_cid === cid ) {
922
+ m.is_in_contacts = bval
923
+ }
924
+ }
925
+ }
926
+ }
927
+
928
+ // CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS
929
+ // CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS CONTACTS
930
+
931
+ function make_individuals_map(indivs_map) {
932
+ if ( Array.isArray(indivs_map) ) {
933
+ cid_individuals_map = {}
934
+ for ( let indiv of indivs_map ) {
935
+ if ( indiv && (typeof indiv !== "string") ) {
936
+ cid_individuals_map[indiv.cid] = indiv
937
+ }
938
+ }
939
+ } else {
940
+ cid_individuals_map = Object.assign(cid_individuals_map,indivs_map)
941
+ }
942
+ window.set_contact_map(cid_individuals_map)
943
+ }
944
+
945
+ function find_contact_from_message(message) {
946
+ if ( message === undefined ) return false
947
+ for ( let contact of individuals ) {
948
+ if ( (contact.name == message.name) && (message.user_cid === contact.cid) ) {
949
+ return contact
950
+ }
951
+ }
952
+ return false
953
+ }
954
+
955
+ async function check_contacts(message_list,clear) {
956
+ let removals = []
957
+ if ( Array.isArray(message_list) ) {
958
+ for ( let m of message_list ) {
959
+ // This will be false --
960
+ // the introduction will supply the sender (from) cid for the keyed path.
961
+ let is = (cid_individuals_map[m.user_cid] !== undefined)
962
+ m.is_in_contacts = is
963
+ //
964
+ if ( is && clear ) {
965
+ let c = cid_individuals_map[m.user_cid]
966
+ let do_update = await check_for_auto_update(c,m)
967
+ if ( do_update ) {
968
+ if ( c.public_key && c.signer_public_key ) {
969
+ let contact = contact_wrapper(c)
970
+ if ( contact ) {
971
+ await respond_to_intro(m,contact)
972
+ }
973
+ } else {
974
+ auto_add_contact(m.user_cid,m.signer_public_key,c.must_send_keys,m)
975
+ removals.push(m)
976
+ }
977
+ }
978
+ } else if ( clear ) {
979
+ if ( m.response_acceptance ) {
980
+ auto_add_contact(m.user_cid,m.signer_public_key,false,m)
981
+ removals.push(m)
982
+ }
983
+ }
984
+ }
985
+ }
986
+ return removals
987
+ }
988
+
989
+ //
990
+ async function check_for_auto_update(c,m) {
991
+ //
992
+ if ( c.must_send_keys === undefined ) return false
993
+ //
994
+ if ( !(c.received_keys) ) {
995
+ if ( c.public_key && c.signer_public_key ) {
996
+ c.received_keys = true
997
+ await update_contact()
998
+ return false
999
+ }
1000
+ let cid = m.user_cid
1001
+ if ( cid ) {
1002
+ if ( active_identity.introductions ) {
1003
+ let intros = active_identity.introductions
1004
+ if ( intros.indexOf(cid) >= 0 ) {
1005
+ return true
1006
+ }
1007
+ } else return true // let "received_keys" make the decision.
1008
+ }
1009
+ } else {
1010
+ if ( c.must_send_keys ) {
1011
+ if ( c.public_key && c.signer_public_key ) {
1012
+ return true
1013
+ }
1014
+ }
1015
+ }
1016
+ //
1017
+ return false
1018
+ }
1019
+
1020
+ //
1021
+ async function get_contact_info(cid) {
1022
+ let user_info = await ipfs_profiles.fetch_contact_info(cid)
1023
+ if ( !user_info ) {
1024
+ alert("get_contact_info: user does not exist")
1025
+ }
1026
+ return user_info
1027
+ }
1028
+
1029
+
1030
+ function reset_inputs(individual) {
1031
+ c_name = individual ? individual.name : '';
1032
+ c_DOB = individual ? individual.DOB : '';
1033
+ c_place_of_origin = individual ? individual.place_of_origin : '';
1034
+ c_cool_public_info = individual ? individual.cool_public_info : '';
1035
+ c_business = individual ? individual.business : '';
1036
+ c_public_key = individual ? individual.public_key : '';
1037
+ c_signer_public_key = individual ? individual.signer_public_key : '';
1038
+ c_answer_message = individual ? individual.answer_message : '';
1039
+ c_cid = individual ? individual.cid : '';
1040
+ }
1041
+
1042
+ let pre_clear_i = 0
1043
+ let cleared_c_form = false
1044
+ function clear_contact_form() {
1045
+ pre_clear_i = i
1046
+ i = -1
1047
+ reset_inputs(false)
1048
+ cleared_c_form = true
1049
+ }
1050
+
1051
+ function harmonize_contact_form(ev) {
1052
+ if ( i < 0 ) {
1053
+ i = pre_clear_i
1054
+ cleared_c_form = false
1055
+ } else {
1056
+ cleared_c_form = false
1057
+ }
1058
+ }
1059
+
1060
+
1061
+ function exising_contact(contact) {
1062
+ //
1063
+ for ( let cid in cid_individuals_map ) {
1064
+ let user_info = cid_individuals_map[cid]
1065
+ if ( contact.match(user_info) ) {
1066
+ return cid
1067
+ }
1068
+ }
1069
+ //
1070
+ return false
1071
+ }
1072
+
1073
+ async function respond_to_intro(msg,contact) {
1074
+ //
1075
+ if ( !(contact) ) return
1076
+ //
1077
+ let identify = active_identity
1078
+ if ( identify ) {
1079
+ let message = Object.assign({},msg) // make a special automatic message. ...
1080
+ //
1081
+ message.user_cid = identify.cid
1082
+ message.public_key = identify.user_info.public_key
1083
+ message.signer_public_key = identify.user_info.signer_public_key
1084
+ message.date = Date.now()
1085
+ message.business = business
1086
+ message.response_acceptance = true
1087
+ message.attachments = [ msg.user_cid ] //[msg.public_key,msg.signer_public_key]
1088
+ //
1089
+ let i_cid = await ipfs_profiles.send_introduction(contact.clear_identity(),identify,message)
1090
+ if ( i_cid ) {
1091
+ contact.extend_contact("must_send_keys",false) // only comes in from the intro message...
1092
+ await update_contact_page()
1093
+
1094
+ if ( identify.introductions === undefined ) {
1095
+ identify.introductions = []
1096
+ }
1097
+ identify.introductions.push(i_cid)
1098
+ update_identity(identify)
1099
+ }
1100
+ }
1101
+ //
1102
+ }
1103
+
1104
+ async function warn_spoofing(msg,contact) {
1105
+ let identify = active_identity
1106
+ if ( identify ) {
1107
+ //
1108
+ let message = Object.assign({},msg) // make a special automatic message. ...
1109
+ //
1110
+ message.user_cid = identify.cid
1111
+ message.public_key = identify.user_info.public_key
1112
+ message.signer_public_key = identify.user_info.signer_public_key
1113
+ message.date = Date.now()
1114
+ message.business = business
1115
+ message.response_acceptance = true
1116
+ message.attachments = []
1117
+ message.subject = "You received a spurious introduction."
1118
+ message.message = `Someone faking my identity sent you a message pretending to be me. Watch out for this user cid: ${msg.user_cid}`
1119
+ //
1120
+ await ipfs_profiles.send_introduction(contact.clear_identity(),identify,message)
1121
+ }
1122
+ }
1123
+
1124
+ async function update_contact_page() {
1125
+ let identify = active_identity // write to client user dir
1126
+ if ( identify ) {
1127
+ let update_cid = await ipfs_profiles.update_contacts_to_ipfs(identify,business,cid_individuals_map)
1128
+ identify.files.contacts.cid = update_cid
1129
+ await update_identity(identify)
1130
+ await get_active_users()
1131
+ }
1132
+ }
1133
+
1134
+
1135
+ function contact_wrapper(contact_info) {
1136
+ let cid = contact_info.cid
1137
+ if ( cid ) {
1138
+ //
1139
+ let contact = new Contact()
1140
+ contact.copy(contact_info)
1141
+ return contact
1142
+ }
1143
+ return false
1144
+ }
1145
+
1146
+ // auto_add_contact
1147
+ // cid -- came in the message ... this is the sender private path cid.
1148
+ // signer_pk is passed.... assuming identity is made by one key -- but it could be two keys, wrapper and signer
1149
+ // if approving a contact, then do_response is true, and a message is sent back automatically with the public keys of the current user.
1150
+ async function auto_add_contact(cid,signer_pk,do_response,msg) {
1151
+ //
1152
+ // use the private path cid pull in public wrapper key from here.
1153
+ let contact_info = await get_contact_info(cid)
1154
+ //
1155
+ if ( contact_info ) {
1156
+ //
1157
+ let origin_cid = msg.attachments[0] // should be a cid there
1158
+ let a_cid = active_identity.cid
1159
+ //
1160
+ let contact = new Contact()
1161
+ contact.copy(contact_info)
1162
+ let old_cid = exising_contact(contact)
1163
+ if ( old_cid !== false ) {
1164
+ delete cid_individuals_map[old_cid]
1165
+ // remove from individuals
1166
+ }
1167
+ contact.extend_contact("cid",cid)
1168
+ contact.extend_contact("answer_message",'')
1169
+ contact.extend_contact("signer_public_key",signer_pk) // only comes in from the intro message...
1170
+ contact.extend_contact("received_keys",true) // If here, then the keys have been received
1171
+ if ( origin_cid && (origin_cid !== a_cid) ) {
1172
+ //
1173
+ await warn_spoofing(msg,contact)
1174
+ return
1175
+ //
1176
+ }
1177
+ //
1178
+ let user_data = contact.identity()
1179
+ //
1180
+ let b = individuals
1181
+ if ( individuals[0] === empty_identity.identity() ) {
1182
+ b[0] = user_data
1183
+ } else {
1184
+ individuals.push(user_data);
1185
+ }
1186
+ individuals = b
1187
+ i = individuals.length - 1;
1188
+ //
1189
+ cid_individuals_map[cid] = user_data
1190
+ messages_update_contacts(cid,false)
1191
+ //
1192
+ if ( do_response ) { // When adding a contact from an introduction, send public keys to sender, who does have these keys - yet...
1193
+ await respond_to_intro(msg,contact)
1194
+ contact.extend_contact("must_send_keys",false) // only comes in from the intro message...
1195
+ }
1196
+ await update_contact_page()
1197
+ return true
1198
+ }
1199
+ return false
1200
+ }
1201
+
1202
+ async function add_contact() {
1203
+ let contact = new Contact()
1204
+ contact.set(c_name,c_DOB,c_place_of_origin,c_cool_public_info,c_business,c_public_key,c_signer_public_key,c_biometric_blob)
1205
+ contact.extend_contact("cid",'')
1206
+ contact.extend_contact("answer_message",'')
1207
+ contact.extend_contact("received_keys",false) // only comes in from the intro message...
1208
+ contact.extend_contact("must_send_keys",true) // only comes in from the intro message...
1209
+ //
1210
+ let user_data = contact.clear_identity()
1211
+ //
1212
+ let cid = await ipfs_profiles.fetch_contact_cid(user_data,true)
1213
+ if ( cid_individuals_map[cid] === undefined ) { // the user is already a contact
1214
+ user_data.cid = cid
1215
+ contact.extend_contact("cid",cid)
1216
+ //
1217
+ if ( individuals[0] === empty_identity.identity() ) {
1218
+ individuals[0] = user_data
1219
+ } else {
1220
+ individuals.push(user_data);
1221
+ }
1222
+ //
1223
+ i = individuals.length - 1;
1224
+ //
1225
+ cid_individuals_map[cid] = user_data
1226
+ messages_update_contacts(cid,true)
1227
+ //
1228
+ await update_contact_page()
1229
+ }
1230
+ //
1231
+ }
1232
+
1233
+ async function update_contact() {
1234
+ selected.name = c_name;
1235
+ selected.DOB = c_DOB;
1236
+ selected.place_of_origin = c_place_of_origin;
1237
+ selected.cool_public_info = c_cool_public_info;
1238
+ selected.business = c_business;
1239
+ selected.public_key = c_public_key;
1240
+ selected.c_signer_public_key = c_signer_public_key
1241
+ //
1242
+ let cid = selected.cid
1243
+ delete cid_individuals_map[cid]
1244
+ messages_update_contacts(cid,false)
1245
+ cid = await ipfs_profiles.fetch_contact_cid(selected,((c_signer_public_key !==undefined) && c_signer_public_key))
1246
+ selected.cid = cid
1247
+ cid_individuals_map[cid] = user_data
1248
+ messages_update_contacts(cid,true)
1249
+ //
1250
+ await update_contact_page()
1251
+ //
1252
+ }
1253
+
1254
+ async function remove_contact() {
1255
+ if ( i < 0 ) return
1256
+ // Remove selected person from the source array (people), not the filtered array
1257
+ const index = individuals.indexOf(selected);
1258
+ individuals = [...individuals.slice(0, index), ...individuals.slice(index + 1)];
1259
+
1260
+ i = Math.min(i, filteredIndviduals.length - 2);
1261
+
1262
+ let cid = selected.cid
1263
+ delete cid_individuals_map[cid]
1264
+ messages_update_contacts(cid,false)
1265
+ //
1266
+ await update_contact_page()
1267
+ //
1268
+ }
1269
+
1270
+ async function fetch_contacts(identify) {
1271
+ if ( identify && identify.files ) {
1272
+ if ( identify.files.contacts ) {
1273
+ let contacts_cid = identify.files.contacts.cid
1274
+ let contacts_data = await ipfs_profiles.fetch_contacts(contacts_cid,identify)
1275
+ let indivs = []
1276
+ if ( Array.isArray(contacts_data) ) {
1277
+ indivs = contacts_data.filter(el => {
1278
+ let t = (typeof el === "object") && (typeof el !== "string") && (el !== false)
1279
+ return t
1280
+ })
1281
+ } else {
1282
+ for ( let ky in contacts_data ) {
1283
+ if ( typeof ky === "string" ) { // make sure this is a cid string
1284
+ indivs.push(contacts_data[ky])
1285
+ }
1286
+ }
1287
+ }
1288
+ if ( indivs.length === 0 ) {
1289
+ individuals = [ empty_identity.identity() ]
1290
+ } else {
1291
+ individuals = indivs
1292
+ }
1293
+ make_individuals_map(contacts_data)
1294
+ }
1295
+ }
1296
+ }
1297
+
1298
+
1299
+ async function app_upload_identity() {
1300
+ await upload_identity()
1301
+ await get_active_users() // updates login page and initializes the view of this user.
1302
+ u_index = (known_users.length - 1) // user was added to the end...
1303
+ }
1304
+
1305
+ async function app_download_identity() {
1306
+ if ( active_identity ) {
1307
+ let user_info = active_identity.user_info
1308
+ await download_identity(user_info,false)
1309
+ }
1310
+ }
1311
+
1312
+
1313
+ // ---- ---- ---- ---- ---- ---- ----
1314
+
1315
+ // MANIFEST MANIFEST MANIFEST MANIFEST MANIFEST MANIFEST MANIFEST MANIFEST MANIFEST
1316
+
1317
+ let cache_contact_form_vars = []
1318
+
1319
+
1320
+ function expand_el(el) {
1321
+ let str = ""
1322
+ for ( let ky in el ) {
1323
+ let el_it = `<li>
1324
+ ${ky} : ${JSON.stringify(el[ky])}
1325
+ </li>`
1326
+ str += el_it
1327
+ }
1328
+ let el_view = `<ul style="margin-left:4px">
1329
+ ${str}
1330
+ </ul>`
1331
+ return el_view
1332
+ }
1333
+
1334
+ async function view_user_dir() {
1335
+ if ( active_user ) {
1336
+ let identify = active_identity
1337
+ let dir_data = await ipfs_profiles.get_dir(identify,false)
1338
+ let listed = ""
1339
+ for ( let el of dir_data ) {
1340
+ let el_it = `<li>
1341
+ ${expand_el(el)}
1342
+ </li>`
1343
+ listed += el_it
1344
+ }
1345
+ dir_view = `<ul style="margin-left:12px">
1346
+ ${listed}
1347
+ </ul>`
1348
+ }
1349
+ }
1350
+
1351
+ function from_dir_data(file_name,dir_data) {
1352
+ if ( Array.isArray(dir_data) ) {
1353
+ for ( let field of dir_data ) {
1354
+ if ( field.file === file_name ) {
1355
+ return field
1356
+ }
1357
+ }
1358
+ } else {
1359
+ let field = dir_data[file_name]
1360
+ return field
1361
+ }
1362
+ return false
1363
+ }
1364
+
1365
+ async function view_user_contacts() {
1366
+ if ( active_user ) {
1367
+ let identify = active_identity
1368
+ if ( typeof identify.files !== 'object' ) {
1369
+ identify.files = {}
1370
+ }
1371
+ //
1372
+ if ( (identify.files.contacts === undefined) || (typeof identify.files.contacts !== 'object') ) {
1373
+ let dir_data = await ipfs_profiles.get_dir(identify,false)
1374
+ identify.files.contacts = from_dir_data("contacts",dir_data)
1375
+ }
1376
+ //
1377
+ if ( identify ) {
1378
+ let contacts_cid = identify.files.contacts.cid
1379
+ let c_data = await ipfs_profiles.fetch_contacts(contacts_cid,identify)
1380
+ dir_view = JSON.stringify(c_data,null,4)
1381
+ dir_view = `
1382
+ <pre>
1383
+ <code>
1384
+ ${dir_view}
1385
+ </code>
1386
+ </pre>
1387
+ `
1388
+ }
1389
+ }
1390
+ }
1391
+
1392
+ async function view_user_manifest() {
1393
+ if ( active_user ) {
1394
+ let identify = active_identity
1395
+ if ( typeof identify.files !== 'object' ) {
1396
+ identify.files = {}
1397
+ }
1398
+ if ( (identify.files.manifest === undefined) || (typeof identify.files.manifest !== 'object') ) {
1399
+ let dir_data = await ipfs_profiles.get_dir(identify,false)
1400
+ identify.files.manifest = from_dir_data("manifest",dir_data)
1401
+ }
1402
+ if ( identify ) {
1403
+ let manifest_cid = identify.files.manifest.cid
1404
+ let btype = business
1405
+ let c_data = await ipfs_profiles.fetch_manifest(manifest_cid,identify,btype)
1406
+ dir_view = JSON.stringify(c_data,false,4)
1407
+ dir_view = `
1408
+ <pre>
1409
+ <code>
1410
+ ${dir_view}
1411
+ </code>
1412
+ </pre>
1413
+ `
1414
+ }
1415
+ }
1416
+ }
1417
+
1418
+
1419
+ async function view_cid_json() {
1420
+ if ( j_cid && j_cid.length ) {
1421
+ let c_data = await ipfs_profiles.fetch_cid_json(j_cid)
1422
+ if ( c_data ) {
1423
+ dir_view = JSON.stringify(c_data,false,4)
1424
+ dir_view = `
1425
+ <pre>
1426
+ <code>
1427
+ ${dir_view}
1428
+ </code>
1429
+ </pre>`
1430
+
1431
+ } else {
1432
+ dir_view = `
1433
+ <pre>
1434
+ <code>
1435
+ Can't Fetch
1436
+ </code>
1437
+ </pre>`
1438
+ }
1439
+ }
1440
+ }
1441
+
1442
+
1443
+ async function view_contact_form() {
1444
+ let t_cid = man_cid
1445
+ if ( t_cid ) {
1446
+ let tmplt = await ipfs_profiles.get_contact_template(t_cid) // we have to get the actaul data, what came in was {name,size,cid}
1447
+ if ( tmplt ) {
1448
+ dir_view = false
1449
+ //
1450
+ tmplt.cid = t_cid //
1451
+ manifest_selected_entry.html = utils.clear_char(tmplt.txt_full,'\n')
1452
+ }
1453
+
1454
+ }
1455
+ }
1456
+
1457
+
1458
+ //
1459
+ async function man_add_contact_form() {
1460
+ //
1461
+ manifest_obj.custom_contact_forms = manifest_contact_form_list
1462
+ //
1463
+ let identify = active_identity
1464
+ if ( identify ) {
1465
+ let act_cid = identify.cid
1466
+ ipfs_profiles.dont_store_html(manifest_obj)
1467
+ let update_cid = await ipfs_profiles.update_manifest_to_ipfs(identify,business,manifest_obj)
1468
+ identify.files.manifest.cid = update_cid
1469
+ await update_identity(identify)
1470
+ }
1471
+ //
1472
+ }
1473
+
1474
+ async function man_prefer_contact_form() {
1475
+ //
1476
+ manifest_obj.custom_contact_forms = manifest_contact_form_list
1477
+ manifest_obj.default_contact_form = man_cid
1478
+ //
1479
+ let identify = active_identity
1480
+ if ( identify ) {
1481
+ let act_cid = identify.cid
1482
+ ipfs_profiles.dont_store_html(manifest_obj)
1483
+ let update_cid = await ipfs_profiles.update_manifest_to_ipfs(identify,business,manifest_obj)
1484
+ identify.files.manifest.cid = update_cid
1485
+ await update_identity(identify)
1486
+ }
1487
+ //
1488
+ }
1489
+
1490
+ async function reset_man_cid(evt) {
1491
+ //
1492
+ let paste_cid = evt.clipboardData.getData('text/plain')
1493
+ //
1494
+ let a_contact_form = {
1495
+ "info" : "",
1496
+ "cid" : paste_cid,
1497
+ "wrapped_key" : "",
1498
+ "html" : ""
1499
+ }
1500
+ //
1501
+ let tmplt = await ipfs_profiles.get_contact_template(paste_cid) // we have to get the actaul data, what came in was {name,size,cid}
1502
+ //
1503
+ if ( tmplt ) {
1504
+ tmplt.cid = paste_cid //
1505
+ a_contact_form.info = tmplt.title
1506
+ a_contact_form.html = tmplt.txt_full
1507
+ //
1508
+ man_sel_not_customized = true
1509
+ cache_contact_form_vars = tmplt.var_map
1510
+ //
1511
+ manifest_contact_form_list = manifest_contact_form_list.concat(a_contact_form);
1512
+ manifest_index = manifest_contact_form_list.length - 1;
1513
+ }
1514
+ //
1515
+ }
1516
+
1517
+ async function man_update_contact_form() {
1518
+ //
1519
+ // open up some controls for populating vars, creating security on-offs, etc.
1520
+ //
1521
+ manifest_selected_entry.info = man_title;
1522
+ manifest_selected_entry.cid = man_cid;
1523
+ manifest_selected_entry.wrapped_key = man_wrapped_key;
1524
+ manifest_selected_entry.html = man_html;
1525
+ //
1526
+ let identify = active_identity
1527
+ if ( identify ) {
1528
+ let act_cid = identify.cid
1529
+ ipfs_profiles.dont_store_html(manifest_obj)
1530
+ let update_cid = await ipfs_profiles.update_manifest_to_ipfs(identify,business,manifest_obj)
1531
+ identify.files.manifest.cid = update_cid
1532
+ await update_identity(identify)
1533
+ }
1534
+ //
1535
+ }
1536
+
1537
+ async function man_remove_contact_form() {
1538
+ // Remove selected person from the source array (people), not the filtered array
1539
+ const index = manifest_contact_form_list.indexOf(manifest_selected_entry);
1540
+ manifest_contact_form_list = [...manifest_contact_form_list.slice(0, index), ...manifest_contact_form_list.slice(index + 1)];
1541
+ manifest_index = Math.min(manifest_index, filtered_manifest_contact_form_list.length - 2);
1542
+ //
1543
+ manifest_obj.custom_contact_forms = manifest_contact_form_list
1544
+ //
1545
+ let identify = active_identity
1546
+ if ( identify ) {
1547
+ let act_cid = identify.cid
1548
+ ipfs_profiles.dont_store_html(manifest_obj)
1549
+ let update_cid = await ipfs_profiles.update_manifest_to_ipfs(identify,business,manifest_obj)
1550
+ identify.files.manifest.cid = update_cid
1551
+ await update_identity(identify)
1552
+ }
1553
+ //
1554
+ }
1555
+
1556
+ /*
1557
+ {
1558
+ "default_contact_form":false,
1559
+ "custom_contact_forms": {
1560
+ "default_clear_contact_cid" : {
1561
+ "encrypted" :false,
1562
+ "preference" :1,
1563
+ "wrapped_key" :false,
1564
+ "info" : "default contact form : service provision "
1565
+ }
1566
+ },
1567
+ "sorted_cids":[false],
1568
+ "max_preference":1,
1569
+ "op_history":[]
1570
+ }
1571
+ */
1572
+
1573
+ async function fetch_manifest(identify) {
1574
+ if ( identify && identify.files ) {
1575
+ if ( identify.files.manifest ) {
1576
+ let manifest_cid = identify.files.manifest.cid
1577
+ manifest_obj = await ipfs_profiles.fetch_manifest(manifest_cid,identify)
1578
+ if ( manifest_obj.clear_cid === undefined ) {
1579
+ manifest_obj.clear_cid = identify.clear_cid
1580
+ }
1581
+ //
1582
+ let m_list = []
1583
+ if ( Array.isArray(manifest_obj.custom_contact_forms) ) {
1584
+ m_list = manifest_obj.custom_contact_forms
1585
+ } else {
1586
+ for ( let ky in manifest_obj.custom_contact_forms ) {
1587
+ let mm = manifest_obj.custom_contact_forms[ky]
1588
+ mm.cid = ky
1589
+ m_list.push(mm)
1590
+ }
1591
+ }
1592
+ //
1593
+ manifest_contact_form_list = m_list
1594
+ }
1595
+ }
1596
+ }
1597
+
1598
+
1599
+ function navigate_to_user(e) {
1600
+ active = 'User'
1601
+ }
1602
+
1603
+ </script>
1604
+
1605
+ <style>
1606
+ * {
1607
+ font-family: inherit;
1608
+ font-size: inherit;
1609
+ }
1610
+
1611
+ .splash-if-you-will {
1612
+ font-size: 140%;
1613
+ text-align: center;
1614
+ line-height: 180%;
1615
+ font-weight: 700;
1616
+ color:rgb(81, 107, 131);
1617
+ font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
1618
+ }
1619
+
1620
+ .splash-if-you-will span {
1621
+ color:rgb(27, 78, 31);
1622
+ font-weight: 900;
1623
+ font-size: 140%;
1624
+ background-color: rgb(255, 254, 238);
1625
+ padding: 12px;
1626
+ border-radius: 25px;
1627
+ font-family: 'Times New Roman', Times, serif;
1628
+ }
1629
+
1630
+
1631
+ .front-page-explain {
1632
+ padding: 8px;
1633
+ margin-top: 30px;
1634
+ color: orangered;
1635
+ font-size: 85%;
1636
+ font-weight: 500;
1637
+ border: solid 1px rgb(45, 99, 45);
1638
+ font-family:Georgia, 'Times New Roman', Times, serif;
1639
+ }
1640
+
1641
+ blockquote {
1642
+ font: 14px/22px normal helvetica, sans-serif;
1643
+ margin-top: 10px;
1644
+ margin-bottom: 10px;
1645
+ margin-left: 50px;
1646
+ padding-left: 15px;
1647
+ border-left: 3px solid rgb(221, 219, 219);
1648
+ }
1649
+
1650
+
1651
+ input {
1652
+ display: block;
1653
+ margin: 0 0 0.5em 0;
1654
+ }
1655
+
1656
+ select {
1657
+ margin: 0 1em 1em 0;
1658
+ width: 14em;
1659
+ }
1660
+
1661
+ option {
1662
+ cursor: pointer;
1663
+ }
1664
+
1665
+ .buttons {
1666
+ clear: both;
1667
+ }
1668
+
1669
+ .buttons button:disabled {
1670
+ color:slategrey;
1671
+ border-bottom-color: rgb(233, 237, 240);
1672
+ cursor:not-allowed;
1673
+ }
1674
+
1675
+ .buttons button {
1676
+ background-color:rgb(255, 249, 240);
1677
+ font-size:small;
1678
+ border-bottom-color: rgb(236, 250, 226);
1679
+ border-radius: 6px;
1680
+ font-weight: 580;
1681
+ font-style: oblique;
1682
+ }
1683
+
1684
+ .buttons button:disabled:hover {
1685
+ background-color:inherit;
1686
+ font-size:small;
1687
+ border-bottom-color: rgb(228, 240, 247);
1688
+ border-radius: 6px;
1689
+ font-weight: 580;
1690
+ font-style: oblique;
1691
+ cursor:not-allowed;
1692
+ }
1693
+
1694
+
1695
+ .header-button {
1696
+ max-width:min-content;
1697
+ border-radius: 6px;
1698
+ padding: 1px;
1699
+ background-color:rgb(248, 250, 248);
1700
+ }
1701
+
1702
+ .header-button:hover {
1703
+ background-color:rgb(51, 65, 28);
1704
+ color:yellow;
1705
+ }
1706
+
1707
+ .classy-small {
1708
+ background-color:inherit;
1709
+ font-size:small;
1710
+ border-bottom-color: chartreuse;
1711
+ border-radius: 6px;
1712
+ font-weight: 580;
1713
+ font-style: oblique;
1714
+ }
1715
+
1716
+
1717
+ .long_button {
1718
+ width:40%;
1719
+ }
1720
+
1721
+ .long_button:disabled {
1722
+ color:beige;
1723
+ }
1724
+
1725
+ .long_button:disabled:hover{
1726
+ color:beige;
1727
+ background-color:blanchedalmond;
1728
+ cursor:not-allowed;
1729
+ }
1730
+
1731
+ .button-header {
1732
+ color:rgb(104, 51, 14);
1733
+ }
1734
+
1735
+ .button-header:hover {
1736
+ color:rgb(15, 92, 34);
1737
+ background-color: rgba(242, 242, 210, 0.3);
1738
+ }
1739
+
1740
+
1741
+ .inner_div {
1742
+ padding-left: 2px;
1743
+ padding-top: 4px;
1744
+ border-bottom: 1px lightgray solid;
1745
+ min-height: 40px;
1746
+ }
1747
+
1748
+ .inner_div label {
1749
+ font-size:smaller;
1750
+ }
1751
+
1752
+
1753
+ .top-of-contact {
1754
+ margin-bottom: 4px;
1755
+ background-color: rgb(252, 249, 240);
1756
+ border: cornsilk solid 1px;
1757
+ text-align:right;
1758
+ }
1759
+
1760
+ .nice_message {
1761
+ width: 85%;
1762
+ font-size: small;
1763
+ font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
1764
+ color:rgb(54, 81, 99);
1765
+ font-weight:600;
1766
+ background: -webkit-linear-gradient(to right, white ,rgb(252, 251, 248));
1767
+ background: linear-gradient(to right, white, rgb(252, 251, 248) );
1768
+ }
1769
+
1770
+ .add-profile-div {
1771
+ margin-top:8px;
1772
+ border: 1px solid rgb(165, 161, 190);
1773
+ padding: 2px;
1774
+ background: -webkit-linear-gradient(to right, rgb(252, 251, 240) ,rgb(249, 252, 248));
1775
+ background: linear-gradient(to right, rgb(252, 251, 240), rgb(249, 252, 248) );
1776
+ }
1777
+
1778
+ .top_instructions {
1779
+ padding: 2px;
1780
+ color:rgb(66, 33, 13);
1781
+ border-bottom: sienna 1px solid;
1782
+ font: 0.9em sans-serif;
1783
+ font-weight: 600;
1784
+ font-style: oblique;
1785
+ }
1786
+
1787
+
1788
+ .team_message {
1789
+ background-color: rgb(254, 252, 245);
1790
+ border: solid 1px darkblue;
1791
+ padding:4px;
1792
+ color:rgb(12, 12, 100);
1793
+ font-size: 110%;
1794
+ height: calc(100vh - 280px);
1795
+ overflow: scroll;
1796
+ }
1797
+
1798
+ .team_message blockquote {
1799
+ width: 85%;
1800
+ line-height: 200%;
1801
+ }
1802
+
1803
+ .items {
1804
+ display: flex;
1805
+ flex-wrap: wrap;
1806
+ margin-left: 2px;
1807
+ margin-top: -10px;
1808
+ }
1809
+
1810
+ .items .item {
1811
+ flex: 1 0 300px;
1812
+ box-sizing: border-box;
1813
+ background: -webkit-linear-gradient(to right, rgba(242, 242, 210, 0.3), white);
1814
+ background: linear-gradient(to right, rgba(242, 242, 210, 0.3), white );
1815
+ color: #171e42;
1816
+ padding: 10px;
1817
+ margin-left: 2px;
1818
+ margin-top: 0px;
1819
+ }
1820
+
1821
+ .items {
1822
+ padding-left: 5px;
1823
+ padding-bottom: 4px;
1824
+ padding-right: 12px;
1825
+ font-size: 110%;
1826
+ font-family: sans-serif;
1827
+ }
1828
+
1829
+ td, th {
1830
+ border : 1px solid rgb(47, 79, 49);
1831
+ border-right: none;
1832
+ padding : 2px;
1833
+ margin : 0px;
1834
+ }
1835
+
1836
+ th {
1837
+ color :rgb(47, 79, 49);
1838
+ font-weight: bolder;
1839
+ background-color: seashell;
1840
+ }
1841
+
1842
+ table {
1843
+ border-right: solid 1px darkslategray;
1844
+ }
1845
+
1846
+ .subject {
1847
+ font-weight: bold;
1848
+ }
1849
+
1850
+ .sender {
1851
+ background-color: rgb(255, 255, 255);
1852
+ font-weight: 600;
1853
+ color:rgb(27, 78, 31);
1854
+ padding-left: 4px;
1855
+ }
1856
+
1857
+
1858
+ .tableFixHead {
1859
+ overflow-y: auto;
1860
+ height: calc(100vh - 200px);
1861
+ }
1862
+ .tableFixHead thead th {
1863
+ position: sticky;
1864
+ top: 0;
1865
+ }
1866
+ table {
1867
+ border-collapse: collapse;
1868
+ width: 100%;
1869
+ }
1870
+ th, td {
1871
+ padding: 8px 16px;
1872
+ border: 1px solid #ccc;
1873
+ }
1874
+ th {
1875
+ background: #eee;
1876
+ }
1877
+
1878
+ tr {
1879
+ cursor: pointer;
1880
+ }
1881
+
1882
+ .tableFixHead option {
1883
+ cursor: pointer;
1884
+ }
1885
+
1886
+
1887
+ .user-options {
1888
+ background-color: rgb(252, 252, 249);
1889
+ }
1890
+
1891
+ .user-options option {
1892
+ cursor: pointer;
1893
+ }
1894
+
1895
+ .selected_form_link-display {
1896
+ margin-top:4px;
1897
+ margin-bottom:4px;
1898
+ border: solid 1px rgb(13, 48, 20);
1899
+ padding:4px;
1900
+ background-color: white;
1901
+ height:200px;
1902
+ overflow:auto;
1903
+ }
1904
+
1905
+ #man_cid {
1906
+ font-size:smaller;
1907
+ min-width:100%;
1908
+ font-weight:bold;
1909
+ }
1910
+
1911
+ .signup-status {
1912
+ color: black;
1913
+ background-color: rgb(254, 252, 245);
1914
+ font-weight: bold;
1915
+ border: solid 1px rgb(13, 48, 20);
1916
+ padding:4px;
1917
+ height: 60px;
1918
+ overflow: auto;
1919
+ }
1920
+ .good-status {
1921
+ color: green;
1922
+ }
1923
+ .bad-status {
1924
+ color: red;
1925
+ }
1926
+
1927
+ .contact_form_list {
1928
+ margin-top:4px;
1929
+ margin-bottom:4px;
1930
+ border: solid 1px navy;
1931
+ padding:4px;
1932
+ color: darkgreen;
1933
+ background-color: rgb(253, 249, 242);
1934
+ text-align: center;
1935
+ }
1936
+
1937
+ .signup-grid-container {
1938
+ display: grid;
1939
+ grid-column-gap: 2px;
1940
+ grid-row-gap: 2px;
1941
+ grid-template-columns: 65% auto;
1942
+ background-color: rgb(250, 250, 242);
1943
+ padding: 4px;
1944
+ }
1945
+
1946
+ .signerupper {
1947
+ background-color: rgb(252, 251, 248);
1948
+ border: solid 1px rgb(0, 0, 117);
1949
+ padding:6px;
1950
+ }
1951
+
1952
+ .picture-drop {
1953
+ width:90px;
1954
+ min-height:90px;
1955
+ border: 1px solid navy;
1956
+ background-color:rgb(225, 230, 236);
1957
+ display:inline-block;
1958
+ margin: 2px;
1959
+ text-align:center;
1960
+ vertical-align: middle;
1961
+ cursor:pointer;
1962
+ }
1963
+
1964
+ .picture-drop:hover {
1965
+ border: 2px dotted rgb(180, 8, 31);
1966
+ background-color:rgb(151, 197, 114);
1967
+ }
1968
+
1969
+ .picture-drop > .capture_image {
1970
+ position:absolute;
1971
+ top:0px;
1972
+ left:0px;
1973
+ z-index:100;
1974
+ width: auto;
1975
+ height: inherit;
1976
+ border:none;
1977
+ cursor:pointer;
1978
+ }
1979
+
1980
+ .contact_controls {
1981
+ width: calc(32vw - 96px);
1982
+ margin: 2px;
1983
+ border: 1px solid navy;
1984
+ display:inline-block;
1985
+ background-color: white;
1986
+ }
1987
+
1988
+ .contact_controls button {
1989
+ border-radius: 8px;
1990
+ }
1991
+
1992
+ .manifest-grid-container {
1993
+ display: grid;
1994
+ grid-column-gap: 2px;
1995
+ grid-row-gap: 2px;
1996
+ grid-template-columns: 40% auto;
1997
+ background-color: rgb(250, 250, 242);
1998
+ padding: 4px;
1999
+ }
2000
+
2001
+ .manifester {
2002
+ background-color: rgb(244, 248, 244);
2003
+ border: solid 1px darkblue;
2004
+ padding:4px;
2005
+ }
2006
+
2007
+ .active-tab {
2008
+ color: rgb(40, 122, 19);
2009
+ background-color: rgb(255, 255, 255);
2010
+ font-weight: bolder;
2011
+ }
2012
+
2013
+ .plain-tab {
2014
+ color: rgb(1, 10, 1);
2015
+ }
2016
+
2017
+ .manifest-contact-entry-instruct {
2018
+ font-weight: 540;
2019
+ font-style:oblique;
2020
+ padding-right:3px;
2021
+ color:tomato;
2022
+ background-color: rgba(235, 225, 235, 0.61);
2023
+ }
2024
+
2025
+ .man-default-selected {
2026
+ color:rgb(56, 156, 81);
2027
+ background-color:rgb(231, 243, 231);
2028
+ font-weight: bold;
2029
+ border: 1x solid rgb(7, 78, 7);
2030
+ }
2031
+ .man-default-not-selected {
2032
+ color:navy;
2033
+ }
2034
+
2035
+ .processed-category {
2036
+ font-weight: bold;
2037
+ color:rgb(22, 63, 63);
2038
+ font-size:larger;
2039
+ text-transform:capitalize;
2040
+ }
2041
+
2042
+ .cid-grabber {
2043
+ font-weight:bolder;
2044
+ color:navy;
2045
+ }
2046
+
2047
+ .cid-grabber-label {
2048
+ font-weight:600;
2049
+ color:rgb(50, 148, 50);
2050
+ font-style: oblique;
2051
+ }
2052
+
2053
+ </style>
2054
+
2055
+ <div>
2056
+ <!--
2057
+ Note: tabs must be unique. (They cannot === each other.)
2058
+ -->
2059
+ <TabBar tabs={['Identify', 'User', 'Messages', 'Introductions', 'Processed', 'Contacts', 'Manifest', 'About Us']} let:tab bind:active>
2060
+ <!-- Note: the `tab` property is required! -->
2061
+ <Tab {tab}>
2062
+ <Label><span class={ (tab === active) ? "active-tab" : "plain-tab"}>{tab}</span></Label>
2063
+ </Tab>
2064
+ </TabBar>
2065
+ <br>
2066
+
2067
+ {#if (active === 'Identify')}
2068
+ <div class="splash-if-you-will" style="height:fit-content" >
2069
+ {#if (known_users.length > 0) }
2070
+ <div style="height:fit-content">
2071
+ The current user is <span>{active_user ? active_user.name : "being created" }</span>.
2072
+ <br>
2073
+ Not you? Select from the list below or Add yourself with the User tab.
2074
+ <div class="user-options" style="text-align:center" >
2075
+ <select bind:value={u_index} size={10} style="text-align:center;" on:click={navigate_to_user} >
2076
+ {#each known_users as maybe_user, u_index }
2077
+ <option value={u_index}>{maybe_user.name}</option>
2078
+ {/each}
2079
+ </select>
2080
+ </div>
2081
+ </div>
2082
+ {:else}
2083
+ <div class="splash-if-you-will" >
2084
+ Please join us in using this way of sending messages.
2085
+ <div>
2086
+ Click on the <span>User</span> tab.
2087
+ </div>
2088
+ </div>
2089
+ {/if}
2090
+ <div class="front-page-explain">
2091
+ Pro-mail is like e-mail.
2092
+ <br>
2093
+ But, where e-mail is complicated, Pro-mail is simpler.
2094
+ <br>
2095
+ And, where Pro-mail is more complicated, it's more fun.
2096
+ <br>
2097
+ No just more fun.
2098
+ <br>
2099
+ More secure
2100
+ <br>
2101
+ More customizable.
2102
+ <br>
2103
+ More Manageable
2104
+ <br>
2105
+ Easier to Filter and Maintain
2106
+ </div>
2107
+ </div>
2108
+ {:else if (active === 'User')}
2109
+ <div class="signup-grid-container">
2110
+ <div class="signerupper">
2111
+ <br>
2112
+ <div class="top_instructions" >
2113
+ Please enter Unique Information about yourself which you would be willing to share with anyone:
2114
+ </div>
2115
+ <br>
2116
+ <div class="inner_div" >
2117
+ <label for="name"style="
2118
+ display:inline" >Name: </label>
2119
+ <input id="name" bind:value={name} placeholder="Name" style="display:inline">
2120
+ <input bind:checked={business} type="checkbox" style="display:inline" ><span>Business (if checked)</span>
2121
+ </div>
2122
+ <div class="inner_div" >
2123
+ {#if business }
2124
+ <label for="DOB" style="display:inline" >Year of Inception: </label><input id="DOB" bind:value={DOB} placeholder="Year of Inception" style="display:inline" >
2125
+ {:else}
2126
+ <label for="DOB" style="display:inline" >DOB: </label><input id="DOB" bind:value={DOB} placeholder="Date of Birth" style="display:inline" >
2127
+ {/if}
2128
+ </div>
2129
+ <div class="inner_div" >
2130
+ {#if business }
2131
+ <label for="POO" style="display:inline" >Main Office: </label><input id="POO" bind:value={place_of_origin} placeholder="Main Office" style="display:inline" >
2132
+ {:else}
2133
+ <label for="POO" style="display:inline" >Place of Origin: </label><input id="POO" bind:value={place_of_origin} placeholder="Place of Origin" style="display:inline" >
2134
+ {/if}
2135
+ </div>
2136
+ <div class="inner_div" >
2137
+ <label for="self-text">Cool Public Info</label><br>
2138
+ <textarea id="self-text" bind:value={cool_public_info} placeholder="Something you would say to anyone about yourself" />
2139
+ </div>
2140
+ <div class="add-profile-div" style="text-align:center" >
2141
+ {#if creation_to_do }
2142
+ <div style = { green ? "background-color:rgba(245,255,250,0.9)" : "background-color:rgba(250,250,250,0.3)" } >
2143
+ <button class="long_button" on:click={add_profile} disabled={creator_disabled}>Create my contact profile.</button>
2144
+ </div>
2145
+ {:else}
2146
+ <div style = { green ? "background-color:rgba(245,255,250,0.9)" : "background-color:rgba(250,250,250,0.3)" } >
2147
+ <span class="cid-grabber-label">Your custom id number:</span> <span class="cid-grabber">{active_cid}</span>
2148
+ </div>
2149
+ {/if}
2150
+ </div>
2151
+ <div class="nice_message">
2152
+ <blockquote>
2153
+ Enter your information above. This information will be used to make an identifier for sending and receiving messages.
2154
+ When you click on the button, "Create my contact profile", your information will go to a gateway server. The gateway server
2155
+ will use your information to make an ID, called a CID. This "User" tab, that you are looking at now, will store the CID for you as part of your identity.
2156
+ It will also store other information that the server will create for you so that you may begin sending and receiving message between
2157
+ you and your contacts.
2158
+ </blockquote>
2159
+ <blockquote>
2160
+ Your identity will be a structure containing directory and file information and public and private keys.
2161
+ <b>This web app uses the structure to store your private information locally in the browser database.</b>
2162
+ And, you will be able to download the idenity structure as a JSON obect at any time.
2163
+ <b>This JSON structure information will never be sent from the browser by these pages.</b> It will be stored in the bowser database
2164
+ as long as you want.
2165
+ </blockquote>
2166
+ <blockquote>
2167
+ Use the buttons on the right side of the page to create or delete and identity. And, use the <b>Identity</b> buttons,
2168
+ with the <i>down</i> triangle ▼ and the <i>up</i> triangle ▲ to download your JSON to disk and to upload your identity, respectively.
2169
+ For exampe, you may download your identity to a thumb drive for safe keeping. Or you may upload your identity into another
2170
+ browser or restore to a browser if it has been previously deleted.
2171
+ </blockquote>
2172
+ <blockquote>
2173
+ The information you enter above should be unique. For example, I know that my name is shared by at least three other people on the planet,
2174
+ all of whom were born in the same year. But, they are from different towns or countries. So, I don't hesitate to enter my place of origin.
2175
+ And, I am willing to share my real place of origin with anyone.
2176
+ </blockquote>
2177
+ <blockquote>
2178
+ Some of the public information that you enter, not including keys, may be used later in an API link only if you have interests for which you would be willing to receive unsolicited mail.
2179
+ You may choose the groups or businesses that may publish to topics that you select. You may make selections at a later time. And, the process of managing
2180
+ topics will be workable on topics pages separate from these message pages. Topic management will, hopefully, direct most
2181
+ advertisement messaging away from your personal and business messaging.
2182
+ </blockquote>
2183
+ <blockquote>
2184
+ <span style="color:blue;">Note:</span> no information will be sent to any organization as a result of signing up.
2185
+ All information, excluding private keys, and your personalized assets such as your contact pages, public and encrypted,
2186
+ will be stored in the Interplanetary File System (IPFS). Most of the informaion kept in the IPFS will be encrypted, and will
2187
+ only be accessibly by keys stored in your identity. (So, do download your idenity structure an keep it safe between sessions.)
2188
+ </blockquote>
2189
+ </div>
2190
+ </div>
2191
+ <div class="signerupper">
2192
+ <div class="signup-status">
2193
+ status: <span class={signup_status === 'OK' ? "good-status" : "bad-status"}>{signup_status}</span>
2194
+ </div>
2195
+ <div>
2196
+ {#if creation_to_do }
2197
+ <div class="picture-drop" on:drop={drop_biometric} on:dragover={dragover_picture} >
2198
+ <img src={active_profile_biometric} bind:this={biometric_data_el} alt={src_biometric_instruct} />
2199
+ </div>
2200
+ {/if}
2201
+ {#if !creation_to_do }
2202
+ <div class="picture-drop" on:drop={drop_picture} on:dragover={dragover_picture} >
2203
+ <img src={active_profile_image} bind:this={profile_image_el} alt={src_1_name} />
2204
+ </div>
2205
+ {/if}
2206
+ <div>
2207
+ <div class="contact_controls">
2208
+ <button on:click={clear_identify_form} >∋ new </button>
2209
+ <button on:click={remove_identify_seen_in_form} >∌ remove</button>
2210
+ </div>
2211
+ <div class="contact_controls">
2212
+ <button on:click={app_download_identity} >▼ identity</button>
2213
+ <button on:click={app_upload_identity} >▲ identity</button>
2214
+ </div>
2215
+ </div>
2216
+ </div>
2217
+ </div>
2218
+ </div>
2219
+ {:else if (active === 'Messages')}
2220
+ <div>Your Message History</div>
2221
+ <div>
2222
+ <div class="tableFixHead" >
2223
+ <table style="width:100%">
2224
+ <thead>
2225
+ <tr>
2226
+ <th class="button-header" style="width:5%">
2227
+ <button class="header-button" on:click={doops_messages}>Op</button>
2228
+ </th><th style="width:20%">Date</th><th style="width:30%">Sender</th><th style="width:55%;text-align: left;">Subject</th>
2229
+ </tr>
2230
+ </thead>
2231
+ {#if inbound_contact_messages.length }
2232
+ {#each inbound_contact_messages as a_message, c_i }
2233
+ <tr on:click={full_message} id="m_contact_{c_i}" class="element-poster" on:mouseover="{show_subject}">
2234
+ <td class="op-select"style="width:5%;text-align:center">
2235
+ <input id="doop-m_contact_{c_i}" type="checkbox" on:click={check_box_block} >
2236
+ </td>
2237
+ <td class="date" style="width:20%;text-align:center">{a_message.date}</td>
2238
+ <td class="sender" style="width:30%">{a_message.name}</td>
2239
+ <td class="subject" style="width:55%">{@html a_message.subject}</td>
2240
+ </tr>
2241
+ {/each}
2242
+ {/if}
2243
+ </table>
2244
+ </div>
2245
+ </div>
2246
+ {:else if active === 'Introductions' }
2247
+ <div>Introduction Messages</div>
2248
+ <div>
2249
+ <div class="tableFixHead" >
2250
+ <table style="width:100%">
2251
+ <thead>
2252
+ <tr>
2253
+ <th class="button-header" style="width:5%">
2254
+ <button class="header-button" on:click={doops_intros}>Op</button>
2255
+ </th><th style="width:20%">Date</th><th style="width:30%">Sender</th><th style="width:55%;text-align: left;">Subject</th>
2256
+ </tr>
2257
+ </thead>
2258
+ {#if inbound_solicitation_messages.length }
2259
+ {#each inbound_solicitation_messages as a_message, i_i }
2260
+ <tr on:click={full_message} id="m_intro_{i_i}" class="element-poster" on:mouseover="{show_subject}">
2261
+ <td class="op-select"style="width:5%;text-align:center">
2262
+ <input id="doop-m_intro_{i_i}" type="checkbox"on:click={check_box_block} >
2263
+ </td>
2264
+ <td class="date" style="width:20%;text-align:center">{a_message.date}</td>
2265
+ <td class="sender" style="width:30%">{a_message.name}</td>
2266
+ <td class="subject" style="width:60%">{@html a_message.subject}</td>
2267
+ </tr>
2268
+ {/each}
2269
+ {/if}
2270
+ </table>
2271
+ </div>
2272
+ </div>
2273
+ {:else if active === 'Processed' }
2274
+ <div>
2275
+ <span class="processed-category" >{processed_category}</span></div>
2276
+ <div>
2277
+ <div class="tableFixHead" >
2278
+ <table style="width:100%">
2279
+ <thead>
2280
+ <tr>
2281
+ <th class="button-header" style="width:5%">
2282
+ <button class="header-button" on:click={doops_processed}>Op</button>
2283
+ </th><th style="width:20%">Date</th><th style="width:30%">Sender</th><th style="width:55%;text-align: left;">Subject</th>
2284
+ </tr>
2285
+ </thead>
2286
+ {#if processed_messages.length }
2287
+ {#each processed_messages as a_message, p_i }
2288
+ <tr on:click={full_message} id="m_category_{p_i}" class="element-poster" on:mouseover="{show_subject}">
2289
+ <td class="op-select"style="width:5%;text-align:center">
2290
+ <input id="doop-m_category_{p_i}" type="checkbox" on:click={check_box_block} >
2291
+ </td>
2292
+ <td class="date" style="width:20%;text-align:center">{a_message.date}</td>
2293
+ <td class="sender" style="width:30%">{a_message.name}</td>
2294
+ <td class="subject" style="width:60%">{@html a_message.subject}</td>
2295
+ </tr>
2296
+ {/each}
2297
+ {/if}
2298
+ </table>
2299
+ </div>
2300
+ </div>
2301
+ {:else if (active === 'Contacts')}
2302
+ <div class="items">
2303
+ <div class="item" >
2304
+ <input placeholder="filter prefix" bind:value={prefix}>
2305
+ <select bind:value={i} size={5} >
2306
+ {#each filteredIndviduals as individual, i}
2307
+ <option value={i} on:click={harmonize_contact_form} >{individual.name}</option>
2308
+ {/each}
2309
+ </select>
2310
+ <div class='buttons'>
2311
+ <button class='classy-small' on:click={add_contact} disabled={c_empty_fields}>add</button>
2312
+ <button class='classy-small' on:click={update_contact} disabled={!c_name || !selected || cleared_c_form}>update</button>
2313
+ <button class='classy-small' on:click={remove_contact} disabled={!selected || cleared_c_form}>delete</button>
2314
+ </div>
2315
+ </div>
2316
+ <div class="item" style="border-top:darkslategrey solid 2px;">
2317
+ <div class="top-of-contact">
2318
+ <button class="long_button classy-small" on:click={clear_contact_form} >clear form</button>
2319
+ </div>
2320
+ <div class="inner_div" >
2321
+ <label for="name"style="display:inline" >Name: </label>
2322
+ <input id="name" bind:value={c_name} placeholder="Name" style="display:inline">
2323
+ <input bind:checked={c_business} type="checkbox" style="display:inline">
2324
+ {#if c_business }
2325
+ <span>Business</span>
2326
+ {:else}
2327
+ <span>Person</span>
2328
+ {/if}
2329
+ </div>
2330
+ <div class="inner_div" >
2331
+ {#if c_business }
2332
+ <label for="DOB" style="display:inline" >Year of Inception: </label><input id="DOB" bind:value={c_DOB} placeholder="Year of Inception" style="display:inline" >
2333
+ {:else}
2334
+ <label for="DOB" style="display:inline" >DOB: </label><input id="DOB" bind:value={c_DOB} placeholder="Date of Birth" style="display:inline" >
2335
+ {/if}
2336
+ </div>
2337
+ <div class="inner_div" >
2338
+ {#if c_business }
2339
+ <label for="POO" style="display:inline" >Main Office: </label><input id="POO" bind:value={c_place_of_origin} placeholder="Main Office" style="display:inline" >
2340
+ {:else}
2341
+ <label for="POO" style="display:inline" >Place of Origin: </label><input id="POO" bind:value={c_place_of_origin} placeholder="Place of Origin" style="display:inline" >
2342
+ {/if}
2343
+ </div>
2344
+ <div class="inner_div" >
2345
+ <label for="self-text">Cool Public Info</label><br>
2346
+ <textarea id="self-text" bind:value={c_cool_public_info} placeholder="Copy info given to you by your new contact" />
2347
+ </div>
2348
+ <div class="inner_div" >
2349
+ <label for="CID" style="display:inline;font-size:smaller" >CID: </label><input id="CID" bind:value={c_cid} placeholder="cid" style="display:inline;width:70%" disabled >
2350
+ <label for="PK" style="display:inline;font-size:smaller" >PK</label>
2351
+ <input id="PK" type="checkbox" style="display:inline" checked={(c_public_key && (c_public_key.length > 0))} disabled >
2352
+ </div>
2353
+ </div>
2354
+ <div class="item" style="border-top:darkslategrey solid 2px;" >
2355
+ <span class="top_instructions" >Compose a new message for:</span> {c_name}
2356
+ <br><br>
2357
+ <button class="long_button" on:click={pop_editor}>compose</button>
2358
+ </div>
2359
+ </div>
2360
+ {:else if (active === 'Manifest') }
2361
+ <div>
2362
+ <blockquote>
2363
+ The manifest is your list of custom contact forms.
2364
+ When you send a message to someone, you may send them a link to one of your contact forms that will best handle
2365
+ the way that your contact might respond to you. Use the tools here to manage your collection of contact forms.
2366
+ </blockquote>
2367
+ <div class="manifest-grid-container" >
2368
+ <div class="manifester">
2369
+ <div style="display:block" >
2370
+ <div style="display:inline;float:left">
2371
+ <input placeholder="filter prefix" bind:value={man_prefix}>
2372
+ <select bind:value={manifest_index} size={5}>
2373
+ {#each filtered_manifest_contact_form_list as contact_item, manifest_index}
2374
+ <option value={manifest_index}>{contact_item.info}</option>
2375
+ {/each}
2376
+ </select>
2377
+ </div>
2378
+ <div class='buttons' style="display:inline;float:clear" >
2379
+ <button on:click={view_user_dir} >directory</button>
2380
+ <button on:click={view_user_contacts} >contacts file</button>
2381
+ <button on:click={view_user_manifest} >manifest file</button>
2382
+ <button on:click={view_contact_form} >view contact form</button>
2383
+ <button on:click={view_cid_json} >view json from cid</button>
2384
+ </div>
2385
+ </div>
2386
+ <div class="inner_div" style="background-color:beige;border:solid 1px grey" >
2387
+ <div style="height:fit-content" >
2388
+ <div class="manifest-contact-entry-instruct" >
2389
+ Use the contact form explorer "Contact Template Management" to find IPFS Links to enter in the field below.
2390
+ </div>
2391
+ <label for="man_cid"style="display:inline" >Manifest IPFS Link: </label>
2392
+ <input id="man_cid" bind:value={man_cid} placeholder="cid" style="display:inline" on:paste={reset_man_cid} >
2393
+ </div>
2394
+ <div class='buttons'>
2395
+ <button on:click={man_add_contact_form} disabled="{!man_title}">sync</button>
2396
+ <button class={man_contact_is_default ? "man-default-selected" : "man-default-not-selected"} on:click={man_prefer_contact_form} disabled="{!man_title}">
2397
+ {#if man_contact_is_default }
2398
+ default
2399
+ {:else}
2400
+ set default
2401
+ {/if}
2402
+ </button>
2403
+ <button on:click={man_remove_contact_form} disabled="{!manifest_selected_entry}">delete</button>
2404
+ <button on:click={man_update_contact_form} disabled="{!man_title || !manifest_selected_entry}">customize</button>
2405
+ </div>
2406
+ </div>
2407
+ <div class="inner_div" >
2408
+ <div style="background-color:beige;border-bottom: darkgreen 1px solid;margin-bottom: 4px;">
2409
+ <label for="preference"style="display:inline" >Max Preference All Forms: </label>
2410
+ <input id="preference" bind:value={man_max_preference} placeholder="Preference Number" style="display:inline" disabled >
2411
+ </div>
2412
+ <label for="name"style="display:inline" >Name: </label>
2413
+ <input id="name" bind:value={man_title} placeholder="Name" style="display:inline" disabled={man_sel_not_customized}>
2414
+ <br>
2415
+ <label for="man_sel_pref" >Selected Form Preference: </label>
2416
+ <input id="man_sel_pref" bind:value={man_preference} placeholder="1.0" style="display:inline" >
2417
+ <div>
2418
+ <label for="man_sel_pref" >Wrapped Key: </label><br>
2419
+ <textarea id="man_contact_key" bind:value={man_wrapped_key} style="display:inline" disabled />
2420
+ <label for="man_contact_enc" >encrypted</label>
2421
+ <input id="man_contact_enc" type="checkbox" checked={man_encrypted ? true : false } style="display:inline" disabled />
2422
+ </div>
2423
+
2424
+ </div>
2425
+ </div>
2426
+ {#if (dir_view !== false) }
2427
+ <div class="manifester">
2428
+ {@html dir_view}
2429
+ </div>
2430
+ {:else if manifest_selected_form }
2431
+ <div class="manifester">
2432
+ {@html manifest_selected_form}
2433
+ </div>
2434
+ {:else}
2435
+ <div class="manifester">
2436
+ No form defined.
2437
+ </div>
2438
+ {/if}
2439
+ </div>
2440
+ <div style="height:fit-content" >
2441
+ <label for="j_cid" style="display:inline" >CID For JSON File: </label>
2442
+ <input id="j_cid" bind:value={j_cid} placeholder="cid" style="display:inline" >
2443
+ </div>
2444
+
2445
+ </div>
2446
+ {:else if (active === 'About Us') }
2447
+ <div class="team_message" >
2448
+ <blockquote>
2449
+ This service is free. It is a way for you to set up messaging with other people.
2450
+ It is like email, but it offers an alernative ways of running your message process.
2451
+ </blockquote>
2452
+ <blockquote>
2453
+ For one, there is no email service associated with this way of handling messages.
2454
+ All messages and interfaces for interacting with the processes are stored on the InterPlanetary File System.
2455
+ </blockquote>
2456
+ <blockquote>
2457
+ Your contact pages is stored there. This tool makes the contact page and stores it for you. Then when someone wants to send
2458
+ you a message, they access your contact page. The person who sends you a message will write a message on your page and click send.
2459
+ The contact page you use will send a message service that is baked into the contact page.
2460
+ </blockquote>
2461
+ <blockquote>
2462
+ This tool, makes and stores the kind of contact page you want to store. So, by selecting the type of contact page, you will also be selecting
2463
+ how you want to communicate. You also get to select your style of contact page. Maybe you want to have your picture on it, maybe not.
2464
+ Depending on the community of contact page makers, you may find different styles. Each style is part of a template. And, you select the template.
2465
+ </blockquote>
2466
+ <blockquote>
2467
+ <span style="font-weight: bold;">How to get the word out about your page?</span> You are probably used to handing out a business card with your email on it.
2468
+ But, instead of that, you can hand out the link to your contact page. The actual link that you receive when you sign up might be hard to read.
2469
+ But, you can give out the contents of the fields that you entered in order to make your contact page.
2470
+ </blockquote>
2471
+ <blockquote>
2472
+ The reason we have asked for information you might tell anyone is that we are asking for information you want to share. This information should identify you,
2473
+ but not give away secrets. When someone sends a message, we can find your contact page by reprocessing the same information.
2474
+ </blockquote>
2475
+ <blockquote>
2476
+ If you don't want to print you contact information on your business card, you can always just give out the hash code.
2477
+ But, keep in mind, your contacts will have to type it.
2478
+ </blockquote>
2479
+ <blockquote>
2480
+ Now, you can store contact information in your list of contacts. Each of these links will find the contact page.
2481
+ </blockquote>
2482
+ <blockquote>
2483
+ Now about getting unsoliceted mail or blog feeds from organizations. For these you get a separate number. Messages being sent through a messaging service will use
2484
+ an API link to send messages to the agreed upon topic (the topic you tell the organization that they can bug you about.) You can use your topic dashbaord to
2485
+ select the latest news from organization you care about.
2486
+ </blockquote>
2487
+ <blockquote>
2488
+ Messages from contacts will show up in your mail stream (promail). Find links to that on your management dashboard (also generated by when you sign up.)
2489
+ To help you find your information when you go back to your browser, the information you enter on signing up will be stored in your broswer's database (indexedDb).
2490
+ If you switch browsers, you can always enter your information again, and click "restore". You will also find an option to remove your information from your browser.
2491
+ </blockquote>
2492
+ </div>
2493
+ {/if}
2494
+ </div>
2495
+
2496
+ <FloatWindow title={message_selected.name} scale_size_array={all_window_scales} index={0} use_smoke={false}>
2497
+ <MessageDisplay {...message_selected} on:message={handle_message} />
2498
+ </FloatWindow>
2499
+
2500
+ <!---->
2501
+ {#if selected !== undefined }
2502
+ <FloatWindow title={selected.name} scale_size_array={all_window_scales} index={1} use_smoke={false}>
2503
+ <MessageEditor {...selected} reply_to={message_selected} from_contact={message_edit_from_contact}
2504
+ active_identity={active_identity}
2505
+ cc_list={filtered_cc_list}
2506
+ contact_form_list={filtered_manifest_contact_form_list}/>
2507
+ </FloatWindow>
2508
+ {/if}
2509
+
2510
+ <FloatWindow title={message_edit_list_name} scale_size_array={all_window_scales} index={2} use_smoke={false}>
2511
+ <MessageListEdit message_edit_type="Message Ops" active_identity={active_identity} on:message={handle_message} />
2512
+ </FloatWindow>
2513
+