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