2 lines
No EOL
6.9 KiB
JavaScript
Generated
2 lines
No EOL
6.9 KiB
JavaScript
Generated
(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},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:()=>u});const n=flarum.core.compat["common/extenders"];var o=t.n(n);function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e)}const r=flarum.core.compat["common/Model"];var a=t.n(r),c=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return(e=t.call.apply(t,[this].concat(o))||this).client_id=a().attribute("client_id"),e.client_secret=a().attribute("client_secret"),e.redirect_uri=a().attribute("redirect_uri"),e.grant_types=a().attribute("grant_types"),e.scope=a().attribute("scope"),e.user_id=a().attribute("user_id"),e.client_name=a().attribute("client_name"),e.client_icon=a().attribute("client_icon"),e.client_desc=a().attribute("client_desc"),e.client_home=a().attribute("client_home"),e}return i(e,t),e}(a());const u=[(new(o().Store)).add("oauth-clients",c)],l=flarum.core.compat["admin/app"];var f=t.n(l);const h=flarum.core.compat["admin/components/ExtensionPage"];var p=t.n(h);const d=flarum.core.compat["common/components/Button"];var v=t.n(d);const g=flarum.core.compat["common/components/Page"];var y=t.n(g);const _=flarum.core.compat["common/components/FieldSet"];var k=t.n(_);const b=flarum.core.compat["admin/utils/saveSettings"];var x=t.n(b);const S=flarum.core.compat["common/utils/Stream"];var w=t.n(S);flarum.core.compat["common/components/Select"];const P=flarum.core.compat["common/components/Switch"];var N=t.n(P),O=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.saving=!1,this.fields=["foskym-oauth-center.access_lifetime","foskym-oauth-center.allow_implicit","foskym-oauth-center.enforce_state","foskym-oauth-center.require_exact_redirect_uri"],this.values={};var o=f().data.settings;this.fields.forEach((function(t){return n.values[t]=w()(o[t]||"")}));for(var s=1;s<this.fields.length;s++)this.values[this.fields[s]]="1"===o[this.fields[s]]},n.view=function(){var t=this;return m("div",null,m("form",{onsubmit:this.onsubmit.bind(this),className:"BasicsPage"},k().component({},[m("div",{style:"height: 5px;"}),N().component({state:this.values["foskym-oauth-center.allow_implicit"],onchange:function(e){return t.saveSingleSetting("foskym-oauth-center.allow_implicit",e)},loading:this.saving},f().translator.trans("foskym-oauth-center.admin.settings.allow_implicit"))]),k().component({},[m("div",{style:"height: 5px;"}),N().component({state:this.values["foskym-oauth-center.enforce_state"],onchange:function(e){return t.saveSingleSetting("foskym-oauth-center.enforce_state",e)},loading:this.saving},f().translator.trans("foskym-oauth-center.admin.settings.enforce_state"))]),k().component({},[m("div",{style:"height: 5px;"}),N().component({state:this.values["foskym-oauth-center.require_exact_redirect_uri"],onchange:function(e){return t.saveSingleSetting("foskym-oauth-center.require_exact_redirect_uri",e)},loading:this.saving},f().translator.trans("foskym-oauth-center.admin.settings.require_exact_redirect_uri"))]),m("hr",null),k().component({},[m("input",{className:"FormControl",bidi:this.values["foskym-oauth-center.access_lifetime"],placeholder:f().translator.trans("foskym-oauth-center.admin.settings.access_lifetime"),required:!0}),m("div",{className:"helpText"},f().translator.trans("foskym-oauth-center.admin.settings.access_lifetime")),v().component({type:"submit",className:"Button Button--primary",loading:this.saving},f().translator.trans("core.admin.settings.submit_button"))])))},n.saveSingleSetting=function(t,e){var n=this;if(!this.saving){this.saving=!0,this.values[t]=e;var o={};o[t]=e,x()(o).then((function(){return f().alerts.show({type:"success"},f().translator.trans("core.admin.settings.saved_message"))})).catch((function(){})).then((function(){n.saving=!1,m.redraw()}))}},n.onsubmit=function(t){var e=this;if(t.preventDefault(),!this.saving){this.saving=!0,f().alerts.dismiss(this.successAlert);var n={};n["foskym-oauth-center.access_lifetime"]=this.values["foskym-oauth-center.access_lifetime"](),""===n["foskym-oauth-center.access_lifetime"]&&(n["foskym-oauth-center.access_lifetime"]=3600),x()(n).then((function(){return f().alerts.show({type:"success"},f().translator.trans("core.admin.settings.saved_message"))})).catch((function(){})).then((function(){e.saving=!1,m.redraw()}))}},e}(y()),B=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return(e=t.call.apply(t,[this].concat(o))||this).settingName="collapsible-posts.reasons",e.translationPrefix="foskym-oauth-center.admin.clients.",e}i(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),f().store.find("oauth/clients").then((function(){m.redraw()}))},n.view=function(){return m("div",null,m("h2",null,"Clients Page"))},e}(y()),j=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e.prototype.view=function(){return m("div",null,m("h2",null,"Scopes Page"))},e}(y()),C=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.content=function(){var t=m.route.param().page||"index";return m("div",{className:"ExtensionPage-settings OAuthCenter"},m("div",{className:"oauth-menu"},m("div",{className:"container"},this.menuButtons(t))),m("div",{className:"container OAuthCenterPage-container"},this.pageContent(t)))},n.menuButtons=function(t){return[v().component({className:"Button "+("index"===t?"item-selected":""),onclick:function(){return m.route.set(f().route("extension",{id:"foskym-oauth-center"}))},icon:"fas fa-home"},f().translator.trans("foskym-oauth-center.admin.page.index")),v().component({className:"Button "+("clients"===t?"item-selected":""),onclick:function(){return m.route.set(f().route("extension",{id:"foskym-oauth-center",page:"clients"}))},icon:"fas fa-network-wired"},f().translator.trans("foskym-oauth-center.admin.page.clients")),v().component({className:"Button "+("scopes"===t?"item-selected":""),onclick:function(){return m.route.set(f().route("extension",{id:"foskym-oauth-center",page:"scopes"}))},icon:"fas fa-user-lock"},f().translator.trans("foskym-oauth-center.admin.page.scopes"))]},n.pageContent=function(t){return"clients"==t?m(B,null):"scopes"==t?m(j,null):m(O,null)},e}(p());f().initializers.add("foskym/flarum-oauth-center",(function(){f().extensionData.for("foskym-oauth-center").registerPage(C)}))})(),module.exports=e})();
|
|
//# sourceMappingURL=admin.js.map
|