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
69e644e1
You need to sign in or sign up before continuing.
Commit
69e644e1
authored
Sep 08, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: code linting
parent
7634bd26
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
151 additions
and
139 deletions
+151
-139
nav-header.vue
client/components/common/nav-header.vue
+18
-12
editor-markdown.vue
client/components/editor/editor-markdown.vue
+15
-15
mixins.scss
client/scss/base/mixins.scss
+59
-59
editor.js
client/store/editor.js
+4
-4
index.js
client/store/index.js
+9
-9
user.js
client/store/user.js
+11
-11
page.vue
client/themes/default/components/page.vue
+14
-8
auth.js
server/core/auth.js
+4
-4
sideloader.js
server/core/sideloader.js
+2
-2
system.js
server/core/system.js
+2
-2
users.js
server/models/users.js
+6
-6
engine.js
server/modules/search/db/engine.js
+7
-7
yarn.lock
yarn.lock
+0
-0
No files found.
client/components/common/nav-header.vue
View file @
69e644e1
...
@@ -41,13 +41,17 @@
...
@@ -41,13 +41,17 @@
v-list-item-title.body-2
{{
$t
(
'common:header.edit'
)
}}
v-list-item-title.body-2
{{
$t
(
'common:header.edit'
)
}}
v-list-item.pl-4(@click='pageHistory', v-if='mode !== `history`')
v-list-item.pl-4(@click='pageHistory', v-if='mode !== `history`')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-history
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-history
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.history'
)
}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.history'
)
}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-list-item.pl-4(@click='pageSource', v-if='mode !== `source`')
v-list-item.pl-4(@click='pageSource', v-if='mode !== `source`')
v-list-item-avatar(size='24'): v-icon(color='indigo') mdi-code-tags
v-list-item-avatar(size='24'): v-icon(color='indigo') mdi-code-tags
v-list-item-title.body-2
{{
$t
(
'common:header.viewSource'
)
}}
v-list-item-title.body-2
{{
$t
(
'common:header.viewSource'
)
}}
v-list-item.pl-4(@click='pageMove', v-if='isAuthenticated')
v-list-item.pl-4(@click='pageMove', v-if='isAuthenticated')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-content-save-move-outline
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-content-save-move-outline
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.move'
)
}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.move'
)
}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-list-item.pl-4(@click='pageDelete', v-if='isAuthenticated')
v-list-item.pl-4(@click='pageDelete', v-if='isAuthenticated')
v-list-item-avatar(size='24'): v-icon(color='red darken-2') mdi-trash-can-outline
v-list-item-avatar(size='24'): v-icon(color='red darken-2') mdi-trash-can-outline
v-list-item-title.body-2
{{
$t
(
'common:header.delete'
)
}}
v-list-item-title.body-2
{{
$t
(
'common:header.delete'
)
}}
...
@@ -55,7 +59,9 @@
...
@@ -55,7 +59,9 @@
.overline.pa-4.grey--text
{{
$t
(
'common:header.assets'
)
}}
.overline.pa-4.grey--text
{{
$t
(
'common:header.assets'
)
}}
v-list-item.pl-4(@click='assets')
v-list-item.pl-4(@click='assets')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-folder-multiple-image
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-folder-multiple-image
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.imagesFiles'
)
}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2
{{
$t
(
'common:header.imagesFiles'
)
}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-toolbar-title(:class='{ "mx-2": $vuetify.breakpoint.mdAndUp, "mx-0": $vuetify.breakpoint.smAndDown }')
v-toolbar-title(:class='{ "mx-2": $vuetify.breakpoint.mdAndUp, "mx-0": $vuetify.breakpoint.smAndDown }')
span.subheading
{{
title
}}
span.subheading
{{
title
}}
v-flex(md4, v-if='$vuetify.breakpoint.mdAndUp')
v-flex(md4, v-if='$vuetify.breakpoint.mdAndUp')
...
@@ -150,12 +156,11 @@
...
@@ -150,12 +156,11 @@
v-btn(icon, v-on='{ ...menu, ...tooltip }', :class='$vuetify.rtl ? `ml-3` : ``')
v-btn(icon, v-on='{ ...menu, ...tooltip }', :class='$vuetify.rtl ? `ml-3` : ``')
v-icon(color='grey') mdi-web
v-icon(color='grey') mdi-web
span
{{
$t
(
'common:header.language'
)
}}
span
{{
$t
(
'common:header.language'
)
}}
v-list
.py-0
v-list
(nav)
template(v-for='(lc, idx) of locales')
template(v-for='(lc, idx) of locales')
v-list-item(@click='changeLocale(lc)')
v-list-item(@click='changeLocale(lc)')
v-list-item-action: v-chip(:color='lc.code === locale ? `blue` : `grey`', small, label, dark)
{{
lc
.
code
.
toUpperCase
()
}}
v-list-item-action: v-chip(:color='lc.code === locale ? `blue` : `grey`', small, label, dark)
{{
lc
.
code
.
toUpperCase
()
}}
v-list-item-title
{{
lc
.
name
}}
v-list-item-title
{{
lc
.
name
}}
v-divider.my-0(v-if='idx < locales.length - 1')
v-tooltip(bottom, v-if='isAuthenticated && isAdmin')
v-tooltip(bottom, v-if='isAuthenticated && isAdmin')
template(v-slot:activator='{ on }')
template(v-slot:activator='{ on }')
v-btn.btn-animate-rotate(icon, href='/a', v-on='on', :class='$vuetify.rtl ? `ml-3` : ``')
v-btn.btn-animate-rotate(icon, href='/a', v-on='on', :class='$vuetify.rtl ? `ml-3` : ``')
...
@@ -170,7 +175,7 @@
...
@@ -170,7 +175,7 @@
v-avatar(v-else-if='picture.kind === `image`', :size='34')
v-avatar(v-else-if='picture.kind === `image`', :size='34')
v-img(:src='picture.url')
v-img(:src='picture.url')
span
{{
$t
(
'common:header.account'
)
}}
span
{{
$t
(
'common:header.account'
)
}}
v-list
.py-0
v-list
(nav)
v-list-item.py-3.grey(:class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-5`')
v-list-item.py-3.grey(:class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-5`')
v-list-item-avatar
v-list-item-avatar
v-avatar.blue(v-if='picture.kind === `initials`', :size='40')
v-avatar.blue(v-if='picture.kind === `initials`', :size='40')
...
@@ -180,18 +185,19 @@
...
@@ -180,18 +185,19 @@
v-list-item-content
v-list-item-content
v-list-item-title
{{
name
}}
v-list-item-title
{{
name
}}
v-list-item-subtitle
{{
email
}}
v-list-item-subtitle
{{
email
}}
v-divider.my-0
v-list-item(href='/w', disabled)
v-list-item(href='/w', disabled)
v-list-item-action: v-icon(color='blue') mdi-view-compact-outline
v-list-item-action: v-icon(color='blue') mdi-view-compact-outline
v-list-item-title
{{
$t
(
'common:header.myWiki'
)
}}
v-list-item-content
v-divider.my-0
v-list-item-title
{{
$t
(
'common:header.myWiki'
)
}}
v-list-item-subtitle.overline Coming soon
v-list-item(href='/p', disabled)
v-list-item(href='/p', disabled)
v-list-item-action: v-icon(color='blue') mdi-face-profile
v-list-item-action: v-icon(color='blue') mdi-face-profile
v-list-item-title
{{
$t
(
'common:header.profile'
)
}}
v-list-item-content
v-divider.my-0
v-list-item-title
{{
$t
(
'common:header.profile'
)
}}
v-list-item-subtitle.overline Coming soon
v-list-item(@click='logout')
v-list-item(@click='logout')
v-list-item-action: v-icon(color='red') mdi-logout
v-list-item-action: v-icon(color='red') mdi-logout
v-list-item-title
{{
$t
(
'common:header.logout'
)
}}
v-list-item-title
.red--text
{{
$t
(
'common:header.logout'
)
}}
v-tooltip(v-else, left)
v-tooltip(v-else, left)
template(v-slot:activator='{ on }')
template(v-slot:activator='{ on }')
...
...
client/components/editor/editor-markdown.vue
View file @
69e644e1
...
@@ -319,21 +319,21 @@ export default {
...
@@ -319,21 +319,21 @@ export default {
}
)
}
)
}
,
500
),
}
,
500
),
onCmPaste
(
cm
,
ev
)
{
onCmPaste
(
cm
,
ev
)
{
const
clipItems
=
(
ev
.
clipboardData
||
ev
.
originalEvent
.
clipboardData
).
items
//
const clipItems = (ev.clipboardData || ev.originalEvent.clipboardData).items
for
(
let
clipItem
of
clipItems
)
{
//
for (let clipItem of clipItems)
{
if
(
_
.
startsWith
(
clipItem
.
type
,
'image/'
))
{
//
if (_.startsWith(clipItem.type, 'image/'))
{
const
file
=
clipItem
.
getAsFile
()
//
const file = clipItem.getAsFile()
const
reader
=
new
FileReader
()
//
const reader = new FileReader()
reader
.
onload
=
evt
=>
{
//
reader.onload = evt =>
{
this
.
$store
.
commit
(
`loadingStart`
,
'editor-paste-image'
)
//
this.$store.commit(`loadingStart`, 'editor-paste-image')
this
.
insertAfter
({
//
this.insertAfter(
{
content
:
``
,
//
content: `
`,
newLine
:
true
//
newLine: true
}
)
//
}
)
}
//
}
reader
.
readAsDataURL
(
file
)
//
reader.readAsDataURL(file)
}
//
}
}
//
}
}
,
}
,
/**
/**
* Update cursor state
* Update cursor state
...
...
client/scss/base/mixins.scss
View file @
69e644e1
/**
/**
* Placeholder attribute for inputs
* Placeholder attribute for inputs
*
*
* @return {string} Placeholder attributes
* @return {string} Placeholder attributes
*/
*/
@mixin
placeholder
{
@mixin
placeholder
{
&
:
:-
webkit-input-placeholder
{
@content
};
&
:
:-
webkit-input-placeholder
{
@content
;}
&
:
:-
moz-placeholder
{
@content
}
&
:
:-
moz-placeholder
{
@content
;
}
&
:
-
ms-input-placeholder
{
@content
}
&
:
-
ms-input-placeholder
{
@content
;
}
&
:placeholder-shown
{
@content
};
&
:placeholder-shown
{
@content
;}
}
}
/**
/**
* Spinner element
* Spinner element
*
*
* @param {string} $color - Color
* @param {string} $color - Color
* @param {string} $dur - Animation Duration
* @param {string} $dur - Animation Duration
* @param {int} $width - Width
* @param {int} $width - Width
* @param {int} $height [$width] - height
* @param {int} $height [$width] - height
*
*
* @return {string} Spinner element
* @return {string} Spinner element
*/
*/
@mixin
spinner
(
$color
,
$dur
,
$width
,
$height
:
$width
)
{
@mixin
spinner
(
$color
,
$dur
,
$width
,
$height
:
$width
)
{
width
:
$width
;
width
:
$width
;
height
:
$height
;
height
:
$height
;
border-radius
:
50%
;
border-radius
:
50%
;
box-shadow
:
0
0
0
1px
rgba
(
0
,
0
,
0
,
0
.1
)
,
2px
1px
0
$color
;
box-shadow
:
0
0
0
1px
rgba
(
0
,
0
,
0
,
0
.1
)
,
2px
1px
0
$color
;
@include
prefix
(
animation
,
spin
$dur
linear
infinite
);
@include
prefix
(
animation
,
spin
$dur
linear
infinite
);
@include
keyframes
(
spin
)
{
@include
keyframes
(
spin
)
{
100
%
{
100
%
{
@include
prefix
(
transform
,
rotate
(
360deg
));
@include
prefix
(
transform
,
rotate
(
360deg
));
}
}
};
}
}
}
/**
/**
* Prefixes for keyframes
* Prefixes for keyframes
*
*
* @param {string} $animation-name - The animation name
* @param {string} $animation-name - The animation name
*
*
* @return {string} Prefixed keyframes attributes
* @return {string} Prefixed keyframes attributes
*/
*/
@mixin
keyframes
(
$animation-name
)
{
@mixin
keyframes
(
$animation-name
)
{
@-webkit-keyframes
#{
$animation-name
}
{
@-webkit-keyframes
#{
$animation-name
}
{
@content
;
@content
;
}
}
@-moz-keyframes
#{
$animation-name
}
{
@-moz-keyframes
#{
$animation-name
}
{
@content
;
@content
;
}
}
@-o-keyframes
#{
$animation-name
}
{
@-o-keyframes
#{
$animation-name
}
{
@content
;
@content
;
}
}
@keyframes
#{
$animation-name
}
{
@keyframes
#{
$animation-name
}
{
@content
;
@content
;
}
}
}
}
/**
/**
* Prefix function for browser compatibility
* Prefix function for browser compatibility
*
*
* @param {string} $property - Property name
* @param {string} $property - Property name
* @param {any} $value - Property value
* @param {any} $value - Property value
*
*
* @return {string} Prefixed attributes
* @return {string} Prefixed attributes
*/
*/
@mixin
prefix
(
$property
,
$value
)
{
@mixin
prefix
(
$property
,
$value
)
{
-webkit-
#{
$property
}
:
#{
$value
}
;
-webkit-
#{
$property
}
:
#{
$value
}
;
-moz-
#{
$property
}
:
#{
$value
}
;
-moz-
#{
$property
}
:
#{
$value
}
;
-ms-
#{
$property
}
:
#{
$value
}
;
-ms-
#{
$property
}
:
#{
$value
}
;
-o-
#{
$property
}
:
#{
$value
}
;
-o-
#{
$property
}
:
#{
$value
}
;
#{
$property
}
:
#{
$value
}
;
#{
$property
}
:
#{
$value
}
;
}
}
/**
/**
* Layout Mixins
* Layout Mixins
*/
*/
@mixin
from
(
$device
)
{
@mixin
from
(
$device
)
{
@media
screen
and
(
min-width
:
$device
)
{
@media
screen
and
(
min-width
:
$device
)
{
@content
;
@content
;
...
...
client/store/editor.js
View file @
69e644e1
...
@@ -18,11 +18,11 @@ export default {
...
@@ -18,11 +18,11 @@ export default {
state
,
state
,
mutations
:
{
mutations
:
{
...
make
.
mutations
(
state
),
...
make
.
mutations
(
state
),
pushMediaFolderTree
:
(
st
ate
,
folder
)
=>
{
pushMediaFolderTree
:
(
st
,
folder
)
=>
{
st
ate
.
media
.
folderTree
=
state
.
media
.
folderTree
.
concat
(
folder
)
st
.
media
.
folderTree
=
st
.
media
.
folderTree
.
concat
(
folder
)
},
},
popMediaFolderTree
:
(
st
ate
)
=>
{
popMediaFolderTree
:
(
st
)
=>
{
st
ate
.
media
.
folderTree
=
state
.
media
.
folderTree
.
slice
(
0
,
-
1
)
st
.
media
.
folderTree
=
st
.
media
.
folderTree
.
slice
(
0
,
-
1
)
}
}
}
}
}
}
client/store/index.js
View file @
69e644e1
...
@@ -33,24 +33,24 @@ export default new Vuex.Store({
...
@@ -33,24 +33,24 @@ export default new Vuex.Store({
},
},
mutations
:
{
mutations
:
{
...
make
.
mutations
(
state
),
...
make
.
mutations
(
state
),
loadingStart
(
st
ate
,
stackName
)
{
loadingStart
(
st
,
stackName
)
{
st
ate
.
loadingStack
=
_
.
union
(
state
.
loadingStack
,
[
stackName
])
st
.
loadingStack
=
_
.
union
(
st
.
loadingStack
,
[
stackName
])
},
},
loadingStop
(
st
ate
,
stackName
)
{
loadingStop
(
st
,
stackName
)
{
st
ate
.
loadingStack
=
_
.
without
(
state
.
loadingStack
,
stackName
)
st
.
loadingStack
=
_
.
without
(
st
.
loadingStack
,
stackName
)
},
},
showNotification
(
st
ate
,
opts
)
{
showNotification
(
st
,
opts
)
{
st
ate
.
notification
=
_
.
defaults
(
opts
,
{
st
.
notification
=
_
.
defaults
(
opts
,
{
message
:
''
,
message
:
''
,
style
:
'primary'
,
style
:
'primary'
,
icon
:
'cached'
,
icon
:
'cached'
,
isActive
:
true
isActive
:
true
})
})
},
},
updateNotificationState
(
st
ate
,
newState
)
{
updateNotificationState
(
st
,
newState
)
{
st
ate
.
notification
.
isActive
=
newState
st
.
notification
.
isActive
=
newState
},
},
pushGraphError
(
st
ate
,
err
)
{
pushGraphError
(
st
,
err
)
{
WIKI
.
$store
.
commit
(
'showNotification'
,
{
WIKI
.
$store
.
commit
(
'showNotification'
,
{
style
:
'red'
,
style
:
'red'
,
message
:
_
.
get
(
err
,
'graphQLErrors[0].message'
,
err
.
message
),
message
:
_
.
get
(
err
,
'graphQLErrors[0].message'
,
err
.
message
),
...
...
client/store/user.js
View file @
69e644e1
...
@@ -20,21 +20,21 @@ export default {
...
@@ -20,21 +20,21 @@ export default {
state
,
state
,
mutations
:
{
mutations
:
{
...
make
.
mutations
(
state
),
...
make
.
mutations
(
state
),
REFRESH_AUTH
(
st
ate
)
{
REFRESH_AUTH
(
st
)
{
const
jwtCookie
=
Cookies
.
get
(
'jwt'
)
const
jwtCookie
=
Cookies
.
get
(
'jwt'
)
if
(
jwtCookie
)
{
if
(
jwtCookie
)
{
try
{
try
{
const
jwtData
=
jwt
.
decode
(
jwtCookie
)
const
jwtData
=
jwt
.
decode
(
jwtCookie
)
st
ate
.
id
=
jwtData
.
id
st
.
id
=
jwtData
.
id
st
ate
.
email
=
jwtData
.
email
st
.
email
=
jwtData
.
email
st
ate
.
name
=
jwtData
.
name
st
.
name
=
jwtData
.
name
st
ate
.
pictureUrl
=
jwtData
.
pictureUrl
st
.
pictureUrl
=
jwtData
.
pictureUrl
st
ate
.
localeCode
=
jwtData
.
localeCode
st
.
localeCode
=
jwtData
.
localeCode
st
ate
.
defaultEditor
=
jwtData
.
defaultEditor
st
.
defaultEditor
=
jwtData
.
defaultEditor
st
ate
.
permissions
=
jwtData
.
permissions
st
.
permissions
=
jwtData
.
permissions
st
ate
.
iat
=
jwtData
.
iat
st
.
iat
=
jwtData
.
iat
st
ate
.
exp
=
jwtData
.
exp
st
.
exp
=
jwtData
.
exp
st
ate
.
authenticated
=
true
st
.
authenticated
=
true
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
debug
(
'Invalid JWT. Silent authentication skipped.'
)
console
.
debug
(
'Invalid JWT. Silent authentication skipped.'
)
}
}
...
...
client/themes/default/components/page.vue
View file @
69e644e1
...
@@ -78,21 +78,27 @@
...
@@ -78,21 +78,27 @@
color='teal lighten-5'
color='teal lighten-5'
v-for='(tag, idx) in tags'
v-for='(tag, idx) in tags'
:href='`/t/` + tag.tag'
:href='`/t/` + tag.tag'
:key='tag.tag'
:key='
`tag-` +
tag.tag'
)
)
v-icon(color='teal', left, small) mdi-
label
v-icon(color='teal', left, small) mdi-
tag
span.teal--text.text--darken-2
{{
tag
.
title
}}
span.teal--text.text--darken-2
{{
tag
.
title
}}
v-chip.mr-1(
label
color='teal lighten-5'
:href='`/t/` + tags.map(t => t.tag).join(`/`)'
)
v-icon(color='teal', size='20') mdi-tag-multiple
v-card.mb-5
v-card.mb-5
.pa-5
.pa-5
.overline.indigo--text.d-flex.align-center(:class='$vuetify.theme.dark ? `text--lighten-3` : ``')
.overline.indigo--text.d-flex.align-center(:class='$vuetify.theme.dark ? `text--lighten-3` : ``')
span
{{
$t
(
'common:page.lastEditedBy'
)
}}
span
{{
$t
(
'common:page.lastEditedBy'
)
}}
v-spacer
//-
v-spacer
v-tooltip(top, v-if='isAuthenticated')
//-
v-tooltip(top, v-if='isAuthenticated')
template(v-slot:activator='{ on }')
//-
template(v-slot:activator='{ on }')
v-btn.btn-animate-edit(icon, :href='"/h/" + locale + "/" + path', v-on='on', x-small)
//-
v-btn.btn-animate-edit(icon, :href='"/h/" + locale + "/" + path', v-on='on', x-small)
v-icon(color='grey', dense) mdi-history
//-
v-icon(color='grey', dense) mdi-history
span History
//-
span History
.body-2.grey--text(:class='darkMode ? `` : `text--darken-3`')
{{
authorName
}}
.body-2.grey--text(:class='darkMode ? `` : `text--darken-3`')
{{
authorName
}}
.caption.grey--text.text--darken-1
{{
updatedAt
|
moment
(
'calendar'
)
}}
.caption.grey--text.text--darken-1
{{
updatedAt
|
moment
(
'calendar'
)
}}
...
...
server/core/auth.js
View file @
69e644e1
...
@@ -120,8 +120,8 @@ module.exports = {
...
@@ -120,8 +120,8 @@ module.exports = {
}
else
{
}
else
{
res
.
cookie
(
'jwt'
,
newToken
.
token
,
{
expires
:
moment
().
add
(
365
,
'days'
).
toDate
()
})
res
.
cookie
(
'jwt'
,
newToken
.
token
,
{
expires
:
moment
().
add
(
365
,
'days'
).
toDate
()
})
}
}
}
catch
(
err
)
{
}
catch
(
err
c
)
{
WIKI
.
logger
.
warn
(
err
)
WIKI
.
logger
.
warn
(
err
c
)
return
next
()
return
next
()
}
}
}
}
...
@@ -137,8 +137,8 @@ module.exports = {
...
@@ -137,8 +137,8 @@ module.exports = {
}
}
// JWT is valid
// JWT is valid
req
.
logIn
(
user
,
{
session
:
false
},
(
err
)
=>
{
req
.
logIn
(
user
,
{
session
:
false
},
(
err
c
)
=>
{
if
(
err
)
{
return
next
(
err
)
}
if
(
err
c
)
{
return
next
(
errc
)
}
next
()
next
()
})
})
})(
req
,
res
,
next
)
})(
req
,
res
,
next
)
...
...
server/core/sideloader.js
View file @
69e644e1
...
@@ -45,8 +45,8 @@ module.exports = {
...
@@ -45,8 +45,8 @@ module.exports = {
_
.
set
(
lcObj
,
key
.
replace
(
':'
,
'.'
),
value
)
_
.
set
(
lcObj
,
key
.
replace
(
':'
,
'.'
),
value
)
})
})
const
localeExists
=
await
WIKI
.
models
.
locales
.
query
().
select
(
'code'
).
where
(
'code'
,
locale
.
code
).
first
()
const
locale
Db
Exists
=
await
WIKI
.
models
.
locales
.
query
().
select
(
'code'
).
where
(
'code'
,
locale
.
code
).
first
()
if
(
localeExists
)
{
if
(
locale
Db
Exists
)
{
await
WIKI
.
models
.
locales
.
query
().
update
({
await
WIKI
.
models
.
locales
.
query
().
update
({
code
:
locale
.
code
,
code
:
locale
.
code
,
strings
:
lcObj
,
strings
:
lcObj
,
...
...
server/core/system.js
View file @
69e644e1
...
@@ -71,8 +71,8 @@ module.exports = {
...
@@ -71,8 +71,8 @@ module.exports = {
}))
}))
resolve
(
true
)
resolve
(
true
)
}
catch
(
err
)
{
}
catch
(
err
c
)
{
reject
(
err
)
reject
(
err
c
)
}
}
db
.
close
()
db
.
close
()
})
})
...
...
server/models/users.js
View file @
69e644e1
...
@@ -291,8 +291,8 @@ module.exports = class User extends Model {
...
@@ -291,8 +291,8 @@ module.exports = class User extends Model {
mustChangePwd
:
true
,
mustChangePwd
:
true
,
continuationToken
:
pwdChangeToken
continuationToken
:
pwdChangeToken
})
})
}
catch
(
err
)
{
}
catch
(
err
c
)
{
WIKI
.
logger
.
warn
(
err
)
WIKI
.
logger
.
warn
(
err
c
)
return
reject
(
new
WIKI
.
Error
.
AuthGenericError
())
return
reject
(
new
WIKI
.
Error
.
AuthGenericError
())
}
}
}
}
...
@@ -308,14 +308,14 @@ module.exports = class User extends Model {
...
@@ -308,14 +308,14 @@ module.exports = class User extends Model {
tfaRequired
:
true
,
tfaRequired
:
true
,
continuationToken
:
tfaToken
continuationToken
:
tfaToken
})
})
}
catch
(
err
)
{
}
catch
(
err
c
)
{
WIKI
.
logger
.
warn
(
err
)
WIKI
.
logger
.
warn
(
err
c
)
return
reject
(
new
WIKI
.
Error
.
AuthGenericError
())
return
reject
(
new
WIKI
.
Error
.
AuthGenericError
())
}
}
}
}
context
.
req
.
logIn
(
user
,
{
session
:
!
strInfo
.
useForm
},
async
err
=>
{
context
.
req
.
logIn
(
user
,
{
session
:
!
strInfo
.
useForm
},
async
err
c
=>
{
if
(
err
)
{
return
reject
(
err
)
}
if
(
err
c
)
{
return
reject
(
errc
)
}
const
jwtToken
=
await
WIKI
.
models
.
users
.
refreshToken
(
user
)
const
jwtToken
=
await
WIKI
.
models
.
users
.
refreshToken
(
user
)
resolve
({
jwt
:
jwtToken
.
token
})
resolve
({
jwt
:
jwtToken
.
token
})
})
})
...
...
server/modules/search/db/engine.js
View file @
69e644e1
...
@@ -31,22 +31,22 @@ module.exports = {
...
@@ -31,22 +31,22 @@ module.exports = {
builder
.
andWhere
(
'path'
,
'like'
,
`
${
opts
.
path
}
%`
)
builder
.
andWhere
(
'path'
,
'like'
,
`
${
opts
.
path
}
%`
)
}
}
// TODO: Add user permissions filtering
// TODO: Add user permissions filtering
builder
.
andWhere
(
builder
=>
{
builder
.
andWhere
(
builder
Sub
=>
{
switch
(
WIKI
.
config
.
db
.
type
)
{
switch
(
WIKI
.
config
.
db
.
type
)
{
case
'postgres'
:
case
'postgres'
:
builder
.
where
(
'title'
,
'ILIKE'
,
`%
${
q
}
%`
)
builder
Sub
.
where
(
'title'
,
'ILIKE'
,
`%
${
q
}
%`
)
builder
.
orWhere
(
'description'
,
'ILIKE'
,
`%
${
q
}
%`
)
builder
Sub
.
orWhere
(
'description'
,
'ILIKE'
,
`%
${
q
}
%`
)
break
break
case
'mysql'
:
case
'mysql'
:
case
'mariadb'
:
case
'mariadb'
:
builder
.
whereRaw
(
`title LIKE '%?%' COLLATE utf8_general_ci`
,
[
q
])
builder
Sub
.
whereRaw
(
`title LIKE '%?%' COLLATE utf8_general_ci`
,
[
q
])
builder
.
orWhereRaw
(
`description LIKE '%?%' COLLATE utf8_general_ci`
,
[
q
])
builder
Sub
.
orWhereRaw
(
`description LIKE '%?%' COLLATE utf8_general_ci`
,
[
q
])
break
break
// TODO: MSSQL handling
// TODO: MSSQL handling
default
:
default
:
builder
.
where
(
'title'
,
'LIKE'
,
`%
${
q
}
%`
)
builder
Sub
.
where
(
'title'
,
'LIKE'
,
`%
${
q
}
%`
)
builder
.
orWhere
(
'description'
,
'LIKE'
,
`%
${
q
}
%`
)
builder
Sub
.
orWhere
(
'description'
,
'LIKE'
,
`%
${
q
}
%`
)
break
break
}
}
})
})
...
...
yarn.lock
View file @
69e644e1
This diff was suppressed by a .gitattributes entry.
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