mirror of https://github.com/requarks/wiki
parent
aa57ea920e
commit
75eb277401
@ -0,0 +1,81 @@
|
||||
.unauthorized {
|
||||
background: linear-gradient(to bottom, darken(mc('blue', '900'), 10%) 0%, mc('red', '500') 100%);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: mc('grey', '50');
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display:block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-image: url('../static/svg/motif-diagonals.svg');
|
||||
background-position: center center;
|
||||
background-repeat: repeat;
|
||||
background-size: 50px;
|
||||
z-index: 0;
|
||||
opacity: .75;
|
||||
animation: onboardingBgReveal 50s linear infinite;
|
||||
|
||||
@include keyframes(onboardingBgReveal) {
|
||||
0% {
|
||||
background-position-y: 0;
|
||||
}
|
||||
100% {
|
||||
background-position-y: -2000px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
background-image: url('../static/svg/motif-overlay.svg');
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
opacity: .5;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
&-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 250px;
|
||||
margin-bottom: 3rem;
|
||||
z-index: 2;
|
||||
animation-duration: 2s;
|
||||
|
||||
@include until($tablet) {
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
z-index: 2;
|
||||
}
|
||||
h2 {
|
||||
margin-bottom: 3rem;
|
||||
z-index: 2;
|
||||
}
|
||||
.v-btn {
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 223 B |
@ -1,12 +0,0 @@
|
||||
FROM requarks/wiki:latest
|
||||
|
||||
# Replace with your email address:
|
||||
ENV WIKI_ADMIN_EMAIL admin@example.com
|
||||
|
||||
WORKDIR /var/wiki
|
||||
|
||||
# Replace your-config.yml with the path to your config file:
|
||||
ADD your-config.yml config.yml
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT [ "node", "server" ]
|
@ -1,19 +1,53 @@
|
||||
version: '3'
|
||||
# -- DEV DOCKER-COMPOSE --
|
||||
# -- DO NOT USE IN PRODUCTION! --
|
||||
|
||||
version: "3"
|
||||
services:
|
||||
wikidb:
|
||||
image: mongo
|
||||
expose:
|
||||
- '27017'
|
||||
command: '--smallfiles --logpath=/dev/null'
|
||||
volumes:
|
||||
- ./data/mongo:/data/db
|
||||
wikijs:
|
||||
image: 'requarks/wiki:latest'
|
||||
links:
|
||||
- wikidb
|
||||
ports:
|
||||
- '80:3000'
|
||||
|
||||
redis:
|
||||
image: redis:4-alpine
|
||||
logging:
|
||||
driver: "none"
|
||||
networks:
|
||||
- wikinet
|
||||
|
||||
db:
|
||||
image: postgres:9-alpine
|
||||
environment:
|
||||
WIKI_ADMIN_EMAIL: admin@example.com
|
||||
POSTGRES_DB: wiki
|
||||
POSTGRES_PASSWORD: wikijsrocks
|
||||
POSTGRES_USER: wikijs
|
||||
logging:
|
||||
driver: "none"
|
||||
volumes:
|
||||
- ./config.yml:/var/wiki/config.yml
|
||||
- db-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- wikinet
|
||||
|
||||
wiki:
|
||||
image: requarks/wiki:beta
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
environment:
|
||||
PORT: 3000 # DO NOT CHANGE! Use ports below to specify listening port.
|
||||
DB_TYPE: postgres
|
||||
DB_HOST: db
|
||||
DB_PORT: 5432
|
||||
DB_USER: wikijs
|
||||
DB_PASS: wikijsrocks
|
||||
DB_NAME: wiki
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
REDIS_DB: 0
|
||||
REDIS_PASS: ''
|
||||
networks:
|
||||
- wikinet
|
||||
ports:
|
||||
- "3000:3000" # <-- replace with "80:3000" to listen on port 80 instead
|
||||
|
||||
networks:
|
||||
wikinet:
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
|
@ -1,11 +0,0 @@
|
||||
exports.seed = (knex, Promise) => {
|
||||
return knex('settings')
|
||||
.insert([
|
||||
{ key: 'auth', value: {} },
|
||||
{ key: 'features', value: {} },
|
||||
{ key: 'logging', value: {} },
|
||||
{ key: 'site', value: {} },
|
||||
{ key: 'theme', value: {} },
|
||||
{ key: 'uploads', value: {} }
|
||||
])
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
const jwt = require('jsonwebtoken')
|
||||
const moment = require('moment')
|
||||
|
||||
const securityHelper = require('../helpers/security')
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
/**
|
||||
* Authentication middleware
|
||||
*/
|
||||
module.exports = {
|
||||
jwt(req, res, next) {
|
||||
WIKI.auth.passport.authenticate('jwt', {session: false}, async (err, user, info) => {
|
||||
if (err) { return next() }
|
||||
|
||||
// Expired but still valid within 7 days, just renew
|
||||
if (info instanceof Error && info.name === 'TokenExpiredError' && moment().subtract(14, 'days').isBefore(info.expiredAt)) {
|
||||
const jwtPayload = jwt.decode(securityHelper.extractJWT(req))
|
||||
try {
|
||||
const newToken = await WIKI.models.users.refreshToken(jwtPayload.id)
|
||||
user = newToken.user
|
||||
|
||||
// Try headers, otherwise cookies for response
|
||||
if (req.get('content-type') === 'application/json') {
|
||||
res.set('new-jwt', newToken.token)
|
||||
} else {
|
||||
res.cookie('jwt', newToken.token, { expires: moment().add(365, 'days').toDate() })
|
||||
}
|
||||
} catch (err) {
|
||||
return next()
|
||||
}
|
||||
}
|
||||
|
||||
// JWT is NOT valid
|
||||
if (!user) { return next() }
|
||||
|
||||
// JWT is valid
|
||||
req.logIn(user, { session: false }, (err) => {
|
||||
if (err) { return next(err) }
|
||||
next()
|
||||
})
|
||||
})(req, res, next)
|
||||
},
|
||||
checkPath(req, res, next) {
|
||||
// Is user authenticated ?
|
||||
|
||||
if (!req.isAuthenticated()) {
|
||||
if (WIKI.config.public !== true) {
|
||||
return res.redirect('/login')
|
||||
} else {
|
||||
// req.user = rights.guest
|
||||
res.locals.isGuest = true
|
||||
}
|
||||
} else {
|
||||
res.locals.isGuest = false
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
|
||||
// res.locals.rights = rights.check(req)
|
||||
|
||||
// if (!res.locals.rights.read) {
|
||||
// return res.render('error-forbidden')
|
||||
// }
|
||||
|
||||
// Expose user data
|
||||
|
||||
res.locals.user = req.user
|
||||
|
||||
return next()
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
extends master.pug
|
||||
|
||||
block body
|
||||
#root.is-fullscreen
|
||||
v-app
|
||||
.unauthorized
|
||||
.unauthorized-content
|
||||
img.animated.fadeIn(src='/svg/icon-delete-shield.svg', alt='Unauthorized')
|
||||
.headline= t('unauthorized.title')
|
||||
.subheading.mt-3= t('unauthorized.action.' + action)
|
||||
v-btn.mt-5(color='red lighten-4', href='javascript:window.history.go(-1);', large, outline)
|
||||
v-icon(left) arrow_back
|
||||
span= t('unauthorized.goback')
|
Loading…
Reference in new issue