-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
1 lines (1 loc) · 12.6 KB
/
index.js
1
(function(){"use strict";var U={exports:{}};(function(p){var t=function(i){var u=Object.prototype,d=u.hasOwnProperty,b=Object.defineProperty||function(r,e,n){r[e]=n.value},v,O=typeof Symbol=="function"?Symbol:{},l=O.iterator||"@@iterator",w=O.asyncIterator||"@@asyncIterator",S=O.toStringTag||"@@toStringTag";function m(r,e,n){return Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{m({},"")}catch{m=function(e,n,o){return e[n]=o}}function _(r,e,n,o){var a=e&&e.prototype instanceof q?e:q,s=Object.create(a.prototype),h=new H(o||[]);return b(s,"_invoke",{value:ut(r,n,h)}),s}i.wrap=_;function E(r,e,n){try{return{type:"normal",arg:r.call(e,n)}}catch(o){return{type:"throw",arg:o}}}var T="suspendedStart",lt="suspendedYield",F="executing",P="completed",y={};function q(){}function G(){}function k(){}var A={};m(A,l,function(){return this});var M=Object.getPrototypeOf,j=M&&M(M(z([])));j&&j!==u&&d.call(j,l)&&(A=j);var L=k.prototype=q.prototype=Object.create(A);G.prototype=k,b(L,"constructor",{value:k,configurable:!0}),b(k,"constructor",{value:G,configurable:!0}),G.displayName=m(k,S,"GeneratorFunction");function V(r){["next","throw","return"].forEach(function(e){m(r,e,function(n){return this._invoke(e,n)})})}i.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return e?e===G||(e.displayName||e.name)==="GeneratorFunction":!1},i.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,k):(r.__proto__=k,m(r,S,"GeneratorFunction")),r.prototype=Object.create(L),r},i.awrap=function(r){return{__await:r}};function I(r,e){function n(s,h,f,g){var c=E(r[s],r,h);if(c.type==="throw")g(c.arg);else{var B=c.arg,C=B.value;return C&&typeof C=="object"&&d.call(C,"__await")?e.resolve(C.__await).then(function($){n("next",$,f,g)},function($){n("throw",$,f,g)}):e.resolve(C).then(function($){B.value=$,f(B)},function($){return n("throw",$,f,g)})}}var o;function a(s,h){function f(){return new e(function(g,c){n(s,h,g,c)})}return o=o?o.then(f,f):f()}b(this,"_invoke",{value:a})}V(I.prototype),m(I.prototype,w,function(){return this}),i.AsyncIterator=I,i.async=function(r,e,n,o,a){a===void 0&&(a=Promise);var s=new I(_(r,e,n,o),a);return i.isGeneratorFunction(e)?s:s.next().then(function(h){return h.done?h.value:s.next()})};function ut(r,e,n){var o=T;return function(s,h){if(o===F)throw new Error("Generator is already running");if(o===P){if(s==="throw")throw h;return Y()}for(n.method=s,n.arg=h;;){var f=n.delegate;if(f){var g=W(f,n);if(g){if(g===y)continue;return g}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(o===T)throw o=P,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);o=F;var c=E(r,e,n);if(c.type==="normal"){if(o=n.done?P:lt,c.arg===y)continue;return{value:c.arg,done:n.done}}else c.type==="throw"&&(o=P,n.method="throw",n.arg=c.arg)}}}function W(r,e){var n=e.method,o=r.iterator[n];if(o===v)return e.delegate=null,n==="throw"&&r.iterator.return&&(e.method="return",e.arg=v,W(r,e),e.method==="throw")||n!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=E(o,r.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,y;var s=a.arg;if(!s)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y;if(s.done)e[r.resultName]=s.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=v);else return s;return e.delegate=null,y}V(L),m(L,S,"Generator"),m(L,l,function(){return this}),m(L,"toString",function(){return"[object Generator]"});function ht(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function N(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function H(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(ht,this),this.reset(!0)}i.keys=function(r){var e=Object(r),n=[];for(var o in e)n.push(o);return n.reverse(),function a(){for(;n.length;){var s=n.pop();if(s in e)return a.value=s,a.done=!1,a}return a.done=!0,a}};function z(r){if(r){var e=r[l];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var n=-1,o=function a(){for(;++n<r.length;)if(d.call(r,n))return a.value=r[n],a.done=!1,a;return a.value=v,a.done=!0,a};return o.next=o}}return{next:Y}}i.values=z;function Y(){return{value:v,done:!0}}return H.prototype={constructor:H,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(N),!r)for(var e in this)e.charAt(0)==="t"&&d.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var r=this.tryEntries[0],e=r.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(g,c){return s.type="throw",s.arg=r,e.next=g,c&&(e.method="next",e.arg=v),!!c}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if(a.tryLoc==="root")return n("end");if(a.tryLoc<=this.prev){var h=d.call(a,"catchLoc"),f=d.call(a,"finallyLoc");if(h&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(h){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else if(f){if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&d.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&(r==="break"||r==="continue")&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=r,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(s)},complete:function(r,e){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&e&&(this.next=e),y},finish:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===r)return this.complete(n.completion,n.afterLoc),N(n),y}},catch:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===r){var o=n.completion;if(o.type==="throw"){var a=o.arg;N(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:z(r),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=v),y}},i}(p.exports);try{regeneratorRuntime=t}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})(U);function R(p,t,i,u,d,b,v,O){var l=typeof p=="function"?p.options:p;t&&(l.render=t,l.staticRenderFns=i,l._compiled=!0),u&&(l.functional=!0),b&&(l._scopeId="data-v-"+b);var w;if(v?(w=function(_){_=_||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!_&&typeof __VUE_SSR_CONTEXT__<"u"&&(_=__VUE_SSR_CONTEXT__),d&&d.call(this,_),_&&_._registeredComponents&&_._registeredComponents.add(v)},l._ssrRegister=w):d&&(w=O?function(){d.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:d),w)if(l.functional){l._injectStyles=w;var S=l.render;l.render=function(E,T){return w.call(T),S(E,T)}}else{var m=l.beforeCreate;l.beforeCreate=m?[].concat(m,w):[w]}return{exports:p,options:l}}const X={name:"OAuth",props:{providers:{type:Array,default(){return[]}},error:{type:String,default:null}}};var J=function(){var t=this,i=t._self._c;return i("div",{staticClass:"thathoff-oauth-providers"},[t.error!==null?i("div",{staticClass:"thathoff-oauth-error",attrs:{"data-theme":"error"},on:{click:function(u){t.error=null}}},[i("k-icon",{attrs:{type:"alert"}}),i("span",[t._v(t._s(t.error))])],1):t._e(),i("k-headline",[t._v(t._s(t.$t("thathoff.oauth.signInWith")))]),t._l(t.providers,function(u){return i("k-button",{key:u.id,staticClass:"thathoff-oauth-provider",attrs:{variant:"filled",target:"_self",icon:u.icon,link:u.href}},[t._v(" "+t._s(u.name)+" ")])})],2)},K=[],Q=R(X,J,K,!1,null,"b6b77e59",null,null);const D=Q.exports,Z={components:{OAuth:D},props:{methods:Array,pending:Object,value:Object},data(){return{settings:{},error:null}},created(){this.load()},computed:{providers(){return Object.values(this.settings.providers)}},methods:{async load(){this.settings=await this.$api.get("oauth/settings"),this.error=(await this.$api.get("oauth/oauthError")).msg,this.error&&this.onError({message:this.error,details:{challengeDestroyed:!1}})},onError(p){this.$emit("error",p)}}};var x=function(){var t=this,i=t._self._c;return i("div",[t.settings.enabled===!1||t.settings.onlyOauth===!1?i("k-login",t._b({on:{error:t.onError}},"k-login",{methods:t.methods,value:t.value},!1)):t._e(),t.settings.enabled===!0?i("OAuth",{attrs:{providers:t.providers}}):t._e()],1)},tt=[],et=R(Z,x,tt,!1,null,null,null,null);const rt=et.exports,nt={props:{isInstallable:Boolean,isInstalled:Boolean,isOk:Boolean,requirements:Object,translations:Array},components:{OAuth:D},data(){return{user:{name:"",email:"",language:this.$panel.translation.code,password:"",role:"admin"},oauthSettings:{},oauthError:null}},computed:{fields(){return{email:{label:this.$t("email"),type:"email",link:!1,autofocus:!0,required:!0},password:{label:this.$t("password"),type:"password",placeholder:this.$t("password")+" …",required:!0},language:{label:this.$t("language"),type:"select",options:this.translations,icon:"translate",empty:!1,required:!0}}},isReady(){return this.isOk&&this.isInstallable},isComplete(){return this.isOk&&this.isInstalled},showOauth(){return this.oauthSettings&&this.oauthSettings.enabled&&this.providers.length},providers(){return this.oauthSettings.providers?Object.values(this.oauthSettings.providers):[]}},mounted(){this.loadOauth()},methods:{async install(){try{await this.$api.system.install(this.user),await this.$reload({globals:["$system","$translation"]}),this.$panel.notification.success(this.$t("welcome")+"!")}catch(p){this.$panel.error(p)}},async loadOauth(){this.oauthSettings=await this.$api.get("oauth/settings"),this.oauthError=(await this.$api.get("oauth/oauthError")).msg}}};var it=function(){var t=this,i=t._self._c;return i("k-panel-outside",{staticClass:"k-installation-view"},[i("div",{staticClass:"k-dialog k-installation-dialog"},[i("k-dialog-body",[t.isComplete?i("k-text",[i("k-headline",[t._v(t._s(t.$t("installation.completed")))]),i("k-link",{attrs:{to:"/login"}},[t._v(" "+t._s(t.$t("login"))+" ")])],1):t.isReady||t.showOauth?i("div",[t.isReady?i("form",{on:{submit:function(u){return u.preventDefault(),t.install.apply(null,arguments)}}},[i("h1",{staticClass:"sr-only"},[t._v(" "+t._s(t.$t("installation"))+" ")]),i("k-fieldset",{attrs:{fields:t.fields,novalidate:!0,value:t.user},on:{input:function(u){t.user=u}}}),i("k-button",{attrs:{text:t.$t("install"),icon:"check",size:"lg",theme:"positive",type:"submit",variant:"filled"}})],1):t._e(),t.showOauth?i("OAuth",{attrs:{providers:t.providers,error:t.oauthError}}):t._e()],1):i("div",[i("k-headline",[t._v(" "+t._s(t.$t("installation.issues.headline"))+" ")]),i("ul",{staticClass:"k-installation-issues"},[t.isInstallable===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.disabled"))}})],1):t._e(),t.requirements.php===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.php"))}})],1):t._e(),t.requirements.server===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.server"))}})],1):t._e(),t.requirements.mbstring===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.mbstring"))}})],1):t._e(),t.requirements.curl===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.curl"))}})],1):t._e(),t.requirements.accounts===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.accounts"))}})],1):t._e(),t.requirements.content===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.content"))}})],1):t._e(),t.requirements.media===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.media"))}})],1):t._e(),t.requirements.sessions===!1?i("li",[i("k-icon",{attrs:{type:"alert"}}),i("span",{domProps:{innerHTML:t._s(t.$t("installation.issues.sessions"))}})],1):t._e()]),i("k-button",{attrs:{text:t.$t("retry"),icon:"refresh",size:"lg",theme:"positive",variant:"filled"},on:{click:t.$reload}})],1)],1)],1)])},at=[],ot=R(nt,it,at,!1,null,null,null,null);const st=ot.exports;panel.plugin("thathoff/oauth",{login:rt,components:{"k-installation-view":st}})})();