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

2 lines
6.4 KiB
JavaScript
Raw Normal View History

2023-10-01 19:41:37 +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:()=>l});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),s=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()),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).scope=c().attribute("scope"),e.is_default=c().attribute("is_default",(function(t){return 1===t})),e.scope_name=c().attribute("scope_name"),e.scope_icon=c().attribute("scope_icon"),e.scope_desc=c().attribute("scope_desc"),e}return a(e,t),e}(c());const l=[(new(r().Store)).add("oauth-clients",s).add("oauth-scopes",u)],p=flarum.core.compat["forum/app"];var d=t.n(p);const h=flarum.core.compat["common/extend"],f=flarum.core.compat["forum/components/UserPage"];var _=t.n(f);const b=flarum.core.compat["common/components/LinkButton"];var y=t.n(b);flarum.core.compat["common/components/Page"];const v=flarum.core.compat["forum/components/IndexPage"];var g=t.n(v);const x=flarum.core.compat["forum/components/LogInModal"];var k=t.n(x);const z=flarum.core.compat["common/utils/extractText"];var O=t.n(z);const j=flarum.core.compat["common/components/Tooltip"];var w=t.n(j),P=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){var o=this;t.prototype.oninit.call(this,e),d().session.user||setTimeout((function(){return d().modal.show(k())}),500);var r=m.route.param();null==r.client_id||null==r.response_type||null==r.redirect_uri?m.route.set("/"):(this.params=r,d().store.find("oauth-clients",r.client_id).then((function(t){if(0===t.length)m.route.set("/");else{o.client=t[0];var e=null;e=o.client.redirect_uri().indexOf(" ")>-1?o.client.redirect_uri().split(" "):[o.client.redirect_uri()],d().forum.attribute("foskym-oauth-center.require_exact_redirect_uri")&&-1==e.indexOf(r.redirect_uri)&&m.route.set("/"),d().forum.attribute("foskym-oauth-center.allow_implicit")&&"token"==r.response_type&&m.route.set("/"),d().forum.attribute("foskym-oauth-center.enforce_state")&&null==r.enforce_state&&m.route.set("/")}})))},o.setTitle=function(){d().setTitle(O()(d().translator.trans("foskym-oauth-center.forum.page.title.authorize"))),d().setTitleCount(0)},o.view=function(){return this.client?m("div",{className:"AuthorizePage"},m("div",{className:"container"},m("div",{class:"oauth-area"},m("div",{class:"oauth-main"},m("div",{class:"oauth-box oauth-header"},m("h2",null,d().forum.attribute("title")),m("p",null,d().translator.trans("foskym-oauth-center.forum.authorize.access")," ",m("a",{href:this.client.client_home(),target:"_blank"},this.client.client_name()))),m("div",{class:"oauth-box oauth-body"},m("div",{class:"oauth-top"},m("img",{src:d().forum.attribute("faviconUrl")}),m("i",{class:"fas fa-exchange-alt fa-2
2023-09-28 17:47:09 +08:00
//# sourceMappingURL=forum.js.map