├── .eslintrc ├── .github └── FUNDING.yml ├── .gitignore ├── .upignore ├── LICENSE ├── README.md ├── backend ├── index.js └── services.js ├── bots ├── services │ └── s3.js ├── slack │ ├── README.ms │ ├── index.js │ ├── package-lock.json │ └── package.json └── wechat │ ├── README.md │ ├── index.js │ ├── package-lock.json │ └── package.json ├── config.js ├── db ├── Group.js ├── GroupMember.js ├── Msg.js ├── TmpGroup.js ├── Topics.js ├── index.js ├── initTables.js └── initTablesData.js ├── docs └── README.md ├── index.html ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── about.js ├── about.scss ├── chat.js ├── chat.scss ├── components │ ├── AdCard.js │ ├── AdCard.scss │ ├── ChatCard.js │ ├── ChatCard.scss │ ├── ChatCards.js │ ├── ChatHero.js │ ├── ChatHero.scss │ ├── ChatTabs.js │ ├── Footer.js │ ├── Footer.scss │ ├── Head.js │ ├── Head.scss │ ├── Msg.scss │ ├── Nav.js │ ├── Nav.scss │ ├── SlackMsg.js │ └── WechatMsg.js ├── index.js ├── index.scss ├── join.js ├── join.scss ├── members.js ├── members.scss ├── new_slack_group.js ├── topic.js ├── topic.scss ├── topics.js ├── topics.scss └── utils │ └── index.js ├── scripts ├── addGroup.js ├── addTopic.js ├── batchAddSlackMsgs.js └── batchAddSlackTopics.js ├── services ├── removeRecalledMsgs.js └── validator.js └── up.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["airbnb"], 3 | "rules": { 4 | "no-console": "off", 5 | "indent": ["warn", 2], 6 | "noplusplus": "warn", 7 | "react/jsx-filename-extension": "off", 8 | "react/react-in-jsx-scope": "off", 9 | "react/prop-types": "warn" 10 | }, 11 | "env": { 12 | "browser": true, 13 | "node": true, 14 | "mocha": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: timqian # Replace with a single Patreon username 5 | open_collective: t9tio # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /db.sqlite 2 | /secret.json 3 | /scripts/sampleJsons/ 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | 64 | # next.js build output 65 | .next 66 | -------------------------------------------------------------------------------- /.upignore: -------------------------------------------------------------------------------- 1 | !.next 2 | *.md 3 | /bots/ 4 | /scripts/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![](https://raw.githubusercontent.com/timqian/images/master/20190704122816.png)](https://wewe.t9t.io) 2 | 3 | # [wewe](https://wewe.t9t.io) 4 | 5 | Open group chat messages to the world 6 | 7 | [![Join us](https://badgen.net/badge/Join%20the%20community%20of%20t9t.io/Get%20in%20touch/green)](https://t9t.io/#contact) 8 | [![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-blue.svg)](https://github.com/chatie/wechaty) 9 | 10 | ## Core values of wewe 11 | 12 | - Open group chat to the internet 13 | - Search engine friendly 14 | - Extract topics from message history 15 | 16 | ## Tech stacks 17 | 18 | - language: js nodejs 19 | - database: dynamodb 20 | - frontend framework: react 21 | - deployment: aws lambda; apex/up 22 | 23 | ## Develop 24 | 25 | ```bash 26 | # reinitialize tables 27 | npm run initDb 28 | 29 | # start the web server 30 | npm run sb 31 | 32 | # start wechat bot 33 | npm run sw 34 | 35 | # deploy the website 36 | npm run deploy 37 | ``` 38 | 39 | ### prepare new instance on aws to deploy wechat bot 40 | 41 | ```bash 42 | # install nvm 43 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash 44 | source ~/.bashrc 45 | 46 | # install stable nodejs 47 | nvm install node 48 | node -v 49 | 50 | # prepare repo to start the bot 51 | git clone https://github.com/t9tio/wewe.git 52 | cd wewe 53 | npm i 54 | cd bots/wechat 55 | npm i 56 | cd ../.. 57 | vim secret.json # add secret config 58 | sudo apt-get update # prepare dependencies of wechaty 59 | sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget 60 | tmux new -s bot # start mux 61 | npm run sw 62 | 63 | # Detach from session: 64 | ctrl+b d 65 | ``` 66 | 67 | refs: 68 | - [tmux cheat sheet](https://github.com/timqian/my-notes/issues/191) 69 | - [wechaty on Ubuntu](https://github.com/Chatie/wechaty/issues/1515#issuecomment-503364700) 70 | -------------------------------------------------------------------------------- /backend/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const path = require('path'); 3 | const cors = require('cors'); 4 | const bodyParser = require('body-parser'); 5 | const next = require('next'); 6 | const axios = require('axios'); 7 | const qs = require('qs'); 8 | const secret = require('../secret.json'); 9 | const Group = require('../db/Group'); 10 | const TmpGroup = require('../db/TmpGroup'); 11 | const Msg = require('../db/Msg'); 12 | const GroupMember = require('../db/GroupMember'); 13 | const Topics = require('../db/Topics'); 14 | const { pageMsgCount } = require('../config'); 15 | const validator = require('../services/validator'); 16 | const removeRecalledMsgs = require('../services/removeRecalledMsgs'); 17 | 18 | const dev = process.env.NODE_ENV !== 'production'; 19 | const nextApp = next({ 20 | dev, 21 | }); 22 | const handle = nextApp.getRequestHandler(); 23 | 24 | const app = express(); 25 | 26 | nextApp.prepare().then(() => { 27 | app.use(cors()); 28 | app.use(bodyParser.json()); 29 | app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies 30 | 31 | app.get('/', async (req, res) => { 32 | res.sendFile(path.join(__dirname, '../index.html')); 33 | }); 34 | 35 | app.get('/groups', async (req, res) => { 36 | const groups = await Group.getAll(); 37 | nextApp.render(req, res, '/index', { groups }); 38 | }); 39 | 40 | // cat history of today 41 | app.get('/chat/:name', async (req, res) => { 42 | const { name } = req.params; 43 | const group = await Group.get({ name }); 44 | if (!group) { 45 | res.status(404); 46 | return; 47 | } 48 | 49 | const totalPageCount = Math.ceil(group.msgCount / pageMsgCount); 50 | // console.log(totalPageCount); 51 | let msgs = await Msg.getRange({ 52 | groupName: name, 53 | idOffset: (totalPageCount - 1) * pageMsgCount, 54 | idLimit: pageMsgCount, 55 | }); 56 | 57 | msgs = removeRecalledMsgs(msgs); 58 | 59 | // potential bug: more than 100 member of a group 60 | const members = await GroupMember.getAllMemberNames({ 61 | groupName: name, 62 | }); 63 | 64 | // console.log(members); 65 | msgs = msgs.map((msg) => { 66 | if (members.includes(msg.from)) { 67 | msg.isKnownMember = true; 68 | } 69 | return msg; 70 | }); 71 | 72 | nextApp.render(req, res, '/chat', { 73 | group, msgs, totalPageCount, currentPage: totalPageCount, 74 | }); 75 | }); 76 | 77 | app.get('/chat/:name/page/:page', async (req, res) => { 78 | const { name, page } = req.params; 79 | const group = await Group.get({ name }); 80 | if (!group) { 81 | res.status(404); 82 | return; 83 | } 84 | 85 | const totalPageCount = Math.ceil(group.msgCount / pageMsgCount); 86 | 87 | let msgs = await Msg.getRange({ 88 | groupName: name, 89 | idOffset: (page - 1) * pageMsgCount, 90 | idLimit: pageMsgCount, 91 | }); 92 | 93 | msgs = removeRecalledMsgs(msgs); 94 | 95 | // potential bug: more than 100 member of a group 96 | const members = await GroupMember.getAllMemberNames({ 97 | groupName: name, 98 | }); 99 | 100 | // console.log(members); 101 | msgs = msgs.map((msg) => { 102 | if (members.includes(msg.from)) { 103 | msg.isKnownMember = true; 104 | } 105 | return msg; 106 | }); 107 | 108 | // console.log(msgs); 109 | nextApp.render(req, res, '/chat', { 110 | group, msgs, totalPageCount, currentPage: page, 111 | }); 112 | }); 113 | 114 | app.get('/chat/:groupName/members', async (req, res) => { 115 | const { groupName } = req.params; 116 | const group = await Group.get({ name: groupName }); 117 | const members = await GroupMember.getAllMembers({ groupName }); 118 | 119 | nextApp.render(req, res, '/members', { 120 | group, members, 121 | }); 122 | }); 123 | 124 | app.get('/chat/:groupname/member/:username', async (req, res) => { 125 | const { groupname, username } = req.params; 126 | const groupMember = await GroupMember.get({ groupName: groupname, name: username }); 127 | if (!groupMember) { 128 | res.status(404); 129 | return; 130 | } 131 | 132 | res.json(groupMember); 133 | // nextApp.render(req, res, '/chat', { 134 | // group, msgs, totalPageCount, currentPage: page, 135 | // }); 136 | }); 137 | 138 | app.get('/chat/:groupName/topics', async (req, res) => { 139 | const { groupName } = req.params; 140 | const group = await Group.get({ name: groupName }); 141 | 142 | const totalPageCount = Math.ceil(group.topicCount / pageMsgCount); 143 | 144 | const topics = await Topics.getRange({ 145 | groupName, 146 | idOffset: (totalPageCount - 1) * pageMsgCount, 147 | idLimit: pageMsgCount, 148 | }); 149 | 150 | // TODO: get msg count of all slack topics 151 | nextApp.render(req, res, '/topics', { 152 | group, topics: topics.reverse(), 153 | }); 154 | }); 155 | 156 | app.get('/chat/:groupName/topic/:topicId', async (req, res) => { 157 | const { groupName, topicId } = req.params; 158 | const group = await Group.get({ name: groupName }); 159 | const topic = await Topics.get({ groupName, id: Number(topicId) }); 160 | 161 | if (group.type === 'wechat') { 162 | let msgs = await Msg.getRange({ 163 | groupName, 164 | idOffset: topic.msgRange[0], 165 | idLimit: 50, 166 | }); 167 | 168 | // potential bug: more than 100 member of a group 169 | const members = await GroupMember.getAllMemberNames({ 170 | groupName, 171 | }); 172 | 173 | // console.log(members); 174 | msgs = msgs.map((msg) => { 175 | if (members.includes(msg.from)) { 176 | msg.isKnownMember = true; 177 | } 178 | return msg; 179 | }); 180 | nextApp.render(req, res, '/topic', { 181 | group, topic, msgs, 182 | }); 183 | } else if (group.type === 'slack') { 184 | console.log(topic.ts); 185 | const msgs = await Msg.getByThreadTs({ ts: topic.ts }); 186 | nextApp.render(req, res, '/topic', { 187 | group, topic, msgs: msgs.reverse(), 188 | }); 189 | } 190 | }); 191 | 192 | app.get('/about', async (req, res) => { 193 | nextApp.render(req, res, '/about'); 194 | }); 195 | 196 | app.get('/join', async (req, res) => { 197 | nextApp.render(req, res, '/join'); 198 | }); 199 | 200 | // APIs 201 | 202 | app.get('/api/chat/:name', async (req, res) => { 203 | const { name } = req.params; 204 | const { page } = req.query; 205 | 206 | const group = await Group.get({ name }); 207 | if (!group) { 208 | res.status(404); 209 | return; 210 | } 211 | 212 | const totalPageCount = Math.ceil(group.msgCount / pageMsgCount); 213 | const currentPage = Number(page) >= 0 ? Number(page) : totalPageCount; 214 | let msgs = await Msg.getRange({ 215 | groupName: name, 216 | idOffset: (currentPage - 1) * pageMsgCount, 217 | idLimit: pageMsgCount, 218 | }); 219 | 220 | msgs = removeRecalledMsgs(msgs); 221 | 222 | // potential bug: more than 100 member of a group 223 | const members = await GroupMember.getAllMemberNames({ 224 | groupName: name, 225 | }); 226 | 227 | // console.log(members); 228 | msgs = msgs.map((msg) => { 229 | if (members.includes(msg.from)) { 230 | msg.isKnownMember = true; 231 | } 232 | return msg; 233 | }); 234 | 235 | res.json({ 236 | msgs, totalPageCount, currentPage, 237 | }); 238 | }); 239 | 240 | app.post('/groupmember/add', async (req, res) => { 241 | const { 242 | groupName, 243 | name, 244 | email, 245 | url, 246 | intro, 247 | date, 248 | } = req.body; 249 | 250 | const valRes = validator.memberInfo({ 251 | groupName, 252 | name, 253 | email, 254 | url, 255 | intro, 256 | date, 257 | }); 258 | 259 | if (valRes.success === false) { 260 | res.status(400).json(valRes); 261 | return 0; 262 | } 263 | 264 | const currentMember = await GroupMember.get({ groupName, name }); 265 | if (currentMember) { 266 | res.status(400).json('Member already exist, contact support if other person takes your name'); 267 | return 0; 268 | } 269 | 270 | await GroupMember.put({ 271 | groupName, 272 | name, 273 | email, 274 | url, 275 | intro, 276 | date, 277 | }); 278 | 279 | res.json('ok'); 280 | }); 281 | 282 | app.post('/api/topics/add', async (req, res) => { 283 | const { 284 | groupName, 285 | from, 286 | title, 287 | date, 288 | msgRange, 289 | description, 290 | type, 291 | password, 292 | } = req.body; 293 | 294 | if (password !== secret.topicPassword) { 295 | res.status(400).json('Wrong password'); 296 | } 297 | 298 | await Topics.add({ 299 | groupName, 300 | from, 301 | title, 302 | date, 303 | msgRange, 304 | description: description || undefined, 305 | type, 306 | }); 307 | res.json('ok'); 308 | }); 309 | 310 | app.get('/api/slackThread/:threadTs', async (req, res) => { 311 | const { threadTs } = req.params; 312 | const msgs = await Msg.getByThreadTs({ ts: threadTs }); 313 | res.json(msgs); 314 | }); 315 | 316 | app.post('/api/slack/message/add', async (req, res) => { 317 | console.log('token should be:', '0TG5la4vs4guENK5Kk3p3jNf'); 318 | 319 | console.log(req); 320 | res.status(200).json('ok'); 321 | }); 322 | 323 | // slack login 324 | app.get('/auth/slack', async (req, res) => { 325 | if (!req.query.code) { // access denied 326 | return; 327 | } 328 | const data = { 329 | client_id: secret.slack.clientId, 330 | client_secret: secret.slack.clientSecret, 331 | code: req.query.code, 332 | }; 333 | 334 | const oauthRes = await axios.post('https://slack.com/api/oauth.access', qs.stringify(data), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); 335 | console.log(oauthRes.data); 336 | await TmpGroup.put(oauthRes.data); 337 | nextApp.render(req, res, '/new_slack_group'); 338 | }); 339 | 340 | app.get('*', (req, res) => handle(req, res)); 341 | const { PORT = 8080 } = process.env; 342 | app.listen(PORT); 343 | console.log(`server running on http://localhost:${PORT}`); 344 | }); 345 | -------------------------------------------------------------------------------- /backend/services.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t9tio/wewe/119d40ee5f4f6158e0ee338f167c4fca072d3f4a/backend/services.js -------------------------------------------------------------------------------- /bots/services/s3.js: -------------------------------------------------------------------------------- 1 | const aws = require('aws-sdk'); 2 | const nanoid = require('nanoid'); 3 | const config = require('../../config'); 4 | 5 | aws.config.update({ 6 | accessKeyId: config.aws.accessKeyId, 7 | secretAccessKey: config.aws.secretAccessKey, 8 | region: 'us-east-1', 9 | signatureVersion: 'v4', 10 | }); 11 | 12 | const s3 = new aws.S3(); 13 | 14 | const getS3Path = s3Key => encodeURI(`${config.aws.s3RootPath}/${s3Key}`); 15 | 16 | const getAvatarS3Key = (roomName, name) => `${roomName}/avatars/${name}.jpg`; 17 | 18 | const getFileS3Key = (roomName, filename) => `${roomName}/files/${nanoid()}${filename}`; 19 | 20 | const getAvatarS3Path = (roomName, name) => getS3Path(getAvatarS3Key(roomName, name)); 21 | 22 | const uploadAvatarToS3AndGetUrl = async (fileStream, roomName, name) => { 23 | console.log('going to upload avatar', name); 24 | const key = getAvatarS3Key(roomName, name); 25 | 26 | await s3.putObject({ 27 | Bucket: config.aws.bucket, 28 | Key: key, 29 | Body: fileStream, 30 | ContentType: '', 31 | }).promise(); 32 | 33 | const s3Path = getS3Path(key); 34 | console.log('upload avatar success', s3Path); 35 | return s3Path; 36 | }; 37 | 38 | /** 39 | * @param contactsInRoom {Array} wechaty contact obj arr 40 | */ 41 | const prepareAvatars = async (roomName, contactsInRoom) => { 42 | // 1. list objects inavatar folder 43 | // 2. compare with usernames, upload unexisted avatars 44 | const data = await s3.listObjectsV2({ 45 | Bucket: config.aws.bucket, 46 | Prefix: `${roomName}/avatars/`, 47 | }).promise(); 48 | 49 | const currentAvatarKeys = data.Contents.map(Content => Content.Key); 50 | console.log('current avatars keys', currentAvatarKeys); 51 | 52 | contactsInRoom.forEach(async (contact) => { 53 | const username = contact.name(); 54 | const avatarKey = getAvatarS3Key(roomName, username); 55 | console.log('generated avatarkey', avatarKey); 56 | if (!currentAvatarKeys.includes(avatarKey)) { 57 | const contactAvatarFileBox = await contact.avatar(); 58 | const contactAvatarBuffer = await contactAvatarFileBox.toBuffer(); 59 | uploadAvatarToS3AndGetUrl(contactAvatarBuffer, roomName, username); 60 | } 61 | }); 62 | }; 63 | 64 | const uploadToS3AndGetUrl = async (fileStream, roomName, filename) => { 65 | console.log('going to upload file', filename); 66 | const key = getFileS3Key(roomName, filename); 67 | await s3.putObject({ 68 | Bucket: config.aws.bucket, 69 | Key: key, 70 | Body: fileStream, 71 | ContentType: '', 72 | }).promise(); 73 | 74 | const s3Path = getS3Path(key); 75 | console.log('upload file success', s3Path); 76 | return s3Path; 77 | }; 78 | 79 | module.exports = { 80 | prepareAvatars, 81 | getAvatarS3Path, 82 | uploadToS3AndGetUrl, 83 | }; 84 | -------------------------------------------------------------------------------- /bots/slack/README.ms: -------------------------------------------------------------------------------- 1 | # Receive msgs from slack 2 | -------------------------------------------------------------------------------- /bots/slack/index.js: -------------------------------------------------------------------------------- 1 | const { WebClient } = require('@slack/web-api'); 2 | const { t9tSlackToken } = require('../../secret.json'); 3 | 4 | // https://api.slack.com/apps/AKUAA9XUJ/install-on-team? 5 | const token = t9tSlackToken; 6 | 7 | // Initialize 8 | const web = new WebClient(token); 9 | 10 | (async () => { 11 | const result = await web.api.test(); 12 | 13 | console.log(result); 14 | 15 | const res2 = await web.channels.list(); 16 | const channel = res2.channels.find(channel => channel.name = 'general'); 17 | const history = await web.channels.history({ channel: channel.id }); 18 | console.log(JSON.stringify(history, 2, null)); 19 | // const user = await web.users.info({ user: 'UEY1ZRJPK' }); 20 | // console.log(user); 21 | })(); 22 | -------------------------------------------------------------------------------- /bots/slack/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slack", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@slack/logger": { 8 | "version": "1.0.0", 9 | "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-1.0.0.tgz", 10 | "integrity": "sha512-QDYhQR/58xKfB5iquvQwfpxPsmKPP/5SuDp8hRhZeUluCHsP1qBCOc3sW2Xb3cydxK0PAEnkLbBJf/ezsGwtlA==", 11 | "requires": { 12 | "@types/node": ">=8.9.0" 13 | } 14 | }, 15 | "@slack/types": { 16 | "version": "1.0.0", 17 | "resolved": "https://registry.npmjs.org/@slack/types/-/types-1.0.0.tgz", 18 | "integrity": "sha512-IktC4uD/CHfLQcSitKSmjmRu4a6+Nf/KzfS6dTgUlDzENhh26l8aESKAuIpvYD5VOOE6NxDDIAdPJOXBvUGxlg==" 19 | }, 20 | "@slack/web-api": { 21 | "version": "5.0.1", 22 | "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-5.0.1.tgz", 23 | "integrity": "sha512-L2Nc8P+NjXH1yqnsNhqxsrbpW3Qv+//9X5PQqcM3bctDmvmwTuhuM1X208RVD2avhnC89aghY5PssyaayWj5sA==", 24 | "requires": { 25 | "@slack/logger": "^1.0.0", 26 | "@slack/types": "^1.0.0", 27 | "@types/form-data": "^2.2.1", 28 | "@types/is-stream": "^1.1.0", 29 | "@types/node": ">=8.9.0", 30 | "@types/p-queue": "^2.3.2", 31 | "axios": "^0.18.0", 32 | "eventemitter3": "^3.1.0", 33 | "form-data": "^2.3.3", 34 | "is-stream": "^1.1.0", 35 | "p-queue": "^2.4.2", 36 | "p-retry": "^4.0.0" 37 | } 38 | }, 39 | "@types/form-data": { 40 | "version": "2.2.1", 41 | "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", 42 | "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", 43 | "requires": { 44 | "@types/node": "*" 45 | } 46 | }, 47 | "@types/is-stream": { 48 | "version": "1.1.0", 49 | "resolved": "https://registry.npmjs.org/@types/is-stream/-/is-stream-1.1.0.tgz", 50 | "integrity": "sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==", 51 | "requires": { 52 | "@types/node": "*" 53 | } 54 | }, 55 | "@types/node": { 56 | "version": "12.0.10", 57 | "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.10.tgz", 58 | "integrity": "sha512-LcsGbPomWsad6wmMNv7nBLw7YYYyfdYcz6xryKYQhx89c3XXan+8Q6AJ43G5XDIaklaVkK3mE4fCb0SBvMiPSQ==" 59 | }, 60 | "@types/p-queue": { 61 | "version": "2.3.2", 62 | "resolved": "https://registry.npmjs.org/@types/p-queue/-/p-queue-2.3.2.tgz", 63 | "integrity": "sha512-eKAv5Ql6k78dh3ULCsSBxX6bFNuGjTmof5Q/T6PiECDq0Yf8IIn46jCyp3RJvCi8owaEmm3DZH1PEImjBMd/vQ==" 64 | }, 65 | "@types/retry": { 66 | "version": "0.12.0", 67 | "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", 68 | "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" 69 | }, 70 | "asynckit": { 71 | "version": "0.4.0", 72 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 73 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 74 | }, 75 | "axios": { 76 | "version": "0.18.1", 77 | "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", 78 | "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", 79 | "requires": { 80 | "follow-redirects": "1.5.10", 81 | "is-buffer": "^2.0.2" 82 | } 83 | }, 84 | "combined-stream": { 85 | "version": "1.0.8", 86 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 87 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 88 | "requires": { 89 | "delayed-stream": "~1.0.0" 90 | } 91 | }, 92 | "debug": { 93 | "version": "3.1.0", 94 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 95 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 96 | "requires": { 97 | "ms": "2.0.0" 98 | } 99 | }, 100 | "delayed-stream": { 101 | "version": "1.0.0", 102 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 103 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 104 | }, 105 | "eventemitter3": { 106 | "version": "3.1.2", 107 | "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", 108 | "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" 109 | }, 110 | "follow-redirects": { 111 | "version": "1.5.10", 112 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", 113 | "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", 114 | "requires": { 115 | "debug": "=3.1.0" 116 | } 117 | }, 118 | "form-data": { 119 | "version": "2.4.0", 120 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.4.0.tgz", 121 | "integrity": "sha512-4FinE8RfqYnNim20xDwZZE0V2kOs/AuElIjFUbPuegQSaoZM+vUT5FnwSl10KPugH4voTg1bEQlcbCG9ka75TA==", 122 | "requires": { 123 | "asynckit": "^0.4.0", 124 | "combined-stream": "^1.0.6", 125 | "mime-types": "^2.1.12" 126 | } 127 | }, 128 | "is-buffer": { 129 | "version": "2.0.3", 130 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", 131 | "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" 132 | }, 133 | "is-stream": { 134 | "version": "1.1.0", 135 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", 136 | "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" 137 | }, 138 | "mime-db": { 139 | "version": "1.40.0", 140 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 141 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 142 | }, 143 | "mime-types": { 144 | "version": "2.1.24", 145 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 146 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 147 | "requires": { 148 | "mime-db": "1.40.0" 149 | } 150 | }, 151 | "ms": { 152 | "version": "2.0.0", 153 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 154 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 155 | }, 156 | "p-queue": { 157 | "version": "2.4.2", 158 | "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-2.4.2.tgz", 159 | "integrity": "sha512-n8/y+yDJwBjoLQe1GSJbbaYQLTI7QHNZI2+rpmCDbe++WLf9HC3gf6iqj5yfPAV71W4UF3ql5W1+UBPXoXTxng==" 160 | }, 161 | "p-retry": { 162 | "version": "4.1.0", 163 | "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.1.0.tgz", 164 | "integrity": "sha512-oepllyG9gX1qH4Sm20YAKxg1GA7L7puhvGnTfimi31P07zSIj7SDV6YtuAx9nbJF51DES+2CIIRkXs8GKqWJxA==", 165 | "requires": { 166 | "@types/retry": "^0.12.0", 167 | "retry": "^0.12.0" 168 | } 169 | }, 170 | "retry": { 171 | "version": "0.12.0", 172 | "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", 173 | "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /bots/slack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slack", 3 | "version": "1.0.0", 4 | "description": "", 5 | "dependencies": { 6 | "@slack/web-api": "^5.0.1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /bots/wechat/README.md: -------------------------------------------------------------------------------- 1 | Using wechaty here 2 | 3 | other options 4 | - https://github.com/nodeWechat/wechat4u 5 | - https://github.com/nodeWechat/wechat4u#%E7%9B%B8%E5%85%B3%E9%A1%B9%E7%9B%AE 6 | - directly base on wechat web: https://github.com/geeeeeeeeek/electronic-wechat/issues/601 -------------------------------------------------------------------------------- /bots/wechat/index.js: -------------------------------------------------------------------------------- 1 | const { Wechaty } = require('wechaty'); 2 | const qrcodeTerminal = require('qrcode-terminal'); 3 | const MsgDao = require('../../db/Msg'); 4 | const GroupDao = require('../../db/Group'); 5 | const TopicDao = require('../../db/Topics'); 6 | 7 | const s3 = require('../services/s3'); 8 | 9 | GroupDao.getAll().then(async (groups) => { 10 | const knownGroups = groups.map(group => group.name); 11 | console.log(knownGroups); 12 | 13 | const bot = Wechaty.instance(); 14 | 15 | bot.start(); 16 | 17 | bot.on('scan', (url, status) => { 18 | const loginUrl = url.replace(/\/qrcode\//, '/l/'); 19 | qrcodeTerminal.generate(loginUrl); 20 | console.log(status); 21 | }); 22 | 23 | bot.on('login', user => console.log(`User ${user} logined`)); 24 | 25 | bot.on('message', async (message) => { 26 | try { 27 | // console.log(`Message: ${message}`); 28 | const room = await message.room(); 29 | 30 | if (room) { 31 | const groupName = await room.topic(); 32 | 33 | // TODO: get groups from db 34 | if (knownGroups.includes(groupName)) { 35 | const from = await message.from().name(); 36 | const rawDate = await message.date(); 37 | const date = new Date(rawDate).getTime(); 38 | // MessageType.Unknown 39 | // MessageType.Attachment 40 | // MessageType.Audio 41 | // MessageType.Contact 42 | // MessageType.Emoticon 43 | // MessageType.Image 44 | // MessageType.Text 45 | // MessageType.Video 46 | // MessageType.Url 47 | const type = await message.type(); 48 | if (knownGroups.includes(from) && type !== bot.Message.Type.Recalled) return; 49 | if (type === bot.Message.Type.Audio || type === bot.Message.Type.Video || type === bot.Message.Type.Image) { 50 | const filebox = await message.toFileBox(); 51 | const filename = filebox.name; 52 | const fileStream = await filebox.toBuffer(); 53 | const link = await s3.uploadToS3AndGetUrl(fileStream, groupName, filename); 54 | await MsgDao.addMsgOfGroup({ 55 | groupName, from, date, type, link, 56 | }); 57 | console.log('msg saved to db', groupName, from, date, type, link); 58 | } else if (type === bot.Message.Type.Recalled) { 59 | const recalledMsg = await message.toRecalled(); 60 | await MsgDao.addMsgOfGroup({ 61 | groupName, 62 | text: recalledMsg.text(), 63 | from: recalledMsg.from().name(), 64 | date, 65 | type, 66 | }); 67 | console.log('msg saved to db', groupName, recalledMsg.text(), recalledMsg.from().name(), type); 68 | } else { 69 | const text = await message.text(); 70 | const msgId = await MsgDao.addMsgOfGroup({ 71 | groupName, text, from, date, type, 72 | }); 73 | if (text.includes('#topic')) { 74 | await TopicDao.add({ 75 | groupName, 76 | from, 77 | title: text, 78 | date, 79 | msgRange: [msgId], 80 | type:'wechat', 81 | }); 82 | } 83 | console.log('msg saved to db', groupName, text, from, date, type); 84 | } 85 | } 86 | } 87 | } catch (e) { 88 | console.error(e); 89 | } 90 | }); 91 | }); 92 | -------------------------------------------------------------------------------- /bots/wechat/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wewe-wechat-bot", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/normalize-package-data": { 8 | "version": "2.4.0", 9 | "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", 10 | "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==" 11 | }, 12 | "ansi-escapes": { 13 | "version": "1.4.0", 14 | "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", 15 | "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=" 16 | }, 17 | "ansi-regex": { 18 | "version": "2.1.1", 19 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 20 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" 21 | }, 22 | "ansi-styles": { 23 | "version": "2.2.1", 24 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", 25 | "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" 26 | }, 27 | "async": { 28 | "version": "1.5.2", 29 | "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", 30 | "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" 31 | }, 32 | "async-limiter": { 33 | "version": "1.0.0", 34 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", 35 | "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" 36 | }, 37 | "aws-sdk": { 38 | "version": "2.476.0", 39 | "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.476.0.tgz", 40 | "integrity": "sha512-GBvp/VjKu5YAiwzLVyfUajq43BXBvxhNUz6D27mG/ttceeFdQxMkZbAHSk36vH7rtECGIgRTw5ok8BoHVCTGuw==", 41 | "requires": { 42 | "buffer": "4.9.1", 43 | "events": "1.1.1", 44 | "ieee754": "1.1.8", 45 | "jmespath": "0.15.0", 46 | "querystring": "0.2.0", 47 | "sax": "1.2.1", 48 | "url": "0.10.3", 49 | "uuid": "3.3.2", 50 | "xml2js": "0.4.19" 51 | } 52 | }, 53 | "babel-polyfill": { 54 | "version": "6.23.0", 55 | "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz", 56 | "integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=", 57 | "requires": { 58 | "babel-runtime": "^6.22.0", 59 | "core-js": "^2.4.0", 60 | "regenerator-runtime": "^0.10.0" 61 | } 62 | }, 63 | "babel-runtime": { 64 | "version": "6.26.0", 65 | "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", 66 | "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", 67 | "requires": { 68 | "core-js": "^2.4.0", 69 | "regenerator-runtime": "^0.11.0" 70 | }, 71 | "dependencies": { 72 | "regenerator-runtime": { 73 | "version": "0.11.1", 74 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", 75 | "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" 76 | } 77 | } 78 | }, 79 | "balanced-match": { 80 | "version": "1.0.0", 81 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 82 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 83 | }, 84 | "base64-js": { 85 | "version": "1.3.0", 86 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", 87 | "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" 88 | }, 89 | "bluebird": { 90 | "version": "3.5.5", 91 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz", 92 | "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==" 93 | }, 94 | "brace-expansion": { 95 | "version": "1.1.11", 96 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 97 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 98 | "requires": { 99 | "balanced-match": "^1.0.0", 100 | "concat-map": "0.0.1" 101 | } 102 | }, 103 | "brolog": { 104 | "version": "1.8.3", 105 | "resolved": "https://registry.npmjs.org/brolog/-/brolog-1.8.3.tgz", 106 | "integrity": "sha512-ye50Dh2AIz6r4UdrKq9KuZHq3P0osZI42bXUTh9Grp3qLjTN7HqnC1b7czD6ySoSj42piFAq4eHuBrYBRSGxDg==" 107 | }, 108 | "buffer": { 109 | "version": "4.9.1", 110 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", 111 | "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", 112 | "requires": { 113 | "base64-js": "^1.0.2", 114 | "ieee754": "^1.1.4", 115 | "isarray": "^1.0.0" 116 | } 117 | }, 118 | "callsites": { 119 | "version": "3.1.0", 120 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 121 | "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" 122 | }, 123 | "chalk": { 124 | "version": "1.1.3", 125 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", 126 | "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", 127 | "requires": { 128 | "ansi-styles": "^2.2.1", 129 | "escape-string-regexp": "^1.0.2", 130 | "has-ansi": "^2.0.0", 131 | "strip-ansi": "^3.0.0", 132 | "supports-color": "^2.0.0" 133 | } 134 | }, 135 | "chardet": { 136 | "version": "0.4.2", 137 | "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", 138 | "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=" 139 | }, 140 | "charenc": { 141 | "version": "0.0.2", 142 | "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", 143 | "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" 144 | }, 145 | "cli-cursor": { 146 | "version": "2.1.0", 147 | "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", 148 | "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", 149 | "requires": { 150 | "restore-cursor": "^2.0.0" 151 | } 152 | }, 153 | "cli-width": { 154 | "version": "2.2.0", 155 | "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", 156 | "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" 157 | }, 158 | "clone-class": { 159 | "version": "0.6.20", 160 | "resolved": "https://registry.npmjs.org/clone-class/-/clone-class-0.6.20.tgz", 161 | "integrity": "sha512-h5ZvC7K0wptqIamtMkRF3LPoIr0bz0f60G3u5KkUhtRRz0PKJG8BnjiUyK4xgJ1FO+YS8muadU0r1J981CluBw==" 162 | }, 163 | "concat-map": { 164 | "version": "0.0.1", 165 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 166 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 167 | }, 168 | "cookie": { 169 | "version": "0.3.1", 170 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 171 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 172 | }, 173 | "core-js": { 174 | "version": "2.6.9", 175 | "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", 176 | "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" 177 | }, 178 | "crypt": { 179 | "version": "0.0.2", 180 | "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", 181 | "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" 182 | }, 183 | "cuid": { 184 | "version": "2.1.6", 185 | "resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.6.tgz", 186 | "integrity": "sha512-ZFp7PS6cSYMJNch9fc3tyHdE4T8TDo3Y5qAxb0KSA9mpiYDo7z9ql1CznFuuzxea9STVIDy0tJWm2lYiX2ZU1Q==" 187 | }, 188 | "debug": { 189 | "version": "2.6.9", 190 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 191 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 192 | "requires": { 193 | "ms": "2.0.0" 194 | } 195 | }, 196 | "encoding": { 197 | "version": "0.1.12", 198 | "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", 199 | "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", 200 | "requires": { 201 | "iconv-lite": "~0.4.13" 202 | } 203 | }, 204 | "err-code": { 205 | "version": "1.1.2", 206 | "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", 207 | "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=" 208 | }, 209 | "error-ex": { 210 | "version": "1.3.2", 211 | "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", 212 | "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", 213 | "requires": { 214 | "is-arrayish": "^0.2.1" 215 | } 216 | }, 217 | "escape-string-regexp": { 218 | "version": "1.0.5", 219 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 220 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" 221 | }, 222 | "events": { 223 | "version": "1.1.1", 224 | "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", 225 | "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" 226 | }, 227 | "external-editor": { 228 | "version": "2.2.0", 229 | "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", 230 | "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", 231 | "requires": { 232 | "chardet": "^0.4.0", 233 | "iconv-lite": "^0.4.17", 234 | "tmp": "^0.0.33" 235 | } 236 | }, 237 | "figures": { 238 | "version": "2.0.0", 239 | "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", 240 | "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", 241 | "requires": { 242 | "escape-string-regexp": "^1.0.5" 243 | } 244 | }, 245 | "file-box": { 246 | "version": "0.8.27", 247 | "resolved": "https://registry.npmjs.org/file-box/-/file-box-0.8.27.tgz", 248 | "integrity": "sha512-ZgjZHnhwr3mRhfx2DSVFbxK2Q4OarxqjD7/g+LdOn79OrtL44uSJ8lM4RSCU3TeGw2nTXcwI2UKkvGNGIlA9tA==", 249 | "requires": { 250 | "mime": "^2.3.1" 251 | } 252 | }, 253 | "find-up": { 254 | "version": "4.0.0", 255 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.0.0.tgz", 256 | "integrity": "sha512-zoH7ZWPkRdgwYCDVoQTzqjG8JSPANhtvLhh4KVUHyKnaUJJrNeFmWIkTcNuJmR3GLMEmGYEf2S2bjgx26JTF+Q==", 257 | "requires": { 258 | "locate-path": "^5.0.0" 259 | } 260 | }, 261 | "fs.realpath": { 262 | "version": "1.0.0", 263 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 264 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 265 | }, 266 | "glob": { 267 | "version": "7.1.4", 268 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", 269 | "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", 270 | "requires": { 271 | "fs.realpath": "^1.0.0", 272 | "inflight": "^1.0.4", 273 | "inherits": "2", 274 | "minimatch": "^3.0.4", 275 | "once": "^1.3.0", 276 | "path-is-absolute": "^1.0.0" 277 | } 278 | }, 279 | "has-ansi": { 280 | "version": "2.0.0", 281 | "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", 282 | "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", 283 | "requires": { 284 | "ansi-regex": "^2.0.0" 285 | } 286 | }, 287 | "hosted-git-info": { 288 | "version": "2.7.1", 289 | "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", 290 | "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==" 291 | }, 292 | "hot-import": { 293 | "version": "0.2.9", 294 | "resolved": "https://registry.npmjs.org/hot-import/-/hot-import-0.2.9.tgz", 295 | "integrity": "sha512-go20QkULYZHxsBr+ZybxoiJddhaSVvSRUn67VrxL7yEP2VubZSanduH5eIq/DOofWPQbD0sMwzo0mz1KcDex8w==", 296 | "requires": { 297 | "brolog": "^1.2.6", 298 | "callsites": "^3.0.0", 299 | "read-pkg-up": "^6.0.0" 300 | } 301 | }, 302 | "iconv-lite": { 303 | "version": "0.4.24", 304 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 305 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 306 | "requires": { 307 | "safer-buffer": ">= 2.1.2 < 3" 308 | } 309 | }, 310 | "ieee754": { 311 | "version": "1.1.8", 312 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", 313 | "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" 314 | }, 315 | "in-gfw": { 316 | "version": "1.2.0", 317 | "resolved": "https://registry.npmjs.org/in-gfw/-/in-gfw-1.2.0.tgz", 318 | "integrity": "sha512-LgSoQXzuSS/x/nh0eIggq7PsI7gs/sQdXNEolRmHaFUj6YMFmPO1kxQ7XpcT3nPpC3DMwYiJmgnluqJmFXYiMg==", 319 | "requires": { 320 | "glob": "^7.1.2", 321 | "is-wsl": "^1.1.0", 322 | "mem": "^3.0.1" 323 | } 324 | }, 325 | "inflight": { 326 | "version": "1.0.6", 327 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 328 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 329 | "requires": { 330 | "once": "^1.3.0", 331 | "wrappy": "1" 332 | } 333 | }, 334 | "inherits": { 335 | "version": "2.0.3", 336 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 337 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 338 | }, 339 | "inquirer": { 340 | "version": "3.0.6", 341 | "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.0.6.tgz", 342 | "integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=", 343 | "requires": { 344 | "ansi-escapes": "^1.1.0", 345 | "chalk": "^1.0.0", 346 | "cli-cursor": "^2.1.0", 347 | "cli-width": "^2.0.0", 348 | "external-editor": "^2.0.1", 349 | "figures": "^2.0.0", 350 | "lodash": "^4.3.0", 351 | "mute-stream": "0.0.7", 352 | "run-async": "^2.2.0", 353 | "rx": "^4.1.0", 354 | "string-width": "^2.0.0", 355 | "strip-ansi": "^3.0.0", 356 | "through": "^2.3.6" 357 | } 358 | }, 359 | "is-arrayish": { 360 | "version": "0.2.1", 361 | "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", 362 | "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" 363 | }, 364 | "is-buffer": { 365 | "version": "1.1.6", 366 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", 367 | "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" 368 | }, 369 | "is-fullwidth-code-point": { 370 | "version": "2.0.0", 371 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 372 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" 373 | }, 374 | "is-promise": { 375 | "version": "2.1.0", 376 | "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", 377 | "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" 378 | }, 379 | "is-stream": { 380 | "version": "1.1.0", 381 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", 382 | "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" 383 | }, 384 | "is-wsl": { 385 | "version": "1.1.0", 386 | "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", 387 | "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" 388 | }, 389 | "isarray": { 390 | "version": "1.0.0", 391 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 392 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 393 | }, 394 | "jmespath": { 395 | "version": "0.15.0", 396 | "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", 397 | "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" 398 | }, 399 | "json-parse-better-errors": { 400 | "version": "1.0.2", 401 | "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", 402 | "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" 403 | }, 404 | "locate-path": { 405 | "version": "5.0.0", 406 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", 407 | "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", 408 | "requires": { 409 | "p-locate": "^4.1.0" 410 | } 411 | }, 412 | "lodash": { 413 | "version": "4.17.11", 414 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", 415 | "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" 416 | }, 417 | "md5": { 418 | "version": "2.2.1", 419 | "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", 420 | "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", 421 | "requires": { 422 | "charenc": "~0.0.1", 423 | "crypt": "~0.0.1", 424 | "is-buffer": "~1.1.1" 425 | } 426 | }, 427 | "mem": { 428 | "version": "3.0.1", 429 | "resolved": "https://registry.npmjs.org/mem/-/mem-3.0.1.tgz", 430 | "integrity": "sha512-QKs47bslvOE0NbXOqG6lMxn6Bk0Iuw0vfrIeLykmQle2LkCw1p48dZDdzE+D88b/xqRJcZGcMNeDvSVma+NuIQ==", 431 | "requires": { 432 | "mimic-fn": "^1.0.0", 433 | "p-is-promise": "^1.1.0" 434 | } 435 | }, 436 | "memory-card": { 437 | "version": "0.6.13", 438 | "resolved": "https://registry.npmjs.org/memory-card/-/memory-card-0.6.13.tgz", 439 | "integrity": "sha512-61RxTlrl+iyTKH0opRFbWz9cdcuQhML1BfF+2KVVMbTDyz0BgSZ/NjC2aBJxj8fg60Jq3oGhRUdrl14b1MYr4Q==", 440 | "requires": { 441 | "aws-sdk": "^2.286.2", 442 | "brolog": "^1.6.2" 443 | } 444 | }, 445 | "mime": { 446 | "version": "2.4.4", 447 | "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", 448 | "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" 449 | }, 450 | "mimic-fn": { 451 | "version": "1.2.0", 452 | "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", 453 | "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" 454 | }, 455 | "minimatch": { 456 | "version": "3.0.4", 457 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 458 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 459 | "requires": { 460 | "brace-expansion": "^1.1.7" 461 | } 462 | }, 463 | "minimist": { 464 | "version": "1.2.0", 465 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 466 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" 467 | }, 468 | "mkdirp": { 469 | "version": "0.5.1", 470 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 471 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 472 | "requires": { 473 | "minimist": "0.0.8" 474 | }, 475 | "dependencies": { 476 | "minimist": { 477 | "version": "0.0.8", 478 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 479 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" 480 | } 481 | } 482 | }, 483 | "ms": { 484 | "version": "2.0.0", 485 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 486 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 487 | }, 488 | "mute-stream": { 489 | "version": "0.0.7", 490 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", 491 | "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" 492 | }, 493 | "node-fetch": { 494 | "version": "1.6.3", 495 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz", 496 | "integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=", 497 | "requires": { 498 | "encoding": "^0.1.11", 499 | "is-stream": "^1.0.1" 500 | } 501 | }, 502 | "nop": { 503 | "version": "1.0.0", 504 | "resolved": "https://registry.npmjs.org/nop/-/nop-1.0.0.tgz", 505 | "integrity": "sha1-y0bPfgFXSqY5CFgUn2aJev5Tyco=" 506 | }, 507 | "normalize-package-data": { 508 | "version": "2.5.0", 509 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", 510 | "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", 511 | "requires": { 512 | "hosted-git-info": "^2.1.4", 513 | "resolve": "^1.10.0", 514 | "semver": "2 || 3 || 4 || 5", 515 | "validate-npm-package-license": "^3.0.1" 516 | }, 517 | "dependencies": { 518 | "semver": { 519 | "version": "5.7.0", 520 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", 521 | "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" 522 | } 523 | } 524 | }, 525 | "npm-programmatic": { 526 | "version": "0.0.12", 527 | "resolved": "https://registry.npmjs.org/npm-programmatic/-/npm-programmatic-0.0.12.tgz", 528 | "integrity": "sha512-fvZdiJS038ZH31z59cEiIywOcgX1u23aLc0wAKF4btyhbYQxE93wTQjzs/URERK+GhS/QghDILQmEvgxu77/zQ==", 529 | "requires": { 530 | "bluebird": "^3.4.1" 531 | } 532 | }, 533 | "object-assign": { 534 | "version": "4.1.1", 535 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 536 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 537 | }, 538 | "once": { 539 | "version": "1.4.0", 540 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 541 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 542 | "requires": { 543 | "wrappy": "1" 544 | } 545 | }, 546 | "onetime": { 547 | "version": "2.0.1", 548 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", 549 | "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", 550 | "requires": { 551 | "mimic-fn": "^1.0.0" 552 | } 553 | }, 554 | "opencollective": { 555 | "version": "1.0.3", 556 | "resolved": "https://registry.npmjs.org/opencollective/-/opencollective-1.0.3.tgz", 557 | "integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=", 558 | "requires": { 559 | "babel-polyfill": "6.23.0", 560 | "chalk": "1.1.3", 561 | "inquirer": "3.0.6", 562 | "minimist": "1.2.0", 563 | "node-fetch": "1.6.3", 564 | "opn": "4.0.2" 565 | } 566 | }, 567 | "opencollective-postinstall": { 568 | "version": "2.0.2", 569 | "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", 570 | "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" 571 | }, 572 | "opn": { 573 | "version": "4.0.2", 574 | "resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz", 575 | "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", 576 | "requires": { 577 | "object-assign": "^4.0.1", 578 | "pinkie-promise": "^2.0.0" 579 | } 580 | }, 581 | "os-tmpdir": { 582 | "version": "1.0.2", 583 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 584 | "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" 585 | }, 586 | "p-is-promise": { 587 | "version": "1.1.0", 588 | "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", 589 | "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=" 590 | }, 591 | "p-limit": { 592 | "version": "2.2.0", 593 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", 594 | "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", 595 | "requires": { 596 | "p-try": "^2.0.0" 597 | } 598 | }, 599 | "p-locate": { 600 | "version": "4.1.0", 601 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", 602 | "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", 603 | "requires": { 604 | "p-limit": "^2.2.0" 605 | } 606 | }, 607 | "p-try": { 608 | "version": "2.2.0", 609 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 610 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" 611 | }, 612 | "parse-json": { 613 | "version": "4.0.0", 614 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", 615 | "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", 616 | "requires": { 617 | "error-ex": "^1.3.1", 618 | "json-parse-better-errors": "^1.0.1" 619 | } 620 | }, 621 | "path-exists": { 622 | "version": "3.0.0", 623 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", 624 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" 625 | }, 626 | "path-is-absolute": { 627 | "version": "1.0.1", 628 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 629 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 630 | }, 631 | "path-parse": { 632 | "version": "1.0.6", 633 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", 634 | "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" 635 | }, 636 | "pinkie": { 637 | "version": "2.0.4", 638 | "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", 639 | "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" 640 | }, 641 | "pinkie-promise": { 642 | "version": "2.0.1", 643 | "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", 644 | "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", 645 | "requires": { 646 | "pinkie": "^2.0.0" 647 | } 648 | }, 649 | "pkg-dir": { 650 | "version": "4.2.0", 651 | "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", 652 | "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", 653 | "requires": { 654 | "find-up": "^4.0.0" 655 | } 656 | }, 657 | "portfinder": { 658 | "version": "1.0.20", 659 | "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz", 660 | "integrity": "sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==", 661 | "requires": { 662 | "async": "^1.5.2", 663 | "debug": "^2.2.0", 664 | "mkdirp": "0.5.x" 665 | } 666 | }, 667 | "promise-retry": { 668 | "version": "1.1.1", 669 | "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", 670 | "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", 671 | "requires": { 672 | "err-code": "^1.0.0", 673 | "retry": "^0.10.0" 674 | } 675 | }, 676 | "punycode": { 677 | "version": "1.3.2", 678 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", 679 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" 680 | }, 681 | "qr-image": { 682 | "version": "3.2.0", 683 | "resolved": "https://registry.npmjs.org/qr-image/-/qr-image-3.2.0.tgz", 684 | "integrity": "sha1-n6gpW+rlDEoUnPn5CaHbRkqGcug=" 685 | }, 686 | "qrcode-terminal": { 687 | "version": "0.12.0", 688 | "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz", 689 | "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==" 690 | }, 691 | "querystring": { 692 | "version": "0.2.0", 693 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", 694 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" 695 | }, 696 | "quick-lru": { 697 | "version": "3.0.0", 698 | "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-3.0.0.tgz", 699 | "integrity": "sha512-WLzHLB/msD8Q/5jNh4LviurG896aIEJRS1M3gHz91nSmaXn8q+/q4yOQvNMIETl9f5pAu3igqexB62ARWOUoOg==" 700 | }, 701 | "raven": { 702 | "version": "2.6.4", 703 | "resolved": "https://registry.npmjs.org/raven/-/raven-2.6.4.tgz", 704 | "integrity": "sha512-6PQdfC4+DQSFncowthLf+B6Hr0JpPsFBgTVYTAOq7tCmx/kR4SXbeawtPch20+3QfUcQDoJBLjWW1ybvZ4kXTw==", 705 | "requires": { 706 | "cookie": "0.3.1", 707 | "md5": "^2.2.1", 708 | "stack-trace": "0.0.10", 709 | "timed-out": "4.0.1", 710 | "uuid": "3.3.2" 711 | } 712 | }, 713 | "read-pkg": { 714 | "version": "5.1.1", 715 | "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.1.1.tgz", 716 | "integrity": "sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w==", 717 | "requires": { 718 | "@types/normalize-package-data": "^2.4.0", 719 | "normalize-package-data": "^2.5.0", 720 | "parse-json": "^4.0.0", 721 | "type-fest": "^0.4.1" 722 | }, 723 | "dependencies": { 724 | "type-fest": { 725 | "version": "0.4.1", 726 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.4.1.tgz", 727 | "integrity": "sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw==" 728 | } 729 | } 730 | }, 731 | "read-pkg-up": { 732 | "version": "6.0.0", 733 | "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-6.0.0.tgz", 734 | "integrity": "sha512-odtTvLl+EXo1eTsMnoUHRmg/XmXdTkwXVxy4VFE9Kp6cCq7b3l7QMdBndND3eAFzrbSAXC/WCUOQQ9rLjifKZw==", 735 | "requires": { 736 | "find-up": "^4.0.0", 737 | "read-pkg": "^5.1.1", 738 | "type-fest": "^0.5.0" 739 | } 740 | }, 741 | "regenerator-runtime": { 742 | "version": "0.10.5", 743 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", 744 | "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" 745 | }, 746 | "resolve": { 747 | "version": "1.11.0", 748 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", 749 | "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", 750 | "requires": { 751 | "path-parse": "^1.0.6" 752 | } 753 | }, 754 | "restore-cursor": { 755 | "version": "2.0.0", 756 | "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", 757 | "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", 758 | "requires": { 759 | "onetime": "^2.0.0", 760 | "signal-exit": "^3.0.2" 761 | } 762 | }, 763 | "retry": { 764 | "version": "0.10.1", 765 | "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", 766 | "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=" 767 | }, 768 | "run-async": { 769 | "version": "2.3.0", 770 | "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", 771 | "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", 772 | "requires": { 773 | "is-promise": "^2.1.0" 774 | } 775 | }, 776 | "rx": { 777 | "version": "4.1.0", 778 | "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", 779 | "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=" 780 | }, 781 | "rx-queue": { 782 | "version": "0.8.2", 783 | "resolved": "https://registry.npmjs.org/rx-queue/-/rx-queue-0.8.2.tgz", 784 | "integrity": "sha512-aAWi0vOWdCfMGQLQwKSDBkJcbhX85GDjVsqQqaXlzXpg2R2If+JE186pEfLA/sfHjX+waVUJTuKoCLiaZ5CCXA==" 785 | }, 786 | "rxjs": { 787 | "version": "6.5.2", 788 | "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz", 789 | "integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==", 790 | "requires": { 791 | "tslib": "^1.9.0" 792 | } 793 | }, 794 | "safer-buffer": { 795 | "version": "2.1.2", 796 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 797 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 798 | }, 799 | "sax": { 800 | "version": "1.2.1", 801 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", 802 | "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" 803 | }, 804 | "semver": { 805 | "version": "6.1.1", 806 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz", 807 | "integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==" 808 | }, 809 | "signal-exit": { 810 | "version": "3.0.2", 811 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", 812 | "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" 813 | }, 814 | "spdx-correct": { 815 | "version": "3.1.0", 816 | "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", 817 | "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", 818 | "requires": { 819 | "spdx-expression-parse": "^3.0.0", 820 | "spdx-license-ids": "^3.0.0" 821 | } 822 | }, 823 | "spdx-exceptions": { 824 | "version": "2.2.0", 825 | "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", 826 | "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" 827 | }, 828 | "spdx-expression-parse": { 829 | "version": "3.0.0", 830 | "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", 831 | "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", 832 | "requires": { 833 | "spdx-exceptions": "^2.1.0", 834 | "spdx-license-ids": "^3.0.0" 835 | } 836 | }, 837 | "spdx-license-ids": { 838 | "version": "3.0.4", 839 | "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz", 840 | "integrity": "sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA==" 841 | }, 842 | "stack-trace": { 843 | "version": "0.0.10", 844 | "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", 845 | "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" 846 | }, 847 | "state-switch": { 848 | "version": "0.6.12", 849 | "resolved": "https://registry.npmjs.org/state-switch/-/state-switch-0.6.12.tgz", 850 | "integrity": "sha512-JVIEvfsj6Arw8qwHVzWtAmltoIufMLUchti1iLWu+4a4UCZ8vwLFiDuudQHZpcQ+QWf5rchlFnCy/9G4AHBiTw==", 851 | "requires": { 852 | "nop": "^1.0.0" 853 | } 854 | }, 855 | "string-width": { 856 | "version": "2.1.1", 857 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 858 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 859 | "requires": { 860 | "is-fullwidth-code-point": "^2.0.0", 861 | "strip-ansi": "^4.0.0" 862 | }, 863 | "dependencies": { 864 | "ansi-regex": { 865 | "version": "3.0.0", 866 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 867 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" 868 | }, 869 | "strip-ansi": { 870 | "version": "4.0.0", 871 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 872 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 873 | "requires": { 874 | "ansi-regex": "^3.0.0" 875 | } 876 | } 877 | } 878 | }, 879 | "strip-ansi": { 880 | "version": "3.0.1", 881 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 882 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 883 | "requires": { 884 | "ansi-regex": "^2.0.0" 885 | } 886 | }, 887 | "supports-color": { 888 | "version": "2.0.0", 889 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", 890 | "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" 891 | }, 892 | "through": { 893 | "version": "2.3.8", 894 | "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 895 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" 896 | }, 897 | "timed-out": { 898 | "version": "4.0.1", 899 | "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", 900 | "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" 901 | }, 902 | "tmp": { 903 | "version": "0.0.33", 904 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", 905 | "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", 906 | "requires": { 907 | "os-tmpdir": "~1.0.2" 908 | } 909 | }, 910 | "tslib": { 911 | "version": "1.10.0", 912 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", 913 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" 914 | }, 915 | "type-fest": { 916 | "version": "0.5.2", 917 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz", 918 | "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==" 919 | }, 920 | "url": { 921 | "version": "0.10.3", 922 | "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", 923 | "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", 924 | "requires": { 925 | "punycode": "1.3.2", 926 | "querystring": "0.2.0" 927 | } 928 | }, 929 | "uuid": { 930 | "version": "3.3.2", 931 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", 932 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" 933 | }, 934 | "validate-npm-package-license": { 935 | "version": "3.0.4", 936 | "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", 937 | "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", 938 | "requires": { 939 | "spdx-correct": "^3.0.0", 940 | "spdx-expression-parse": "^3.0.0" 941 | } 942 | }, 943 | "watchdog": { 944 | "version": "0.8.17", 945 | "resolved": "https://registry.npmjs.org/watchdog/-/watchdog-0.8.17.tgz", 946 | "integrity": "sha512-RHxxLKqtggCGapGIng8OBOzebF9rx2ucl4bT36mj7GkipcIzj4Rhg0nlcP0RpMHtC8Gys4a5F9/DXz/qYIa0WQ==", 947 | "requires": { 948 | "brolog": "^1.3.3" 949 | } 950 | }, 951 | "wechaty": { 952 | "version": "0.27.19", 953 | "resolved": "https://registry.npmjs.org/wechaty/-/wechaty-0.27.19.tgz", 954 | "integrity": "sha512-rHAYSftknbvO/gHVjaGyMYWskcLpEXxvlsU/2WMhM1z9HsWqQjKGQRhlLtuUntuHZ50BWBjnE7Bj+D26GJT+Qw==", 955 | "requires": { 956 | "brolog": "^1.8.1", 957 | "clone-class": "^0.6.11", 958 | "cuid": "^2.1.1", 959 | "file-box": "^0.8.23", 960 | "hot-import": "^0.2.1", 961 | "in-gfw": "^1.2.0", 962 | "memory-card": "^0.6.9", 963 | "npm-programmatic": "0.0.12", 964 | "opencollective": "^1.0.3", 965 | "opencollective-postinstall": "^2.0.2", 966 | "pkg-dir": "^4.0.0", 967 | "portfinder": "^1.0.17", 968 | "promise-retry": "^1.1.1", 969 | "qr-image": "^3.2.0", 970 | "raven": "^2.6.2", 971 | "read-pkg-up": "^6.0.0", 972 | "semver": "^6.0.0", 973 | "state-switch": "^0.6.2", 974 | "watchdog": "^0.8.1", 975 | "wechaty-puppet": "^0.15.9", 976 | "ws": "^7.0.0" 977 | } 978 | }, 979 | "wechaty-puppet": { 980 | "version": "0.15.10", 981 | "resolved": "https://registry.npmjs.org/wechaty-puppet/-/wechaty-puppet-0.15.10.tgz", 982 | "integrity": "sha512-nvgveVKkJiN0lFwUm5aBT8bNLAO2+T/4Na+pLQGJFOyseijrz5UEvbXoSduhD1Glr+9RvddK/9sBMzZlY55Y7w==", 983 | "requires": { 984 | "brolog": "^1.6.5", 985 | "clone-class": "^0.6.19", 986 | "hot-import": "^0.2.1", 987 | "normalize-package-data": "^2.4.0", 988 | "quick-lru": "^3.0.0", 989 | "read-pkg-up": "^5.0.0", 990 | "rx-queue": "^0.8.1", 991 | "rxjs": "^6.2.1", 992 | "semver": "^6.0.0", 993 | "state-switch": "^0.6.2", 994 | "watchdog": "^0.8.12" 995 | }, 996 | "dependencies": { 997 | "find-up": { 998 | "version": "3.0.0", 999 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", 1000 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", 1001 | "requires": { 1002 | "locate-path": "^3.0.0" 1003 | } 1004 | }, 1005 | "locate-path": { 1006 | "version": "3.0.0", 1007 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", 1008 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", 1009 | "requires": { 1010 | "p-locate": "^3.0.0", 1011 | "path-exists": "^3.0.0" 1012 | } 1013 | }, 1014 | "p-locate": { 1015 | "version": "3.0.0", 1016 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", 1017 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", 1018 | "requires": { 1019 | "p-limit": "^2.0.0" 1020 | } 1021 | }, 1022 | "read-pkg-up": { 1023 | "version": "5.0.0", 1024 | "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-5.0.0.tgz", 1025 | "integrity": "sha512-XBQjqOBtTzyol2CpsQOw8LHV0XbDZVG7xMMjmXAJomlVY03WOBRmYgDJETlvcg0H63AJvPRwT7GFi5rvOzUOKg==", 1026 | "requires": { 1027 | "find-up": "^3.0.0", 1028 | "read-pkg": "^5.0.0" 1029 | } 1030 | } 1031 | } 1032 | }, 1033 | "wrappy": { 1034 | "version": "1.0.2", 1035 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1036 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1037 | }, 1038 | "ws": { 1039 | "version": "7.0.0", 1040 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.0.0.tgz", 1041 | "integrity": "sha512-cknCal4k0EAOrh1SHHPPWWh4qm93g1IuGGGwBjWkXmCG7LsDtL8w9w+YVfaF+KSVwiHQKDIMsSLBVftKf9d1pg==", 1042 | "requires": { 1043 | "async-limiter": "^1.0.0" 1044 | } 1045 | }, 1046 | "xml2js": { 1047 | "version": "0.4.19", 1048 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", 1049 | "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", 1050 | "requires": { 1051 | "sax": ">=0.6.0", 1052 | "xmlbuilder": "~9.0.1" 1053 | } 1054 | }, 1055 | "xmlbuilder": { 1056 | "version": "9.0.7", 1057 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", 1058 | "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" 1059 | } 1060 | } 1061 | } 1062 | -------------------------------------------------------------------------------- /bots/wechat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wewe-wechat-bot", 3 | "version": "1.0.0", 4 | "description": "Open wechat group chat messages to the world", 5 | "dependencies": { 6 | "qrcode-terminal": "^0.12.0", 7 | "wechaty": "^0.27.19" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const secret = require('./secret.json'); 3 | 4 | const config = { 5 | db: { 6 | client: 'sqlite3', 7 | dbFilePath: path.join(__dirname, '../db.sqlite'), 8 | }, 9 | aws: { 10 | accessKeyId: secret.aws.accessKeyId, 11 | secretAccessKey: secret.aws.secretAccessKey, 12 | region: 'us-east-1', 13 | bucket: 'wewe-imgs', 14 | s3RootPath: 'https://wewe-imgs.s3.amazonaws.com', 15 | }, 16 | pageMsgCount: 50, 17 | gaTrackingId: 'UA-56506279-9', 18 | }; 19 | 20 | module.exports = config; 21 | -------------------------------------------------------------------------------- /db/Group.js: -------------------------------------------------------------------------------- 1 | const { dynamodb, docClient } = require('./index'); 2 | 3 | async function createTable() { 4 | console.log('going to create "wewe-group" table'); 5 | await dynamodb.createTable({ 6 | TableName: 'wewe-group', 7 | KeySchema: [ 8 | { AttributeName: 'name', KeyType: 'HASH' }, 9 | ], 10 | AttributeDefinitions: [ 11 | { AttributeName: 'name', AttributeType: 'S' }, 12 | ], 13 | ProvisionedThroughput: { 14 | ReadCapacityUnits: 5, 15 | WriteCapacityUnits: 5, 16 | }, 17 | }).promise(); 18 | console.log('successfully created table "wewe-group"'); 19 | } 20 | 21 | async function deleteTable() { 22 | await dynamodb.deleteTable({ TableName: 'wewe-group' }).promise(); 23 | } 24 | 25 | async function get({ name }) { 26 | const { Item } = await docClient.get({ 27 | TableName: 'wewe-group', 28 | Key: { 29 | name, 30 | }, 31 | }).promise(); 32 | return Item; 33 | } 34 | 35 | // 直接用群聊名作为 id 的问题: 36 | // con: 名字不能重复 37 | // con: 无法改名, 或者说麻烦: 要对所有 msg 做 migration; 也可以不改, 改名: 两个 wewe-group 合成一个 38 | // con: 无法得知群聊总数 39 | // pro: 插入 msg 时不用管 40 | // 与群聊名无关的 id: 41 | // pro: 相同名字微信群也可支持 42 | // pro: 微信群改名方便 43 | // pro: id 如果是数字, 可以拿到群聊总数 44 | // con: 插入 msg 时需要查询 msg 所在 wewe-group id 45 | // con: 查询 msg 所在 wewe-group 时仍需要防止同名 46 | // con: 只有微信需要用到这个! 47 | async function getAll() { 48 | const { Items } = await docClient.scan({ 49 | TableName: 'wewe-group', 50 | }).promise(); 51 | return Items.reverse(); 52 | } 53 | 54 | async function put({ 55 | name, description, logoUrl, type, userCount, msgCount, topicCount, 56 | }) { 57 | await docClient.put({ 58 | TableName: 'wewe-group', 59 | Item: { 60 | name, description, logoUrl, type, userCount, msgCount, topicCount, 61 | }, 62 | }).promise(); 63 | } 64 | 65 | async function incMsgCount({ name }) { 66 | const res = await docClient.update({ 67 | TableName: 'wewe-group', 68 | Key: { name }, 69 | AttributeUpdates: { 70 | msgCount: { 71 | Action: 'ADD', 72 | Value: 1, 73 | }, 74 | }, 75 | ReturnValues: 'UPDATED_NEW', 76 | }).promise(); 77 | return res.Attributes.msgCount; 78 | } 79 | 80 | async function incTopicCount({ name }) { 81 | const res = await docClient.update({ 82 | TableName: 'wewe-group', 83 | Key: { name }, 84 | AttributeUpdates: { 85 | topicCount: { 86 | Action: 'ADD', 87 | Value: 1, 88 | }, 89 | }, 90 | ReturnValues: 'UPDATED_NEW', 91 | }).promise(); 92 | return res.Attributes.topicCount; 93 | } 94 | 95 | async function incMsgCountByN({ name, n }) { 96 | const res = await docClient.update({ 97 | TableName: 'wewe-group', 98 | Key: { name }, 99 | AttributeUpdates: { 100 | msgCount: { 101 | Action: 'ADD', 102 | Value: n, 103 | }, 104 | }, 105 | ReturnValues: 'UPDATED_NEW', 106 | }).promise(); 107 | return res.Attributes.msgCount; 108 | } 109 | 110 | module.exports = { 111 | createTable, 112 | deleteTable, 113 | get, 114 | getAll, 115 | put, 116 | incMsgCount, 117 | incMsgCountByN, 118 | incTopicCount, 119 | }; 120 | 121 | // put({ 122 | // name: 'wewe', 123 | // description: 'Building wewe together', 124 | // logoUrl: 'https://user-images.githubusercontent.com/5512552/58616555-87959580-82f0-11e9-8ac4-4045463f2f41.png', 125 | // type: 'wechat', 126 | // userCount: 3, 127 | // msgCount: 0, 128 | // topicCount: 0, 129 | // }); 130 | -------------------------------------------------------------------------------- /db/GroupMember.js: -------------------------------------------------------------------------------- 1 | const { dynamodb, docClient } = require('./index'); 2 | 3 | async function createTable() { 4 | console.log('going to create "wewe-group-member" table'); 5 | await dynamodb.createTable({ 6 | TableName: 'wewe-group-member', 7 | KeySchema: [ 8 | { AttributeName: 'groupName', KeyType: 'HASH' }, 9 | { AttributeName: 'name', KeyType: 'RANGE' }, 10 | ], 11 | AttributeDefinitions: [ 12 | { AttributeName: 'groupName', AttributeType: 'S' }, 13 | { AttributeName: 'name', AttributeType: 'S' }, 14 | ], 15 | ProvisionedThroughput: { 16 | ReadCapacityUnits: 3, 17 | WriteCapacityUnits: 3, 18 | }, 19 | }).promise(); 20 | console.log('successfully created table "wewe-group-member"'); 21 | } 22 | 23 | async function deleteTable() { 24 | await dynamodb.deleteTable({ TableName: 'wewe-group-member' }).promise(); 25 | } 26 | 27 | async function get({ groupName, name }) { 28 | const { Item } = await docClient.get({ 29 | TableName: 'wewe-group-member', 30 | Key: { 31 | groupName, name, 32 | }, 33 | AttributesToGet: [ // list of specific attribute names to return 34 | 'name', 35 | 'intro', 36 | 'url', 37 | ], 38 | }).promise(); 39 | return Item; 40 | } 41 | 42 | async function put({ 43 | groupName, name, email, url, intro, date, 44 | }) { 45 | await docClient.put({ 46 | TableName: 'wewe-group-member', 47 | Item: { 48 | groupName, name, email, url, intro, date, 49 | }, 50 | }).promise(); 51 | } 52 | 53 | async function getAllMembers({ groupName }) { 54 | const { Items } = await docClient.query({ 55 | TableName: 'wewe-group-member', 56 | KeyConditions: { 57 | groupName: { 58 | ComparisonOperator: 'EQ', 59 | AttributeValueList: [groupName], 60 | }, 61 | }, 62 | }).promise(); 63 | 64 | return Items; 65 | } 66 | 67 | async function getAllMemberNames({ groupName }) { 68 | const { Items } = await docClient.query({ 69 | TableName: 'wewe-group-member', 70 | KeyConditions: { 71 | groupName: { 72 | ComparisonOperator: 'EQ', 73 | AttributeValueList: [groupName], 74 | }, 75 | }, 76 | AttributesToGet: [ // list of specific attribute names to return 77 | 'name', 78 | ], 79 | }).promise(); 80 | 81 | return Items.map(item => item.name); 82 | } 83 | 84 | module.exports = { 85 | createTable, 86 | deleteTable, 87 | get, 88 | put, 89 | getAllMembers, 90 | getAllMemberNames, 91 | }; 92 | 93 | // createTable(); 94 | // put({ 95 | // groupName: 't9t.io community', 96 | // name: 'timbot', 97 | // intro: 'building t9t.io', 98 | // url: 't9t.io', 99 | // email: 'timqian92@qq.com', 100 | // }); 101 | 102 | 103 | // put({ 104 | // groupName: 'wewe', 105 | // name: '秋虫儿闹声喧', 106 | // email: 'liuyunli1992@163.com', 107 | // // url: 'https://weibo.com/345981205', 108 | // // intro: '野路子产品菜🐶,立志要做全栈产品。小程序:小确幸Me', 109 | // date: new Date().getTime(), 110 | // }); 111 | -------------------------------------------------------------------------------- /db/Msg.js: -------------------------------------------------------------------------------- 1 | // Note: Create global secondary index on Msg table 2 | const { dynamodb, docClient } = require('./index'); 3 | const Group = require('./Group'); 4 | 5 | async function createTable() { 6 | console.log('going to create "wewe-msg" table'); 7 | await dynamodb.createTable({ 8 | TableName: 'wewe-msg', 9 | KeySchema: [ 10 | { AttributeName: 'groupName', KeyType: 'HASH' }, 11 | { AttributeName: 'id', KeyType: 'RANGE' }, 12 | ], 13 | AttributeDefinitions: [ 14 | { AttributeName: 'groupName', AttributeType: 'S' }, 15 | { AttributeName: 'id', AttributeType: 'N' }, 16 | ], 17 | ProvisionedThroughput: { 18 | ReadCapacityUnits: 5, 19 | WriteCapacityUnits: 5, 20 | }, 21 | }).promise(); 22 | console.log('successfully created table "wewe-msg"'); 23 | } 24 | 25 | async function deleteTable() { 26 | await dynamodb.deleteTable({ TableName: 'wewe-msg' }).promise(); 27 | } 28 | 29 | async function get({ groupName, id }) { 30 | const { Item } = await docClient.get({ 31 | TableName: 'wewe-msg', 32 | Key: { 33 | groupName, id, 34 | }, 35 | }).promise(); 36 | return Item; 37 | } 38 | 39 | async function getRange({ groupName, idOffset, idLimit }) { 40 | const { Items } = await docClient.query({ 41 | TableName: 'wewe-msg', 42 | KeyConditions: { 43 | groupName: { 44 | ComparisonOperator: 'EQ', 45 | AttributeValueList: [groupName], 46 | }, 47 | id: { 48 | ComparisonOperator: 'BETWEEN', 49 | AttributeValueList: [idOffset, idOffset + idLimit], 50 | }, 51 | }, 52 | }).promise(); 53 | return Items; 54 | } 55 | 56 | async function addMsgOfGroup({ 57 | groupName, text, from, date, type, link, 58 | }) { 59 | const msgCount = await Group.incMsgCount({ 60 | name: groupName, 61 | }); 62 | 63 | await docClient.put({ 64 | TableName: 'wewe-msg', 65 | Item: { 66 | groupName, text, from, date, type, link, id: msgCount - 1, 67 | }, 68 | }).promise(); 69 | 70 | return msgCount -1; // msg id 71 | } 72 | 73 | /** 74 | * 75 | * @param {Array} msgs 76 | * @example msgs 77 | * [{ 78 | * "user": "UL54328J0", 79 | * "type": "message", 80 | * "subtype": "channel_join", 81 | * "ts": "1562311078.029900", 82 | * "text": "<@UL54328J0> has joined the channel" 83 | * }, 84 | * { 85 | * "client_msg_id": "6C579416-B4D1-4EED-85A8-8DD952244312", 86 | * "type": "message", 87 | * "text": "好多做公众号的,做到一定量,就给你直接砍了", 88 | * "user": "UKTHARF34", 89 | * "ts": "1562305844.029700", 90 | * "team": "TKSPMPXU1" 91 | * }] 92 | */ 93 | // batch write at most 25 at a time 94 | // ref: https://docs.aws.amazon.com/zh_cn/amazondynamodb/latest/APIReference/API_BatchWriteItem.html 95 | async function batchAddSlackMsgs({ 96 | groupName, msgs, 97 | }) { 98 | const curMsgCount = await Group.incMsgCountByN({ 99 | name: groupName, n: msgs.length, 100 | }); 101 | 102 | console.log(curMsgCount, 'curmsgcount'); 103 | const putRequests = msgs.map((msg, i) => ({ 104 | PutRequest: { 105 | Item: { 106 | groupName, 107 | id: curMsgCount - i - 1, 108 | ...msg, 109 | }, 110 | }, 111 | })); 112 | 113 | await docClient.batchWrite({ 114 | RequestItems: { 115 | 'wewe-msg': putRequests, 116 | }, 117 | }).promise(); 118 | } 119 | 120 | async function getByThreadTs({ ts }) { 121 | const { Items } = await docClient.query({ 122 | TableName: 'wewe-msg', 123 | IndexName: 'thread_ts-index', 124 | KeyConditions: { 125 | thread_ts: { 126 | ComparisonOperator: 'EQ', 127 | AttributeValueList: [ts], 128 | }, 129 | }, 130 | }).promise(); 131 | 132 | return Items; 133 | } 134 | 135 | async function getByTsArr({ tsArr }) { 136 | const { Items } = await docClient.query({ 137 | TableName: 'wewe-msg', 138 | IndexName: 'ts', 139 | KeyConditions: { 140 | ts: { 141 | ComparisonOperator: 'IN', 142 | AttributeValueList: tsArr, 143 | }, 144 | }, 145 | }).promise(); 146 | 147 | return Items; 148 | } 149 | 150 | module.exports = { 151 | createTable, 152 | deleteTable, 153 | get, 154 | getRange, 155 | addMsgOfGroup, 156 | batchAddSlackMsgs, 157 | getByThreadTs, 158 | getByTsArr, 159 | }; 160 | -------------------------------------------------------------------------------- /db/TmpGroup.js: -------------------------------------------------------------------------------- 1 | const { dynamodb, docClient } = require('./index'); 2 | 3 | async function createTable() { 4 | console.log('going to create "wewe-tmp-group" table'); 5 | await dynamodb.createTable({ 6 | TableName: 'wewe-tmp-group', 7 | KeySchema: [ 8 | { AttributeName: 'team_id', KeyType: 'HASH' }, 9 | ], 10 | AttributeDefinitions: [ 11 | { AttributeName: 'team_id', AttributeType: 'S' }, 12 | ], 13 | ProvisionedThroughput: { 14 | ReadCapacityUnits: 1, 15 | WriteCapacityUnits: 1, 16 | }, 17 | }).promise(); 18 | console.log('successfully created table "wewe-tmp-group"'); 19 | } 20 | 21 | async function deleteTable() { 22 | await dynamodb.deleteTable({ TableName: 'wewe-tmp-group' }).promise(); 23 | } 24 | 25 | async function get({ name }) { 26 | const { Item } = await docClient.get({ 27 | TableName: 'wewe-tmp-group', 28 | Key: { 29 | name, 30 | }, 31 | }).promise(); 32 | return Item; 33 | } 34 | 35 | async function put(data) { 36 | await docClient.put({ 37 | TableName: 'wewe-tmp-group', 38 | Item: data, 39 | }).promise(); 40 | } 41 | 42 | 43 | module.exports = { 44 | createTable, 45 | deleteTable, 46 | get, 47 | put, 48 | }; 49 | 50 | // createTable() 51 | // put({ 52 | // name: 'wewe', 53 | // description: 'Building wewe together', 54 | // logoUrl: 'https://user-images.githubusercontent.com/5512552/58616555-87959580-82f0-11e9-8ac4-4045463f2f41.png', 55 | // type: 'wechat', 56 | // userCount: 3, 57 | // msgCount: 0, 58 | // topicCount: 0, 59 | // }); 60 | -------------------------------------------------------------------------------- /db/Topics.js: -------------------------------------------------------------------------------- 1 | const { dynamodb, docClient } = require('./index'); 2 | const Group = require('./Group'); 3 | 4 | async function createTable() { 5 | console.log('going to create "wewe-topic" table'); 6 | await dynamodb.createTable({ 7 | TableName: 'wewe-topic', 8 | KeySchema: [ 9 | { AttributeName: 'groupName', KeyType: 'HASH' }, 10 | { AttributeName: 'id', KeyType: 'RANGE' }, 11 | ], 12 | AttributeDefinitions: [ 13 | { AttributeName: 'groupName', AttributeType: 'S' }, 14 | { AttributeName: 'id', AttributeType: 'N' }, 15 | ], 16 | ProvisionedThroughput: { 17 | ReadCapacityUnits: 5, 18 | WriteCapacityUnits: 5, 19 | }, 20 | }).promise(); 21 | console.log('successfully created table "wewe-topic"'); 22 | } 23 | 24 | async function deleteTable() { 25 | await dynamodb.deleteTable({ TableName: 'wewe-topic' }).promise(); 26 | } 27 | 28 | async function get({ groupName, id }) { 29 | const { Item } = await docClient.get({ 30 | TableName: 'wewe-topic', 31 | Key: { 32 | groupName, id, 33 | }, 34 | }).promise(); 35 | return Item; 36 | } 37 | 38 | async function getRange({ groupName, idOffset, idLimit }) { 39 | const { Items } = await docClient.query({ 40 | TableName: 'wewe-topic', 41 | KeyConditions: { 42 | groupName: { 43 | ComparisonOperator: 'EQ', 44 | AttributeValueList: [groupName], 45 | }, 46 | id: { 47 | ComparisonOperator: 'BETWEEN', 48 | AttributeValueList: [idOffset, idOffset + idLimit], 49 | }, 50 | }, 51 | }).promise(); 52 | return Items; 53 | } 54 | 55 | async function add({ 56 | groupName, title, description, from, date, msgRange, hiddenMsgs, type, ts, 57 | }) { 58 | const msgCount = await Group.incTopicCount({ 59 | name: groupName, 60 | }); 61 | await docClient.put({ 62 | TableName: 'wewe-topic', 63 | Item: { 64 | groupName, id: msgCount - 1, title, description, from, date, msgRange, hiddenMsgs, type, ts, 65 | }, 66 | }).promise(); 67 | } 68 | 69 | module.exports = { 70 | createTable, 71 | deleteTable, 72 | get, 73 | getRange, 74 | add, 75 | }; 76 | 77 | // createTable(); 78 | // add({ 79 | // groupName: 'GraphQL交流', title: 'test', from: 'timbot', date: new Date().getTime(), msgRange: [0, 43], hiddenMsgs: [] 80 | // }); 81 | -------------------------------------------------------------------------------- /db/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const config = require('../config'); 3 | 4 | 5 | const awsConfig = { 6 | region: 'us-east-1', 7 | // endpoint: 'https://dynamodb.us-east-1.amazonaws.com', 8 | accessKeyId: config.aws.accessKeyId, 9 | secretAccessKey: config.aws.secretAccessKey, 10 | signatureVersion: 'v4', 11 | }; 12 | 13 | AWS.config.update(awsConfig); 14 | 15 | const dynamodb = new AWS.DynamoDB(); 16 | const docClient = new AWS.DynamoDB.DocumentClient(); 17 | 18 | module.exports = { 19 | dynamodb, 20 | docClient, 21 | }; 22 | -------------------------------------------------------------------------------- /db/initTables.js: -------------------------------------------------------------------------------- 1 | const Group = require('./Group'); 2 | const Msg = require('./Msg'); 3 | 4 | async function initDb() { 5 | try { 6 | await Group.deleteTable(); 7 | await new Promise(r => setTimeout(r, 2000)); 8 | } catch (error) { 9 | console.log(error.message); 10 | } 11 | await Group.createTable(); 12 | 13 | try { 14 | await Msg.deleteTable(); 15 | await new Promise(r => setTimeout(r, 2000)); 16 | } catch (error) { 17 | console.log(error.message); 18 | } 19 | await Msg.createTable(); 20 | } 21 | 22 | initDb(); 23 | -------------------------------------------------------------------------------- /db/initTablesData.js: -------------------------------------------------------------------------------- 1 | const Group = require('./Group'); 2 | const Msg = require('./Msg'); 3 | 4 | async function initDb() { 5 | // init groups 6 | await Group.put({ 7 | name: 'wewe', 8 | description: 'Building wewe together', 9 | logoUrl: 'https://user-images.githubusercontent.com/5512552/58616555-87959580-82f0-11e9-8ac4-4045463f2f41.png', 10 | type: 'wechat', 11 | userCount: 3, 12 | msgCount: 0, 13 | }); 14 | 15 | await Group.put({ 16 | name: 't9t.io community', 17 | description: 'Building transparent products together', 18 | logoUrl: 'https://raw.githubusercontent.com/timqian/images/master/font.png', 19 | type: 'wechat', 20 | userCount: 492, 21 | msgCount: 0, 22 | }); 23 | 24 | await Group.put({ 25 | name: 't9t.io community 2', 26 | description: 'Building transparent products together', 27 | // logoUrl: 'https://raw.githubusercontent.com/timqian/images/master/font-graphql.png', 28 | logoUrl: 'https://raw.githubusercontent.com/timqian/images/master/font.png', 29 | type: 'wechat', 30 | userCount: 99, 31 | msgCount: 0, 32 | }); 33 | 34 | const item = await Group.get({ 35 | name: 'wewe', 36 | }); 37 | 38 | console.log('inserted group:', item); 39 | 40 | const items = await Group.getAll(); 41 | console.log('group count:', items.length); 42 | 43 | // init msgs 44 | await Msg.addMsgOfGroup({ 45 | groupName: 'wewe', 46 | text: 'test 消息 from initTablesData.js', 47 | from: 'timqian', 48 | date: new Date().getTime(), 49 | }); 50 | 51 | for (let i = 0; i < 145; i++) { 52 | await Msg.addMsgOfGroup({ 53 | groupName: 'wewe', 54 | text: `test ${i} from initTablesData.js`, 55 | from: `timqian${i}`, 56 | date: new Date().getTime(), 57 | }); 58 | } 59 | 60 | 61 | const group1 = await Group.get({ name: 'wewe' }); 62 | const msgsOfGroup1 = await Msg.getRange({ 63 | groupName: 'wewe', 64 | idOffset: 0, 65 | idLimit: 10, 66 | }); 67 | console.log('group after inserted msgs: ', group1); 68 | console.log('msgs in group:', msgsOfGroup1); 69 | } 70 | 71 | initDb(); 72 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # API doc 2 | 3 | ## Get chat messages 4 | 5 | - Examples(just click the links) 6 | - Get Latest 50 msgs: https://wewe.t9t.io/api/chat/t9t.io%20community%202 7 | - Get first page of msgs: https://wewe.t9t.io/api/chat/t9t.io%20community%202?page=1 8 | 9 | - Url: `/api/chat/:name` 10 | - Method: `Get` 11 | - Query params: `?page=[integer]` 12 | - Success Response: 13 | ```javascript 14 | { 15 | totalPageCount: 100, 16 | currentPage: 100, 17 | msgs: [{ 18 | groupName: '', 19 | date: 1560825086000, 20 | type: 7, // 7: text 6: img 13: video 1: link 21 | text: 'hello world', 22 | }] 23 | } 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | wewe 10 | 11 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 67 | 94 |
95 |
96 |
97 |

98 | wewe 99 | 100 |

101 |

102 | Open group to the world 103 |

104 | 115 |
116 | wewe 117 |
118 |
119 |
120 | View groups 121 | Join wewe 122 |
123 |
124 |
125 |
126 |
127 |
128 |

129 | Why open group chat 130 |

131 |
132 | 133 |
134 |
135 | Bring valuable disscussions to the open internet 136 |
137 |
138 | 139 |
140 |
141 | Grow influence of your group chat 142 |
143 |
144 | 145 |
146 |
147 | Backup chat history 148 |
149 |
150 | 151 |
152 |
153 |
154 | 155 |
156 |
157 |
158 |
159 |
160 |

Save chat history

161 |
162 |
163 | 164 | groups 165 | 166 |
167 |
168 |
169 |
170 |
171 | 172 |
173 |
174 |
175 |
176 |
177 |

Extract topics by hand or automatically

178 |
179 |
180 | 181 | groups 182 | 183 |
184 |
185 |
186 |
187 |
188 | 189 |
190 |
191 |
192 |
193 |
194 |

Content accessable to search engine

195 |
196 |
197 | 198 | groups 199 | 200 |
201 |
202 |
203 |
204 |
205 | 206 |
207 |
208 |
209 |
210 |
211 |

Support different kinds of chat tools like slack, wechat, and more to come

212 |
213 |
214 | 215 | groups 216 | 217 |
218 |
219 |
220 |
221 |
222 | 223 |
224 |
225 |
226 |
227 |
228 |

Trusted by many open minded communities

229 |
230 |
231 | 232 | groups 233 | 234 |
235 |
236 |
237 |
238 |
239 | 240 |
241 |
242 |
243 | View groups 244 | Join wewe 245 |
246 |
247 |
248 | 273 | 274 | 275 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const withSass = require('@zeit/next-sass'); 2 | const withCSS = require('@zeit/next-css'); 3 | 4 | module.exports = withCSS(withSass({ 5 | 6 | })); 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wewe", 3 | "version": "1.0.0", 4 | "description": "Open wechat group chat messages to the world", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "next build", 8 | "start": "NODE_ENV=production node backend/index.js", 9 | "sb": "nodemon backend/index.js --watch backend/ --watch config.js --watch db/", 10 | "sw": "node bots/wechat/index.js", 11 | "initDb": "node db/initDb.js", 12 | "deploy": "npm run build && npm prune --production && up deploy production --no-build && npm i --offline" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/t9tio/wewe.git" 17 | }, 18 | "keywords": [], 19 | "author": "", 20 | "license": "ISC", 21 | "bugs": { 22 | "url": "https://github.com/t9tio/wewe/issues" 23 | }, 24 | "homepage": "https://github.com/t9tio/wewe#readme", 25 | "dependencies": { 26 | "@zeit/next-css": "^1.0.1", 27 | "@zeit/next-sass": "^1.0.1", 28 | "aws": "0.0.3-2", 29 | "aws-sdk": "^2.471.0", 30 | "axios": "^0.19.0", 31 | "body-parser": "^1.19.0", 32 | "bulma": "^0.7.5", 33 | "cors": "^2.8.5", 34 | "dayjs": "^1.8.14", 35 | "express": "^4.17.1", 36 | "linkifyjs": "^2.1.8", 37 | "lodash.chunk": "^4.2.0", 38 | "nanoid": "^2.0.3", 39 | "next": "^8.1.0", 40 | "node-sass": "^4.12.0", 41 | "qs": "^6.7.0", 42 | "react": "^16.8.6", 43 | "react-dom": "^16.8.6", 44 | "react-paginate": "^6.3.0", 45 | "timeago.js": "^4.0.0-beta.2", 46 | "validator": "^11.0.0" 47 | }, 48 | "devDependencies": { 49 | "eslint": "^5.16.0", 50 | "eslint-config-airbnb": "^17.1.0", 51 | "eslint-plugin-import": "^2.17.3", 52 | "eslint-plugin-jsx-a11y": "^6.2.1", 53 | "eslint-plugin-react": "^7.13.0", 54 | "nodemon": "^2.0.2" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /pages/about.js: -------------------------------------------------------------------------------- 1 | import Head from './components/Head'; 2 | import Nav from './components/Nav'; 3 | import Footer from './components/Footer'; 4 | import './about.scss'; 5 | 6 | const Index = () => ( 7 |
8 | 9 |
140 | ); 141 | 142 | export default Index; 143 | -------------------------------------------------------------------------------- /pages/about.scss: -------------------------------------------------------------------------------- 1 | .about-content { 2 | max-width: 40em;; 3 | } 4 | 5 | .about-ul { 6 | list-style: disc outside; 7 | margin-left: 2em; 8 | // margin-top: 1em; 9 | } -------------------------------------------------------------------------------- /pages/chat.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | import ReactPaginate from 'react-paginate'; 3 | import axios from 'axios'; 4 | import Head from './components/Head'; 5 | import Nav from './components/Nav'; 6 | import Footer from './components/Footer'; 7 | import WechatMsg from './components/WechatMsg'; 8 | import SlackMsg from './components/SlackMsg'; 9 | import './chat.scss'; 10 | import ChatTabs from './components/ChatTabs'; 11 | import ChatHero from './components/ChatHero'; 12 | import AdCard from './components/AdCard'; 13 | 14 | const Index = (props) => { 15 | const { 16 | group, msgs, totalPageCount, currentPage, 17 | } = props; 18 | 19 | 20 | const [isModalVisible, setIsModalVisible] = useState(false); 21 | const [topicTitle, setTopicTitle] = useState(''); 22 | const [topicDesc, setTopicDesc] = useState(''); 23 | const [password, setPassword] = useState(''); 24 | const [topicMsg, setTopicMsg] = useState({}); 25 | 26 | const addTopic = async () => { 27 | await axios.post('/api/topics/add', { 28 | groupName: group.name, 29 | from: topicMsg.from, 30 | title: topicTitle, 31 | date: topicMsg.date, 32 | msgRange: [topicMsg.id], 33 | description: topicDesc || undefined, 34 | type: 'wechat', 35 | password, 36 | }); 37 | 38 | window.location.href = `/chat/${group.name}/topics`; 39 | }; 40 | 41 | 42 | const Msgs = () => { 43 | if (group.type === 'wechat') { 44 | return ( 45 |
46 | { 47 | msgs.map(msg => ( 48 | 80 | )) 81 | } 82 |
83 | ); 84 | } if (group.type === 'slack') { 85 | return ( 86 |
87 | { 88 | msgs.filter(msg => !msg.thread_ts || msg.replies).map(msg => ( 89 | 92 | )) 93 | } 94 |
95 | ); 96 | } 97 | }; 98 | 99 | return ( 100 |
101 | 102 |