forum-oauth-center/js/dist/forum.js

2 lines
3.4 KiB
JavaScript
Raw Normal View History

2023-10-01 17:34:20 +08:00
(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{extend:()=>s});const o=flarum.core.compat["common/extenders"];var r=t.n(o);function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}const i=flarum.core.compat["common/Model"];var c=t.n(i),u=function(t){function e(){for(var e,o=arguments.length,r=new Array(o),n=0;n<o;n++)r[n]=arguments[n];return(e=t.call.apply(t,[this].concat(r))||this).client_id=c().attribute("client_id"),e.client_secret=c().attribute("client_secret"),e.redirect_uri=c().attribute("redirect_uri"),e.grant_types=c().attribute("grant_types"),e.scope=c().attribute("scope"),e.user_id=c().attribute("user_id"),e.client_name=c().attribute("client_name"),e.client_icon=c().attribute("client_icon"),e.client_desc=c().attribute("client_desc"),e.client_home=c().attribute("client_home"),e}return a(e,t),e}(c());const s=[(new(r().Store)).add("oauth-clients",u)],l=flarum.core.compat["forum/app"];var p=t.n(l);const d=flarum.core.compat["common/extend"],f=flarum.core.compat["forum/components/UserPage"];var h=t.n(f);const y=flarum.core.compat["common/components/LinkButton"];var _=t.n(y);flarum.core.compat["common/components/Page"];const b=flarum.core.compat["forum/components/IndexPage"];var v=t.n(b);const g=flarum.core.compat["forum/components/LogInModal"];var z=t.n(g);const P=flarum.core.compat["common/utils/extractText"];var O=t.n(P),x=function(t){function e(){for(var e,o=arguments.length,r=new Array(o),n=0;n<o;n++)r[n]=arguments[n];return(e=t.call.apply(t,[this].concat(r))||this).params=[],e.client=null,e}a(e,t);var o=e.prototype;return o.oninit=function(e){t.prototype.oninit.call(this,e),p().session.user||setTimeout((function(){return p().modal.show(z())}),500);var o=m.route.param();null==o.client_id||null==o.response_type||null==o.redirect_uri?m.route.set("/"):(this.params=o,this.client=p().store.getBy("oauth-clients","client_id",o.client_id))},o.setTitle=function(){p().setTitle(O()(p().translator.trans("foskym-oauth-center.forum.page.title.authorize"))),p().setTitleCount(0)},o.view=function(){return m("div",{className:"AuthorizePage"},m("div",{className:"container"}))},e}(v()),j=function(t){function e(){return t.apply(this,arguments)||this}a(e,t);var o=e.prototype;return o.oninit=function(e){t.prototype.oninit.call(this,e),this.loadUser(m.route.param("username"))},o.content=function(){return m("div",{className:"AuthorizedPage"})},e}(h());p().initializers.add("foskym/flarum-oauth-center",(function(){p().routes["oauth.authorize"]={path:"/oauth/authorize",component:x},p().routes["user.authorized"]={path:"/u/:username/authorized",component:j},(0,d.extend)(h().prototype,"navItems",(function(t){p().session.user&&p().session.user.id()===this.user.id()&&t.add("authorized",_().component({href:p().route("user.authorized",{username:this.user.username()}),icon:"fas fa-user-friends"},[p().translator.trans("foskym-oauth-center.forum.page.label.authorized")]),-110)}))}))})(),module.exports=e})();
2023-09-28 17:47:09 +08:00
//# sourceMappingURL=forum.js.map