From 882504b4348c795b1fb5f5a6e61542f3cddad02a Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 15 May 2021 18:45:22 +0530 Subject: Housekeeping: Fixed markdown rule violations. --- .github/ISSUE_TEMPLATE/recipe_request.md | 5 ++-- .github/PULL_REQUEST_TEMPLATE/add_recipe.md | 7 ++++-- README.md | 7 ++++-- docs/integration.md | 37 +++++++++++++++++++---------- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/recipe_request.md b/.github/ISSUE_TEMPLATE/recipe_request.md index c32ea1a..65bf7a9 100644 --- a/.github/ISSUE_TEMPLATE/recipe_request.md +++ b/.github/ISSUE_TEMPLATE/recipe_request.md @@ -18,13 +18,12 @@ If there is no repository on GitHub you can also create one yourself - this ofte IF YOU ARE NOT FAMILIAR WITH JAVASCRIPT: Please still search for a recipe using the guide above and add it to your request. --> - -Name of the service (e.g. WhatsApp): +Name of the service (e.g. WhatsApp): URL of the service (e.g. whatsapp.com): GitHub URL to a recipe : https://github.com/... Features you want implemented (optional): -- +- diff --git a/.github/PULL_REQUEST_TEMPLATE/add_recipe.md b/.github/PULL_REQUEST_TEMPLATE/add_recipe.md index 6cc42b4..052fde4 100644 --- a/.github/PULL_REQUEST_TEMPLATE/add_recipe.md +++ b/.github/PULL_REQUEST_TEMPLATE/add_recipe.md @@ -2,7 +2,9 @@ Thank you for taking the time to create a recipe for Ferdi. Please complete the following form so we can add your new recipe --> + ## Adding new recipe + Service: [Service your new recipe is for] URL: [URL to your service] @@ -10,7 +12,8 @@ URL: [URL to your service] Service ID: [What ID does your recipe use?] ### Terminal output -``` + +```bash [Output of your terminal when you ran yarn package] ``` @@ -19,4 +22,4 @@ Service ID: [What ID does your recipe use?] - [ ] I am the original creator of this package - [ ] My recipe has been tested to work inside Ferdi - + diff --git a/README.md b/README.md index 63753ea..495c36e 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,15 @@ Official Recipe repository for Ferdi with over 100 recipes. Copyright on these recipes is on their original creators - please look at `recipes//package.json` for information about the original creator and license. This is simply a curation of those recipes so we can include them into Ferdi. ## What are "Recipes"? + Recipes are small scripts that are responsible for providing the connection between your services (e.g. WhatsApp, GMail or Slack) and Ferdi. It provides Ferdi information like the number of current notifications, handles enabling dark mode and may otherwise improve your experience with the service. Each time you create a new service inside Ferdi, Ferdi will automatically install and execute the recipe associated with that service. ## Creating and adding your own recipes -Please refer to our documentation at https://github.com/getferdi/recipes/blob/master/docs/integration.md. + +Please refer to our [documentation](docs/integration.md) ## Minifying images -Please run `npm run minify-images` to optimize images + +Please run `npm run minify-images` to optimize images before you commit or raise PRs into this repository diff --git a/docs/integration.md b/docs/integration.md index 45d3af7..3eb8c1d 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -11,6 +11,7 @@ A Ferdi recipe is basically nothing else than a node module and is currently ini > If you want to update an existing recipe, please refer to [updating.md](https://github.com/getferdi/recipes/blob/master/docs/updating.md) instead ## Table of Contents + - [Ferdi Recipe Documentation / Overview](#ferdi-recipe-documentation--overview) - [Table of Contents](#table-of-contents) - [Preparing](#preparing) @@ -25,28 +26,35 @@ A Ferdi recipe is basically nothing else than a node module and is currently ini - [Publishing](#publishing) ## Preparing + You should have basic knowledge of JavaScript - don't worry, you'll really only need some basic commands as we've already prepared the complicated stuff for you. We have also created a nice script that already does 50% of the work for you - yay 🎉. If you want to use this script, please make sure you have NodeJS installed on your system. ## Create a recipe + 1. Fork this repository on GitHub. You can do this by clicking the "Fork" button in the top right corner 2. Clone your forked repository. Normally, you can do this by running `git clone https://github.com//recipes.git` in your terminal. You may also use a Git GUI or the GitHub Website for this. -2. (Optional, if you want to use our creation script) Install its dependencies via the terminal: +3. (Optional, if you want to use our creation script) Install its dependencies via the terminal: + ```Bash npm install ``` -3. You can now run our automatic recipe wizard that creates and opens the new recipe for you: + +4. You can now run our automatic recipe wizard that creates and opens the new recipe for you: + ```Bash # Make sure you are still in the repository's folder npm run create "Service Name" ``` + Replace `Service Name` with the name of your service, e.g. `npm run create "Google Hangouts"`. This command will automatically create the development recipe in the correct folder, prepares it for your service and opens the new recipe in your file explorer or Finder. -4. Reload Ferdi (`CMD/CTRL + SHIFT + R`) in order for it to register the new recipe -5. You can now develop your recipe as described below. Please continue down below with "[Publishing](#Publishing)" after you are done creating your recipe. +5. Reload Ferdi (`CMD/CTRL + SHIFT + R`) in order for it to register the new recipe +6. You can now develop your recipe as described below. Please continue down below with "[Publishing](#Publishing)" after you are done creating your recipe. ## Recipe structure + Every recipe needs a specific file structure in order to work as a Ferdi recipe * icon.svg - Icon for the service in SVG form (must be square) @@ -57,6 +65,7 @@ Every recipe needs a specific file structure in order to work as a Ferdi recipe * darkmode.css - CSS File that gets included when dark mode is activated ### package.json + The package.json is structured like any other node module and allows to completely configure the service. ```json @@ -79,8 +88,8 @@ To get more information about all the provided configuration flags, check the [c Please note that the fields `id`, `name`, `version` and `config` and required. - ### index.js + This is your "backend" code. Right now the options are very limited and most of the services don't need a custom handling here. If your service is relatively straight forward and has a static URL eg. _messenger.com_, _`[TEAMID]`.slack.com_ or _web.skype.com_ all you need to do to return the Ferdi Class: ```js @@ -88,6 +97,7 @@ module.exports = Ferdi => Ferdi; ``` If your service can be hosted on custom servers, you can validate the given URL to detect if it's your server and not e.g. google.com. To enable validation you can override the function `validateServer` + ```js // RocketChat integration module.exports = Ferdi => class RocketChat extends Ferdi { @@ -113,10 +123,9 @@ module.exports = Ferdi => class RocketChat extends Ferdi { `validateServer` needs to return a [`Promise`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise), otherwise validation will fail. - - By default, Ferdi's user agent looks like this: -``` + +```text Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.141 Safari/537.36 Ferdi/5.4.4-beta.3 (Electron 8.1.1) ``` @@ -124,7 +133,7 @@ Some services may not be compatible with Ferdi adding it's signature to the user If you encounter such a service, you remove this signature with the following snippet of code -``` +```js overrideUserAgent() { return window.navigator.userAgent.replace( /(Ferdi|Electron)\/\S+ \([^)]+\)/g, @@ -135,15 +144,15 @@ overrideUserAgent() { If you want to change the user agent to a different one, you can simply return the String for the new user agent: -``` +```js overrideUserAgent() { return "Mozilla/2.02Gold (Win95; I)"; } ``` ### webview.js -The webview.js is the actual script that will be loaded into the webview. Here you can do whatever you want to do in order perfectly integrate the service into Ferdi. For convenience, we have provided a very simple set of functions to set unread message badges (`Ferdi.setBadge()`) and inject CSS files (`Ferdi.injectCSS()`). +The webview.js is the actual script that will be loaded into the webview. Here you can do whatever you want to do in order perfectly integrate the service into Ferdi. For convenience, we have provided a very simple set of functions to set unread message badges (`Ferdi.setBadge()`) and inject CSS files (`Ferdi.injectCSS()`). ```js // orat.io integration @@ -167,19 +176,23 @@ module.exports = (Ferdi) => { To get more information about the provided functions, check the [API docs](frontend_api.md). ## Icons + In order to show every service icon crystal clear within the Ferdi UI, we require the icon in both .svg (square) and .png (square, 1024x1024px) formats. ## Dark Mode + You can provide a custom Dark Mode Theme for your recipes just by putting the `darkmode.css` into your recipe folder. Once the `darkmode.css` exists, you can enable the Dark Mode in your service settings. Recipe Dark Mode is only supported by Ferdi 5.0.0-beta.19+ ## Debugging + In order to debug your service integration, open Ferdi and use the shortcut `Cmd/Ctrl+Alt+Shift+i` to open the recipes developer tools. ## Publishing + Ferdi uses its recipe repository at to publish recipes to all clients. Publishing your recipes to Ferdi is super easy! When you used our recipe creation script, we have created a folder for your recipe inside Ferdi's internal folders (the one that got automatically opened after you ran our script). -Simply copy that whole folder into the repositories "recipes" folder. You'll now need to push your changes to Git and create a Pull Request from your fork repository to our repository using the GitHub website. \ No newline at end of file +Simply copy that whole folder into the repositories "recipes" folder. You'll now need to push your changes to Git and create a Pull Request from your fork repository to our repository using the GitHub website. -- cgit v1.2.3-54-g00ecf