Compare commits
5 Commits
6ce3734124
...
37a469a419
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37a469a419 | ||
|
|
8c4bb5e8ba | ||
|
|
8eba73a29b | ||
|
|
873734b1e0 | ||
|
|
f634ec7bba |
@@ -22,8 +22,14 @@ if [ -d "/config" ];then
|
|||||||
CONFDIR="/config"
|
CONFDIR="/config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# create home directory with full access that git can access
|
||||||
|
mkdir -p /home/mykb
|
||||||
|
chmod 0777 -R /home/mykb
|
||||||
|
|
||||||
cd /opt/mykb
|
cd /opt/mykb
|
||||||
|
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
|
export HOME=/home/mykb
|
||||||
|
|
||||||
if [ -z "$PUID" ];then
|
if [ -z "$PUID" ];then
|
||||||
echo 'no PUID set running as default user'
|
echo 'no PUID set running as default user'
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
"isomorphic-unfetch": "^3.0.0",
|
"isomorphic-unfetch": "^3.0.0",
|
||||||
"jsonwebtoken": "^8.3.0",
|
"jsonwebtoken": "^8.3.0",
|
||||||
"keymirror": "^0.1.1",
|
"keymirror": "^0.1.1",
|
||||||
"next": "^7.0.2",
|
"next": "^8.1.1-canary.52",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
"passport-jwt": "^4.0.0",
|
"passport-jwt": "^4.0.0",
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
"eslint-plugin-react": "^7.11.1",
|
"eslint-plugin-react": "^7.11.1",
|
||||||
"husky": "^1.1.3",
|
"husky": "^1.1.3",
|
||||||
"lint-staged": "^8.0.4",
|
"lint-staged": "^8.0.4",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.5",
|
||||||
"prettier": "^1.15.1",
|
"prettier": "^1.15.1",
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
"server-destroy": "^1.0.1",
|
"server-destroy": "^1.0.1",
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ export default async function checkLogin(req) {
|
|||||||
verified: true,
|
verified: true,
|
||||||
jwt,
|
jwt,
|
||||||
}
|
}
|
||||||
|
} else if (res.status === 400) {
|
||||||
|
user = {}
|
||||||
|
delete localStorage.jwt
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ module.exports = function docs(app) {
|
|||||||
if (!doc) return notFound(res)
|
if (!doc) return notFound(res)
|
||||||
if (!isOkDoc({ name: name || doc.name, dir, md }, kb, res)) return
|
if (!isOkDoc({ name: name || doc.name, dir, md }, kb, res)) return
|
||||||
let newDir = typeof dir === 'string' ? dir : doc.dir
|
let newDir = typeof dir === 'string' ? dir : doc.dir
|
||||||
const oldDir = path.join(docsDir, doc.dir)
|
const oldPath = path.join(docsDir, doc.dir, doc.name)
|
||||||
const oldPath = path.join(oldDir, doc.name)
|
|
||||||
const docPath = path.join(docsDir, newDir, name || doc.name)
|
const docPath = path.join(docsDir, newDir, name || doc.name)
|
||||||
const oldRelPath = oldPath.split(docsDir + '/')[1]
|
const oldRelPath = oldPath.split(docsDir + '/')[1]
|
||||||
const curRelPath = docPath.split(docsDir + '/')[1]
|
const curRelPath = docPath.split(docsDir + '/')[1]
|
||||||
@@ -125,13 +124,14 @@ module.exports = function docs(app) {
|
|||||||
}
|
}
|
||||||
await tryRmdir(docsDir, oldRelPath)
|
await tryRmdir(docsDir, oldRelPath)
|
||||||
|
|
||||||
if (useGit && isNewPath) {
|
if (useGit) {
|
||||||
await git.rm(oldPath)
|
let commitMsg = `updated doc ${curRelPath}`
|
||||||
|
if (isNewPath) {
|
||||||
|
git.rm(oldPath)
|
||||||
|
commitMsg = `renamed doc ${oldRelPath} to ${curRelPath}`
|
||||||
|
}
|
||||||
await git.add(docPath)
|
await git.add(docPath)
|
||||||
await git.commit(`renamed doc ${oldRelPath} to ${curRelPath}`)
|
await git.commit(commitMsg)
|
||||||
} else if (useGit) {
|
|
||||||
await git.add(docPath)
|
|
||||||
await git.commit(`updated doc ${curRelPath}`)
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return serverError(res, err)
|
return serverError(res, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user