Bug fixes + interactive setup UI

This commit is contained in:
NGPixel 2017-02-26 18:06:20 -05:00
parent 3300d42866
commit 9414380c9f
14 changed files with 257 additions and 10 deletions

View File

@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Interactive setup
- GitHub and Slack authentication providers are now available
- Experimental: LDAP authentication provider
### Changed
- Content headers are now showing an anchor icon instead of a #
- Sidebar: Contents is now Page Contents
- Sidebar: Start is now Top of Page
### Fixed
- Search index should now update upon article creation
- Missing icons on login page
## [v1.0.0-beta.8] - 2017-02-19
### Added

File diff suppressed because one or more lines are too long

7
assets/css/configure.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,27 @@
$primary: 'indigo';
@import 'core-client/scss/core';
@import 'core-client/scss/components/button';
@import 'core-client/scss/components/footer';
@import 'core-client/scss/components/form';
@import 'core-client/scss/components/grid';
@import 'core-client/scss/components/modal';
@import 'core-client/scss/components/nav';
@import 'core-client/scss/components/panel';
@import 'core-client/scss/components/typography';
.welcome {
text-align: center;
padding: 25px 0 0;
color: mc('grey', '700');
h1 {
margin-top: 5px;
}
h2 {
margin: 0;
}
}

View File

@ -78,6 +78,14 @@ auth:
clientSecret: SLACK_CLIENT_SECRET
ldap:
enabled: false
url: ldap://serverhost:389
bindDn: cn='root'
bindCredentials: BIND_PASSWORD
searchBase: o=users,o=example.com
# searchFilter: {{username}} to use the provided username in search
searchFilter: (uid={{username}})
tlsEnabled: false
tlsCertPath: C:\example\root_ca_cert.crt
# ---------------------------------------------------------------------
# Secret key to use when encrypting sessions

103
configure.js Normal file
View File

@ -0,0 +1,103 @@
'use strict'
module.exports = (port, spinner) => {
const ROOTPATH = __dirname
const IS_DEBUG = process.env.NODE_ENV === 'development'
// ----------------------------------------
// Load modules
// ----------------------------------------
const bodyParser = require('body-parser')
const compression = require('compression')
const express = require('express')
const favicon = require('serve-favicon')
const http = require('http')
const path = require('path')
// ----------------------------------------
// Define Express App
// ----------------------------------------
var app = express()
app.use(compression())
// ----------------------------------------
// Public Assets
// ----------------------------------------
app.use(favicon(path.join(ROOTPATH, 'assets', 'favicon.ico')))
app.use(express.static(path.join(ROOTPATH, 'assets')))
// ----------------------------------------
// View Engine Setup
// ----------------------------------------
app.set('views', path.join(ROOTPATH, 'views'))
app.set('view engine', 'pug')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.locals._ = require('lodash')
// ----------------------------------------
// Controllers
// ----------------------------------------
app.get('*', (req, res) => {
res.render('configure/index')
})
// ----------------------------------------
// Error handling
// ----------------------------------------
app.use(function (req, res, next) {
var err = new Error('Not Found')
err.status = 404
next(err)
})
app.use(function (err, req, res, next) {
res.status(err.status || 500)
res.send({
message: err.message,
error: IS_DEBUG ? err : {}
})
spinner.fail(err.message)
process.exit(1)
})
// ----------------------------------------
// Start HTTP server
// ----------------------------------------
spinner.text = 'Starting HTTP server...'
app.set('port', port)
var server = http.createServer(app)
server.listen(port)
server.on('error', (error) => {
if (error.syscall !== 'listen') {
throw error
}
switch (error.code) {
case 'EACCES':
spinner.fail('Listening on port ' + port + ' requires elevated privileges!')
process.exit(1)
break
case 'EADDRINUSE':
spinner.fail('Port ' + port + ' is already in use!')
process.exit(1)
break
default:
throw error
}
})
server.on('listening', () => {
spinner.text = 'Browse to http://localhost:' + port + ' to configure Wiki.js!'
})
}

View File

@ -95,6 +95,14 @@ gulp.task('server', ['scripts', 'css', 'fonts'], function () {
env: { 'NODE_ENV': 'development' }
})
})
gulp.task('configure', ['scripts', 'css', 'fonts'], function () {
nodemon({
exec: 'node wiki configure',
ignore: ['assets/', 'client/', 'data/', 'repo/', 'tests/'],
ext: 'js json',
env: { 'NODE_ENV': 'development' }
})
})
/**
* TASK - Process all scripts processes
@ -182,6 +190,7 @@ gulp.task('watch', function () {
* TASK - Starts development server with watchers
*/
gulp.task('default', ['watch', 'server'])
gulp.task('default-configure', ['watch', 'configure'])
gulp.task('dev', function () {
paths.css.includes.pop()
@ -193,6 +202,16 @@ gulp.task('dev', function () {
return run('default')
})
gulp.task('dev-configure', function () {
paths.css.includes.pop()
paths.css.includes.push('../core')
paths.fonts.pop()
paths.fonts.push('../core/core-client/fonts/**/*')
return run('default-configure')
})
/**
* TASK - Creates deployment packages
*/

View File

@ -37,8 +37,8 @@ var mkdown = md({
.use(mdAnchor, {
slugify: _.kebabCase,
permalink: true,
permalinkClass: 'toc-anchor',
permalinkSymbol: '#',
permalinkClass: 'toc-anchor icon-anchor',
permalinkSymbol: '',
permalinkBefore: true
})
.use(mdFootnote)

View File

@ -50,6 +50,8 @@ userSchema.statics.processProfile = (profile) => {
primaryEmail = (e) ? e.value : _.first(profile.emails).value
} else if (_.isString(profile.email) && profile.email.length > 5) {
primaryEmail = profile.email
} else if (_.isString(profile.mail) && profile.mail.length > 5) {
primaryEmail = profile.mail
} else if (profile.user && profile.user.email && profile.user.email.length > 5) {
primaryEmail = profile.user.email
} else {

View File

@ -9,11 +9,7 @@
global.PROCNAME = 'SERVER'
global.ROOTPATH = __dirname
global.IS_DEBUG = process.env.NODE_ENV === 'development'
if (IS_DEBUG) {
global.CORE_PATH = ROOTPATH + '/../core/'
} else {
global.CORE_PATH = ROOTPATH + '/node_modules/requarks-core/'
}
global.CORE_PATH = (IS_DEBUG) ? ROOTPATH + '/../core/' : ROOTPATH + '/node_modules/requarks-core/'
process.env.VIPS_WARNING = false

58
views/configure/index.pug Normal file
View File

@ -0,0 +1,58 @@
doctype html
html
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
title Wiki.js | Configure
// Favicon
each favsize in [32, 96, 16]
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
// CSS
link(type='text/css', rel='stylesheet', href='/css/libs.css')
link(type='text/css', rel='stylesheet', href='/css/configure.css')
// JS
script(type='text/javascript', src='/js/libs.js')
//script(type='text/javascript', src='/js/app.js')
block head
body
#root
#header-container
nav.nav#header
.nav-left
a.nav-item(href='/')
h1
i.icon-layers
| Wiki.js
main
.container
.welcome(style={'padding-bottom': '5px'})
img(src='/favicons/android-icon-96x96.png', alt='Wiki.js')
h1 Welcome to Wiki.js!
h2(style={'margin-bottom': 0}) Fill in the fields below to get up and running.
.content
.panel
h2.panel-title
span General
i(v-if='loading')
.panel-content.form-sections
section
p.control.is-fullwidth
label.label Site Title
input(type='text', placeholder='e.g. Wiki', v-model='title')
section
p.control.is-fullwidth
label.label Host
input(type='text', placeholder='http://', v-model='host')
.panel-footer
button.button.is-indigo(v-on:click='add', v-bind:disabled='loading') Continue
footer.footer
span
| Powered by
a(href='https://github.com/Requarks/wiki') Wiki.js
| .
block outside

View File

@ -30,7 +30,7 @@ block adminContent
i.icon-check
span Save Changes
.column
.panel
.panel-aside
label.label Provider
p.control.account-profile-provider
case user.provider

View File

@ -63,7 +63,7 @@ block content
i.icon-th-list
span Page Contents
ul.sidebar-menu
li: a(href='#root', title='Top of Page') Top
li: a(href='#root', title='Top of Page') Top of Page
+tocMenu(pageData.tree)
.column

14
wiki.js
View File

@ -1,6 +1,12 @@
#!/usr/bin/env node
'use strict'
// ===========================================
// Wiki.js
// 1.0.0
// Licensed under AGPLv3
// ===========================================
const Promise = require('bluebird')
const fs = Promise.promisifyAll(require('fs-extra'))
const ora = require('ora')
@ -54,6 +60,14 @@ cmdr.command('stop')
})
})
cmdr.command('configure [port]')
.description('Configure Wiki.js')
.action((port) => {
port = port || 3000
let spinner = ora('Initializing interactive setup...').start()
require('./configure')(port, spinner)
})
cmdr.parse(process.argv)
if (!process.argv.slice(2).length) {