Commit 6baa277f authored by NGPixel's avatar NGPixel

fix: migrate setup to vuetify + remove git related steps

parent 16d3336c
......@@ -44,7 +44,7 @@ window.Hammer = Hammer
// Initialize Apollo Client (GraphQL)
// ====================================
const graphQLEndpoint = window.location.protocol + '//' + window.location.host + siteConfig.path + 'graphql'
const graphQLEndpoint = window.location.protocol + '//' + window.location.host + '/graphql'
window.graphQL = new ApolloClient({
link: new BatchHttpLink({
......@@ -65,17 +65,7 @@ Vue.use(VueClipboards)
Vue.use(VueSimpleBreakpoints)
Vue.use(localization.VueI18Next)
Vue.use(helpers)
Vue.use(VeeValidate, {
enableAutoClasses: true,
classNames: {
touched: 'is-touched', // the control has been blurred
untouched: 'is-untouched', // the control hasn't been blurred
valid: 'is-valid', // model is valid
invalid: 'is-invalid', // model is invalid
pristine: 'is-pristine', // control has not been interacted with
dirty: 'is-dirty' // control has been interacted with
}
})
Vue.use(VeeValidate, { events: '' })
Vue.use(Vuetify)
Vue.prototype.Velocity = Velocity
......
......@@ -9,8 +9,6 @@
@import 'components/button';
@import 'components/markdown-content';
@import 'components/navigator';
@import 'components/panel';
@import 'components/setup';
@import 'components/toggle';
@import 'components/typography';
......
......@@ -20,17 +20,6 @@ html {
}
}
// body {
// background-color: lighten(mc('blue-grey','50'), 5%);
// height: 100%;
// }
// main {
// background-color: mc('blue','500');
// background-image: linear-gradient(to bottom, mc('blue', '700') 0%, mc('blue', '500') 100%);
// padding: 50px;
// min-height: 100vh;
// }
// Container
.container {
......
.setup {
background-color: #1565c0;
background-image: url('../static/svg/config-bg.svg');
width: 100%;
min-height: 100vh;
padding-top: 1rem;
.welcome {
text-align: center;
padding: 1rem 0 2rem 0;
border-bottom: 1px solid mc('blue', '50');
margin-bottom: 1rem;
img {
max-height: 100px;
}
h2 {
margin: 0;
color: mc('indigo', '700');
font-weight: 500;
}
}
.is-logo {
text-align: center;
padding: .5rem 0 1.5rem 0;
border-bottom: 1px solid mc('blue', '50');
margin-bottom: 1rem;
display: flex;
justify-content: center;
align-items: center;
img {
max-height: 64px;
}
h4 {
font-size: 1.2rem;
font-weight: 600;
margin-left: 1.5rem;
color: mc('grey', '700');
}
}
i.icon-loader {
display: inline-block;
color: mc('blue', '500')
}
.progress-bar {
width: 150px;
height: 10px;
background-color: mc('indigo', '50');
border:1px solid mc('indigo', '100');
border-radius: 3px;
position: absolute;
left: 15px;
top: 21px;
padding: 1px;
> div {
width: 5px;
height: 6px;
background-color: mc('indigo', '200');
border-radius: 2px;
transition: all 1s ease;
}
}
footer {
background-color: mc('blue','800');
border-top: 1px solid mc('blue', '700');
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 25px;
height: 70px;
font-size: 13px;
font-weight: 500;
color: mc('blue','200');
position: absolute;
right: 0;
bottom: 0;
left: 0;
}
}
......@@ -15,7 +15,7 @@ port: 80
# ---------------------------------------------------------------------
paths:
repo: ./repo
content: ./content
data: ./data
# ---------------------------------------------------------------------
......
......@@ -42,7 +42,6 @@ defaults:
enabled: true
site:
lang: en
path: ''
rtl: false
title: Wiki.js
# System defaults
......@@ -103,36 +102,47 @@ langs:
-
id: en
name: English
original: English
-
id: zh
name: Chinese - 中文
name: Chinese
original: 中文
-
id: nl
name: Dutch - Nederlands
name: Dutch
original: Nederlands
-
id: fr
name: French - Français
name: French
original: Français
-
id: de
name: German - Deutsch
name: German
original: Deutsch
-
id: ja
name: Japanese - 日本語
name: Japanese
original: 日本語
-
id: ko
name: Korean - 한국어
name: Korean
original: 한국어
-
id: fa
name: Persian (Fārsi) - فارسی
name: Persian (Fārsi)
original: فارسی
-
id: pt
name: Portuguese - Português
name: Portuguese
original: Português
-
id: ru
name: Russian - Русский
name: Russian
original: Русский
-
id: es
name: Spanish - Español
name: Spanish
original: Español
rtlLangs:
- fa
# ---------------------------------
......@@ -34,8 +34,6 @@ module.exports = () => {
let app = express()
app.use(compression())
let server
// ----------------------------------------
// Public Assets
// ----------------------------------------
......@@ -91,14 +89,20 @@ module.exports = () => {
if (!semver.satisfies(semver.clean(process.version), '>=8.9.0')) {
throw new Error('Node.js version is too old. Minimum is 8.9.0.')
}
return 'Node.js ' + process.version + ' detected. Minimum is 8.9.0.'
return {
title: 'Node.js ' + process.version + ' detected.',
subtitle: ' Minimum is 8.9.0.'
}
},
() => {
return Promise.try(() => {
require('crypto')
}).catch(err => {
throw new Error('Crypto Node.js module is not available.')
}).return('Node.js Crypto module is available.')
}).return({
title: 'Node.js Crypto module is available.',
subtitle: 'Crypto module is required.'
})
},
() => {
const exec = require('child_process').exec
......@@ -112,16 +116,22 @@ module.exports = () => {
if (!gitver || !semver.satisfies(semver.clean(gitver), '>=2.7.4')) {
reject(new Error('Git version is too old. Minimum is 2.7.4.'))
}
resolve('Git ' + gitver + ' detected. Minimum is 2.7.4.')
resolve({
title: 'Git ' + gitver + ' detected.',
subtitle: 'Minimum is 2.7.4.'
})
})
})
},
() => {
const os = require('os')
if (os.totalmem() < 1000 * 1000 * 512) {
throw new Error('Not enough memory. Minimum is 512 MB.')
if (os.totalmem() < 1000 * 1000 * 768) {
throw new Error('Not enough memory. Minimum is 768 MB.')
}
return {
title: filesize(os.totalmem()) + ' of system memory available.',
subtitle: 'Minimum is 768 MB.'
}
return filesize(os.totalmem()) + ' of system memory available. Minimum is 512 MB.'
},
() => {
let fs = require('fs')
......@@ -129,7 +139,10 @@ module.exports = () => {
fs.accessSync(path.join(WIKI.ROOTPATH, 'config.yml'), (fs.constants || fs).W_OK)
}).catch(err => {
throw new Error('config.yml file is not writable by Node.js process or was not created properly.')
}).return('config.yml is writable by the setup process.')
}).return({
title: 'config.yml is writable by the setup process.',
subtitle: 'Setup will write to this file.'
})
}
], test => test()).then(results => {
res.json({ ok: true, results })
......@@ -251,13 +264,14 @@ module.exports = () => {
let conf = yaml.safeLoad(confRaw)
conf.port = req.body.port
conf.paths.repo = req.body.pathRepo
conf.paths.data = req.body.pathData
conf.paths.content = req.body.pathContent
confRaw = yaml.safeDump(conf)
await fs.writeFileAsync(path.join(WIKI.ROOTPATH, 'config.yml'), confRaw)
_.set(WIKI.config, 'port', req.body.port)
_.set(WIKI.config, 'paths.repo', req.body.pathRepo)
_.set(WIKI.config, 'paths.content', req.body.pathContent)
// Populate config namespaces
WIKI.config.auth = WIKI.config.auth || {}
......@@ -270,7 +284,6 @@ module.exports = () => {
// Site namespace
_.set(WIKI.config.site, 'title', req.body.title)
_.set(WIKI.config.site, 'path', req.body.path)
_.set(WIKI.config.site, 'lang', req.body.lang)
_.set(WIKI.config.site, 'rtl', _.includes(WIKI.data.rtlLangs, req.body.lang))
_.set(WIKI.config.site, 'sessionSecret', (await crypto.randomBytesAsync(32)).toString('hex'))
......@@ -280,32 +293,6 @@ module.exports = () => {
_.set(WIKI.config.auth, 'strategies.local.enabled', true)
_.set(WIKI.config.auth, 'strategies.local.allowSelfRegister', req.body.selfRegister === 'true')
// Git namespace
_.set(WIKI.config.git, 'enabled', req.body.gitUseRemote === 'true')
if (WIKI.config.git.enabled) {
_.set(WIKI.config.git, 'url', req.body.gitUrl)
_.set(WIKI.config.git, 'branch', req.body.gitBranch)
_.set(WIKI.config.git, 'author.defaultEmail', req.body.gitServerEmail)
_.set(WIKI.config.git, 'author.useUserEmail', req.body.gitShowUserEmail)
_.set(WIKI.config.git, 'sslVerify', req.body.gitAuthSSL === 'true')
_.set(WIKI.config.git, 'auth.type', req.body.gitAuthType)
switch (WIKI.config.git.auth.type) {
case 'basic':
_.set(WIKI.config.git, 'auth.user', req.body.gitAuthUser)
_.set(WIKI.config.git, 'auth.pass', req.body.gitAuthPass)
break
case 'ssh':
_.set(WIKI.config.git, 'auth.keyPath', req.body.gitAuthSSHKey)
break
case 'sshenv':
_.set(WIKI.config.git, 'auth.keyEnv', req.body.gitAuthSSHKeyEnv)
break
case 'sshdb':
_.set(WIKI.config.git, 'auth.keyContents', req.body.gitAuthSSHKeyDB)
break
}
}
// Logging namespace
WIKI.config.logging.telemetry = (req.body.telemetry === 'true')
......@@ -332,7 +319,7 @@ module.exports = () => {
}).end()
WIKI.logger.info('Stopping Setup...')
server.destroy(() => {
WIKI.server.destroy(() => {
WIKI.logger.info('Setup stopped. Starting WIKI.js...')
_.delay(() => {
WIKI.kernel.bootMaster()
......
......@@ -2,5 +2,5 @@ extends ../master.pug
block body
body
#app.setup.is-fullscreen
#app
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version, :langs!=JSON.stringify(data.langs).replace(/"/g, "'"))
......@@ -3,34 +3,34 @@ html
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
meta(name='viewport', content='width=device-width, initial-scale=1')
meta(name='theme-color', content='#0288d1')
meta(name='msapplication-TileColor', content='#0288d1')
meta(name='msapplication-TileImage', content=config.site.path + 'favicons/ms-icon-144x144.png')
meta(name='viewport', content='user-scalable=yes, width=device-width, initial-scale=1, maximum-scale=5')
meta(name='theme-color', content='#333333')
meta(name='msapplication-TileColor', content='#333333')
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
title= config.site.title
//- Favicon
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href=config.site.path + 'favicons/apple-icon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes='192x192', href=config.site.path + 'favicons/android-icon-192x192.png')
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href='/favicons/apple-icon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes='192x192', href='/favicons/android-icon-192x192.png')
each favsize in [32, 96, 16]
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href=config.site.path + 'favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href=config.site.path + 'manifest.json')
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
//- Site Lang
script.
var siteConfig = !{JSON.stringify(config.site)}
//- CSS
link(type='text/css', rel='stylesheet', href=config.site.path + 'css/bundle.css')
link(type='text/css', rel='stylesheet', href='/css/bundle.css')
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Source+Code+Pro:400,700|Material+Icons')
link(type='text/css', rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css" />
//- JS
script(type='text/javascript', src=config.site.path + 'js/runtime.js')
script(type='text/javascript', src=config.site.path + 'js/vendor.js')
script(type='text/javascript', src=config.site.path + 'js/client.js')
script(type='text/javascript', src='/js/runtime.js')
script(type='text/javascript', src='/js/vendor.js')
script(type='text/javascript', src='/js/client.js')
block head
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment