-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from web-tech-tw/arona
Merge Arona branch
- Loading branch information
Showing
82 changed files
with
3,951 additions
and
1,094 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
node_modules | ||
/dist | ||
/data | ||
.env | ||
/static/file_* | ||
config.yaml | ||
|
||
# Log files | ||
npm-debug.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,85 @@ | ||
import "dotenv/config"; | ||
// Purpose: Main entry point for the application. | ||
|
||
// Import the configuration. | ||
import { | ||
loopEvent as httpServerLoop, | ||
} from "./src/http_server"; | ||
httpConfig, | ||
} from "./src/config"; | ||
|
||
// Import the application. | ||
import { | ||
loopEvent as matrixListenerLoop, | ||
} from "./src/provider/matrix/listener"; | ||
|
||
(async () => { | ||
const events = [ | ||
httpServerLoop, | ||
matrixListenerLoop, | ||
]; | ||
await Promise.all( | ||
events.map((e) => e()), | ||
); | ||
})(); | ||
app, | ||
indexHandler, | ||
heartHandler, | ||
staticHandler, | ||
checkHeartCode, | ||
} from "./src/server"; | ||
|
||
// Import listen providers. | ||
import MatrixListen from "./src/providers/matrix/listen"; | ||
import DiscordListen from "./src/providers/discord/listen"; | ||
import TelegramListen from "./src/providers/telegram/listen"; | ||
|
||
// Import hook providers. | ||
import LINEHook from "./src/providers/line/hook"; | ||
|
||
// Import send providers. | ||
import LINESend from "./src/providers/line/send"; | ||
import MatrixSend from "./src/providers/matrix/send"; | ||
import DiscordSend from "./src/providers/discord/send"; | ||
import TelegramSend from "./src/providers/telegram/send"; | ||
import OpenaiSend from "./src/providers/openai/send"; | ||
|
||
import { | ||
hookRouter, | ||
registerSendProviders, | ||
registerHookProviders, | ||
registerListenProviders, | ||
} from "./src/registry"; | ||
|
||
// Register all senders. | ||
await registerSendProviders([ | ||
new LINESend(), | ||
new MatrixSend(), | ||
new DiscordSend(), | ||
new TelegramSend(), | ||
new OpenaiSend(), | ||
]); | ||
|
||
// Register all listeners. | ||
await registerListenProviders([ | ||
new MatrixListen(), | ||
new DiscordListen(), | ||
new TelegramListen(), | ||
]); | ||
|
||
// Register all Hookers. | ||
await registerHookProviders([ | ||
new LINEHook(), | ||
]); | ||
|
||
// This route is used to handle the index. | ||
app.get("/", indexHandler); | ||
|
||
// This route is used to serve static files. | ||
app.use("/static", staticHandler); | ||
|
||
// This route is used to handle the heart. | ||
app.get("/heart", heartHandler); | ||
|
||
// This route is used to handle the hooks. | ||
app.use("/hooks", hookRouter); | ||
|
||
// Define the port to expose the application on. | ||
const { | ||
bindHost, | ||
bindPort, | ||
} = httpConfig(); | ||
|
||
// Create a server and listen to it. | ||
app.listen(bindPort, bindHost, () => { | ||
console.info("Arona"); | ||
console.info("==="); | ||
console.info("The perfectest bridging for every messenger."); | ||
console.info(`Listening on http://${bindHost}:${bindPort}`); | ||
checkHeartCode(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.