diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..5fae3b3 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,32 @@ +name: Docs workflow + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + build-and-deploy-docs: + runs-on: ubuntu-latest + steps: + - name: Specific Node.js version 🦄 + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Install and Build 📎 + run: | + npm install + npm run docs:build + + - name: Deploy Docs 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs/.vitepress/dist diff --git a/.gitignore b/.gitignore index 0434eb6..075f969 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ node_modules /data /static/file_* config.yaml +docs/.vitepress/dist +docs/.vitepress/cache # Log files npm-debug.log* diff --git a/README.md b/README.md index 6c20be3..8454b9c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # Arona -The perfectest bridging for every messenger. +A simple bridge for every messenger. -[Bridge](https://matrix.org/bridges/) is the idea makes **[Matrix](https://matrix.org)** cross connecting every Instant Message Providers. - -![Arona](icon.min.png) +![Arona](docs/statics/icon.min.png) ## Documentation diff --git a/app.ts b/app.ts index e7de473..7fd8e19 100644 --- a/app.ts +++ b/app.ts @@ -79,7 +79,7 @@ const { app.listen(bindPort, bindHost, () => { console.info("Arona"); console.info("==="); - console.info("The perfectest bridging for every messenger."); + console.info("A simple bridge for every messenger."); console.info(`Listening on http://${bindHost}:${bindPort}`); checkHeartCode(); }); diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts new file mode 100644 index 0000000..cf92b94 --- /dev/null +++ b/docs/.vitepress/config.ts @@ -0,0 +1,97 @@ +import { defineConfig } from 'vitepress' + +// https://vitepress.dev/reference/site-config +export default defineConfig({ + title: "Arona", + description: "A simple bridge for every messenger.", + themeConfig: { + // https://vitepress.dev/reference/default-theme-config + nav: [{ + text: "Home", + link: "/", + }, { + text: "Docs", + link: "/introduction", + }], + sidebar: [ + { + text: "🌟 Introduction", + link: "/introduction", + }, + { + text: "😎 Prerequisites", + link: "/prerequisites", + }, + { + text: "✨ Get Started", + link: "/get-started", + }, + { + text: "🪄 Configuration", + link: "/configuration", + }, + { + text: "🎯 Usage", + link: "/usage", + }, + { + text: "🏁 Commands", + link: "/commands", + }, + { + text: "❓ FAQ", + link: "/faq", + }, + { + text: "🔱 Integrations", + link: "/integrations", + items: [ + { + text: "LINE", + link: "/integrations/line", + }, + { + text: "Matrix", + link: "/integrations/matrix", + }, + { + text: "Discord", + link: "/integrations/discord", + }, + { + text: "Telegram", + link: "/integrations/telegram", + }, + { + text: "OpenAI", + link: "/integrations/openai", + } + ], + }, + { + text: "🔮 About", + link: "/about", + }, + ], + socialLinks: [ + { + icon: 'github', + link: 'https://github.com/web-tech-tw/arona', + } + ], + footer: { + message: "MIT Licensed", + copyright: "Copyright © 2024 Taiwan Web Technology Promotion Organization (Web Tech TW)" + } + }, + locales: { + root: { + label: 'English', + lang: 'en' + }, + "zh-tw": { + label: '正體中文', + lang: 'zh-tw', + } + } +}) diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index b8727df..0000000 --- a/docs/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Hello! - -This is the bridge for LINE and Matrix, - -to communicate with the chat room which belongs to both of the different providers. - -![logo](../icon.min.png) - -The bridge is using [line-bot-sdk-nodejs](https://github.com/line/line-bot-sdk-nodejs) and [matrix-bot-sdk](https://github.com/turt2live/matrix-bot-sdk) for transporting. - -[Instruction of Matrix Bridges](https://matrix.org/bridges/) diff --git a/docs/about.md b/docs/about.md new file mode 100644 index 0000000..3edaa7b --- /dev/null +++ b/docs/about.md @@ -0,0 +1,15 @@ +# 🔮 About + +Hello! + +This is the bridge for LINE and Matrix, + +to communicate with the chat room which belongs to both of the different providers. + +![logo](statics/icon.min.png) + +The bridge is using [line-bot-sdk-python](https://github.com/line/line-bot-sdk-python) and [matrix-nio](https://github.com/poljar/matrix-nio) for transporting. + +[Instruction of Matrix Bridges](https://matrix.org/bridges/) + +This is the documentation for Arona, the perfectest bridging for every messenger. diff --git a/docs/commands.md b/docs/commands.md new file mode 100644 index 0000000..fe6d6e3 --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,16 @@ +# 🏁 Commands + +The following commands are available in the chat: + +| Command | Description | +| ---------------- | ------------------------- | +| `/aiLink` | Link with AI chat | +| `/aiUnlink` | Unlink with AI chat | +| `/setLocaleCode` | Set locale | +| `/datetime` | Get current date and time | +| `/chatId` | Get chat ID | +| `/pair` | Pair with another chat | +| `/pairStatus` | Get pairing status | +| `/pairLink` | Link with another chat | +| `/pairUnlink` | Unlink with another chat | +| `/help` | Show the help message | diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..ee5bd62 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,154 @@ +# 🪄 Configuration + +To configure the Arona, you need to create a configuration file named `config.yaml` in the root directory of the project. + +## Configuration File + +The configuration file is a YAML file that contains the configuration for the Arona. + +```yaml +deviceName: "Arona" + +http: + bindHost: 127.0.0.1 + bindPort: 3000 + baseUrl: "http://example.com" + +bridge: + public: true + +bridgeProvider: + # OpenAI + openai: + enable: true + # https://github.com/ai-tech-tw/openai + baseUrl: "https://web-tech-tw.eu.org/openai/v1" + apiKey: "YourGeminiApiKey" + chatModel: "gpt-3.5-turbo" + + # LINE + line: + enable: true + channelAccessToken: "YourChannelAccessToken" + channelSecret: "YourChannelSecret" + useNotify: true + notifyClientId: "YourClientID" + notifyClientSecret: "YourClientSecret" + + # Matrix + matrix: + enable: true + homeserverUrl: "https://matrix.org" + accessToken: "YourSecretAccessToken" + + # Discord + discord: + enable: false + appId: "YourAppId" + botToken: "YourBotToken" + + # Telegram + telegram: + enable: false + botToken: "YourBotToken" +``` + +## Configuration Options + +The configuration file contains the following options: + +| Option | Description | +| ---------------- | ---------------------------------- | +| `deviceName` | The name of the device. | +| `http` | The HTTP configuration. | +| `bridge` | The bridge configuration. | +| `bridgeProvider` | The bridge provider configuration. | + +### `deviceName` + +The `deviceName` option is used to specify the name of the device. + +### `http` + +The `http` option is used to configure the HTTP server. + +| Option | Description | +| ---------- | ------------------------ | +| `bindHost` | The host to bind to. | +| `bindPort` | The port to bind to. | +| `baseUrl` | The base URL of the API. | + +### `bridge` + +The `bridge` option is used to configure the bridge. + +| Option | Description | +| -------- | ------------------------------------ | +| `public` | Whether the bridge is public or not. | + +### `bridgeProvider` + +The `bridgeProvider` option is used to configure the bridge provider. + +#### OpenAI + +The `openai` option is used to configure the OpenAI provider. + +| Option | Description | +| ----------- | --------------------------------------- | +| `enable` | Whether the provider is enabled or not. | +| `baseUrl` | The base URL of the OpenAI API. | +| `apiKey` | The API key of the OpenAI API. | +| `chatModel` | The chat model to use. | + +Details of OpenAI integration can be found [here](integrations/openai.md). + +#### LINE + +The `line` option is used to configure the LINE provider. + +| Option | Description | +| -------------------- | ----------------------------------------- | +| `enable` | Whether the provider is enabled or not. | +| `channelAccessToken` | The channel access token of the LINE API. | +| `channelSecret` | The channel secret of the LINE API. | +| `useNotify` | Whether to use LINE Notify or not. | +| `notifyClientId` | The client ID of the LINE Notify API. | +| `notifyClientSecret` | The client secret of the LINE Notify API. | + +Details of LINE integration can be found [here](integrations/line.md). + +#### Matrix + +The `matrix` option is used to configure the Matrix provider. + +| Option | Description | +| --------------- | --------------------------------------- | +| `enable` | Whether the provider is enabled or not. | +| `homeserverUrl` | The homeserver URL of the Matrix API | +| `accessToken` | The access token of the Matrix API. | + +Details of Matrix integration can be found [here](integrations/matrix.md). + +#### Discord + +The `discord` option is used to configure the Discord provider. + +| Option | Description | +| ---------- | --------------------------------------- | +| `enable` | Whether the provider is enabled or not. | +| `appId` | The application ID of the Discord API. | +| `botToken` | The bot token of the Discord API. | + +Details of Discord integration can be found [here](integrations/discord.md). + +#### Telegram + +The `telegram` option is used to configure the Telegram provider. + +| Option | Description | +| ---------- | --------------------------------------- | +| `enable` | Whether the provider is enabled or not. | +| `botToken` | The bot token of the Telegram API. | + +Details of Telegram integration can be found [here](integrations/telegram.md). diff --git a/docs/faq.md b/docs/faq.md new file mode 100644 index 0000000..f777ff1 --- /dev/null +++ b/docs/faq.md @@ -0,0 +1,5 @@ +# ❓ FAQ + +## What is Arona? + +Arona is a bridge for LINE and Matrix, to communicate with the chat room which belongs to both of the different providers. diff --git a/docs/get-started.md b/docs/get-started.md new file mode 100644 index 0000000..e0d3fe1 --- /dev/null +++ b/docs/get-started.md @@ -0,0 +1,104 @@ +# ✨ Get Started + +Arona is a simple bridge for every messenger. + +It exchanges messages between LINE, Telegram, Discord, and Matrix. + +## Configuration + +Create a `config.yaml` file in the root directory. + +```yaml +deviceName: "Arona" + +http: + bindHost: 127.0.0.1 + bindPort: 3000 + baseUrl: "http://example.com" + +bridge: + public: true + +bridgeProvider: + # OpenAI + openai: + enable: true + # https://github.com/ai-tech-tw/openai + baseUrl: "https://web-tech-tw.eu.org/openai/v1" + apiKey: "YourGeminiApiKey" + chatModel: "gpt-3.5-turbo" + + # LINE + line: + enable: true + channelAccessToken: "YourChannelAccessToken" + channelSecret: "YourChannelSecret" + useNotify: true + notifyClientId: "YourClientID" + notifyClientSecret: "YourClientSecret" + + # Matrix + matrix: + enable: true + homeserverUrl: "https://matrix.org" + accessToken: "YourSecretAccessToken" + + # Discord + discord: + enable: false + appId: "YourAppId" + botToken: "YourBotToken" + + # Telegram + telegram: + enable: false + botToken: "YourBotToken" +``` + +To get detailed information about the configuration, please refer to the [Configuration](./configuration.md) page. + +## Installation + +To run the project, you can use Docker or run it natively. + +### Docker + +Create a `docker-compose.yml` file in the root directory. + +Copy the following content to the `docker-compose.yml` file. + +```yaml +version: 3 +services: + arona: + image: ghcr.io/web-tech-tw/arona:main + ports: + - 127.0.0.1:3000:3000 + volumes: + - ./config.yaml:/workplace/config.yaml:ro + restart: always +``` + +Run the following command to start the project. + +```bash +docker-compose up -d +``` + +### Native + +Run the following commands to start the project. + +Clone the repository. + +```bash +git clone https://github.com/web-tech-tw/arona.git +cd arona +``` + +Install the dependencies and start the project. + +```bash +npm install +npm start +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..9b1381e --- /dev/null +++ b/docs/index.md @@ -0,0 +1,26 @@ +--- +layout: home + +hero: + name: Arona + text: "A simple bridge for every messenger." + tagline: Sending your messages from anywhere to everywhere! + image: statics/icon.min.png + actions: + - theme: brand + text: GitHub + link: https://github.com/web-tech-tw/arona + - theme: alt + text: Docs + link: /introduction + +features: + - title: Simplicity First + details: Minimal setup with a simple and intuitive structure that makes it easy to get started. + - title: 4 Instant Messengers Supported + details: Support for LINE, Telegram, Discord and Matrix. + - title: Open Source + details: The project is open source and available on GitHub. + - title: Cross-platform + details: The bridge can be run on any platform that supports Node.js/Docker. +--- diff --git a/docs/integrations.md b/docs/integrations.md new file mode 100644 index 0000000..d5cab8a --- /dev/null +++ b/docs/integrations.md @@ -0,0 +1,9 @@ +# 🔱 Integrations + +Integrations are a way to connect your bot to other services. +This allows you to send messages to other platforms, or receive messages from them. + +- [LINE](integrations/line.md) +- [Matrix](integrations/matrix.md) +- [Discrod](integrations/discord.md) +- [Telegram](integrations/telegram.md) diff --git a/docs/integrations/discord.md b/docs/integrations/discord.md new file mode 100644 index 0000000..e8301b5 --- /dev/null +++ b/docs/integrations/discord.md @@ -0,0 +1,20 @@ +# Discord + +## Introduction + +The Discord integration allows you to send notifications to a Discord channel. You can use this integration to send notifications from your workflows to your Discord channel. + +## Prerequisites + +Before you can set up the Discord integration, you need to have the following: + +- A Discord account +- A Discord server +- A Discord channel + +## Setting up the integration + +To set up the Discord integration, you need to create a webhook in your Discord channel. You can do this by following these steps: + +1. Open your Discord channel. +2. Click on the settings icon next to the channel name. diff --git a/docs/integrations/line.md b/docs/integrations/line.md new file mode 100644 index 0000000..72272a8 --- /dev/null +++ b/docs/integrations/line.md @@ -0,0 +1,22 @@ +# LINE + +LINE Messaging API allows you to add LINE to your app or website to reach your customers. You can respond to messages, send stickers, images, videos, and more. + +## Prerequisites + +Before you can set up the LINE integration, you need to have the following: + +- A LINE account +- A LINE channel +- A LINE bot + +## Setting up the integration + +To set up the LINE integration, you need to create a LINE bot in your LINE account. You can do this by following these steps: + +1. Log in to your LINE account. +2. Go to the LINE Developers Console. +3. Click on the "Create a new provider" button. +4. Enter the provider name and description. +5. Click on the "Create" button. +6. Go to the "Messaging API" tab. diff --git a/docs/integrations/matrix.md b/docs/integrations/matrix.md new file mode 100644 index 0000000..d653da9 --- /dev/null +++ b/docs/integrations/matrix.md @@ -0,0 +1,22 @@ +# Matrix + +Matrix is a powerful tool for managing your data. It allows you to create a table of data with rows and columns. You can use it to store data, perform calculations, and visualize data. Matrix is a great tool for organizing and analyzing data. + +## Prerequisites + +Before you can set up the Matrix integration, you need to have the following: + +- A Matrix account +- A Matrix server +- A Matrix room + +## Setting up the integration + +To set up the Matrix integration, you need to create a Matrix room in your Matrix account. You can do this by following these steps: + +1. Log in to your Matrix account. +2. Go to the rooms section of your account. +3. Click on the "Create room" button. +4. Enter the room name and description. + +![Matrix Pairing](../statics/matrix_pairing.png) diff --git a/docs/integrations/openai.md b/docs/integrations/openai.md new file mode 100644 index 0000000..c283142 --- /dev/null +++ b/docs/integrations/openai.md @@ -0,0 +1,25 @@ +# OpenAI + +OpenAI is a research lab consisting of the for-profit OpenAI LP and the non-profit OpenAI Inc. The organization aims to ensure that artificial general intelligence (AGI) benefits all of humanity. OpenAI is funded by a group of technology executives and investors, including Elon Musk, Reid Hoffman, and Peter Thiel. + +## Introduction + +The OpenAI integration allows you to interact with the OpenAI API to generate text, images, and more. You can use this integration to create AI-powered workflows that generate content, answer questions, and more. + +## Prerequisites + +Before you can set up the OpenAI integration, you need to have the following: + +- An OpenAI account +- An OpenAI API key +- An understanding of how to use the OpenAI API + +## Setting up the integration + +To set up the OpenAI integration, you need to create an API key in your OpenAI account. You can do this by following these steps: + +1. Log in to your OpenAI account. +2. Go to the API section of your account. +3. Click on the "Create API key" button. +4. Copy the API key and save it in a secure location. +5. Use the API key in your workflows to interact with the OpenAI API. diff --git a/docs/integrations/telegram.md b/docs/integrations/telegram.md new file mode 100644 index 0000000..336a04f --- /dev/null +++ b/docs/integrations/telegram.md @@ -0,0 +1,18 @@ +# Telegram + +Telegram is a popular messaging app that allows you to send messages, photos, videos, and files to your friends and family. It is available on all major platforms, including iOS, Android, and the web. Telegram also has a bot API that allows developers to create bots that can interact with users on the platform. + +## Introduction + +The Telegram integration allows you to send messages, photos, videos, and files to a Telegram chat or channel. You can use this integration to send notifications, alerts, and updates to your Telegram contacts. + +## Prerequisites + +Before you can set up the Telegram integration, you need to have the following: + +- A Telegram account +- A Telegram bot +- A Telegram chat or channel +- A bot token + +## Setting up the integration diff --git a/docs/introduction.md b/docs/introduction.md new file mode 100644 index 0000000..6f397f7 --- /dev/null +++ b/docs/introduction.md @@ -0,0 +1,14 @@ +# 🌟 Introduction + +Hello! This is the bridge to exchange messages from different instant messaging platforms. + +The project will provide a way to exchange messages between different platforms, such as LINE, Matrix, Telegram, and Discord. + +![logo](statics/icon.min.png) + +## Features + +- **Simple**: Minimal setup with a simple and intuitive structure that makes it easy to get started. +- **4 Instant Messengers Supported**: Support for LINE, Telegram, Discord and Matrix. +- **Open Source**: The project is open source and available on [GitHub](https://github.com/web-tech-tw/arona). +- **Cross-platform**: The bridge can be run on any platform that supports Node.js/Docker. diff --git a/docs/prerequisites.md b/docs/prerequisites.md new file mode 100644 index 0000000..066a679 --- /dev/null +++ b/docs/prerequisites.md @@ -0,0 +1,18 @@ +# 😎 Prerequisites + +It's necessary to have the following tools installed in your machine to run the project. + +## Docker + +We recommend using Docker and Docker Compose to run the project in production. + +- Docker +- Docker Compose + +## Native + +If you hoping to run the application natively, you will need the following tools: + +- Node.js +- NPM +- Git diff --git a/icon.min.png b/docs/statics/icon.min.png similarity index 100% rename from icon.min.png rename to docs/statics/icon.min.png diff --git a/icon.png b/docs/statics/icon.png similarity index 100% rename from icon.png rename to docs/statics/icon.png diff --git a/logo.png b/docs/statics/logo.png similarity index 100% rename from logo.png rename to docs/statics/logo.png diff --git a/logo.svg b/docs/statics/logo.svg similarity index 100% rename from logo.svg rename to docs/statics/logo.svg diff --git a/docs/statics/matrix_pairing.png b/docs/statics/matrix_pairing.png new file mode 100644 index 0000000..8f7250c Binary files /dev/null and b/docs/statics/matrix_pairing.png differ diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..a9e4422 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,8 @@ +# 🎯 Usage + +Supported messengers: + +- [LINE](./integrations/line.md) +- [Telegram](./integrations/telegram.md) +- [Discord](./integrations/discord.md) +- [Matrix](./integrations/matrix.md) diff --git a/docs/zh-tw/index.md b/docs/zh-tw/index.md new file mode 100644 index 0000000..4e6e303 --- /dev/null +++ b/docs/zh-tw/index.md @@ -0,0 +1,26 @@ +--- +layout: home + +hero: + name: Arona + text: "為世上每個通訊軟體打造簡單的溝通橋樑" + tagline: 將你的訊息傳送到全世界! + image: ../statics/icon.min.png + actions: + - theme: brand + text: GitHub + link: https://github.com/web-tech-tw/arona + - theme: alt + text: 文件 + link: /introduction + +features: + - title: 簡單易用 + details: 最小化設定,即可快速啟動。 + - title: 4 個通訊軟體平台 + details: 支援 LINE、Telegram、Discord 以及 Matrix。 + - title: 開放原始碼 + details: 本專案為開放原始碼,並且可在 GitHub 上取得。 + - title: 跨平台 + details: 本橋樑可在任何支援 Node.js/Docker 的平台上運行。 +--- diff --git a/package.json b/package.json index 11ce6e8..31b0e58 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "arona", "version": "1.0.0", - "description": "The bridge for Matrix to connect with LINE via Messaging API.", + "description": "A simple bridge for every messenger.", "author": "Taiwan Web Technology Promotion Organization", "license": "MIT", "main": "app.ts", @@ -11,7 +11,10 @@ "start": "tsx app.ts", "matrix-access": "tsx matrix_access.ts", "lint": "eslint \"app.ts\" \"matrix_access.ts\" \"src/**/*.ts\"", - "lint:fix": "eslint \"app.ts\" \"matrix_access.ts\" \"src/**/*.ts\" --fix" + "lint:fix": "eslint \"app.ts\" \"matrix_access.ts\" \"src/**/*.ts\" --fix", + "docs:dev": "vitepress dev docs", + "docs:build": "vitepress build docs", + "docs:preview": "vitepress preview docs" }, "dependencies": { "@line/bot-sdk": "^9.2.2", @@ -40,6 +43,7 @@ "@typescript-eslint/parser": "^7.9.0", "eslint": "^8.56.0", "eslint-config-google": "^0.14.0", - "typescript": "^5.4.5" + "typescript": "^5.4.5", + "vitepress": "^1.3.0" } } diff --git a/src/server.ts b/src/server.ts index 456f90c..5b90eba 100644 --- a/src/server.ts +++ b/src/server.ts @@ -40,7 +40,7 @@ export const indexHandler = async ( return res.status(200).send(`
Arona
- The perfectest bridging for every messenger.
+ A simple bridge for every messenger.
GitHub
`);