-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathindex.js
More file actions
1 lines (1 loc) · 12.4 KB
/
index.js
File metadata and controls
1 lines (1 loc) · 12.4 KB
1
(function(){"use strict";var P={exports:{}},z;function J(){return z||(z=1,(function(f){var t=(function(i){var l=Object.prototype,y=l.hasOwnProperty,_=Object.defineProperty||function(r,e,n){r[e]=n.value},d,L=typeof Symbol=="function"?Symbol:{},m=L.iterator||"@@iterator",lt=L.asyncIterator||"@@asyncIterator",G=L.toStringTag||"@@toStringTag";function g(r,e,n){return Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{g({},"")}catch{g=function(e,n,o){return e[n]=o}}function D(r,e,n,o){var a=e&&e.prototype instanceof q?e:q,s=Object.create(a.prototype),u=new A(o||[]);return _(s,"_invoke",{value:ht(r,n,u)}),s}i.wrap=D;function I(r,e,n){try{return{type:"normal",arg:r.call(e,n)}}catch(o){return{type:"throw",arg:o}}}var F="suspendedStart",ut="suspendedYield",Y="executing",O="completed",v={};function q(){}function S(){}function w(){}var R={};g(R,m,function(){return this});var C=Object.getPrototypeOf,E=C&&C(C(N([])));E&&E!==l&&y.call(E,m)&&(R=E);var b=w.prototype=q.prototype=Object.create(R);S.prototype=w,_(b,"constructor",{value:w,configurable:!0}),_(w,"constructor",{value:S,configurable:!0}),S.displayName=g(w,G,"GeneratorFunction");function W(r){["next","throw","return"].forEach(function(e){g(r,e,function(n){return this._invoke(e,n)})})}i.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return e?e===S||(e.displayName||e.name)==="GeneratorFunction":!1},i.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,w):(r.__proto__=w,g(r,G,"GeneratorFunction")),r.prototype=Object.create(b),r},i.awrap=function(r){return{__await:r}};function T(r,e){function n(s,u,h,p){var c=I(r[s],r,u);if(c.type==="throw")p(c.arg);else{var H=c.arg,$=H.value;return $&&typeof $=="object"&&y.call($,"__await")?e.resolve($.__await).then(function(k){n("next",k,h,p)},function(k){n("throw",k,h,p)}):e.resolve($).then(function(k){H.value=k,h(H)},function(k){return n("throw",k,h,p)})}}var o;function a(s,u){function h(){return new e(function(p,c){n(s,u,p,c)})}return o=o?o.then(h,h):h()}_(this,"_invoke",{value:a})}W(T.prototype),g(T.prototype,lt,function(){return this}),i.AsyncIterator=T,i.async=function(r,e,n,o,a){a===void 0&&(a=Promise);var s=new T(D(r,e,n,o),a);return i.isGeneratorFunction(e)?s:s.next().then(function(u){return u.done?u.value:s.next()})};function ht(r,e,n){var o=F;return function(s,u){if(o===Y)throw new Error("Generator is already running");if(o===O){if(s==="throw")throw u;return ft()}for(n.method=s,n.arg=u;;){var h=n.delegate;if(h){var p=V(h,n);if(p){if(p===v)continue;return p}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(o===F)throw o=O,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);o=Y;var c=I(r,e,n);if(c.type==="normal"){if(o=n.done?O:ut,c.arg===v)continue;return{value:c.arg,done:n.done}}else c.type==="throw"&&(o=O,n.method="throw",n.arg=c.arg)}}}function V(r,e){var n=e.method,o=r.iterator[n];if(o===d)return e.delegate=null,n==="throw"&&r.iterator.return&&(e.method="return",e.arg=d,V(r,e),e.method==="throw")||n!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var a=I(o,r.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,v;var s=a.arg;if(!s)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v;if(s.done)e[r.resultName]=s.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=d);else return s;return e.delegate=null,v}W(b),g(b,G,"Generator"),g(b,m,function(){return this}),g(b,"toString",function(){return"[object Generator]"});function ct(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 M(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function A(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(ct,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 N(r){if(r||r===""){var e=r[m];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(y.call(r,n))return a.value=r[n],a.done=!1,a;return a.value=d,a.done=!0,a};return o.next=o}}throw new TypeError(typeof r+" is not iterable")}i.values=N;function ft(){return{value:d,done:!0}}return A.prototype={constructor:A,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(M),!r)for(var e in this)e.charAt(0)==="t"&&y.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},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(p,c){return s.type="throw",s.arg=r,e.next=p,c&&(e.method="next",e.arg=d),!!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 u=y.call(a,"catchLoc"),h=y.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else if(h){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&&y.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,v):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),v},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),M(n),v}},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;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:N(r),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=d),v}},i})(f.exports);try{regeneratorRuntime=t}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})(P)),P.exports}J();function j(f,t,i,l,y,_,d,L){var m=typeof f=="function"?f.options:f;return t&&(m.render=t,m.staticRenderFns=i,m._compiled=!0),_&&(m._scopeId="data-v-"+_),{exports:f,options:m}}const K={name:"OAuth",props:{providers:{type:Array,default(){return[]}},error:{type:String,default:null}}};var Q=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(l){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(l){return i("k-button",{key:l.id,staticClass:"thathoff-oauth-provider",attrs:{variant:"filled",target:"_self",theme:l.theme??"green",icon:l.icon,link:l.href}},[t._v(" "+t._s(l.name)+" ")])})],2)},U=[],X=j(K,Q,U,!1,null,"0c96023b");const B=X.exports,Z={components:{OAuth:B},props:{methods:Array,pending:Object,value:Object},data(){return{settings:{},error:null,autoLogin:!1}},created(){this.load()},computed:{providers(){return Object.values(this.settings.providers)}},methods:{async load(){if(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}});return}if(this.settings.autoRedirect&&this.providers.length==1){this.autoLogin=!0,window.location=this.providers[0].href;return}},onError(f){this.$emit("error",f)}}};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&&!this.autoLogin?i("OAuth",{attrs:{providers:t.providers}}):t._e(),this.autoLogin?i("div",[t._v(t._s(t.$t("thathoff.oauth.autoLoggingIn")))]):t._e()],1)},tt=[],et=j(Z,x,tt,!1,null,null);const rt=et.exports,nt={props:{isInstallable:Boolean,isInstalled:Boolean,isOk:Boolean,requirements:Object,translations:Array},components:{OAuth:B},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(f){this.$panel.error(f)}},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(l){return l.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(l){t.user=l}}}),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=j(nt,it,at,!1,null,null);const st=ot.exports;panel.plugin("thathoff/oauth",{login:rt,components:{"k-installation-view":st}})})();