From 54e7659d9fcfe49db592696e27d8744da9ed81c8 Mon Sep 17 00:00:00 2001 From: FoskyM Date: Fri, 29 Sep 2023 22:25:55 +0800 Subject: [PATCH] feat(extend): clients --- extend.php | 2 ++ js/dist/admin.js | Bin 6118 -> 7015 bytes js/dist/admin.js.map | Bin 18886 -> 20632 bytes js/dist/forum.js | Bin 2638 -> 3225 bytes js/dist/forum.js.map | Bin 9881 -> 11465 bytes js/src/admin/pages/ClientsPage.js | 2 +- js/src/common/extend.js | 7 +++++++ js/src/common/index.ts | 6 +----- js/src/common/models/Client.js | 14 ++++++++++++++ 9 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 js/src/common/extend.js create mode 100644 js/src/common/models/Client.js 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 8d4d494d86c29a55cfedc5a27bf4773966de85d4..47a216f0b03a994c05c3c66bcdb4dd3fc1aa9845 100644 GIT binary patch delta 1778 zcmchX&u<$=6vwrR9h0O^?AT6848^P{ol!R%QmIgCmL#o!6G@~Xgouo_*&W;4tY_Vs zabhcRedh$c3*0zy;+Is^OZy)nIQCd^fgW=09cE{DTjMGmx$S$O@6NoL_nr6G>f<+m z{!uF#!gLWaj!91t>Rw0Kdbc}(AGC{WQHC(C*Q$p$s|1!XDWbUA=u$^`0j+Q(41$jt z5nU!D_-W$Pe3TnJ)p)Qx`N4dgbppyog;}7b%fk-?m-zA8wpyEE!?BV-k-*2vcZDDs z1Pq0B5QADaYj)d&3U2y@Hbu(_EJ}_ln~d3gS)#$MH>&&{TIH87<6w{1p8X($sw#L$ z5s|w(w(pyEr{nkK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k1OL2Ys=q* dd$JVnxQK}2E@3M9YRR&(=jY*$+M95f=P%2dP&EJm 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'); +}