Skip to content

Commit 48be0fc

Browse files
authored
Merge pull request #14 from pxthinh/feature/update_provider
Feature/update provider
2 parents 979b3e7 + 551f6b5 commit 48be0fc

File tree

2 files changed

+59
-12
lines changed

2 files changed

+59
-12
lines changed

config/telegram-git-notifier.php

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,81 @@
22

33
return [
44
'app' => [
5-
'name' => env('APP_NAME', 'Laravel Telegram Git Notify'),
6-
'url' => env('APP_URL', 'http://localhost:8000'),
5+
'name' => env('TGN_APP_NAME', 'Laravel Telegram Git Notifier'),
6+
7+
// Required for the bot to work properly
8+
'url' => env('TGN_APP_URL', 'http://localhost:8000'),
79
'timezone' => env('TIMEZONE', 'Asia/Ho_Chi_Minh'),
810
],
911

1012
'bot' => [
1113
'token' => env('TELEGRAM_BOT_TOKEN', ''),
1214
'chat_id' => env('TELEGRAM_BOT_CHAT_ID', ''),
13-
'notify_chat_ids' => explode(
14-
',',
15-
env('TELEGRAM_NOTIFY_CHAT_IDS', '')
16-
),
15+
16+
/**
17+
* Set the chat IDs that will receive notifications
18+
* You can add the owner bot ID, group ID, ...
19+
* -------------------------------------------------------
20+
* Note:
21+
* Please use semicolon ";" to separate chat ids
22+
* And use a colon ":" to separate chat ID and thread ID
23+
* And use comma "," if you want to add multiple thread IDs
24+
* -------------------------------------------------------
25+
* The environment variable is expected to be in the format:
26+
* "chat_id1;chat_id2:thread_id2;chat_id3:thread_id3_1,thread_id3_2;...".
27+
*/
28+
'notify_chat_ids' => env('TELEGRAM_NOTIFY_CHAT_IDS', ''),
1729
],
1830

1931
'author' => [
20-
'discussion' => env('TGN_AUTHOR_CONTACT', 'https://t.me/tannp27'),
32+
'discussion' => env(
33+
'TGN_AUTHOR_DISCUSSION',
34+
'https://github.com/lbiltech/laravel-telegram-git-notifier/discussions'
35+
),
2136
'source_code' => env(
2237
'TGN_AUTHOR_SOURCE_CODE',
2338
'https://github.com/lbiltech/laravel-telegram-git-notifier'
2439
),
2540
],
2641

42+
/** Set the path to the data file */
43+
'data_file' => [
44+
'setting' => env(
45+
'TGN_PATH_SETTING',
46+
storage_path('/app/json/tgn/tgn-settings.json')
47+
),
48+
49+
'platform' => [
50+
'gitlab' => env(
51+
'TGN_PATH_PLATFORM_GITLAB',
52+
storage_path('/app/json/tgn/gitlab-events.json')
53+
),
54+
'github' => env(
55+
'TGN_PATH_PLATFORM_GITHUB',
56+
storage_path('/app/json/tgn/github-events.json')
57+
),
58+
],
59+
],
60+
61+
/** Set the path to the view file */
2762
'view' => [
28-
'event' => [
63+
'default' => env(
64+
'TGN_VIEW_DEFAULT',
65+
base_path('resources/views/vendor/telegram-git-notifier')
66+
),
67+
68+
'event' => [
2969
'default' => env('TGN_VIEW_EVENT_DEFAULT', 'default'),
3070
],
71+
3172
'globals' => [
3273
'access_denied' => env(
3374
'TGN_VIEW_GLOBALS_ACCESS_DENIED',
3475
'globals.access_denied'
3576
),
3677
],
37-
'tools' => [
78+
79+
'tools' => [
3880
'settings' => env(
3981
'TGN_VIEW_TOOL_SETTING',
4082
'tools.settings'
@@ -53,4 +95,5 @@
5395
),
5496
],
5597
],
98+
5699
];

src/Providers/TelegramGitNotifierServiceProvider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ public function boot(): void
2323
$this->loadRoutesFrom($routePath);
2424
}
2525

26-
$helperPath = __DIR__.'/../../common/helpers.php';
27-
if (file_exists($helperPath)) {
28-
require_once $helperPath;
26+
$viewPath = __DIR__.'/../../resources/views';
27+
if (file_exists($viewPath)) {
28+
$this->loadViewsFrom($viewPath, 'telegram-git-notifier');
2929
}
3030

31+
$this->publishes([
32+
__DIR__.'/../../resources/views' => base_path('resources/views/vendor/telegram-git-notifier'),
33+
], 'views');
34+
3135
$this->loadTranslationsFrom(__DIR__.'/../../lang', 'telegram-git-notifier');
3236

3337
$this->publishes([

0 commit comments

Comments
 (0)