-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
52 lines (46 loc) · 1.8 KB
/
Copy pathbootstrap.php
File metadata and controls
52 lines (46 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use App\Services\Hook;
use Illuminate\Support\Facades\Route;
return function () {
Hook::addRoute(function () {
// OAuth authorization records
Route::namespace('OAuthRecord\Controllers')
->prefix('user/oauth-record')
->middleware(['web', 'authorize', 'verified'])
->group(function () {
Route::get('', 'OAuthRecordController@index');
Route::post('revoke/{tokenId}', 'OAuthRecordController@revoke');
Route::post('revoke-client/{clientId}', 'OAuthRecordController@revokeClient');
});
// OAuth App Hall
Route::namespace('OAuthRecord\Controllers')
->prefix('oauth-apps')
->middleware(['web', 'authorize'])
->group(function () {
Route::get('', 'AppHallController@index');
Route::get('favicon', 'AppHallController@favicon');
});
// Admin cleanup route
Route::namespace('OAuthRecord\Controllers')
->prefix('admin/oauth-record')
->middleware(['web', 'auth', 'role:admin'])
->group(function () {
Route::post('cleanup', 'ConfigController@cleanup');
Route::post('cleanup-redundant', 'ConfigController@cleanupRedundant');
});
});
if (option('oauth_record_enable_auth_record', true)) {
Hook::addMenuItem('user', 5, [
'title' => 'OAuthRecord::oauth-record.title',
'link' => 'user/oauth-record',
'icon' => 'fa-key',
]);
}
if (option('oauth_record_enable_app_hall', true)) {
Hook::addMenuItem('explore', 0, [
'title' => 'OAuthRecord::oauth-record.hall-title',
'link' => 'oauth-apps',
'icon' => 'fa-th-large',
]);
}
};