mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
adds back the laravel channels package and applies a deprecated check
This commit is contained in:
parent
6f0c1b12b1
commit
b987b3dc00
|
@ -4,6 +4,7 @@ namespace App\Livewire;
|
|||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Component;
|
||||
use App\Models\Setting;
|
||||
use App\Helpers\Helper;
|
||||
|
@ -19,6 +20,7 @@ class SlackSettingsForm extends Component
|
|||
public $webhook_placeholder;
|
||||
public $webhook_icon;
|
||||
public $webhook_selected;
|
||||
public $teams_webhook_deprecated;
|
||||
public array $webhook_text;
|
||||
|
||||
public Setting $setting;
|
||||
|
@ -235,15 +237,33 @@ class SlackSettingsForm extends Component
|
|||
}
|
||||
}
|
||||
public function msTeamTestWebhook(){
|
||||
$this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows');
|
||||
try {
|
||||
|
||||
try {
|
||||
$notification = new TeamsNotification($this->webhook_endpoint);
|
||||
$message = trans('general.webhook_test_msg', ['app' => $this->webhook_name]);
|
||||
$notification->success()->sendMessage($message);
|
||||
if($this->teams_webhook_deprecated){
|
||||
//will use the deprecated webhook format
|
||||
$payload =
|
||||
[
|
||||
"@type" => "MessageCard",
|
||||
"@context" => "http://schema.org/extensions",
|
||||
"summary" => trans('mail.snipe_webhook_summary'),
|
||||
"title" => trans('mail.snipe_webhook_test'),
|
||||
"text" => trans('general.webhook_test_msg', ['app' => $this->webhook_name]),
|
||||
];
|
||||
$response = Http::withHeaders([
|
||||
'content-type' => 'applications/json',
|
||||
])->post($this->webhook_endpoint,
|
||||
$payload)->throw();
|
||||
}
|
||||
else {
|
||||
$notification = new TeamsNotification($this->webhook_endpoint);
|
||||
$message = trans('general.webhook_test_msg', ['app' => $this->webhook_name]);
|
||||
$notification->success()->sendMessage($message);
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'content-type' => 'applications/json',
|
||||
])->post($this->webhook_endpoint);
|
||||
$response = Http::withHeaders([
|
||||
'content-type' => 'applications/json',
|
||||
])->post($this->webhook_endpoint);
|
||||
}
|
||||
|
||||
if(($response->getStatusCode() == 302)||($response->getStatusCode() == 301)){
|
||||
return session()->flash('error' , trans('admin/settings/message.webhook.error_redirect', ['endpoint' => $this->webhook_endpoint]));
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
"intervention/image": "^2.5",
|
||||
"javiereguiluz/easyslugger": "^1.0",
|
||||
"laravel-notification-channels/google-chat": "^3.0",
|
||||
"laravel-notification-channels/microsoft-teams": "^1.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/helpers": "^1.4",
|
||||
"laravel/passport": "^11.0",
|
||||
|
|
59
composer.lock
generated
59
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6eb153ab8627da9552bc84de32665f0f",
|
||||
"content-hash": "0750e3a427347b2a56a05a8b9b533d48",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alek13/slack",
|
||||
|
@ -2623,6 +2623,63 @@
|
|||
},
|
||||
"time": "2024-03-19T06:42:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel-notification-channels/microsoft-teams",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel-notification-channels/microsoft-teams.git",
|
||||
"reference": "41d054c5f603ca10951144a87eb8e9652307ce1b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel-notification-channels/microsoft-teams/zipball/41d054c5f603ca10951144a87eb8e9652307ce1b",
|
||||
"reference": "41d054c5f603ca10951144a87eb8e9652307ce1b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.3 || ^7.0",
|
||||
"illuminate/notifications": "~5.5 || ~6.0 || ~7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
|
||||
"illuminate/support": "~5.5 || ~6.0 || ~7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.2.3",
|
||||
"phpunit/phpunit": "^8.0 || ^9.5 || ^10.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"NotificationChannels\\MicrosoftTeams\\MicrosoftTeamsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"NotificationChannels\\MicrosoftTeams\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tobias Madner",
|
||||
"email": "tobias.madner@gmx.at",
|
||||
"homepage": "https://www.pinpoll.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A Laravel Notification Channel for Microsoft Teams",
|
||||
"homepage": "https://github.com/laravel-notification-channels/microsoft-teams",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel-notification-channels/microsoft-teams/issues",
|
||||
"source": "https://github.com/laravel-notification-channels/microsoft-teams/tree/1.2.0"
|
||||
},
|
||||
"time": "2024-03-11T15:07:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v10.48.22",
|
||||
|
|
Loading…
Reference in a new issue