2018-01-28 18:34:37 +00:00
< template lang = "pug" >
2018-03-11 05:11:32 +00:00
v - app . setup
2019-07-01 02:37:01 +00:00
v - content
v - container
v - layout
v - flex ( xs12 , lg6 , offset - lg3 )
2019-10-06 18:55:22 +00:00
v - card . elevation - 20. radius - 7. animated . fadeInUp
2020-01-26 04:12:57 +00:00
v - alert ( v - if = 'isDevMode' , tile , dark , color = 'red darken-3' , icon = 'mdi-alert' , prominent )
. body - 2 You are running an unstable , unreleased development version . This code base is # [ strong NOT ] for production use !
2020-08-22 23:37:49 +00:00
. body - 2. mt - 3 Cloning the dev branch directly from GitHub is # [ strong NOT ] the proper way to install Wiki . js !
2020-01-26 04:12:57 +00:00
. body - 2 Read the # [ a ( href = 'https://docs.requarks.io/install' , style = 'color: #FFF;' ) documentation ] on correctly installing the latest stable version .
2019-08-04 02:51:29 +00:00
. text - center
2020-06-01 02:39:45 +00:00
img . setup - logo . animated . fadeInUp . wait - p2s ( src = '/_assets/svg/logo-wikijs-full.svg' , alt = 'Wiki.js Logo' )
2019-09-16 03:20:40 +00:00
v - alert ( v - model = 'error' , type = 'error' , icon = 'mdi-alert' , tile , dismissible ) { { errorMessage } }
2019-10-06 18:55:22 +00:00
v - alert ( v - if = '!error' , tile , color = 'blue lighten-5' , : value = 'true' )
v - icon . mr - 3 ( color = 'blue' ) mdi - package - variant
span . blue -- text You are about to install Wiki . js # [ strong { { wikiVersion } } ] .
2019-07-01 02:37:01 +00:00
v - card - text
2019-09-16 03:20:40 +00:00
. overline . pl - 3 Administrator Account
v - container . pa - 3. mt - 3 ( grid - list - xl )
2019-07-01 02:37:01 +00:00
v - layout ( row , wrap )
v - flex ( xs12 )
v - text - field (
2019-08-04 02:51:29 +00:00
outlined
2019-07-01 02:37:01 +00:00
v - model = 'conf.adminEmail' ,
label = 'Administrator Email' ,
2019-08-04 02:51:29 +00:00
hint = 'The email address of the administrator account.' ,
2019-07-01 02:37:01 +00:00
persistent - hint
2019-09-16 03:20:40 +00:00
required
2019-07-01 02:37:01 +00:00
ref = 'adminEmailInput'
)
v - flex ( xs6 )
v - text - field (
2019-08-04 02:51:29 +00:00
outlined
2019-07-01 02:37:01 +00:00
ref = 'adminPassword' ,
counter = '255'
v - model = 'conf.adminPassword' ,
label = 'Password' ,
2019-08-04 02:51:29 +00:00
: append - icon = "pwdMode ? 'mdi-eye-off' : 'mdi-eye'"
2019-07-01 02:37:01 +00:00
@ click : append = "() => (pwdMode = !pwdMode)"
: type = "pwdMode ? 'password' : 'text'"
hint = 'At least 8 characters long.' ,
persistent - hint
)
v - flex ( xs6 )
v - text - field (
2019-08-04 02:51:29 +00:00
outlined
2019-07-01 02:37:01 +00:00
ref = 'adminPasswordConfirm' ,
counter = '255'
v - model = 'conf.adminPasswordConfirm' ,
label = 'Confirm Password' ,
2019-08-04 02:51:29 +00:00
: append - icon = "pwdConfirmMode ? 'mdi-eye-off' : 'mdi-eye'"
2019-07-01 02:37:01 +00:00
@ click : append = "() => (pwdConfirmMode = !pwdConfirmMode)"
: type = "pwdConfirmMode ? 'password' : 'text'"
hint = 'Verify your password again.' ,
persistent - hint
)
v - divider . mb - 4
2019-10-06 18:55:22 +00:00
. overline . pl - 3. mb - 5 Site URL
v - text - field . mb - 4. mx - 3 (
outlined
ref = 'adminSiteUrl' ,
v - model = 'conf.siteUrl' ,
label = 'Site URL' ,
hint = 'Full URL to your wiki, without the trailing slash (e.g. https://wiki.example.com). This should be the public facing URL, not the internal one if using a reverse-proxy.' ,
persistent - hint
@ keyup . enter = 'install'
)
v - divider . mb - 4
. overline . pl - 3. mb - 3 Telemetry
v - switch . ml - 3 (
inset
2018-03-11 05:11:32 +00:00
color = 'primary' ,
v - model = 'conf.telemetry' ,
label = 'Allow Telemetry' ,
persistent - hint ,
hint = 'Help Wiki.js developers improve this app with anonymized telemetry.'
)
2019-10-06 18:55:22 +00:00
a . pl - 3 ( style = 'font-size: 12px; letter-spacing: initial;' , href = 'https://docs.requarks.io/telemetry' , target = '_blank' ) Learn more
2019-09-16 03:20:40 +00:00
v - divider . mt - 2
2019-07-01 02:37:01 +00:00
v - card - actions
2019-09-16 03:20:40 +00:00
v - btn ( color = 'primary' , @ click = 'install' , : disabled = 'loading' , x - large , depressed , block )
2019-08-04 02:51:29 +00:00
v - icon ( left ) mdi - check
2019-07-01 02:37:01 +00:00
span Install
v - dialog ( v - model = 'loading' , width = '450' , persistent )
v - card ( color = 'primary' , dark ) . radius - 7
2019-08-04 02:51:29 +00:00
v - card - text . text - center . py - 5
2019-07-01 02:37:01 +00:00
. py - 3 ( style = 'width: 64px; display:inline-block;' )
breeding - rhombus - spinner (
: animation - duration = '2000'
: size = '64'
color = '#FFF'
)
template ( v - if = '!success' )
2019-08-04 02:51:29 +00:00
. subtitle - 1. white -- text Finalizing your installation ...
2019-07-01 02:37:01 +00:00
. caption Just a moment
template ( v - else )
2019-08-04 02:51:29 +00:00
. subtitle - 1. white -- text Installation complete !
2019-07-01 02:37:01 +00:00
. caption Redirecting ...
2018-01-28 18:34:37 +00:00
< / template >
< script >
2018-02-04 05:53:13 +00:00
import _ from 'lodash'
2019-09-16 03:20:40 +00:00
import validate from 'validate.js'
2019-03-17 02:41:48 +00:00
import { BreedingRhombusSpinner } from 'epic-spinners'
2020-05-21 04:34:24 +00:00
import confetti from 'canvas-confetti'
2018-01-28 18:34:37 +00:00
2020-01-26 04:12:57 +00:00
/* global siteConfig */
2018-01-28 18:34:37 +00:00
export default {
2018-08-05 15:27:46 +00:00
components : {
2019-03-17 02:41:48 +00:00
BreedingRhombusSpinner
2018-08-05 15:27:46 +00:00
} ,
2018-01-28 18:34:37 +00:00
props : {
wikiVersion : {
type : String ,
required : true
}
} ,
data ( ) {
return {
loading : false ,
2019-07-01 02:37:01 +00:00
success : false ,
error : false ,
errorMessage : '' ,
2018-01-28 18:34:37 +00:00
conf : {
adminEmail : '' ,
adminPassword : '' ,
adminPasswordConfirm : '' ,
2019-10-06 18:55:22 +00:00
siteUrl : 'https://wiki.yourdomain.com' ,
2019-07-01 02:37:01 +00:00
telemetry : true
2018-05-28 18:46:55 +00:00
} ,
pwdMode : true ,
2020-01-26 04:12:57 +00:00
pwdConfirmMode : true ,
isDevMode : false
2018-01-28 18:34:37 +00:00
}
} ,
2019-07-01 02:37:01 +00:00
mounted ( ) {
_ . delay ( ( ) => {
this . $refs . adminEmailInput . focus ( )
} , 500 )
2020-01-26 04:12:57 +00:00
this . isDevMode = siteConfig . devMode === true
2019-07-01 02:37:01 +00:00
} ,
2018-01-28 18:34:37 +00:00
methods : {
2019-07-01 02:37:01 +00:00
async install ( ) {
2019-09-16 03:20:40 +00:00
this . error = false
const validationResults = validate ( this . conf , {
adminEmail : {
presence : {
allowEmpty : false
} ,
email : true
} ,
adminPassword : {
presence : {
allowEmpty : false
} ,
length : {
minimum : 6 ,
maximum : 255
}
} ,
adminPasswordConfirm : {
equality : 'adminPassword'
2019-10-06 18:55:22 +00:00
} ,
siteUrl : {
presence : {
allowEmpty : false
} ,
url : {
schemes : [ 'http' , 'https' ] ,
allowLocal : true ,
allowDataUrl : false
} ,
format : {
pattern : '^(?!.*/$).*$' ,
flags : 'i' ,
message : 'must not have a trailing slash'
}
2019-09-16 03:20:40 +00:00
}
} , {
format : 'flat'
} )
if ( validationResults ) {
this . error = true
this . errorMessage = validationResults [ 0 ]
this . $forceUpdate ( )
2019-07-01 02:37:01 +00:00
return
2018-03-11 05:11:32 +00:00
}
this . loading = true
2019-07-01 02:37:01 +00:00
this . success = false
2018-03-11 05:11:32 +00:00
this . $forceUpdate ( )
2018-01-28 18:34:37 +00:00
2019-07-01 02:37:01 +00:00
_ . delay ( async ( ) => {
try {
2019-09-16 03:20:40 +00:00
const resp = await fetch ( '/finalize' , {
method : 'POST' ,
cache : 'no-cache' ,
headers : {
'Content-Type' : 'application/json'
} ,
body : JSON . stringify ( this . conf )
} ) . then ( res => res . json ( ) )
if ( resp . ok === true ) {
2018-03-11 05:11:32 +00:00
_ . delay ( ( ) => {
2020-05-21 04:34:24 +00:00
confetti ( {
particleCount : 100 ,
spread : 70 ,
zIndex : 100000
} )
2019-09-22 20:32:39 +00:00
this . success = true
_ . delay ( ( ) => {
window . location . assign ( '/login' )
} , 3000 )
} , 10000 )
2018-01-28 18:34:37 +00:00
} else {
2019-07-01 02:37:01 +00:00
this . error = true
2019-09-16 03:20:40 +00:00
this . errorMessage = resp . error
2019-07-01 02:37:01 +00:00
this . loading = false
2018-01-28 18:34:37 +00:00
}
2019-07-29 04:50:03 +00:00
} catch ( err ) {
2018-01-28 18:34:37 +00:00
window . alert ( err . message )
2019-07-01 02:37:01 +00:00
}
2018-01-28 18:34:37 +00:00
} , 1000 )
}
}
}
< / script >
2018-03-11 05:11:32 +00:00
< style lang = 'scss' >
2019-07-01 02:37:01 +00:00
. setup {
2019-08-04 02:51:29 +00:00
. v - application -- wrap {
2019-07-01 02:37:01 +00:00
padding - top : 10 vh ;
2019-10-06 18:55:22 +00:00
background - color : # 111 ;
background - image : linear - gradient ( 45 deg , mc ( 'blue' , '100' ) , mc ( 'blue' , '700' ) , mc ( 'indigo' , '900' ) ) ;
background - blend - mode : exclusion ;
& : : before {
content : '' ;
position : absolute ;
left : 0 ;
top : 0 ;
width : 100 % ;
height : 100 vh ;
z - index : 0 ;
background - color : transparent ;
2020-08-22 23:37:49 +00:00
background - image : url ( . . / static / svg / motif - grid . svg ) ! important ;
2019-10-06 18:55:22 +00:00
background - size : 100 px ;
background - repeat : repeat ;
animation : bg - anim 100 s linear infinite ;
}
}
@ keyframes bg - anim {
0 % {
background - position : 0 0 ;
}
100 % {
background - position : 100 % 100 % ;
}
2019-07-01 02:37:01 +00:00
}
2018-03-11 05:11:32 +00:00
2019-07-01 02:37:01 +00:00
& - logo {
2019-09-16 03:20:40 +00:00
width : 400 px ;
margin : 2 rem 0 2 rem 0 ;
2019-07-01 02:37:01 +00:00
}
}
2018-03-11 05:11:32 +00:00
< / style >