Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
358e79d7
Commit
358e79d7
authored
Mar 16, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: setup https support + various fixes
parent
7bbf6839
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
58 deletions
+64
-58
setup.vue
client/components/setup.vue
+4
-4
page.vue
client/themes/default/components/page.vue
+12
-12
auth.js
server/core/auth.js
+3
-4
authentication.js
server/graph/resolvers/authentication.js
+1
-1
flash.js
server/middlewares/flash.js
+0
-15
seo.js
server/middlewares/seo.js
+2
-2
setup.js
server/setup.js
+42
-20
No files found.
client/components/setup.vue
View file @
358e79d7
...
...
@@ -171,8 +171,8 @@
v-card.text-xs-center(flat)
template(v-if='loading')
.mt-3(style='width: 64px; display:inline-block;')
atom
-spinner(
:animation-duration='
8
00'
breeding-rhombus
-spinner(
:animation-duration='
20
00'
:size='64'
color='#1976d2'
)
...
...
@@ -199,11 +199,11 @@
<
script
>
import
axios
from
'axios'
import
_
from
'lodash'
import
{
Atom
Spinner
}
from
'epic-spinners'
import
{
BreedingRhombus
Spinner
}
from
'epic-spinners'
export
default
{
components
:
{
Atom
Spinner
BreedingRhombus
Spinner
},
props
:
{
telemetryId
:
{
...
...
client/themes/default/components/page.vue
View file @
358e79d7
...
...
@@ -83,18 +83,18 @@
v-list-tile-title.pl-3.caption
{{
tocSubItem
.
title
}}
v-divider(inset, v-if='tocIdx < toc.length - 1')
v-divider
v-list.grey(dense, :class='darkMode ? `darken-3` : `lighten-4`')
v-subheader.pl-4.yellow--text.text--darken-4 Rating
.text-xs-center
v-rating(
v-model='rating'
color='yellow darken-3'
background-color='grey lighten-1'
half-increments
hover
)
.pb-2.caption.grey--text 5 votes
v-divider
//-
v-list.grey(dense, :class='darkMode ? `darken-3` : `lighten-4`')
//-
v-subheader.pl-4.yellow--text.text--darken-4 Rating
//-
.text-xs-center
//-
v-rating(
//-
v-model='rating'
//-
color='yellow darken-3'
//-
background-color='grey lighten-1'
//-
half-increments
//-
hover
//-
)
//-
.pb-2.caption.grey--text 5 votes
//-
v-divider
template(v-if='tags.length')
v-list.grey(dense, :class='darkMode ? `darken-3-d3` : `lighten-3`')
v-subheader.pl-4.teal--text Tags
...
...
server/core/auth.js
View file @
358e79d7
...
...
@@ -130,7 +130,7 @@ module.exports = {
// JWT is NOT valid, set as guest
if
(
!
user
)
{
if
(
true
||
WIKI
.
auth
.
guest
.
cacheExpiration
.
isSameOrBefore
(
moment
.
utc
()))
{
if
(
WIKI
.
auth
.
guest
.
cacheExpiration
.
isSameOrBefore
(
moment
.
utc
()))
{
WIKI
.
auth
.
guest
=
await
WIKI
.
models
.
users
.
getGuestUser
()
WIKI
.
auth
.
guest
.
cacheExpiration
=
moment
.
utc
().
add
(
1
,
'm'
)
}
...
...
@@ -176,9 +176,7 @@ module.exports = {
user
.
groups
.
forEach
(
grp
=>
{
const
grpId
=
_
.
isObject
(
grp
)
?
_
.
get
(
grp
,
'id'
,
0
)
:
grp
_
.
get
(
WIKI
.
auth
.
groups
,
`
${
grpId
}
.pageRules`
,
[]).
forEach
(
rule
=>
{
console
.
info
(
page
.
path
)
console
.
info
(
rule
)
switch
(
rule
.
match
)
{
switch
(
rule
.
match
)
{
case
'START'
:
if
(
_
.
startsWith
(
`/
${
page
.
path
}
`
,
`/
${
rule
.
path
}
`
))
{
checkState
=
this
.
_applyPageRuleSpecificity
({
rule
,
checkState
,
higherPriority
:
[
'END'
,
'REGEX'
,
'EXACT'
]
})
...
...
@@ -194,6 +192,7 @@ module.exports = {
if
(
reg
.
test
(
page
.
path
))
{
checkState
=
this
.
_applyPageRuleSpecificity
({
rule
,
checkState
,
higherPriority
:
[
'EXACT'
]
})
}
break
case
'EXACT'
:
if
(
`/
${
page
.
path
}
`
===
`/
${
rule
.
path
}
`
)
{
checkState
=
this
.
_applyPageRuleSpecificity
({
rule
,
checkState
,
higherPriority
:
[]
})
...
...
server/graph/resolvers/authentication.js
View file @
358e79d7
...
...
@@ -60,7 +60,7 @@ module.exports = {
},
async
register
(
obj
,
args
,
context
)
{
try
{
await
WIKI
.
models
.
users
.
register
({...
args
,
verify
:
true
},
context
)
await
WIKI
.
models
.
users
.
register
({
...
args
,
verify
:
true
},
context
)
return
{
responseResult
:
graphHelper
.
generateSuccess
(
'Registration success'
)
}
...
...
server/middlewares/flash.js
deleted
100644 → 0
View file @
7bbf6839
'use strict'
/**
* Flash middleware
*
* @param {Express Request} req Express Request object
* @param {Express Response} res Express Response object
* @param {Function} next Next callback function
* @return {any} void
*/
module
.
exports
=
(
req
,
res
,
next
)
=>
{
res
.
locals
.
flash
=
req
.
flash
(
'alert'
)
next
()
}
server/middlewares/seo.js
View file @
358e79d7
'use strict'
const
_
=
require
(
'lodash'
)
/* global WIKI */
/**
* SEO Middleware
*
...
...
server/setup.js
View file @
358e79d7
const
path
=
require
(
'path'
)
const
uuid
=
require
(
'uuid/v4'
)
const
bodyParser
=
require
(
'body-parser'
)
const
compression
=
require
(
'compression'
)
const
express
=
require
(
'express'
)
const
favicon
=
require
(
'serve-favicon'
)
const
http
=
require
(
'http'
)
const
https
=
require
(
'https'
)
const
Promise
=
require
(
'bluebird'
)
const
fs
=
require
(
'fs-extra'
)
const
_
=
require
(
'lodash'
)
const
cfgHelper
=
require
(
'./helpers/config'
)
const
crypto
=
Promise
.
promisifyAll
(
require
(
'crypto'
))
const
pem2jwk
=
require
(
'pem-jwk'
).
pem2jwk
const
semver
=
require
(
'semver'
)
/* global WIKI */
...
...
@@ -12,23 +25,6 @@ module.exports = () => {
WIKI
.
system
=
require
(
'./core/system'
)
// ----------------------------------------
// 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
Promise
=
require
(
'bluebird'
)
const
fs
=
require
(
'fs-extra'
)
const
_
=
require
(
'lodash'
)
const
cfgHelper
=
require
(
'./helpers/config'
)
const
crypto
=
Promise
.
promisifyAll
(
require
(
'crypto'
))
const
pem2jwk
=
require
(
'pem-jwk'
).
pem2jwk
const
semver
=
require
(
'semver'
)
// ----------------------------------------
// Define Express App
// ----------------------------------------
...
...
@@ -138,8 +134,8 @@ module.exports = () => {
WIKI
.
telemetry
.
sendEvent
(
'setup'
,
'install-start'
)
// Basic checks
if
(
!
semver
.
satisfies
(
process
.
version
,
'>=10.1
4
'
))
{
throw
new
Error
(
'Node.js 10.1
4
.x or later required!'
)
if
(
!
semver
.
satisfies
(
process
.
version
,
'>=10.1
2
'
))
{
throw
new
Error
(
'Node.js 10.1
2
.x or later required!'
)
}
// Upgrade from WIKI.js 1.x?
...
...
@@ -356,7 +352,33 @@ module.exports = () => {
WIKI
.
logger
.
info
(
`HTTP Server on port: [
${
WIKI
.
config
.
port
}
]`
)
app
.
set
(
'port'
,
WIKI
.
config
.
port
)
WIKI
.
server
=
http
.
createServer
(
app
)
if
(
WIKI
.
config
.
ssl
.
enabled
)
{
WIKI
.
logger
.
info
(
`HTTPS Server on port: [
${
WIKI
.
config
.
port
}
]`
)
const
tlsOpts
=
{}
try
{
if
(
WIKI
.
config
.
ssl
.
format
===
'pem'
)
{
tlsOpts
.
key
=
fs
.
readFileSync
(
WIKI
.
config
.
ssl
.
key
)
tlsOpts
.
cert
=
fs
.
readFileSync
(
WIKI
.
config
.
ssl
.
cert
)
}
else
{
tlsOpts
.
pfx
=
fs
.
readFileSync
(
WIKI
.
config
.
ssl
.
pfx
)
}
if
(
!
_
.
isEmpty
(
WIKI
.
config
.
ssl
.
passphrase
))
{
tlsOpts
.
passphrase
=
WIKI
.
config
.
ssl
.
passphrase
}
if
(
!
_
.
isEmpty
(
WIKI
.
config
.
ssl
.
dhparam
))
{
tlsOpts
.
dhparam
=
WIKI
.
config
.
ssl
.
dhparam
}
}
catch
(
err
)
{
WIKI
.
logger
.
error
(
'Failed to setup HTTPS server parameters:'
)
WIKI
.
logger
.
error
(
err
)
return
process
.
exit
(
1
)
}
WIKI
.
server
=
https
.
createServer
(
tlsOpts
,
app
)
}
else
{
WIKI
.
logger
.
info
(
`HTTP Server on port: [
${
WIKI
.
config
.
port
}
]`
)
WIKI
.
server
=
http
.
createServer
(
app
)
}
WIKI
.
server
.
listen
(
WIKI
.
config
.
port
,
WIKI
.
config
.
bindIP
)
var
openConnections
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment