nextcloud-server/dist/core-install.js

2 lines
14 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(()=>{"use strict";var e,t={85325:(e,t,a)=>{a.d(t,{A:()=>i});var o=a(71354),n=a.n(o),r=a(76314),s=a.n(r)()(n());s.push([e.id,"form{padding:calc(3*var(--default-grid-baseline));color:var(--color-main-text);border-radius:var(--border-radius-container);background-color:var(--color-main-background-blur);box-shadow:0 0 10px var(--color-box-shadow);-webkit-backdrop-filter:var(--filter-background-blur);backdrop-filter:var(--filter-background-blur);max-width:300px;margin-bottom:30px}form>fieldset:first-child,form>.notecard:first-child{margin-top:0}form>.notecard:last-child{margin-bottom:0}form fieldset,form details{margin-block:1rem}form .setup-form__button:not(.setup-form__button--loading) .material-design-icon{transition:all linear var(--animation-quick)}form .setup-form__button:not(.setup-form__button--loading):hover .material-design-icon{transform:translateX(0.2em)}form .setup-form__database-type-select{display:flex}form .setup-form__database-type-select--vertical{flex-direction:column}code{background-color:var(--color-background-dark);margin-top:1rem;padding:0 .3em;border-radius:var(--border-radius)}.input-field{margin-block-start:1rem !important}.notecard__heading{font-size:inherit !important}","",{version:3,sources:["webpack://./core/src/views/Setup.vue"],names:[],mappings:"AACA,KACC,4CAAA,CACA,4BAAA,CACA,4CAAA,CACA,kDAAA,CACA,2CAAA,CACA,qDAAA,CACA,6CAAA,CAEA,eAAA,CACA,kBAAA,CAEA,qDAEC,YAAA,CAGD,0BACC,eAAA,CAGD,2BAEC,iBAAA,CAIA,iFACC,4CAAA,CAGD,uFACC,2BAAA,CAKF,uCACC,YAAA,CACA,iDACC,qBAAA,CAMH,KACC,6CAAA,CACA,eAAA,CACA,cAAA,CACA,kCAAA,CAID,aACC,kCAAA,CAGD,mBACC,4BAAA",sourcesContent:["\nform {\n\tpadding: calc(3 * var(--default-grid-baseline));\n\tcolor: var(--color-main-text);\n\tborder-radius: var(--border-radius-container);\n\tbackground-color: var(--color-main-background-blur);\n\tbox-shadow: 0 0 10px var(--color-box-shadow);\n\t-webkit-backdrop-filter: var(--filter-background-blur);\n\tbackdrop-filter: var(--filter-background-blur);\n\n\tmax-width: 300px;\n\tmargin-bottom: 30px;\n\n\t> fieldset:first-child,\n\t> .notecard:first-child {\n\t\tmargin-top: 0;\n\t}\n\n\t> .notecard:last-child {\n\t\tmargin-bottom: 0;\n\t}\n\n\tfieldset,\n\tdetails {\n\t\tmargin-block: 1rem;\n\t}\n\n\t.setup-form__button:not(.setup-form__button--loading) {\n\t\t.material-design-icon {\n\t\t\ttransition: all linear var(--animation-quick);\n\t\t}\n\n\t\t&:hover .material-design-icon {\n\t\t\ttransform: translateX(0.2em);\n\t\t}\n\t}\n\n\t// Db select required styling\n\t.setup-form__database-type-select {\n\t\tdisplay: flex;\n\t\t&--vertical {\n\t\t\tflex-direction: column;\n\t\t}\n\t}\n\n}\n\ncode {\n\tbackground-color: var(--color-background-dark);\n\tmargin-top: 1rem;\n\tpadding: 0 0.3em;\n\tborder-radius: var(--border-radius);\n}\n\n// Various overrides\n.input-field {\n\tmargin-block-start: 1rem !important;\n}\n\n.notecard__heading {\n\tfont-size: inherit !important;\n}\n"],sourceRoot:""}]);const i=s},95748:(e,t,a)=>{var o,n=a(85471),r=a(81222),s=a(53334),i=a(99418),c=a(74095),l=a(32073),d=a(88289),u=a(371),f=a(93663),p=a(82182),m=a(33691);function g(e=""){const t=new Set(e),a=parseInt(Math.log2(Math.pow(parseInt(t.size.toString()),e.length)).toFixed(2));return a<16?o.VeryWeak:a<31?o.Weak:a<46?o.Moderate:a<61?o.Strong:a<76?o.VeryStrong:o.ExtremelyStrong}!function(e){e[e.VeryWeak=0]="VeryWeak",e[e.Weak=1]="Weak",e[e.Moderate=2]="Moderate",e[e.Strong=3]="Strong",e[e.VeryStrong=4]="VeryStrong",e[e.ExtremelyStrong=5]="ExtremelyStrong"}(o||(o={}));const b=(0,n.pM)({name:"Setup",components:{IconArrowRight:m.A,NcButton:c.A,NcCheckboxRadioSwitch:l.A,NcLoadingIcon:d.A,NcNoteCard:u.A,NcPasswordField:f.A,NcTextField:p.A},setup:()=>({t:s.t}),data:()=>({config:{},links:{},isValidAutoconfig:!1,loading:!1}),computed:{passwordHelperText(){if(""===this.config?.adminpass)return"";switch(g(this.config?.adminpass)){case o.VeryWeak:return(0,s.t)("core","Password is too weak");case o.Weak:return(0,s.t)("core","Password is weak");case o.Moderate:return(0,s.t)("core","Password is average");case o.Strong:return(0,s.t)("core","Password is strong");case o.VeryStrong:return(0,s.t)("core","Password is very strong");case o.ExtremelyStrong:return(0,s.t)("core","Password is extremely strong")}return(0,s.t)("core","Unknown password strength")},passwordHelperType(){return g(this.config?.adminpass)<o.Moderate?"error":g(this.config?.adminpass)<o.Strong?"warning":"success"},firstAndOnlyDatabase(){const e=Object.values(this.config?.databases||{});return 1===e.length?e[0]:null},DBTypeGroupDirection(){return Object.keys(this.config?.databases||{}).length>3?"vertical":"horizontal"},htaccessWarning(){const e=[(0,s.t)("core","Your data directory and files are probably accessible from the internet because the <code>.htaccess</code> file does not work."),(0,s.t)("core","For information how to properly configure your server, please {linkStart}see the documentation{linkEnd}",{linkStart:'<a href="'+this.links.adminInstall+'" target="_blank" rel="noreferrer noopener">',linkEnd:"</a>"},{escape:!1})].join("<br>");return i.A.sanitize(e)},errors(){return(this.config?.errors||[]).map(e=>"string"==typeof e?{heading:"",message:e}:""===e.hint?{heading:"",message:e.error}:{heading:e.error,message:e.hint})}},beforeMount(){this.config=(0,r.C)("core","config"),this.links=(0,r.C)("core","links")},mounted(){if(""===this.config.dbtype&&(this.config.dbtype=Object.keys(this.config.databases).at(0)),this.config.hasAutoconfig){const e=this.$refs.form;e.querySelectorAll('input[name="adminlogin"], input[name="adminpass"]').forEach(e=>{e.removeAttribute("required")}),e.checkValidity()&&0===this.config.errors.length?this.isValidAutoconfig=!0:this.isValidAutoconfig=!1,e.querySelectorAll('input[name="adminlogin"], input[name="adminpass"]').forEach(e=>{e.setAttribute("required","true")})}},methods:{async onSubmit(){this.loading=!0}}});var A=a(85072),h=a.n(A),v=a(97825),y=a.n(v),_=a(77659),k=a.n(_),C=a(55056),w=a.n(C),x=a(10540),S=a.n(x),N=a(41113),D=a.n(N),O=a(85325),T={};T.styleTagTransform=D(),T.setAttributes=w(),T.insert=k().bind(null,"head"),T.domAPI=y(),T.insertStyleElement=S(),h()(O.A,T),O.A&&O.A.locals&&O.A.locals;const P=(0,a(14486).A)(b,function(){var e=this,t=e._self._c;return e._self._setupProxy,t("form",{ref:"form",staticClass:"setup-form",class:{"setup-form--loading":e.loading},attrs:{action:"","data-cy-setup-form":"",method:"POST"},on:{submit:e.onSubmit}},[e.config.hasAutoconfig?t("NcNoteCard",{attrs:{heading:e.t("core","Autoconfig file detected"),"data-cy-setup-form-note":"autoconfig",type:"success"}},[e._v("\n\t\t"+e._s(e.t("core","The setup form below is pre-filled with the values from the config file."))+"\n\t")]):e._e(),e._v(" "),!1===e.config.htaccessWorking?t("NcNoteCard",{attrs:{heading:e.t("core","Security warning"),"data-cy-setup-form-note":"htaccess",type:"warning"}},[t("p",{domProps:{innerHTML:e._s(e.htaccessWarning)}})]):e._e(),e._v(" "),e._l(e.errors,function(a,o){return t("NcNoteCard",{key:o,attrs:{heading:a.heading,"data-cy-setup-form-note":"error",type:"error"}},[e._v("\n\t\t"+e._s(a.message)+"\n\t")])}),e._v(" "),t("fieldset",{staticClass:"setup-form__administration"},[t("legend",[e._v(e._s(e.t("core","Create administration account")))]),e._v(" "),t("NcTextField",{attrs:{label:e.t("core","Administration account name"),"data-cy-setup-form-field":"adminlogin",name:"adminlogin",required:""},model:{value:e.config.adminlogin,callback:function(t){e.$set(e.config,"adminlogin",t)},expression:"config.adminlogin"}}),e._v(" "),t("NcPasswordField",{attrs:{label:e.t("core","Administration account password"),"data-cy-setup-form-field":"adminpass",name:"adminpass",required:""},model:{value:e.config.adminpass,callback:function(t){e.$set(e.config,"adminpass",t)},expression:"config.adminpass"}}),e._v(" "),t("NcNoteCard",{directives:[{name:"show",rawName:"v-show",value:""!==e.config.adminpass,expression:"config.adminpass !== ''"}],attrs:{type:e.passwordHelperType}},[e._v("\n\t\t\t"+e._s(e.passwordHelperText)+"\n\t\t")])],1),e._v(" "),t("details",{attrs:{open:!e.isValidAutoconfig,"data-cy-setup-form-advanced-config":""}},[t("summary",[e._v(e._s(e.t("core","Storage & database")))]),e._v(" "),t("fieldset",{staticClass:"setup-form__data-folder"},[t("NcTextField",{attrs:{label:e.t("core","Data folder"),placeholder:e.config.serverRoot+"/data",required:"",autocomplete:"off",autocapitalize:"none","data-cy-setup-form-field":"directory",name:"directory",spellcheck:"false"},model:{value:e.config.directory,callback:function(t){e.$set(e.config,"directory",t)},expression:"config.directory"}})],1),e._v(" "),t("fieldset",{staticClass:"setup-form__database"},[t("legend",[e._v(e._s(e.t("core","Database configuration")))]),e._v(" "),t("fieldset",{staticClass:"setup-form__database-type"},[t("legend",{staticClass:"hidden-visually"},[e._v("\n\t\t\t\t\t"+e._s(e.t("core","Database type"))+"\n\t\t\t\t")]),e._v(" "),t("p",{directives:[{name:"show",rawName:"v-show",value:!e.firstAndOnlyDatabase,expression:"!firstAndOnlyDatabase"}],staticClass:"setup-form__database-type-select",class:`setup-form__database-type-select--${e.DBTypeGroupDirection}`},e._l(e.config.databases,function(a,o){return t("NcCheckboxRadioSwitch",{key:o,attrs:{"button-variant":!0,"data-cy-setup-form-field":`dbtype-${o}`,value:o,"button-variant-grouped":e.DBTypeGroupDirection,name:"dbtype",type:"radio"},model:{value:e.config.dbtype,callback:function(t){e.$set(e.config,"dbtype",t)},expression:"config.dbtype"}},[e._v("\n\t\t\t\t\t\t"+e._s(a)+"\n\t\t\t\t\t")])}),1),e._v(" "),e.firstAndOnlyDatabase?t("NcNoteCard",{attrs:{"data-cy-setup-form-db-note":"single-db",type:"warning"}},[e._v("\n\t\t\t\t\t"+e._s(e.t("core","Only {firstAndOnlyDatabase} is available.",{firstAndOnlyDatabase:e.firstAndOnlyDatabase}))),t("br"),e._v("\n\t\t\t\t\t"+e._s(e.t("core","Install and activate additional PHP modules to choose other database types."))),t("br"),e._v(" "),t("a",{attrs:{href:e.links.adminSourceInstall,target:"_blank",rel:"noreferrer noopener"}},[e._v("\n\t\t\t\t\t\t"+e._s(e.t("core","For more details check out the documentation."))+" ↗\n\t\t\t\t\t")])]):e._e(),e._v(" "),"sqlite"===e.config.dbtype?t("NcNoteCard",{attrs:{heading:e.t("core","Performance warning"),"data-cy-setup-form-db-note":"sqlite",type:"warning"}},[e._v("\n\t\t\t\t\t"+e._s(e.t("core","You chose SQLite as database."))),t("br"),e._v("\n\t\t\t\t\t"+e._s(e.t("core","SQLite should only be used for minimal and development instances. For production we recommend a different database backend."))),t("br"),e._v("\n\t\t\t\t\t"+e._s(e.t("core","If you use clients for file syncing, the use of SQLite is highly discouraged."))+"\n\t\t\t\t")]):e._e()],1),e._v(" "),"sqlite"!==e.config.dbtype?t("fieldset",[t("legend",{staticClass:"hidden-visually"},[e._v("\n\t\t\t\t\t"+e._s(e.t("core","Database connection"))+"\n\t\t\t\t")]),e._v(" "),t("NcTextField",{attrs:{label:e.t("core","Database user"),autocapitalize:"none",autocomplete:"off","data-cy-setup-form-field":"dbuser",name:"dbuser",spellcheck:"false",required:""},model:{value:e.config.dbuser,callback:function(t){e.$set(e.config,"dbuser",t)},expression:"config.dbuser"}}),e._v(" "),t("NcPasswordField",{attrs:{label:e.t("core","Database password"),autocapitalize:"none",autocomplete:"off","data-cy-setup-form-field":"dbpass",name:"dbpass",spellcheck:"false",required:""},model:{value:e.config.dbpass,callback:function(t){e.$set(e.config,"dbpass",t)},expression:"config.dbpass"}}),e._v(" "),t("NcTextField",{attrs:{label:e.t("core","Database name"),autocapitalize:"none",autocomplete:"off","data-cy-setup-form-field":"dbname",name:"dbname",pattern:"[0-9a-zA-Z\\$_\\-]+",spellcheck:"false",required:""},model:{value:e.config.dbname,callback:function(t){e.$set(e.config,"dbname",t)},expression:"config.dbname"}}),e._v(" "),"oci"===e.config.dbtype?t("NcTextField",{attrs:{label:e.t("core","Database tablespace"),autocapitalize:"none",autocomplete:"off","data-cy-setup-form-field":"dbtablespace",name:"dbtablespace",spellcheck:"false"},model:{value:e.config.dbtablespace,callback:function(t){e.$set(e.config,"dbtablespace",t)},expression:"config.dbtablespace"}}):e._e(),e._v(" "),t("NcTextField",{attrs:{"helper-text":e.t("core","Please specify the port number along with the host name (e.g., localhost:5432)."),label:e.t("core","Database host"),placeholder:e.t("core","localhost"),autocapitalize:"none",autocomplete:"off","data-cy-setup-form-field":"dbhost",name:"dbhost",spellcheck:"false"},model:{value:e.config.dbhost,callback:function(t){e.$set(e.config,"dbhost",t)},expression:"config.dbhost"}})],1):e._e()])]),e._v(" "),t("NcButton",{staticClass:"setup-form__button",class:{"setup-form__button--loading":e.loading},attrs:{disabled:e.loading,loading:e.loading,wide:!0,alignment:"center-reverse","data-cy-setup-form-submit":"",type:"submit",variant:"primary"},scopedSlots:e._u([{key:"icon",fn:function(){return[e.loading?t("NcLoadingIcon"):t("IconArrowRight")]},proxy:!0}])},[e._v("\n\t\t"+e._s(e.loading?e.t("core","Installing …"):e.t("core","Install"))+"\n\t")]),e._v(" "),t("NcNoteCard",{attrs:{"data-cy-setup-form-note":"help",type:"info"}},[e._v("\n\t\t"+e._s(e.t("core","Need help?"))+"\n\t\t"),t("a",{attrs:{target:"_blank",rel:"noreferrer noopener",href:e.links.adminInstall}},[e._v(e._s(e.t("core","See the documentation"))+" ↗")])])],2)},[],!1,null,null,null).exports;(new(n.Ay.extend(P))).$mount("#content")}},a={};function o(e){var n=a[e];if(void 0!==n)return n.exports;var r=a[e]={id:e,loaded:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.loaded=!0,r.exports}o.m=t,e=[],o.O=(t,a,n,r)=>{if(!a){var s=1/0;for(d=0;d<e.length;d++){for(var[a,n,r]=e[d],i=!0,c=0;c<a.length;c++)(!1&r||s>=r)&&Object.keys(o.O).every(e=>o.O[e](a[c]))?a.splice(c--,1):(i=!1,r<s&&(s=r));if(i){e.splice(d--,1);var l=n();void 0!==l&&(t=l)}}return t}r=r||0;for(var d=e.length;d>0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[a,n,r]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.e=()=>Promise.resolve(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.j=820,(()=>{var e={820:0};o.O.j=t=>0===e[t];var t=(t,a)=>{var n,r,[s,i,c]=a,l=0;if(s.some(t=>0!==e[t])){for(n in i)o.o(i,n)&&(o.m[n]=i[n]);if(c)var d=c(o)}for(t&&t(a);l<s.length;l++)r=s[l],o.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return o.O(d)},a=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),o.nc=void 0;var n=o.O(void 0,[4208],()=>o(95748));n=o.O(n)})();
//# sourceMappingURL=core-install.js.map?v=62c694f9486ef9ae1b73