diff --git a/.synchronize-wiki.sh b/.synchronize-wiki.sh index 4b7a2c8..96d4c5c 100644 --- a/.synchronize-wiki.sh +++ b/.synchronize-wiki.sh @@ -17,4 +17,6 @@ git rm .travis.yml --cached git commit --message "Synchronized wiki (Travis build #$TRAVIS_BUILD_NUMBER)" echo "Pushing wiki..." -git push --force wiki master \ No newline at end of file +git push --force wiki master + +# This file is not included in the wiki. \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6c4166f..7d3833b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +language: minimal notifications: email: false branches: @@ -5,4 +6,6 @@ branches: - master script: - chmod +x .synchronize-wiki.sh - - ./.synchronize-wiki.sh \ No newline at end of file + - ./.synchronize-wiki.sh + +# This file is not included in the wiki. \ No newline at end of file diff --git a/Home.md b/Home.md index b56c48a..536428c 100644 --- a/Home.md +++ b/Home.md @@ -1,2 +1,4 @@ +_Wiki for chatoverflow version [0.2-prealpha](https://github.com/codeoverflow-org/chatoverflow/releases/tag/0.2-prealpha)_ + Welcome to the Chat Overflow wiki! Please see the menu to find more information. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a73481c --- /dev/null +++ b/LICENSE @@ -0,0 +1,428 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/README.md b/README.md index 188f89b..d605dca 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,44 @@ # Chatoverflow wiki -This repository contains the files for the chatoverflow wiki. For more information about the chat overflow project, please visit [chatoverflow.org](http://chatoverflow.org). +This repository contains the files for the chatoverflow wiki. +For more information about the chat overflow project, please visit [codeoverflow.org](http://codeoverflow.org). + +## Content + +**Usage:** +1. [Installation](usage/Installation.md) +2. [Using the CLI](usage/Using-the-CLI.md) +3. [Using the GUI](usage/Using-the-GUI.md) + 1. [Starting the Better REPL](usage/Using-the-GUI.md#Starting-the-Better-REPL) + 2. [Creating a plugin instance](usage/Using-the-GUI.md#Creating-a-plugin-instance) + 3. [Setting plugin requirements](usage/Using-the-GUI.md#Setting-plugin-requirements) + 4. [Adding connectors](usage/Using-the-GUI.md#Adding-connectors) + 5. [Set credentials](usage/Using-the-GUI.md#Set-credentials) +4. [Frequent Issues](usage/Frequent-Issues.md) + 1. [Run Configuration Bug](usage/Frequent-Issues.md#Run-Configuration-Bug) + 2. [Credentials value encrypted with wrong auth key](usage/Frequent-Issues.md#Credentials-value-encrypted-with-wrong-auth-key) + +**Development:** +1. [Writing a plugin](development/Writing-a-plugin.md) +2. [Adding a new platform source](development/Adding-a-new-platform-source.md) +3. [Deploy ChatOverflow](development/Deploy-ChatOverflow.md) +4. [Structure](development/Structure.md) +5. [Pluggable migration guide](development/Pluggable-migration-guide.md) + +## Contributing + +You have an idea how the wiki could be improved or just found some typos/spelling mistakes? + +Everybody can easily contribute to the wiki: +1. Navigate the the right file in this repo +2. Click on the ✎ icon in the upper right corner +3. Edit the page +4. Enter a message that describes your change and click on `Propose file change`. +5. We'll review the change and merge it if it fits. + +If you are experienced with git you can of course also fork this repo, do commits and create a pull request. + +**Thanks a lot to everybody who is willing to improve the wiki! You are awesome!** + +---------------------------------------- +_This file is not included in the wiki._ diff --git a/Run-Configuration-Bug.md b/Run-Configuration-Bug.md deleted file mode 100644 index 3791b97..0000000 --- a/Run-Configuration-Bug.md +++ /dev/null @@ -1 +0,0 @@ -Due to IntelliJ version differences and usage on Windows vs. Mac OS, the run configurations show problems, sometimes. Change the *classpath or module* under `Edit configurations...` back to the Chat Overflow root module, and everything should be fine. \ No newline at end of file diff --git a/Writing-a-plugin.md b/Writing-a-plugin.md deleted file mode 100644 index d12c1b0..0000000 --- a/Writing-a-plugin.md +++ /dev/null @@ -1,77 +0,0 @@ -**Important: Chat Overflow is still work in progress. So this guide will probably change in the future!** - -There are 3 important steps when you want to create and implement a new chat overflow plugin: - -1. Create a new plugin project with the commands of the framework -2. Implement the pluggable construct -3. Implement the plugin with own logic - -## Create a new plugin project - -Use the *Create Plugin* configuration or start the custom task `sbt create` directly. Enter the basic plugin information in the command promt. This includes the name, version and base plugin folder (e.g. `plugins-public`). The command creates the folder structure of the new plugin and adds a basic build file. Here you can also add custom dependencies. - -Next, run the custom task `sbt fetch` to let the framework look for new plugins and update the plugin reference file `plugins.sbt`. If you're using IntelliJ, you can now reload the framework by hand to register the plugin as new and custom project. You should also run `sbt reload` (Yes, both actions have different effects although they shouldn't). - -## Implement the pluggable - -Next, add your first class to the source folder of the new plugin. Supported languages are *Scala* and *Java*, but this guide will only show the scala way - development of java plugins is very similar. - -The first class should extend the Pluggable-Interface from `org.codeoverflow.chatoverflow.api.plugin.Pluggable`. When the framework starts up, your plugin will be looked trough for a class implementing this interface to get an entry point to your work. A raw version might look like this: - - ``` -class MySuperCoolPlug extends Pluggable{ - - override def getName: String = ??? - - override def getAuthor: String = ??? - - override def getDescription: String = ??? - - override def getMajorAPIVersion: Int = ??? - - override def getMinorAPIVersion: Int = ??? - - override def createNewPluginInstance(manager: PluginManager): Plugin = ??? -} - - ``` - -**A short explanation**: The first 3 Methods `getName`, `getAuthor` and `getDescription` are simple: Just a return a String representing the meta information of your plugin. This inclucde it's name (please make sure to not name two plugins develeoped by yourself the same), your name or pseudonym and a brief topic of the plugins purpose. - -The next two methods return the number of the API-Version, you developed the plugin with. These are evaluated in the loading process to ensure that your plugin works with the framework version from the user. You can get these numbers from `org.codeoverflow.chatoverflow.api.APIVersion`. - -The last method `createNewPluginInstance` is the interesting one: After the framework checked your meta and version information, it will eventually load your plugin completely. In this method (**and only in this method**), you might return an object that extends the plugin interface. This class is will containt your plugin logic. - -## Implement the Plugin - -The last step is the creation of the plugin class, which contains your own plugin logic. Create a new class and implement the Plugin-Interface, located at `org.codeoverflow.chatoverflow.api.plugin.Plugin`. Alternatively, extend the `PluginImpl` and get rid of some boilerplate code. It might look like this: - -``` -class MySuperCoolPlugin(manager: PluginManager) extends PluginImpl(manager) { - override def setup(): Unit = { ... } - override def loop(): Unit = { ... } - override def shutdown(): Unit = { ... } -} -``` - -Let's talk about *Requirements* first: These are the way to retrieve data from the outside world and returning information to it. Basicaly, you can require everything from a single paramter, set by the user to full access to a users livestream chat. - -The `getRequirements` method is used by the framework to check what your plugin needs and to ask the user to specify which services or data he wants to give to your plugin. Here is a example: - -``` -private val require = new Requirements -private val twitchChatInput = require.input.twitchChat("reqTwitch", "A twitch channel", false) -private val nameToSayHelloTo = require.parameter.string("reqHello", "Your name", false) -``` - -This code requires reading-access to a twitch livestream chat and a parameter ("*a name to say hello to"*). Note: You can obviously not specify, which channel the user might choose - but you can be sure, that you will get a working input. This is ensured by the framework. Please note, that the requirements element already exists, if you extend `PluginImpl`. - -After this, the last step ist the `start` method. And it is as easy as you might think: Just add your own logic now, using the required parameters of your Requirement object. Here is a short example: This code will simply print out all messages from a twitch chat in the console. To access the chat, your required variable is used with the `getValue` method. - -``` -twitchChatInput.getValue.registerMessageHandler(msg => println(msg)) -``` - -Of course, you can also add own classes and infrastrucutre by now - the important steps are done, happy coding! - -*One last note: If your testing your plugin the first time, a full reload might be needed. Use the custom task `[Advanced] Full Reload and run ChatOverlfow` to do so. Afters this, you can configure the framework to start your plugin using the [CLI](Using-the-CLI)!* \ No newline at end of file diff --git a/_Footer.md b/_Footer.md new file mode 100644 index 0000000..a211f26 --- /dev/null +++ b/_Footer.md @@ -0,0 +1,4 @@ +**We need your help to improve the wiki!** +Head over to [codeoverflow-org/chatoverflow-wiki](https://github.com/codeoverflow-org/chatoverflow-wiki) to edit the wiki and create a pull request. + +**You still need help?** Join our [discord server](https://discord.gg/sX2Gjbs). \ No newline at end of file diff --git a/_Sidebar.md b/_Sidebar.md new file mode 100644 index 0000000..cb61180 --- /dev/null +++ b/_Sidebar.md @@ -0,0 +1,21 @@ +### Content + +**Usage:** +1. [Installation](Installation) +2. [Using the CLI](Using-the-CLI) +3. [Using the GUI](Using-the-GUI) + 1. [Starting the Better REPL](Using-the-GUI#Starting-the-Better-REPL) + 2. [Creating a plugin instance](Using-the-GUI#Creating-a-plugin-instance) + 3. [Setting plugin requirements](Using-the-GUI#Setting-plugin-requirements) + 4. [Adding connectors](Using-the-GUI#Adding-connectors) + 5. [Set credentials](Using-the-GUI#Set-credentials) +4. [Frequent Issues](Frequent-Issues) + 1. [Run Configuration Bug](Frequent-Issues#Run-Configuration-Bug) + 2. [Credentials value encrypted with wrong auth key](Frequent-Issues#Credentials-value-encrypted-with-wrong-auth-key) + +**Development:** +1. [Writing a plugin](Writing-a-plugin) +2. [Adding a new platform source](Adding-a-new-platform-source) +3. [Deploy ChatOverflow](Deploy-ChatOverflow) +4. [Structure](Structure) +5. [Pluggable migration guide](Pluggable-migration-guide) \ No newline at end of file diff --git a/Adding-a-new-platform-source.md b/development/Adding-a-new-platform-source.md similarity index 100% rename from Adding-a-new-platform-source.md rename to development/Adding-a-new-platform-source.md diff --git a/Deploy-ChatOverflow.md b/development/Deploy-ChatOverflow.md similarity index 100% rename from Deploy-ChatOverflow.md rename to development/Deploy-ChatOverflow.md diff --git a/development/Pluggable-migration-guide.md b/development/Pluggable-migration-guide.md new file mode 100644 index 0000000..f502330 --- /dev/null +++ b/development/Pluggable-migration-guide.md @@ -0,0 +1,31 @@ +If you have updated from 0.2-prealpha to 0.3-prealpha you might notice that your plugins aren't detected by the framework anymore and are also not included in `plugins.sbt` by the sbt fetch task. + +This is because as of 0.3-prealpha `Pluggable` got removed and replaced with a xml file called `plugin.xml` in the resources of the plugin. Check the issue at [codeoverflow-org/chatoverflow#41](https://github.com/codeoverflow-org/chatoverflow/issues/41) or the pr at [codeoverflow-org/chatoverflow#91](https://github.com/codeoverflow-org/chatoverflow/pull/91) for more information about this rework. + +Here are the required steps to make your plugin compatible with the new format: + +1. Delete your class implementing `Pluggable`. Its not used anymore got removed from the api. + +2. Create the resources directory at `yourPlugin/src/main/resources`. + +3. Create a file at `yourPlugin/src/main/resources/plugin.xml` containing the following: + + ```xml + + myPluginName + sebinside + This is a simple plugin for demonstration purposes. + + 3 + 0 + + 0.3.0 + https://codeoverflow.org + https://github.com/codeoverflow-org/chatoverflow-plugins + https://github.com/codeoverflow-org/chatoverflow/issues + EPL-2.0 + + ``` + +4. Replace these values with yours. Name, author, api and version are mandatory while the other ones aren't and can be omitted by remove the xml tag. Note that you also may need to adjust the api version numbers if you are running a newer version. + diff --git a/Structure.md b/development/Structure.md similarity index 100% rename from Structure.md rename to development/Structure.md diff --git a/development/Writing-a-plugin.md b/development/Writing-a-plugin.md new file mode 100644 index 0000000..8b7ef6c --- /dev/null +++ b/development/Writing-a-plugin.md @@ -0,0 +1,104 @@ +**Important: Chat Overflow is still work in progress. So this guide will probably change in the future!** + +There are 3 important steps when you want to create and implement a new chat overflow plugin: + +1. Create a new plugin project with the commands of the framework +2. Inspect the `plugin.xml` file +3. Extend the plugin with own logic + +## Create a new plugin project + +Use the *Create Plugin* configuration or start the custom task `sbt create` directly. Enter the basic plugin information in the command prompt. This includes mandatory values like the name, author, version and base plugin folder (e.g. `plugins-public`) and some optional values like a description, a website, a link to a source repo, a link to a bug tracker and a license. + +The command creates the folder structure of the new plugin and adds a basic build file. Here you can also add custom dependencies. In addition the command generates a basic `plugin.xml` containing all the passed information like name and description and a basic source code file generated in the language of your choice to get you started. Note that currently only Scala and Java are supported. + +Next, run the custom task `sbt fetch` to let the framework look for new plugins and update the plugin reference file `plugins.sbt`. If you're using IntelliJ, you can now reload the framework by hand to register the plugin as new and custom project. You should also run `sbt reload` (Yes, both actions have different effects although they shouldn't). + +## Inspect the `plugin.xml` file + +All the metadata of the plugin like the name and the author of the plugin is saved in a xml file which is located at `src/main/resources/plugin.xml` in the plugin directory. This file gets autogenerated by the create command but in case you need to update a value its good to know where this file is located. + +A simple version of the `plugin.xml` file might look like this: + + ```xml + + Demonstration + sebinside + This is a simple plugin for demonstration purposes. + + 3 + 0 + + 0.3.0 + https://codeoverflow.org + https://github.com/codeoverflow-org/chatoverflow-plugins + https://github.com/codeoverflow-org/chatoverflow/issues + EPL-2.0 + + ``` + +The properties called name, author, api versions and version are mandatory and the framework won't load the plugin if one of these is missing. All others are optional informations for the user. If you don't want to specify a value for those you can just omit them. + +The api tag contains the API-Version, you developed the plugin with. These are evaluated in the loading process to ensure that your plugin works with the framework version from the user. You can get these numbers either from `org.codeoverflow.chatoverflow.api.APIVersion` in the api project or in the `build.sbt` also in the api project. + +## Extend the Plugin with own logic + +The last step is the creation of the plugin class, which contains your own plugin logic. Again the create command has autogenerated a basic class extending `org.codeoverflow.chatoverflow.api.plugin.PluginImpl` in the language of your choice. Such a file might look like this in case of Scala: + +```scala +import org.codeoverflow.chatoverflow.api.plugin.{PluginImpl, PluginManager} + +class DemonstrationPlugin(manager: PluginManager) extends PluginImpl(manager) { + + // require more requirements as needed here + private val sampleReq = require.input.sample("sampleReq", "Sample requirement", true) + + // you can adjust the loop interval here + // loopInterval = 1000; + + /** + * The setup method is executed one, when the plugin is started. Do NOT define your requirements in here! + */ + override def setup(): Unit = { + log("Initialized Demonstration!") + } + + /** + * The loop method is executed in loop with a specified interval until the shutdown method is called. + * The loop method is NOT executed if a negative loop interval is set. + */ + override def loop(): Unit = { + log("Demonstration loop!") + } + + /** + * The shutdown method should contain logic to close everything. + */ + override def shutdown(): Unit = { + log("Shutting down Demonstration!") + } +} +``` + +The framework searches for a class implementing `org.codeoverflow.chatoverflow.api.plugin.Plugin` when it tries to load a plugin. `PluginImpl` does this for you and also decreases some other boilerplate. Note that the whole plugin is only allowed to have *exactly* one class implementing `Plugin` otherwise the framework won't load your plugin. + +All methods in the generated class are pretty self explaining. The only thing we might need to talk about are *requirements*: These are the way to retrieve data from the outside world and returning information to it. Basically, you can require everything from a single parameter, set by the user, to full access to a users livestream chat. + +Thanks to `PluginImpl` a requirements object is already created, meaning you can start adding requirements right away. Here is a example: + +```scala +private val twitchChatInput = require.input.twitchChat("reqTwitch", "A twitch channel", false) +private val nameToSayHelloTo = require.parameter.string("reqHello", "Your name", false) +``` + +This code requires reading-access to a twitch livestream chat and a parameter ("*a name to say hello to"*). Note: You can obviously not specify, which channel the user might choose - but you can be sure, that you will get a working input. This is ensured by the framework. + +After this, the last step is the `start` method. And it is as easy as you might think: Just add your own logic now, using the required parameters of your Requirement object. Here is a short example: This code will simply print out all messages from a twitch chat in the console. To access the chat, your required variable is used with the `getValue` method. + +```scala +twitchChatInput.getValue.registerMessageHandler(msg => println(msg)) +``` + +Of course, you can also add own classes and infrastructure by now - the important steps are done, happy coding! + +*One last note: If your testing your plugin the first time, a full reload might be needed. Use the custom task `[Advanced] Full Reload and run ChatOverlfow` to do so. Afters this, you can configure the framework to start your plugin using the [CLI](Using-the-CLI)!* \ No newline at end of file diff --git a/img/change-requirement.png b/img/change-requirement.png new file mode 100644 index 0000000..eac9898 Binary files /dev/null and b/img/change-requirement.png differ diff --git a/img/class.png b/img/class.png index 0a17178..d7af1da 100644 Binary files a/img/class.png and b/img/class.png differ diff --git a/img/component.png b/img/component.png index c034ce7..e930d9e 100644 Binary files a/img/component.png and b/img/component.png differ diff --git a/img/create-connector.png b/img/create-connector.png new file mode 100644 index 0000000..22025b0 Binary files /dev/null and b/img/create-connector.png differ diff --git a/img/create-plugin.png b/img/create-plugin.png new file mode 100644 index 0000000..0d50574 Binary files /dev/null and b/img/create-plugin.png differ diff --git a/img/credentials.png b/img/credentials.png new file mode 100644 index 0000000..039c8b6 Binary files /dev/null and b/img/credentials.png differ diff --git a/img/login.png b/img/login.png new file mode 100644 index 0000000..19e61dc Binary files /dev/null and b/img/login.png differ diff --git a/img/plugin-instances.png b/img/plugin-instances.png new file mode 100644 index 0000000..a546b12 Binary files /dev/null and b/img/plugin-instances.png differ diff --git a/img/plugin-requirements.png b/img/plugin-requirements.png new file mode 100644 index 0000000..4732326 Binary files /dev/null and b/img/plugin-requirements.png differ diff --git a/img/plugin-types.png b/img/plugin-types.png new file mode 100644 index 0000000..dedf3ba Binary files /dev/null and b/img/plugin-types.png differ diff --git a/img/value-encrypted-wrong-key.png b/img/value-encrypted-wrong-key.png new file mode 100644 index 0000000..4af4be6 Binary files /dev/null and b/img/value-encrypted-wrong-key.png differ diff --git a/usage/Frequent-Issues.md b/usage/Frequent-Issues.md new file mode 100644 index 0000000..eb28a64 --- /dev/null +++ b/usage/Frequent-Issues.md @@ -0,0 +1,11 @@ +## Run Configuration Bug +Due to IntelliJ version differences and usage on Windows vs. Mac OS, the run configurations show problems, sometimes. Change the *classpath or module* under `Edit configurations...` back to the Chat Overflow root module, and everything should be fine. + +## Credentials value encrypted with wrong auth key +![](img/value-encrypted-wrong-key.png) +``` +ERROR configuration.CryptoUtil$ - Your environment does not work with AES256.Please update your java runtime version to at least: 1.8.0_161 +``` +If you see this image or error message you are probably running on an old java version that doesn't work with AES 256 bit encryption. +Please follow the instructions from the error message and update java to at least `1.8.0_161`. +More information about the issue can be found [on stackoverflow.com](https://stackoverflow.com/questions/3862800/invalidkeyexception-illegal-key-size). diff --git a/Installation.md b/usage/Installation.md similarity index 86% rename from Installation.md rename to usage/Installation.md index ddd8a3f..b382fe3 100644 --- a/Installation.md +++ b/usage/Installation.md @@ -2,16 +2,17 @@ This tutorial shows how to install the chat overflow framework. By now, working ### Pro -1. Clone the main repository. Then clone the api into folder `codeoverflow/api` and public plugins repository into `codeoverflow/plugins-public`. +1. Clone the main repository. Then clone the api into folder `codeoverflow/api`, the gui into folder `codeoverflow/gui` and public plugins repository into `codeoverflow/plugins-public`. 2. Setup the main repository as imported scala project, e.g. using IntelliJ. Make sure to refresh all sbt content and load the custom run configurations. 3. You're done. Happy coding! ### Not so Pro -1. Download and install [git](https://git-scm.com/) (obviously). Make sure that you can run it using the console. -2. Clone the main repository using `git clone https://github.com/codeoverflow-org/chatoverflow.git`. -3. Navigate to the created chatoverflow-folder, e.g. using `cd chatoverflow`. -4. Clone the [api repository](https://github.com/codeoverflow-org/chatoverflow-api) into a folder named "api". using `git clone https://github.com/codeoverflow-org/chatoverflow-api.git api`. +0. Download and install [git](https://git-scm.com/) (obviously) and [Node.js](https://nodejs.org/en/download/). Make sure that you can run it using the console. +1. Clone the main repository using `git clone https://github.com/codeoverflow-org/chatoverflow.git`. +2. Navigate to the created chatoverflow-folder, e.g. using `cd chatoverflow`. +3. Clone the [api repository](https://github.com/codeoverflow-org/chatoverflow-api) into a folder named "api". using `git clone https://github.com/codeoverflow-org/chatoverflow-api.git api`. +4. Clone the [gui repository](https://github.com/codeoverflow-org/chatoverflow-gui) into a folder named "gui". using `git clone https://github.com/codeoverflow-org/chatoverflow-gui.git gui`. 5. Clone the [public plugins repository](https://github.com/codeoverflow-org/chatoverflow-plugins) into a folder named "plugins-public" using `git clone https://github.com/codeoverflow-org/chatoverflow-plugins.git plugins-public`. Site note: You can name the folders whatever you want. But if you do so, update the names in the main [build-file](https://github.com/codeoverflow-org/chatoverflow/blob/42b9469fe489fe5efeb4aa70f278e3558fccab7d/build.sbt#L64). diff --git a/Using-the-CLI.md b/usage/Using-the-CLI.md similarity index 84% rename from Using-the-CLI.md rename to usage/Using-the-CLI.md index 6675322..423181f 100644 --- a/Using-the-CLI.md +++ b/usage/Using-the-CLI.md @@ -1,4 +1,4 @@ -Chat overflow may be configured using the CLI. While running, the easiest way to control everything is the **GUI**, accessible through `http://localhost:2400`. +Chat overflow may be configured using the CLI. While running, the easiest way to control everything is the [**Better REPL**](Using-the-GUI), accessible through `http://localhost:2400`. ## Command Line Interface @@ -41,9 +41,3 @@ Useful is the combination of login and startup plugins for rapid prototyping. ``` By default, plugin output on console is disable. But you can still enable it with the flag `-o`. - -## GUI - -The GUI is still in development. The **Better REPL** is an easy-to-use one-page dashboard, where everything can be controlled. - -*Please note: Added credentials are encrypted with AES 128/256.* \ No newline at end of file diff --git a/usage/Using-the-GUI.md b/usage/Using-the-GUI.md new file mode 100644 index 0000000..e8c674c --- /dev/null +++ b/usage/Using-the-GUI.md @@ -0,0 +1,68 @@ +The GUI for chatoverflow is still in development. +Thats why whe have the **Better REPL**, an easy-to-use one-page dashboard, where everything can be controlled. + +## Starting the Better REPL +When using the GUI for the first time use the `[Advanced]` run configuration that packages the gui into the chatoverflow jar. +For all further runs you may use the `[Simple]` run configuration which is way faster. + +Once the framework is running open http://localhost:2400/, wait for the server status to display `Connected!` and click on `OPEN BETTER REPL`. + +![](img/login.png) + +When running for the first time enter a password that you want to use for securing your credentials and click on `REGISTER`. +If you have already registered, use your password to login. +If the login was successful the gui will display the authentication key for that session. + +## Creating a plugin instance +Before running a plugin you have to create the plugin instance. +All available plugins are listed under `Plugin types`. +Add more plugins by putting the plugin Jar files into the plugins folder. + +![](img/plugin-types.png) + +Enter the plugin name and the author of the plugin and give the instance a name (whatever you like), the click on `CREATE`: + +![](img/create-plugin.png) + +The plugin instance should now list under `Plugin instances`: + +![](img/plugin-instances.png) + +You can use the pen to copy an instances name. +There are buttons that allow you to `START` / `STOP` a instance, to show its log (if running) or requirements and a button to `DELETE` the instance (just make sure to stop it before deleting it). + +## Setting plugin requirements +Before you can start a plugin you need to set its requirements. +A plugin can require a lot of thins: Strings, Inputs or Outputs are the most often used. +To view all requirements of a plugin enter the instance name and click on `SHOW REQUIREMENTS`. + +![](img/plugin-requirements.png) +You see that each requirement has a type and needs a value. +You see which requirements are already set and which ones are optional (don't need to be set to start the plugin). +To set/change the value click on the blue pen, enter the requirement value and click on `PUT`. + +![](img/change-requirement.png) + +For inputs and outputs the value should be the source identifier of a connector - which you first have to define. + +## Adding connectors +To add a connector use whatever source identifier you like, specify the connector type (a list of all types can be found in the connector types box above) and click `ADD`. It will then be displayed in the list on the left side. + +![](img/create-connector.png) + +## Set credentials +Every connector needs you to set the credentials for that service. +Use the blue pen to copy the identifier and the type to the connector and then use the manage credentials field to set key and value of the credentials. + +![](img/credentials.png) + +Currently the only way to view which credentials a connector requires is to click on `GET` in the manage credentials section and have a look at the returned response which is displayed in the Last request section. It should look similar to this: +```json +{"found":true,"sourceIdentifier":"twitch","uniqueTypeString":"org.codeoverflow.chatoverflow.requirement.service.twitch.chat.TwitchChatConnector","areCredentialsSet":true,"isRunning":false,"requiredCredentialKeys":["oauth"],"optionalCredentialKeys":[]} +``` +Look for `requiredCredentialKeys` and `optionalCredentialKeys`. + +If you are getting errors when adding credentials [Frequent-Issues](Frequent-Issues#Credentials-value-encrypted-with-wrong-auth-key) might contain a solution. + +*Please note: Added credentials are encrypted with AES 128/256.* +