diff --git a/extend.php b/extend.php index 293c788..c8f1edd 100644 --- a/extend.php +++ b/extend.php @@ -27,6 +27,8 @@ return [ (new Extend\Routes('forum')) ->post('/oauth/authorize', 'oauth.authorize.post', Controllers\AuthorizeController::class), + (new Extend\Routes('api')) + ->get('/oauth/clients', 'oauth.clients.list', Api\Controller\ListClientController::class), (new Extend\Middleware('api'))->add(ResourceScopeMiddleware::class), ]; diff --git a/js/dist/admin.js b/js/dist/admin.js index 8d4d494..47a216f 100644 Binary files a/js/dist/admin.js and b/js/dist/admin.js differ diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index b234155..5f1a3e8 100644 Binary files a/js/dist/admin.js.map and b/js/dist/admin.js.map differ diff --git a/js/dist/forum.js b/js/dist/forum.js index d1604e5..3003770 100644 Binary files a/js/dist/forum.js and b/js/dist/forum.js differ diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 00df114..8eac3b2 100644 Binary files a/js/dist/forum.js.map and b/js/dist/forum.js.map differ diff --git a/js/src/admin/pages/ClientsPage.js b/js/src/admin/pages/ClientsPage.js index 6cbe583..fd464c3 100644 --- a/js/src/admin/pages/ClientsPage.js +++ b/js/src/admin/pages/ClientsPage.js @@ -7,7 +7,7 @@ export default class ClientsPage extends Page { oninit(vnode) { super.oninit(vnode); - app.store.find('clients').then(() => { + app.store.find('oauth/clients').then(() => { m.redraw(); }); } diff --git a/js/src/common/extend.js b/js/src/common/extend.js new file mode 100644 index 0000000..54f41cd --- /dev/null +++ b/js/src/common/extend.js @@ -0,0 +1,7 @@ +import Extend from 'flarum/common/extenders'; +import Client from "./models/Client"; + +export default [ + new Extend.Store() + .add('oauth-clients', Client), +]; diff --git a/js/src/common/index.ts b/js/src/common/index.ts index 6e6e9c1..6d2293d 100644 --- a/js/src/common/index.ts +++ b/js/src/common/index.ts @@ -1,5 +1 @@ -import app from 'flarum/common/app'; - -app.initializers.add('foskym/flarum-oauth-center', () => { - console.log('[foskym/flarum-oauth-center] Hello, forum and admin!'); -}); +export { default as extend } from './extend'; diff --git a/js/src/common/models/Client.js b/js/src/common/models/Client.js new file mode 100644 index 0000000..4372b95 --- /dev/null +++ b/js/src/common/models/Client.js @@ -0,0 +1,14 @@ +import Model from 'flarum/common/Model'; + +export default class Client extends Model { + client_id = Model.attribute('client_id'); + client_secret = Model.attribute('client_secret'); + redirect_uri = Model.attribute('redirect_uri'); + grant_types = Model.attribute('grant_types'); + scope = Model.attribute('scope'); + user_id = Model.attribute('user_id'); + client_name = Model.attribute('client_name'); + client_icon = Model.attribute('client_icon'); + client_desc = Model.attribute('client_desc'); + client_home = Model.attribute('client_home'); +}