this.me 2.8.1 → 2.8.3

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 (59) hide show
  1. package/README.md +44 -55
  2. package/index.js +15 -0
  3. package/jsdoc.json +21 -13
  4. package/nino.js +2 -0
  5. package/package.json +3 -7
  6. package/src/cli/CLI.md +20 -0
  7. package/src/cli/ascii_art/welcome.js +1 -1
  8. package/src/cli/commands.js +17 -0
  9. package/src/cli/main.js +23 -167
  10. package/src/cli/shell.js +201 -0
  11. package/src/hash.js +24 -0
  12. package/src/me.html +0 -19
  13. package/src/me.js +6 -4
  14. package/src/searchImages.js +31 -0
  15. package/Cleaker-removebg-preview (1).png +0 -0
  16. package/docs/Me.html +0 -697
  17. package/docs/README.md +0 -77
  18. package/docs/ThisMe.html +0 -690
  19. package/docs/cli_main.js.html +0 -382
  20. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  21. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  22. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  23. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  24. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  25. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  26. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  27. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  28. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  29. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  30. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  31. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  32. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  33. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  34. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  35. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  36. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  37. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  38. package/docs/global.html +0 -454
  39. package/docs/index.html +0 -257
  40. package/docs/me.js.html +0 -211
  41. package/docs/module-CLI.html +0 -1117
  42. package/docs/neurons_logo.png +0 -0
  43. package/docs/scripts/app.min.js +0 -1
  44. package/docs/scripts/linenumber.js +0 -26
  45. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  46. package/docs/scripts/prettify/lang-css.js +0 -2
  47. package/docs/scripts/prettify/prettify.js +0 -28
  48. package/docs/scripts/search.js +0 -39
  49. package/docs/styles/app.min.css +0 -1
  50. package/docs/styles/iframe.css +0 -13
  51. package/docs/styles/jsdoc-default.css +0 -358
  52. package/docs/styles/prettify-jsdoc.css +0 -111
  53. package/docs/styles/prettify-tomorrow.css +0 -132
  54. package/docs/styles/reset.css +0 -44
  55. package/src/os/unix/install_me.sh +0 -5
  56. package/src/this/dir.js +0 -0
  57. package/src/this/file.js +0 -0
  58. package/src/this/url.js +0 -0
  59. package/src/this/video.js +0 -0
@@ -1,382 +0,0 @@
1
-
2
-
3
- <!DOCTYPE html>
4
- <html lang="en">
5
-
6
- <head>
7
- ...
8
- <meta charset="utf-8">
9
- <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <title>This.Me cli/main.js</title>
11
-
12
- <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
13
- <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
14
- <script src="./build/entry.js"></script>
15
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
16
- <!--[if lt IE 9]>
17
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
18
- <![endif]-->
19
- <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
20
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
21
- <link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
22
- <link type="text/css" rel="stylesheet" href="styles/app.min.css">
23
- <link type="text/css" rel="stylesheet" href="styles/iframe.css">
24
- <link type="text/css" rel="stylesheet" href="style.css">
25
- <script async defer src="https://buttons.github.io/buttons.js"></script>
26
-
27
-
28
- </head>
29
-
30
-
31
-
32
- <body class="layout small-header">
33
- <div id="stickyNavbarOverlay"></div>
34
-
35
-
36
- <div class="top-nav">
37
- <div class="inner">
38
- <a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
39
- <span aria-hidden="true"></span>
40
- <span aria-hidden="true"></span>
41
- <span aria-hidden="true"></span>
42
- </a>
43
- <div class="logo">
44
-
45
-
46
- <a href="index.html">
47
- <h1 class="navbar-item">This.Me</h1>
48
- </a>
49
-
50
- </div>
51
- <div class="menu">
52
-
53
- <div class="navigation">
54
- <a
55
- href="index.html"
56
- class="link"
57
- >
58
- Documentation
59
- </a>
60
-
61
-
62
-
63
- <a
64
- class="link user-link "
65
- href="https://suign.github.io/all.this/"
66
- >
67
- all.This @Packages
68
- </a>
69
-
70
- <a
71
- class="link user-link "
72
- href="https://github.com/suiGn/neurons.me"
73
- >
74
- Github
75
- </a>
76
-
77
- <a
78
- class="link user-link "
79
- href="https://neurons.me"
80
- >
81
- App
82
- </a>
83
-
84
-
85
-
86
- </div>
87
- </div>
88
- </div>
89
- </div>
90
- <div id="main">
91
- <div
92
- class="sidebar "
93
- id="sidebarNav"
94
- >
95
-
96
- <div class="search-wrapper">
97
- <input id="search" type="text" placeholder="Search docs..." class="input">
98
- </div>
99
-
100
- <nav>
101
-
102
- <h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Modules</h3><ul><li><a href="module-CLI.html">CLI</a></li></ul><h3>Classes</h3><ul><li><a href="Me.html">Me</a></li></ul></div>
103
-
104
- </nav>
105
- </div>
106
- <div class="core" id="main-content-wrapper">
107
- <div class="content">
108
- <header class="page-title">
109
- <p>Source</p>
110
- <h1>cli/main.js</h1>
111
- </header>
112
-
113
-
114
-
115
-
116
-
117
- <section>
118
- <article>
119
- <pre class="prettyprint source linenums"><code>#!/usr/bin/env node
120
- import os from 'os';
121
- import Me from '../me.js';
122
- import { Command } from 'commander';
123
- const program = new Command();
124
- import inquirer from 'inquirer';
125
- import fs from 'fs';
126
- import path from 'path';
127
- import printWelcome from './ascii_art/welcome.js';
128
- import crypto from 'crypto';
129
- /**
130
- * @module CLI
131
- * @description
132
- * .Me Command Line Interface Functionalities.
133
- * The CLI application's code structure is categorized into two main parts:
134
- * Command Definitions and Interactive Shell.*/
135
-
136
- /***Command Definitions.*/
137
- program
138
- .command('user &lt;username> &lt;pin>')
139
- .description('Authenticate and start a .me session.')
140
- .action((username, pin) => {
141
- console.log(`Attempting to authenticate user: ${username}`);
142
- // Authentication logic here
143
- });
144
-
145
- program
146
- .option('-o, --options', 'View options and commands');
147
-
148
- /***Welcome message.*/
149
- function welcomeToMe() {
150
- printWelcome();
151
- console.log(`Host_Session@ ${os.userInfo().username}`);
152
- console.log(`v.path@ ${os.homedir()}/.me`);
153
- }
154
-
155
- /**
156
- * Prompts the user to select an action and returns their choice.
157
- * @returns {Promise&lt;string>} The user's choice.
158
- */
159
- async function getUserChoice() {
160
- const choices = ['View Existing Profiles', 'Create New Profile', 'Exit'];
161
- const answer = await inquirer.prompt([{
162
- type: 'list',
163
- name: 'action',
164
- message: 'What would you like to do?',
165
- choices: choices
166
- }]);
167
- return answer.action;
168
- }
169
-
170
- /**
171
- * Prompts the user for details to create a new profile.
172
- * @returns {Promise&lt;Me>} The new Me object with user details.
173
- */
174
- async function getNewProfileDetails() {
175
- const questions = [
176
- {
177
- type: 'input',
178
- name: 'name',
179
- message: 'What is your first name?',
180
- // Add validation as needed
181
- },
182
- {
183
- type: 'input',
184
- name: 'lastname',
185
- message: 'What is your last name?',
186
- // Add validation as needed
187
- },
188
- {
189
- type: 'input',
190
- name: 'birthday',
191
- message: 'What is your birthday? (YYYY-MM-DD)',
192
- validate: function(value) {
193
- const pass = value.match(
194
- /^\d{4}-\d{2}-\d{2}$/
195
- );
196
- if (pass) {
197
- return true;
198
- }
199
- return 'Please enter a valid date (YYYY-MM-DD)';
200
- }
201
- },
202
- {
203
- type: 'password',
204
- name: 'password',
205
- message: 'Choose a password:',
206
- // Add validation as needed
207
- },
208
- {
209
- type: 'input',
210
- name: 'pin',
211
- message: 'Choose a PIN:',
212
- // Add validation as needed
213
- },
214
- // ... Add more questions as needed
215
- ];
216
- const userDetails = await inquirer.prompt(questions);
217
- return new Me(
218
- userDetails.name,
219
- userDetails.lastname,
220
- userDetails.birthday,
221
- userDetails.password,
222
- userDetails.pin
223
- );
224
- }
225
-
226
- /**
227
- * Writes the .me object to the filesystem.
228
- * @param {Me} meProfile - The Me object to be saved.
229
- */
230
- function writeMeObjectToFile(meProfile) {
231
- const meDirectory = path.join(os.homedir(), '.me');
232
- if (!fs.existsSync(meDirectory)) {
233
- fs.mkdirSync(meDirectory, { recursive: true });
234
- }
235
-
236
- const filePath = path.join(meDirectory, `${meProfile.name}.me`);
237
- // Consider encrypting the data here before writing to the filesystem
238
- fs.writeFileSync(filePath, JSON.stringify(meProfile.getIdentityObject()));
239
- console.log('Profile created successfully.');
240
- }
241
-
242
- /**
243
- * Function to display options and commands.
244
- */
245
- function displayOptionsAndCommands() {
246
- console.log(program.helpInformation());
247
- }
248
-
249
- /**
250
- * Lists all the .me profile file paths in the user's .me directory.
251
- * @returns {string[]} An array of full file paths for each .me profile.
252
- */
253
- function listMeProfiles() {
254
- const meDirectory = path.join(os.homedir(), '.me');
255
- if (fs.existsSync(meDirectory)) {
256
- const profileFiles = fs.readdirSync(meDirectory)
257
- .filter(file => file.endsWith('.me'));
258
- return profileFiles.map(file => path.join(meDirectory, file));
259
- } else {
260
- console.log('No profiles found.');
261
- return [];
262
- }
263
- }
264
-
265
- /**
266
- * Prompts the user to select a .me profile or go back to the main menu.
267
- * @returns {Promise&lt;string>} The file path of the selected profile or 'back' to go to the main menu.
268
- */
269
- async function selectProfile() {
270
- const profiles = listMeProfiles();
271
- if (profiles.length === 0) {
272
- console.log('No profiles found.');
273
- return 'back';
274
- }
275
-
276
- const choices = profiles.map(file => ({
277
- name: path.basename(file, '.me'),
278
- value: file
279
- })).concat([{ name: 'Go Back to Main Menu', value: 'back' }]);
280
-
281
- const answer = await inquirer.prompt([{
282
- type: 'list',
283
- name: 'selectedProfile',
284
- message: 'Select a profile to view or go back:',
285
- choices: choices
286
- }]);
287
- return answer.selectedProfile;
288
- }
289
-
290
- /**
291
- * Main function to handle the CLI interactions.
292
- * Continuously prompts the user for actions until an exit command is given.
293
- */
294
- async function main() {
295
- welcomeToMe();
296
- let exit = false;
297
- while (!exit) {
298
- const choice = await getUserChoice();
299
- switch (choice) {
300
- /**
301
- * Handles the 'View Existing Profiles' choice.
302
- * Lists and displays all existing .me profiles.
303
- */
304
- case 'View Existing Profiles':
305
- const selectedProfile = await selectProfile();
306
- if (selectedProfile === 'back') {
307
- break;
308
- }
309
- // Read and display the selected profile details here
310
- console.log(`Selected profile: ${selectedProfile}`);
311
- // Add logic to handle the selected profile
312
- break;
313
- case 'Exit':
314
- console.log('Exiting .me CLI.');
315
- exit = true;
316
- break;
317
- default:
318
- console.log('Invalid choice. Please try again.');
319
- }
320
- }
321
- }
322
-
323
- if (process.argv.length > 2) {
324
- program.parse(process.argv);
325
- } else {
326
- main();
327
- }
328
-
329
- // Error handling for CLI
330
- process.on('uncaughtException', (err) => {
331
- console.error('An error occurred in the CLI:', err.message);
332
- process.exit(1);
333
- });
334
-
335
-
336
-
337
- </code></pre>
338
- </article>
339
- </section>
340
-
341
-
342
-
343
-
344
- </div>
345
-
346
- <footer class="footer">
347
- <div class="content has-text-centered">
348
- <p>
349
- <style>
350
- .center-div {
351
- display: flex;
352
- justify-content: center;
353
- align-items: center;
354
- height: 89px;
355
- }
356
-
357
- img {
358
- max-width: 100%;
359
- max-height: 100%;
360
- }
361
- </style>
362
- <div class="center-div">
363
- <img src="https://suign.github.io/neurons.me/neurons_logo.png" alt="Witness our Seal.">
364
- </div>
365
- <a href="http://neurons.me" target="_blank">neurons.me</a>
366
- </p>
367
- </div>
368
- </footer>
369
-
370
- </div>
371
- <div id="side-nav" class="side-nav">
372
- </div>
373
- </div>
374
- <script src="scripts/app.min.js"></script>
375
- <script>PR.prettyPrint();</script>
376
- <script src="scripts/linenumber.js"> </script>
377
-
378
- <script src="scripts/search.js"> </script>
379
-
380
-
381
- </body>
382
- </html>