├── .babelrc ├── .eslintrc.json ├── .gitignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── docs └── README.md ├── gulpfile.babel.js ├── index.html ├── lib ├── index.js └── neta.js ├── package.json ├── styles ├── colors.styl ├── components │ ├── app.styl │ ├── bar.styl │ ├── button.styl │ ├── main.styl │ ├── page.styl │ └── sect.styl ├── global.styl └── index.styl └── ui ├── app.js ├── bar.js ├── button.js ├── chat.js ├── home.js ├── index.js ├── input.js ├── sect.js └── settings.js /.babelrc: -------------------------------------------------------------------------------- 1 | { "presets": [ "es2015", "react" ] } 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb", 3 | "rules": { 4 | "no-console": 0, 5 | "react/prop-types": 0, 6 | "react/prefer-es6-class": 1, 7 | "react/prefer-stateless-function": 0, 8 | "require-jsdoc": 2, 9 | "consistent-return": 2, 10 | "no-undefined": 2, 11 | "max-len": [2, 80, 2], 12 | "indent": [2, 2], 13 | "valid-jsdoc": [2, { 14 | "requireReturn": false, 15 | "prefer": { 16 | "returns": "return", 17 | "arg": "param", 18 | "argument": "param" 19 | } 20 | }] 21 | }, 22 | "env": { 23 | "node": true, 24 | "browser": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ._* 3 | *.log 4 | node_modules 5 | dist 6 | out 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Issues 2 | We hope you do the following before creating an issue: 3 | 1. Search opened and closed issues first. 4 | 2. State your operating system. 5 | 3. State the version of Neta you're using when the issue happened. 6 | 4. Post error stack traces (if any). 7 | 8 | # Contributing 9 | Neta encourages and welcomes contributing as long as you follow our guidelines as best you can. 10 | 11 | ## Prerequisites (What you should know) 12 | Neta is built on many technologies, some of which you may need to know when wanting to contribute. We want Neta to be well-made, so we are pretty strict about pull requests! 13 | 14 | Here is a list of some widespread things in Neta (in no particular order): 15 | - [ES2015](https://babeljs.io/docs/learn-es2015/) (JavaScript) 16 | - [Electron](http://electron.atom.io/) 17 | - [NodeJS](http://nodejs.org/) 18 | - [Stylus](http://stylus-lang.com/) 19 | - [React](http://facebook.github.io/react/) 20 | 21 | ## Guidelines 22 | Our guidelines are _config-form_, we use [eslint](.eslintrc.json) to keep a consistent style throughout the code, to keep it neat. Remember to always lint your code when making a contribution! 23 | 24 | Neta has made this easy for you by setting up a npm-script, `"lint"`: 25 | ``` 26 | $ npm run lint 27 | ``` 28 | 29 | We recommend you use a plugin for linting inside of your editor / IDE. For instance, [linter-eslint](https://atom.io/packages/linter-eslint) when using [Atom](http://atom.io/) makes life a lot easier. 30 | 31 | ## Testing 32 | `electron-prebuild` is included as a developer depdendency. It's bound to `"test"` in the npm scripts, so you can test it with: 33 | ``` 34 | $ npm test 35 | ``` 36 | 37 | ## What do I do? 38 | Take a look at issues labeled with [`help wanted`](https://github.com/jamen/neta/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) if you don't know where to start. If there are none then feel free to poke around in the rest of the issues. 39 | 40 | ## Licensing 41 | Neta is licensed under MIT and any contributions made towards Neta are (must be) licensed under MIT as well. 42 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | - Neta version: 4 | - Operating system: 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | 6 | Everyone is permitted to copy and distribute verbatim copies of this license 7 | document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The GNU General Public License is a free, copyleft license for software 12 | and other kinds of works. 13 | 14 | The licenses for most software and other practical works are designed to 15 | take away your freedom to share and change the works. By contrast, the 16 | GNU General Public License is intended to guarantee your freedom to share 17 | and change all versions of a program--to make sure it remains free software 18 | for all its users. We, the Free Software Foundation, use the GNU General 19 | Public License for most of our software; it applies also to any other work 20 | released this way by its authors. You can apply it to your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not price. 23 | Our General Public Licenses are designed to make sure that you have the 24 | freedom to distribute copies of free software (and charge for them if 25 | you wish), that you receive source code or can get it if you want it, that 26 | you can change the software or use pieces of it in new free programs, 27 | and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you these 30 | rights or asking you to surrender the rights. Therefore, you have certain 31 | responsibilities if you distribute copies of the software, or if you modify it: 32 | responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether gratis or 35 | for a fee, you must pass on to the recipients the same freedoms that 36 | you received. You must make sure that they, too, receive or can get the 37 | source code. And you must show them these terms so they know their rights. 38 | 39 | Developers that use the GNU GPL protect your rights with two steps: (1) assert 40 | copyright on the software, and (2) offer you this License giving you legal 41 | permission to copy, distribute and/or modify it. 42 | 43 | For the developers' and authors' protection, the GPL clearly explains that 44 | there is no warranty for this free software. For both users' and authors' sake, 45 | the GPL requires that modified versions be marked as changed, so that their 46 | problems will not be attributed erroneously to authors of previous versions. 47 | 48 | Some devices are designed to deny users access to install or run modified 49 | versions of the software inside them, although the manufacturer can do so. 50 | This is fundamentally incompatible with the aim of protecting users' freedom 51 | to change the software. The systematic pattern of such abuse occurs in the 52 | area of products for individuals to use, which is precisely where it is most 53 | unacceptable. Therefore, we have designed this version of the GPL to prohibit 54 | the practice for those products. If such problems arise substantially in other 55 | domains, we stand ready to extend this provision to those domains in future 56 | versions of the GPL, as needed to protect the freedom of users. 57 | 58 | Finally, every program is threatened constantly by software patents. States 59 | should not allow patents to restrict development and use of software on 60 | general-purpose computers, but in those that do, we wish to avoid the special 61 | danger that patents applied to a free program could make it effectively 62 | proprietary. To prevent this, the GPL assures that patents cannot be used 63 | to render the program non-free. 64 | 65 | The precise terms and conditions for copying, distribution 66 | and modification follow. 67 | 68 | TERMS AND CONDITIONS 69 | 70 | 0. Definitions. 71 | 72 | “This License” refers to version 3 of the GNU General Public License. 73 | 74 | “Copyright” also means copyright-like laws that apply to other kinds of works, 75 | such as semiconductor masks. 76 | 77 | “The Program” refers to any copyrightable work licensed under this License. 78 | Each licensee is addressed as “you”. “Licensees” and “recipients” may be 79 | individuals or organizations. 80 | 81 | To “modify” a work means to copy from or adapt all or part of the work in a 82 | fashion requiring copyright permission, other than the making of an exact copy. 83 | The resulting work is called a “modified version” of the earlier work or a work 84 | “based on” the earlier work. 85 | 86 | A “covered work” means either the unmodified Program or a work 87 | based on the Program. 88 | 89 | To “propagate” a work means to do anything with it that, without permission, 90 | would make you directly or secondarily liable for infringement under applicable 91 | copyright law, except executing it on a computer or modifying a private copy. 92 | Propagation includes copying, distribution (with or without modification), 93 | making available to the public, and in some countries other activities as well. 94 | 95 | To “convey” a work means any kind of propagation that enables other parties 96 | to make or receive copies. Mere interaction with a user through a computer 97 | network, with no transfer of a copy, is not conveying. 98 | 99 | An interactive user interface displays “Appropriate Legal Notices” to the 100 | extent that it includes a convenient and prominently visible feature that 101 | (1) displays an appropriate copyright notice, and (2) tells the user that 102 | there is no warranty for the work (except to the extent that warranties are 103 | provided), that licensees may convey the work under this License, and how to 104 | view a copy of this License. If the interface presents a list of user commands 105 | or options, such as a menu, a prominent item in the list meets this criterion. 106 | 107 | 1. Source Code. 108 | 109 | The “source code” for a work means the preferred form of the work for making 110 | modifications to it. “Object code” means any non-source form of a work. 111 | 112 | A “Standard Interface” means an interface that either is an official standard 113 | defined by a recognized standards body, or, in the case of interfaces specified 114 | for a particular programming language, one that is widely used among 115 | developers working in that language. 116 | 117 | The “System Libraries” of an executable work include anything, other than the 118 | work as a whole, that (a) is included in the normal form of packaging a 119 | Major Component, but which is not part of that Major Component, and (b) serves 120 | only to enable use of the work with that Major Component, or to implement a 121 | Standard Interface for which an implementation is available to the public in 122 | source code form. A “Major Component”, in this context, means a major essential 123 | component (kernel, window system, and so on) of the specific operating system 124 | (if any) on which the executable work runs, or a compiler used to produce 125 | the work, or an object code interpreter used to run it. 126 | 127 | The “Corresponding Source” for a work in object code form means all the source 128 | code needed to generate, install, and (for an executable work) run the object 129 | code and to modify the work, including scripts to control those activities. 130 | However, it does not include the work's System Libraries, or general-purpose 131 | tools or generally available free programs which are used unmodified in 132 | performing those activities but which are not part of the work. For example, 133 | Corresponding Source includes interface definition files associated with 134 | source files for the work, and the source code for shared libraries and 135 | dynamically linked subprograms that the work is specifically designed to 136 | require, such as by intimate data communication or control flow between 137 | those subprograms and other parts of the work. 138 | 139 | The Corresponding Source need not include anything that users can regenerate 140 | automatically from other parts of the Corresponding Source. 141 | 142 | The Corresponding Source for a work in source code form is that same work. 143 | 144 | 2. Basic Permissions. 145 | 146 | All rights granted under this License are granted for the term of copyright 147 | on the Program, and are irrevocable provided the stated conditions are met. 148 | This License explicitly affirms your unlimited permission to run the 149 | unmodified Program. The output from running a covered work is covered by 150 | this License only if the output, given its content, constitutes a covered work. 151 | This License acknowledges your rights of fair use or other equivalent, 152 | as provided by copyright law. 153 | 154 | You may make, run and propagate covered works that you do not convey, without 155 | conditions so long as your license otherwise remains in force. You may convey 156 | covered works to others for the sole purpose of having them make modifications 157 | exclusively for you, or provide you with facilities for running those works, 158 | provided that you comply with the terms of this License in conveying all 159 | material for which you do not control copyright. Those thus making or running 160 | the covered works for you must do so exclusively on your behalf, under your 161 | direction and control, on terms that prohibit them from making any copies 162 | of your copyrighted material outside their relationship with you. 163 | 164 | Conveying under any other circumstances is permitted solely under the 165 | conditions stated below. Sublicensing is not allowed; 166 | section 10 makes it unnecessary. 167 | 168 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 169 | 170 | No covered work shall be deemed part of an effective technological measure 171 | under any applicable law fulfilling obligations under article 11 of the WIPO 172 | copyright treaty adopted on 20 December 1996, or similar laws prohibiting or 173 | restricting circumvention of such measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention is 177 | effected by exercising rights under this License with respect to the covered 178 | work, and you disclaim any intention to limit operation or modification of 179 | the work as a means of enforcing, against the work's users, your or third 180 | parties' legal rights to forbid circumvention of technological measures. 181 | 182 | 4. Conveying Verbatim Copies. 183 | 184 | You may convey verbatim copies of the Program's source code as you receive it, 185 | in any medium, provided that you conspicuously and appropriately publish on 186 | each copy an appropriate copyright notice; keep intact all notices stating 187 | that this License and any non-permissive terms added in accord with section 7 188 | apply to the code; keep intact all notices of the absence of any warranty; 189 | and give all recipients a copy of this License along with the Program. 190 | 191 | You may charge any price or no price for each copy that you convey, and you 192 | may offer support or warranty protection for a fee. 193 | 194 | 5. Conveying Modified Source Versions. 195 | 196 | You may convey a work based on the Program, or the modifications to produce 197 | it from the Program, in the form of source code under the terms of section 4, 198 | provided that you also meet all of these conditions: 199 | 200 | a) The work must carry prominent notices stating that you modified it, 201 | and giving a relevant date. 202 | 203 | b) The work must carry prominent notices stating that it is released under 204 | this License and any conditions added under section 7. This requirement 205 | modifies the requirement in section 4 to “keep intact all notices”. 206 | 207 | c) You must license the entire work, as a whole, under this License to 208 | anyone who comes into possession of a copy. This License will therefore 209 | apply, along with any applicable section 7 additional terms, to the whole 210 | of the work, and all its parts, regardless of how they are packaged. 211 | This License gives no permission to license the work in any other way, 212 | but it does not invalidate such permission if you 213 | have separately received it. 214 | 215 | d) If the work has interactive user interfaces, each must display 216 | Appropriate Legal Notices; however, if the Program has interactive 217 | interfaces that do not display Appropriate Legal Notices, your work 218 | need not make them do so. 219 | 220 | A compilation of a covered work with other separate and independent works, 221 | which are not by their nature extensions of the covered work, and which are 222 | not combined with it such as to form a larger program, in or on a volume of 223 | a storage or distribution medium, is called an “aggregate” if the compilation 224 | and its resulting copyright are not used to limit the access or legal rights 225 | of the compilation's users beyond what the individual works permit. Inclusion 226 | of a covered work in an aggregate does not cause this License to apply to 227 | the other parts of the aggregate. 228 | 229 | 6. Conveying Non-Source Forms. 230 | 231 | You may convey a covered work in object code form under the terms of 232 | sections 4 and 5, provided that you also convey the machine-readable 233 | Corresponding Source under the terms of this License, in one of these ways: 234 | 235 | a) Convey the object code in, or embodied in, a physical product 236 | (including a physical distribution medium), accompanied by the 237 | Corresponding Source fixed on a durable physical medium customarily 238 | used for software interchange. 239 | 240 | b) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by a written offer, 242 | valid for at least three years and valid for as long as you offer spare 243 | parts or customer support for that product model, to give anyone who 244 | possesses the object code either (1) a copy of the Corresponding Source 245 | for all the software in the product that is covered by this License, on a 246 | durable physical medium customarily used for software interchange, for a 247 | price no more than your reasonable cost of physically performing this 248 | conveying of source, or (2) access to copy the Corresponding Source from 249 | a network server at no charge. 250 | 251 | c) Convey individual copies of the object code with a copy of the written 252 | offer to provide the Corresponding Source. This alternative is allowed 253 | only occasionally and noncommercially, and only if you received the object 254 | code with such an offer, in accord with subsection 6b. 255 | 256 | d) Convey the object code by offering access from a designated place 257 | (gratis or for a charge), and offer equivalent access to the Corresponding 258 | Source in the same way through the same place at no further charge. 259 | You need not require recipients to copy the Corresponding Source along 260 | with the object code. If the place to copy the object code is a network 261 | server, the Corresponding Source may be on a different server (operated 262 | by you or a third party) that supports equivalent copying facilities, 263 | provided you maintain clear directions next to the object code saying 264 | where to find the Corresponding Source. Regardless of what server hosts 265 | the Corresponding Source, you remain obligated to ensure that it is 266 | available for as long as needed to satisfy these requirements. 267 | 268 | e) Convey the object code using peer-to-peer transmission, provided you 269 | inform other peers where the object code and Corresponding Source of the 270 | work are being offered to the general public at no charge 271 | under subsection 6d. 272 | 273 | A separable portion of the object code, whose source code is excluded from the 274 | Corresponding Source as a System Library, need not be included in conveying 275 | the object code work. 276 | 277 | A “User Product” is either (1) a “consumer product”, which means any tangible 278 | personal property which is normally used for personal, family, or household 279 | purposes, or (2) anything designed or sold for incorporation into a dwelling. 280 | In determining whether a product is a consumer product, doubtful cases shall 281 | be resolved in favor of coverage. For a particular product received by a 282 | particular user, “normally used” refers to a typical or common use of that 283 | class of product, regardless of the status of the particular user or of the 284 | way in which the particular user actually uses, or expects or is expected 285 | to use, the product. A product is a consumer product regardless of whether 286 | the product has substantial commercial, industrial or non-consumer uses, 287 | unless such uses represent the only significant mode of use of the product. 288 | 289 | “Installation Information” for a User Product means any methods, procedures, 290 | authorization keys, or other information required to install and execute 291 | modified versions of a covered work in that User Product from a modified 292 | version of its Corresponding Source. The information must suffice to ensure 293 | that the continued functioning of the modified object code is in no case 294 | prevented or interfered with solely because modification has been made. 295 | 296 | If you convey an object code work under this section in, or with, or 297 | specifically for use in, a User Product, and the conveying occurs as part of 298 | a transaction in which the right of possession and use of the User Product 299 | is transferred to the recipient in perpetuity or for a fixed term (regardless 300 | of how the transaction is characterized), the Corresponding Source conveyed 301 | under this section must be accompanied by the Installation Information. 302 | But this requirement does not apply if neither you nor any third party retains 303 | the ability to install modified object code on the User Product (for example, 304 | the work has been installed in ROM). 305 | 306 | The requirement to provide Installation Information does not include a 307 | requirement to continue to provide support service, warranty, or updates for 308 | a work that has been modified or installed by the recipient, or for the User 309 | Product in which it has been modified or installed. Access to a network may 310 | be denied when the modification itself materially and adversely affects the 311 | operation of the network or violates the rules and protocols for 312 | communication across the network. 313 | 314 | Corresponding Source conveyed, and Installation Information provided, in 315 | accord with this section must be in a format that is publicly documented 316 | (and with an implementation available to the public in source code form), 317 | and must require no special password or key for unpacking, reading or copying. 318 | 319 | 7. Additional Terms. 320 | 321 | “Additional permissions” are terms that supplement the terms of this License 322 | by making exceptions from one or more of its conditions. Additional permissions 323 | that are applicable to the entire Program shall be treated as though they were 324 | included in this License, to the extent that they are valid under applicable 325 | law. If additional permissions apply only to part of the Program, that part 326 | may be used separately under those permissions, but the entire Program remains 327 | governed by this License without regard to the additional permissions. 328 | 329 | When you convey a copy of a covered work, you may at your option remove any 330 | additional permissions from that copy, or from any part of it. (Additional 331 | permissions may be written to require their own removal in certain cases 332 | when you modify the work.) You may place additional permissions on material, 333 | added by you to a covered work, for which you have or can give 334 | appropriate copyright permission. 335 | 336 | Notwithstanding any other provision of this License, for material you add to a 337 | covered work, you may (if authorized by the copyright holders of that material) 338 | supplement the terms of this License with terms: 339 | 340 | a) Disclaiming warranty or limiting liability differently from the terms 341 | of sections 15 and 16 of this License; or 342 | 343 | b) Requiring preservation of specified reasonable legal notices or author 344 | attributions in that material or in the Appropriate Legal Notices displayed 345 | by works containing it; or 346 | 347 | c) Prohibiting misrepresentation of the origin of that material, or 348 | requiring that modified versions of such material be marked in reasonable 349 | ways as different from the original version; or 350 | 351 | d) Limiting the use for publicity purposes of names of licensors or 352 | authors of the material; or 353 | 354 | e) Declining to grant rights under trademark law for use of some trade 355 | names, trademarks, or service marks; or 356 | 357 | f) Requiring indemnification of licensors and authors of that material 358 | by anyone who conveys the material (or modified versions of it) with 359 | contractual assumptions of liability to the recipient, for any liability 360 | that these contractual assumptions directly impose on those 361 | licensors and authors. 362 | 363 | All other non-permissive additional terms are considered “further restrictions” 364 | within the meaning of section 10. If the Program as you received it, or any 365 | part of it, contains a notice stating that it is governed by this License 366 | along with a term that is a further restriction, you may remove that term. 367 | If a license document contains a further restriction but permits relicensing 368 | or conveying under this License, you may add to a covered work material 369 | governed by the terms of that license document, provided that the further 370 | restriction does not survive such relicensing or conveying. 371 | 372 | If you add terms to a covered work in accord with this section, you must place, 373 | in the relevant source files, a statement of the additional terms that apply 374 | to those files, or a notice indicating where to find the applicable terms. 375 | 376 | Additional terms, permissive or non-permissive, may be stated in the form of 377 | a separately written license, or stated as exceptions; the above 378 | requirements apply either way. 379 | 380 | 8. Termination. 381 | 382 | You may not propagate or modify a covered work except as expressly provided 383 | under this License. Any attempt otherwise to propagate or modify it is void, 384 | and will automatically terminate your rights under this License (including 385 | any patent licenses granted under the third paragraph of section 11). 386 | 387 | However, if you cease all violation of this License, then your license from a 388 | particular copyright holder is reinstated (a) provisionally, unless and until 389 | the copyright holder explicitly and finally terminates your license, and 390 | (b) permanently, if the copyright holder fails to notify you of the violation 391 | by some reasonable means prior to 60 days after the cessation. 392 | 393 | Moreover, your license from a particular copyright holder is reinstated 394 | permanently if the copyright holder notifies you of the violation by some 395 | reasonable means, this is the first time you have received notice of violation 396 | of this License (for any work) from that copyright holder, and you cure the 397 | violation prior to 30 days after your receipt of the notice. 398 | 399 | Termination of your rights under this section does not terminate the licenses 400 | of parties who have received copies or rights from you under this License. 401 | If your rights have been terminated and not permanently reinstated, you do 402 | not qualify to receive new licenses for the same material under section 10. 403 | 404 | 9. Acceptance Not Required for Having Copies. 405 | 406 | You are not required to accept this License in order to receive or run a copy 407 | of the Program. Ancillary propagation of a covered work occurring solely as 408 | a consequence of using peer-to-peer transmission to receive a copy likewise 409 | does not require acceptance. However, nothing other than this License grants 410 | you permission to propagate or modify any covered work. These actions infringe 411 | copyright if you do not accept this License. Therefore, by modifying or 412 | propagating a covered work, you indicate your acceptance 413 | of this License to do so. 414 | 415 | 10. Automatic Licensing of Downstream Recipients. 416 | 417 | Each time you convey a covered work, the recipient automatically receives a 418 | license from the original licensors, to run, modify and propagate that work, 419 | subject to this License. You are not responsible for enforcing compliance 420 | by third parties with this License. 421 | 422 | An “entity transaction” is a transaction transferring control of an 423 | organization, or substantially all assets of one, or subdividing an 424 | organization, or merging organizations. If propagation of a covered work 425 | results from an entity transaction, each party to that transaction who receives 426 | a copy of the work also receives whatever licenses to the work the party's 427 | predecessor in interest had or could give under the previous paragraph, plus a 428 | right to possession of the Corresponding Source of the work from the 429 | predecessor in interest, if the predecessor has it or can get it 430 | with reasonable efforts. 431 | 432 | You may not impose any further restrictions on the exercise of the rights 433 | granted or affirmed under this License. For example, you may not impose a 434 | license fee, royalty, or other charge for exercise of rights granted under 435 | this License, and you may not initiate litigation (including a cross-claim 436 | or counterclaim in a lawsuit) alleging that any patent claim is infringed 437 | by making, using, selling, offering for sale, or importing the Program 438 | or any portion of it. 439 | 440 | 11. Patents. 441 | 442 | A “contributor” is a copyright holder who authorizes use under this License 443 | of the Program or a work on which the Program is based. The work thus licensed 444 | is called the contributor's “contributor version”. 445 | 446 | A contributor's “essential patent claims” are all patent claims owned or 447 | controlled by the contributor, whether already acquired or hereafter acquired, 448 | that would be infringed by some manner, permitted by this License, of making, 449 | using, or selling its contributor version, but do not include claims that 450 | would be infringed only as a consequence of further modification of the 451 | contributor version. For purposes of this definition, “control” includes 452 | the right to grant patent sublicenses in a manner consistent with the 453 | requirements of this License. 454 | 455 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent 456 | license under the contributor's essential patent claims, to make, use, sell, 457 | offer for sale, import and otherwise run, modify and propagate the contents 458 | of its contributor version. 459 | 460 | In the following three paragraphs, a “patent license” is any express agreement 461 | or commitment, however denominated, not to enforce a patent (such as an 462 | express permission to practice a patent or covenant not to sue for patent 463 | infringement). To “grant” such a patent license to a party means to make such 464 | an agreement or commitment not to enforce a patent against the party. 465 | 466 | If you convey a covered work, knowingly relying on a patent license, and the 467 | Corresponding Source of the work is not available for anyone to copy, free of 468 | charge and under the terms of this License, through a publicly available 469 | network server or other readily accessible means, then you must either 470 | (1) cause the Corresponding Source to be so available, or (2) arrange to 471 | deprive yourself of the benefit of the patent license for this particular work, 472 | or (3) arrange, in a manner consistent with the requirements of this License, 473 | to extend the patent license to downstream recipients. “Knowingly relying” 474 | means you have actual knowledge that, but for the patent license, your 475 | conveying the covered work in a country, or your recipient's use of the 476 | covered work in a country, would infringe one or more identifiable patents 477 | in that country that you have reason to believe are valid. 478 | 479 | If, pursuant to or in connection with a single transaction or arrangement, 480 | you convey, or propagate by procuring conveyance of, a covered work, and 481 | grant a patent license to some of the parties receiving the covered work 482 | authorizing them to use, propagate, modify or convey a specific copy of the 483 | covered work, then the patent license you grant is automatically extended 484 | to all recipients of the covered work and works based on it. 485 | 486 | A patent license is “discriminatory” if it does not include within the scope 487 | of its coverage, prohibits the exercise of, or is conditioned on the 488 | non-exercise of one or more of the rights that are specifically granted under 489 | this License. You may not convey a covered work if you are a party to an 490 | arrangement with a third party that is in the business of distributing 491 | software, under which you make payment to the third party based on the extent 492 | of your activity of conveying the work, and under which the third party grants, 493 | to any of the parties who would receive the covered work from you, a 494 | discriminatory patent license (a) in connection with copies of the covered 495 | work conveyed by you (or copies made from those copies), or (b) primarily 496 | for and in connection with specific products or compilations that contain 497 | the covered work, unless you entered into that arrangement, or that patent 498 | license was granted, prior to 28 March 2007. 499 | 500 | Nothing in this License shall be construed as excluding or limiting any 501 | implied license or other defenses to infringement that may otherwise be 502 | available to you under applicable patent law. 503 | 504 | 12. No Surrender of Others' Freedom. 505 | 506 | If conditions are imposed on you (whether by court order, agreement or 507 | otherwise) that contradict the conditions of this License, they do not excuse 508 | you from the conditions of this License. If you cannot convey a covered work 509 | so as to satisfy simultaneously your obligations under this License and any 510 | other pertinent obligations, then as a consequence you may not convey it 511 | at all. For example, if you agree to terms that obligate you to collect a 512 | royalty for further conveying from those to whom you convey the Program, 513 | the only way you could satisfy both those terms and this License would be 514 | to refrain entirely from conveying the Program. 515 | 516 | 13. Use with the GNU Affero General Public License. 517 | 518 | Notwithstanding any other provision of this License, you have permission to 519 | link or combine any covered work with a work licensed under version 3 of the 520 | GNU Affero General Public License into a single combined work, and to convey 521 | the resulting work. The terms of this License will continue to apply to the 522 | part which is the covered work, but the special requirements of the 523 | GNU Affero General Public License, section 13, concerning interaction through 524 | a network will apply to the combination as such. 525 | 526 | 14. Revised Versions of this License. 527 | 528 | The Free Software Foundation may publish revised and/or new versions of the 529 | GNU General Public License from time to time. Such new versions will be similar 530 | in spirit to the present version, but may differ in detail to address 531 | new problems or concerns. 532 | 533 | Each version is given a distinguishing version number. If the Program 534 | specifies that a certain numbered version of the GNU General Public License 535 | “or any later version” applies to it, you have the option of following the 536 | terms and conditions either of that numbered version or of any later version 537 | published by the Free Software Foundation. If the Program does not specify a 538 | version number of the GNU General Public License, you may choose any version 539 | ever published by the Free Software Foundation. 540 | 541 | If the Program specifies that a proxy can decide which future versions of the 542 | GNU General Public License can be used, that proxy's public statement of 543 | acceptance of a version permanently authorizes you to choose that 544 | version for the Program. 545 | 546 | Later license versions may give you additional or different permissions. 547 | However, no additional obligations are imposed on any author or copyright 548 | holder as a result of your choosing to follow a later version. 549 | 550 | 15. Disclaimer of Warranty. 551 | 552 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE 553 | LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER 554 | PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER 555 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 556 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO 557 | THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM 558 | PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 559 | REPAIR OR CORRECTION. 560 | 561 | 16. Limitation of Liability. 562 | 563 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL 564 | ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE 565 | PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 566 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE 567 | OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA 568 | OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES 569 | OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF 570 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 571 | 572 | 17. Interpretation of Sections 15 and 16. 573 | 574 | If the disclaimer of warranty and limitation of liability provided above 575 | cannot be given local legal effect according to their terms, reviewing courts 576 | shall apply local law that most closely approximates an absolute waiver of 577 | all civil liability in connection with the Program, unless a warranty or 578 | assumption of liability accompanies a copy of the Program in return for a fee. 579 | 580 | END OF TERMS AND CONDITIONS 581 | 582 | How to Apply These Terms to Your New Programs 583 | 584 | If you develop a new program, and you want it to be of the greatest possible 585 | use to the public, the best way to achieve this is to make it free software 586 | which everyone can redistribute and change under these terms. 587 | 588 | To do so, attach the following notices to the program. It is safest to attach 589 | them to the start of each source file to most effectively state the exclusion 590 | of warranty; and each file should have at least the “copyright” line and a 591 | pointer to where the full notice is found. 592 | 593 | 594 | Copyright (C) 2016 Jamen Marzonie 595 | 596 | 597 | This program is free software: you can redistribute it and/or modify 598 | it under the terms of the GNU General Public License as published by 599 | the Free Software Foundation, either version 3 of the License, or 600 | (at your option) any later version. 601 | 602 | This program is distributed in the hope that it will be useful, 603 | but WITHOUT ANY WARRANTY; without even the implied warranty of 604 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 605 | GNU General Public License for more details. 606 | 607 | You should have received a copy of the GNU General Public License 608 | along with this program. If not, see . 609 | 610 | Also add information on how to contact you by electronic and paper mail. 611 | 612 | If the program does terminal interaction, make it output a short notice like 613 | this when it starts in an interactive mode: 614 | 615 | bin Copyright (C) 2016 Jamen Marzonie 616 | 617 | 618 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 619 | This is free software, and you are welcome to redistribute it 620 | under certain conditions; type `show c' for details. 621 | 622 | The hypothetical commands `show w' and `show c' should show the appropriate 623 | parts of the General Public License. Of course, your program's commands 624 | might be different; for a GUI interface, you would use an “about box”. 625 | 626 | You should also get your employer (if you work as a programmer) or school, 627 | if any, to sign a “copyright disclaimer” for the program, if necessary. 628 | For more information on this, and how to apply and follow the GNU GPL, 629 | see . 630 | 631 | The GNU General Public License does not permit incorporating your program 632 | into proprietary programs. If your program is a subroutine library, you may 633 | consider it more useful to permit linking proprietary applications with the 634 | library. If this is what you want to do, use the GNU Lesser General Public 635 | License instead of this License. 636 | But first, please read . 637 | 638 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Neta 2 | ==== 3 | > A modern, decentralized, and customizable chatting client. 4 | 5 | **Note:** This is in early development, expect lots of changes and potientally unstable code. 6 | 7 | Neta is a modern, decentralized, and customizable chatting client. It uses a developer-friendly ecosystem to enable use of plugin and theme APIs, so users can build a more personal chatting client, but not at the expense of security, usability, or price. 8 | 9 | ## Installation 10 | You cannot currently install `neta` from npm, dep files, etc... You wont be able to [until v1][v1-issues]. Until then, clone this repository and see "Usage" as well as "Building & Packaging" below. 11 | 12 | ## Building & Packaging 13 | Building the source files (outputs to `out`): 14 | ```shell 15 | $ npm run build 16 | ``` 17 | 18 | Building the source and packaging (outputs to `dist`): 19 | ```shell 20 | $ npm run package 21 | ``` 22 | 23 | When packaging from `gulp`, you can use specific systems: 24 | - `package-win32`: Windows 25 | - `package-linux`: linux 26 | - `package-mac`: Mac OS 27 | - `package`: Everything 28 | 29 | ## Usage 30 | Build Neta and start with Electron: 31 | ```shell 32 | $ npm start 33 | ``` 34 | 35 | Watch file changes and restart Neta as needed: 36 | ```shell 37 | $ npm run watch 38 | ``` 39 | (Close the Electron process and gulp will reopen it when the source changes) 40 | 41 | ## Docs & Support 42 | - [GitHub Wiki][wiki] 43 | - [Repo Issues][issues] 44 | - [Contact](#Credits) 45 | 46 | ## Credits 47 | |![Jamen Marz][jamen-image]| 48 | |:--------:| 49 | | [@jamen] | 50 | 51 | ## License 52 | [GPL v3](LICENSE) © Jamen Marzonie 53 | 54 | 55 | [@jamen]: https://github.com/jamen 56 | [jamen-image]: https://avatars2.githubusercontent.com/u/6251703?v=3&s=125 57 | [wiki]: https://github.com/jamen/neta/wiki 58 | [issues]: https://github.com/jamen/neta/issues 59 | [v1-issues]: https://github.com/jamen/neta/milestones/v1 60 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamen/neta/8db813a5849b7051782baecd3822c6fe6dd4c05f/docs/README.md -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | import gulp from 'gulp'; 2 | import rename from 'gulp-rename'; 3 | import babel from 'gulp-babel'; 4 | import stylus from 'gulp-stylus'; 5 | import eslint from 'gulp-eslint'; 6 | import del from 'del'; 7 | import path from 'path'; 8 | import { exec, spawn } from 'child_process'; 9 | 10 | const output = 'out'; 11 | const dist = 'dist'; 12 | const js = { presets: ['es2015', 'react'] }; 13 | const bin = path.join(__dirname, 'node_modules', '.bin'); 14 | const pack = path.join(bin, 'electron-packager'); 15 | const electron = path.join(bin, 'electron'); 16 | const version = '0.37.6'; 17 | const handlePack = function handlePack(err, stdout, stderr) { 18 | if (err) throw err; 19 | if (stdout) console.log(stdout); 20 | if (stderr) console.log(stderr); 21 | this(); 22 | }; 23 | 24 | gulp.task('lib', () => 25 | gulp.src('lib/*.js', { base: '.' }) 26 | .pipe(babel(js)) 27 | .pipe(gulp.dest(output)) 28 | ); 29 | 30 | gulp.task('ui', () => 31 | gulp.src('ui/*.js', { base: '.' }) 32 | .pipe(babel(js)) 33 | .pipe(gulp.dest(output)) 34 | ); 35 | 36 | gulp.task('styles', () => 37 | gulp.src('styles/index.styl') 38 | .pipe(stylus()) 39 | .pipe(rename('neta.css')) 40 | .pipe(gulp.dest(output)) 41 | ); 42 | 43 | gulp.task('copy', () => 44 | gulp.src(['package.json', 'README.md', 'LICENSE', 'index.html']) 45 | .pipe(gulp.dest(output)) 46 | ); 47 | 48 | gulp.task('clean', () => del([output, dist])); 49 | 50 | gulp.task('build', ['lib', 'ui', 'styles', 'copy']); 51 | 52 | gulp.task('start', ['build'], (cb) => { 53 | const run = spawn(electron, ['out', '--dev']); 54 | process.stdin.pipe(run.stdout); 55 | run.on('error', () => {}); 56 | run.on('exit', () => cb()); 57 | }); 58 | 59 | gulp.task('lint', () => 60 | gulp.src(['lib/*.js', 'ui/*.js']) 61 | .pipe(eslint()) 62 | .pipe(eslint.format()) 63 | ); 64 | 65 | gulp.task('watch', () => { 66 | gulp.watch([ 67 | 'lib/*.js', 68 | 'ui/*.js', 69 | 'styles/*.styl', 70 | 'index.html', 71 | ], ['start', 'lint']); 72 | }); 73 | 74 | gulp.task('package-win32', ['build'], (cb) => 75 | exec( 76 | `${pack} out \ 77 | --platform="win32" \ 78 | --arch="all" \ 79 | --version="${version}" \ 80 | --out="${dist}"`, 81 | handlePack.bind(cb) 82 | ) 83 | ); 84 | 85 | gulp.task('package-linux', ['build'], (cb) => 86 | exec( 87 | `${pack} out \ 88 | --platform="linux" \ 89 | --arch="all" \ 90 | --version="${version}" \ 91 | --out="${dist}"`, 92 | handlePack.bind(cb) 93 | ) 94 | ); 95 | 96 | gulp.task('package-mac', ['build'], (cb) => 97 | exec( 98 | `${pack} out \ 99 | --platform="darwin" \ 100 | --arch="all" \ 101 | --version="${version}" \ 102 | --out="${dist}"`, 103 | handlePack.bind(cb) 104 | ) 105 | ); 106 | 107 | gulp.task('package', ['package-win32', 'package-linux', 'package-mac']); 108 | 109 | gulp.task('default', ['watch']); 110 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Loading...
9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | import { BrowserWindow, app, screen } from 'electron'; 2 | import { join } from 'path'; 3 | import minimist from 'minimist'; 4 | import pack from '../package'; 5 | 6 | const opts = minimist(process.argv.slice(2)); 7 | 8 | if (opts.version) { 9 | console.log(pack.version); 10 | process.exit(0); 11 | } 12 | 13 | app.on('ready', () => { 14 | const size = screen.getPrimaryDisplay().workAreaSize; 15 | const win = new BrowserWindow({ 16 | width: size.width - 100, 17 | height: size.height - 100, 18 | autoHideMenuBar: true, 19 | show: false, 20 | }); 21 | const wc = win.webContents; 22 | win.loadURL(`file://${join(__dirname, '..', 'index.html')}`); 23 | wc.on('dom-ready', () => win.show()); 24 | 25 | if (opts.dev) { 26 | win.openDevTools(); 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /lib/neta.js: -------------------------------------------------------------------------------- 1 | import { render } from 'react-dom'; 2 | import React from 'react'; 3 | import { App, Chat, Settings, Home } from '../ui'; 4 | import { Router, Route, IndexRoute, hashHistory } from 'react-router'; 5 | 6 | window.onload = function load() { 7 | const main = document.getElementById('main'); 8 | render(( 9 | 10 | 11 | 12 | 13 | 14 | 15 | ), 16 | main 17 | ); 18 | }; 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "neta", 3 | "version": "0.0.0", 4 | "description": "A modern, decentralized, and customizable chatting client.", 5 | "main": "lib", 6 | "scripts": { 7 | "clean": "gulp clean", 8 | "build": "gulp build", 9 | "start": "gulp start", 10 | "lint": "gulp lint", 11 | "watch": "gulp watch", 12 | "package": "gulp package" 13 | }, 14 | "private": true, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/jamen/neta.git" 18 | }, 19 | "keywords": [ 20 | "chat", 21 | "client", 22 | "customizable" 23 | ], 24 | "author": "Jamen Marzonie", 25 | "license": "GPL-3.0", 26 | "bugs": { 27 | "url": "https://github.com/jamen/neta/issues" 28 | }, 29 | "homepage": "https://github.com/jamen/neta#readme", 30 | "dependencies": { 31 | "classnames": "^2.2.3", 32 | "neta-client": "0.0.1", 33 | "react": "^0.14.5", 34 | "react-dom": "^0.14.5", 35 | "react-router": "^2.0.0" 36 | }, 37 | "devDependencies": { 38 | "babel-preset-es2015": "^6.6.0", 39 | "babel-preset-react": "^6.5.0", 40 | "del": "^2.2.0", 41 | "electron-packager": "^7.0.0", 42 | "electron-prebuilt": "^0.37.6", 43 | "eslint": "^2.8.0", 44 | "eslint-config-airbnb": "^7.0.0", 45 | "eslint-config-airbnb-base": "^1.0.2", 46 | "eslint-plugin-import": "^1.5.0", 47 | "eslint-plugin-jsx-a11y": "^0.6.2", 48 | "eslint-plugin-react": "^4.3.0", 49 | "gulp": "^3.9.1", 50 | "gulp-babel": "^6.1.2", 51 | "gulp-eslint": "^2.0.0", 52 | "gulp-rename": "^1.2.2", 53 | "gulp-stylus": "^2.3.1", 54 | "precommit": "^1.2.0" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /styles/colors.styl: -------------------------------------------------------------------------------- 1 | $white = #E3E3E3 2 | $red = #96281B 3 | $blue = #2C3E50 4 | -------------------------------------------------------------------------------- /styles/components/app.styl: -------------------------------------------------------------------------------- 1 | .app 2 | display flex 3 | width 100% 4 | height 100% 5 | -------------------------------------------------------------------------------- /styles/components/bar.styl: -------------------------------------------------------------------------------- 1 | .bar 2 | display flex 3 | flex-direction column 4 | width 300px 5 | height auto 6 | background-color $blue 7 | color $white 8 | -------------------------------------------------------------------------------- /styles/components/button.styl: -------------------------------------------------------------------------------- 1 | .button 2 | width 100% 3 | padding 15px 4 | font-size .9em 5 | 6 | &:hover 7 | background-color darken($blue, 10%) 8 | -------------------------------------------------------------------------------- /styles/components/main.styl: -------------------------------------------------------------------------------- 1 | #main 2 | width 100% 3 | height 100% 4 | font-family 'Open Sans', Helvetica, Arial, sans-serif 5 | -------------------------------------------------------------------------------- /styles/components/page.styl: -------------------------------------------------------------------------------- 1 | .page 2 | width 100% 3 | height 100% 4 | -------------------------------------------------------------------------------- /styles/components/sect.styl: -------------------------------------------------------------------------------- 1 | .sect 2 | width 100% 3 | 4 | .title 5 | color $white 6 | font-weight bold 7 | opacity 0.6 8 | display block 9 | width 100% 10 | background-color darken($blue, 15%); 11 | padding 5px 12 | text-indent 10px 13 | 14 | .fa 15 | float right 16 | padding-right 15px 17 | 18 | .items 19 | display flex 20 | flex-direction column 21 | 22 | &.disabled 23 | display none 24 | -------------------------------------------------------------------------------- /styles/global.styl: -------------------------------------------------------------------------------- 1 | body, html, #main 2 | width 100% 3 | height 100% 4 | margin 0 5 | padding 0 6 | 7 | * 8 | box-sizing border-box 9 | 10 | a 11 | color inherit 12 | text-decoration inherit 13 | outline none 14 | -------------------------------------------------------------------------------- /styles/index.styl: -------------------------------------------------------------------------------- 1 | @import 'colors' 2 | @import 'global' 3 | @import 'components/*' 4 | -------------------------------------------------------------------------------- /ui/app.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Bar } from '.'; 3 | 4 | class App extends Component { 5 | render() { 6 | return ( 7 |
8 | 9 |
{this.props.children}
10 |
11 | ); 12 | } 13 | } 14 | 15 | export default App; 16 | -------------------------------------------------------------------------------- /ui/bar.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Sect, Button } from '.'; 3 | 4 | class Bar extends Component { 5 | render() { 6 | return ( 7 |
8 | 9 |
18 | ); 19 | } 20 | } 21 | 22 | export default Bar; 23 | -------------------------------------------------------------------------------- /ui/button.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Link } from 'react-router'; 3 | 4 | class Button extends Component { 5 | render() { 6 | const btn = (
{this.props.name}
); 7 | 8 | if (typeof this.props.to !== 'undefined') { 9 | return ({btn}); 10 | } 11 | 12 | return btn; 13 | } 14 | } 15 | 16 | export default Button; 17 | -------------------------------------------------------------------------------- /ui/chat.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class Chat extends Component { 4 | render() { 5 | return ( 6 |
7 | Chat {this.props.params.chat} 8 |
9 | ); 10 | } 11 | } 12 | 13 | export default Chat; 14 | -------------------------------------------------------------------------------- /ui/home.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Input } from '.'; 3 | import { createServer, createConnection } from 'net'; 4 | 5 | class Home extends Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | status: 'unconnected', 11 | messages: [], 12 | }; 13 | 14 | this.connect = this.connect.bind(this); 15 | this.message = this.message.bind(this); 16 | 17 | this.relay = createServer(peer => { 18 | this.setState({ messages: [] }); 19 | this.incoming = peer; 20 | 21 | this.incoming.on('data', (message) => this.message('Peer', message)); 22 | }); 23 | 24 | this.relay.listen(1300); 25 | } 26 | 27 | connect(addr) { 28 | const [ip, port] = addr.split(':'); 29 | this.peer = createConnection(parseInt(port, 10), ip); 30 | 31 | this.peer.on('connect', () => { 32 | this.setState({ status: 'connected' }); 33 | }); 34 | 35 | this.peer.on('end', () => { 36 | this.setState({ status: 'unconnected' }); 37 | }); 38 | } 39 | 40 | message(user, message) { 41 | this.state.messages.push({ user, message: message.toString() }); 42 | this.forceUpdate(); 43 | } 44 | 45 | render() { 46 | return ( 47 |
48 | {"Peer's address (press enter to connect):"} 49 | { 51 | console.log(keyCode); 52 | if (keyCode === 13) this.connect(target.value); 53 | }} 54 | /> 55 | {"Message (press enter to send):"} 56 | { 58 | if (keyCode === 13) { 59 | this.peer.write(target.value); 60 | this.message('You', target.value); 61 | } 62 | }} 63 | /> 64 | Status: {this.state.status} 65 |
66 | {this.state.messages.map(m => (
{m.user}: {m.message}
))} 67 |
68 |
69 | ); 70 | } 71 | } 72 | 73 | export default Home; 74 | -------------------------------------------------------------------------------- /ui/index.js: -------------------------------------------------------------------------------- 1 | import App from './app'; 2 | import Bar from './bar'; 3 | import Sect from './sect'; 4 | import Button from './button'; 5 | import Chat from './chat'; 6 | import Home from './home'; 7 | import Settings from './settings'; 8 | import Input from './input'; 9 | export { App, Bar, Sect, Button, Chat, Home, Settings, Input }; 10 | -------------------------------------------------------------------------------- /ui/input.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class Input extends Component { 4 | constructor(props) { 5 | super(props); 6 | 7 | this.state = { 8 | value: '', 9 | }; 10 | } 11 | 12 | render() { 13 | return ( 14 |
15 | 16 |
17 | ); 18 | } 19 | } 20 | 21 | export default Input; 22 | -------------------------------------------------------------------------------- /ui/sect.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import classes from 'classnames'; 3 | 4 | class Sect extends Component { 5 | constructor(props) { 6 | super(props); 7 | 8 | this.state = { 9 | active: typeof props.active !== 'undefined' ? props.active : true, 10 | }; 11 | 12 | this.toggle = this.toggle.bind(this); 13 | } 14 | 15 | toggle() { 16 | this.setState({ active: !this.state.active }); 17 | } 18 | 19 | render() { 20 | const active = this.state.active; 21 | return ( 22 |
23 | 24 | {this.props.title} 25 | 26 | 27 |
28 | {this.props.children} 29 |
30 |
31 | ); 32 | } 33 | } 34 | 35 | export default Sect; 36 | -------------------------------------------------------------------------------- /ui/settings.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class Settings extends Component { 4 | render() { 5 | return ( 6 |
7 | The {this.props.params.page} settings page 8 |
9 | ); 10 | } 11 | } 12 | 13 | export default Settings; 14 | --------------------------------------------------------------------------------