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
f5aa726c
Commit
f5aa726c
authored
May 14, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: search not indexing properly + cjk/arabic validators
parent
8f974a3a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
26 additions
and
23 deletions
+26
-23
regex.js
server/app/regex.js
+2
-2
uploads.js
server/controllers/uploads.js
+1
-1
entry.js
server/helpers/entry.js
+1
-1
security.js
server/helpers/security.js
+1
-1
entries.js
server/libs/entries.js
+4
-0
local.js
server/libs/local.js
+1
-1
markdown.js
server/libs/markdown.js
+7
-8
search.js
server/libs/search.js
+2
-2
profile.pug
server/views/pages/admin/profile.pug
+2
-2
settings.pug
server/views/pages/admin/settings.pug
+1
-1
users-edit.pug
server/views/pages/admin/users-edit.pug
+2
-2
users.pug
server/views/pages/admin/users.pug
+2
-2
No files found.
server/app/regex.js
View file @
f5aa726c
'use strict'
module
.
exports
=
{
arabic
:
/
([\u
0600-
\u
06ff
]
|
[\u
0750-
\u
077f
]
|
[\u
fb50-
\u
fc3f
]
|
[\u
fe70-
\u
fefc
])
/
,
cjk
:
/
([\u
4E00-
\u
9FBF
]
|
[\u
3040-
\u
309F
\u
30A0-
\u
30FF
]
|
[
ㄱ-ㅎ가-힣ㅏ-ㅣ
])
/
,
arabic
:
'
\
u0600-
\
u06ff
\
u0750-
\
u077f
\
ufb50-
\
ufc3f
\
ufe70-
\
ufefc'
,
cjk
:
'
\
u4E00-
\
u9FBF
\
u3040-
\
u309F
\
u30A0-
\
u30FFㄱ-ㅎ가-힣ㅏ-ㅣ'
,
youtube
:
/
(?:(?:
youtu
\.
be
\/
|v
\/
|vi
\/
|u
\/\w\/
|embed
\/)
|
(?:(?:
watch
)?\?
v
(?:
i
)?
=|&v
(?:
i
)?
=
))([^
#&?
]
*
)
.*/
,
vimeo
:
/vimeo.com
\/(?:
channels
\/(?:\w
+
\/)?
|groups
\/(?:[^/]
*
)\/
videos
\/
|album
\/(?:\d
+
)\/
video
\/
|
)(\d
+
)(?:
$|
\/
|
\?)
/
,
dailymotion
:
/
(?:
dailymotion
\.
com
(?:\/
embed
)?(?:\/
video|
\/
hub
)
|dai
\.
ly
)\/([
0-9a-z
]
+
)(?:[
-_0-9a-zA-Z
]
+
(?:
#video=
)?([
a-z0-9
]
+
)?)?
/
...
...
server/controllers/uploads.js
View file @
f5aa726c
...
...
@@ -12,7 +12,7 @@ const fs = Promise.promisifyAll(require('fs-extra'))
const
path
=
require
(
'path'
)
const
_
=
require
(
'lodash'
)
const
validPathRe
=
new
RegExp
(
'^(
([a-z0-9/-]|'
+
appdata
.
regex
.
cjk
.
source
+
')
+
\\
.[a-z0-9]+)$'
)
const
validPathRe
=
new
RegExp
(
'^(
[a-z0-9/-'
+
appdata
.
regex
.
cjk
+
appdata
.
regex
.
arabic
+
']
+
\\
.[a-z0-9]+)$'
)
const
validPathThumbsRe
=
new
RegExp
(
'^([a-z0-9]+
\\
.png)$'
)
// ==========================================
...
...
server/helpers/entry.js
View file @
f5aa726c
...
...
@@ -14,7 +14,7 @@ module.exports = {
*/
parsePath
(
urlPath
)
{
urlPath
=
qs
.
unescape
(
urlPath
)
let
wlist
=
new
RegExp
(
'
(?!([^a-z0-9]|'
+
appdata
.
regex
.
cjk
.
source
+
'|[/-]))
'
,
'g'
)
let
wlist
=
new
RegExp
(
'
[^a-z0-9'
+
appdata
.
regex
.
cjk
+
appdata
.
regex
.
arabic
+
'/-]
'
,
'g'
)
urlPath
=
_
.
toLower
(
urlPath
).
replace
(
wlist
,
''
)
...
...
server/helpers/security.js
View file @
f5aa726c
...
...
@@ -6,7 +6,7 @@ const _ = require('lodash')
module
.
exports
=
{
sanitizeCommitUser
(
user
)
{
let
wlist
=
new
RegExp
(
'
(?!([^a-zA-Z0-9-_.
\'
,& ]|'
+
appdata
.
regex
.
cjk
.
source
+
'))
'
,
'g'
)
let
wlist
=
new
RegExp
(
'
[^a-zA-Z0-9-_.
\'
,& '
+
appdata
.
regex
.
cjk
+
appdata
.
regex
.
arabic
+
']
'
,
'g'
)
return
{
name
:
_
.
chain
(
user
.
name
).
replace
(
wlist
,
''
).
trim
().
value
(),
email
:
appconfig
.
git
.
showUserEmail
?
user
.
email
:
appconfig
.
git
.
serverEmail
...
...
server/libs/entries.js
View file @
f5aa726c
...
...
@@ -266,6 +266,10 @@ module.exports = {
},
{
new
:
true
,
upsert
:
true
}).
then
(
result
=>
{
let
plainResult
=
result
.
toObject
()
plainResult
.
text
=
content
.
text
return
plainResult
})
}).
then
(
result
=>
{
return
self
.
updateTreeInfo
().
then
(()
=>
{
...
...
server/libs/local.js
View file @
f5aa726c
...
...
@@ -154,7 +154,7 @@ module.exports = {
*/
validateUploadsFilename
(
f
,
fld
,
isImage
)
{
let
fObj
=
path
.
parse
(
f
)
let
fname
=
_
.
chain
(
fObj
.
name
).
trim
().
toLower
().
kebabCase
().
value
().
replace
(
new
RegExp
(
'
(?!([^a-z0-9-]|'
+
appdata
.
regex
.
cjk
.
source
+
'))
'
,
'g'
),
''
)
let
fname
=
_
.
chain
(
fObj
.
name
).
trim
().
toLower
().
kebabCase
().
value
().
replace
(
new
RegExp
(
'
[^a-z0-9-'
+
appdata
.
regex
.
cjk
+
appdata
.
regex
.
arabic
+
']
'
,
'g'
),
''
)
let
fext
=
_
.
toLower
(
fObj
.
ext
)
if
(
isImage
&&
!
_
.
includes
([
'.jpg'
,
'.jpeg'
,
'.png'
,
'.gif'
,
'.webp'
],
fext
))
{
...
...
server/libs/markdown.js
View file @
f5aa726c
...
...
@@ -87,6 +87,10 @@ const videoRules = [
}
]
// Non-markdown filter
const
textRegex
=
new
RegExp
(
'
\\
b[a-z0-9-.,'
+
appdata
.
regex
.
cjk
+
appdata
.
regex
.
arabic
+
']+
\\
b'
,
'g'
)
/**
* Parse markdown content and build TOC tree
*
...
...
@@ -290,20 +294,15 @@ const parseMeta = (content) => {
* @return {String} Text-only version
*/
const
removeMarkdown
=
(
content
)
=>
{
return
mdRemove
(
_
.
chain
(
content
)
return
_
.
join
(
mdRemove
(
_
.
chain
(
content
)
.
replace
(
/<!--
?([
a-zA-Z
]
+
)
:
(
.*
)
-->/g
,
''
)
.
replace
(
/```
[^
`
]
+
```/g
,
''
)
.
replace
(
/```
([^
`
]
|`
)
+
?
```/g
,
''
)
.
replace
(
/`
[^
`
]
+`/g
,
''
)
.
replace
(
new
RegExp
(
'(?!mailto:)(?:(?:http|https|ftp)://)(?:
\\
S+(?::
\\
S*)?@)?(?:(?:(?:[1-9]
\\
d?|1
\\
d
\\
d|2[01]
\\
d|22[0-3])(?:
\\
.(?:1?
\\
d{1,2}|2[0-4]
\\
d|25[0-5])){2}(?:
\\
.(?:[0-9]
\\
d?|1
\\
d
\\
d|2[0-4]
\\
d|25[0-4]))|(?:(?:[a-z
\\
u00a1-
\\
uffff0-9]+-?)*[a-z
\\
u00a1-
\\
uffff0-9]+)(?:
\\
.(?:[a-z
\\
u00a1-
\\
uffff0-9]+-?)*[a-z
\\
u00a1-
\\
uffff0-9]+)*(?:
\\
.(?:[a-z
\\
u00a1-
\\
uffff]{2,})))|localhost)(?::
\\
d{2,5})?(?:(/|
\\
?|#)[^
\\
s]*)?'
,
'g'
),
''
)
.
replace
(
/
\r?\n
|
\r
/g
,
' '
)
.
deburr
()
.
toLower
()
.
replace
(
/
(\b([^
a-z
]
+
)\b)
/g
,
' '
)
.
replace
(
/
[^
a-z
]
+/g
,
' '
)
.
replace
(
/
(\b(\w{1,2})\b(\W
|$
))
/g
,
''
)
.
replace
(
/
\s\s
+/g
,
' '
)
.
value
()
)
)
.
replace
(
/
\r?\n
|
\r
/g
,
' '
).
match
(
textRegex
),
' '
)
}
module
.
exports
=
{
...
...
server/libs/search.js
View file @
f5aa726c
...
...
@@ -92,7 +92,7 @@ module.exports = {
title
:
content
.
title
,
subtitle
:
content
.
subtitle
||
''
,
parent
:
content
.
parent
||
''
,
content
:
content
.
conten
t
||
''
content
:
content
.
tex
t
||
''
}]).
then
(()
=>
{
winston
.
log
(
'verbose'
,
'Entry '
+
content
.
_id
+
' added/updated to search index.'
)
return
true
...
...
@@ -160,7 +160,7 @@ module.exports = {
.
deburr
()
.
toLower
()
.
trim
()
.
replace
(
/
[^
a-z0-9
]
/g
,
''
)
.
replace
(
/
[^
a-z0-9
]
/g
,
'
'
)
.
value
()
let
arrTerms
=
_
.
chain
(
terms
)
.
split
(
' '
)
...
...
server/views/pages/admin/profile.pug
View file @
f5aa726c
...
...
@@ -45,9 +45,9 @@ block adminContent
default: i.icon-warning
= t('auth:providers.' + user.provider)
label.label= t('admin:profile.membersince')
p.control=
userM
oment(user.createdAt).format('LL')
p.control=
m
oment(user.createdAt).format('LL')
label.label= t('admin:profile.lastprofileupdate')
p.control=
userM
oment(user.updatedAt).format('LL')
p.control=
m
oment(user.updatedAt).format('LL')
script(type='text/javascript').
var usrDataName = "!{user.name}";
server/views/pages/admin/settings.pug
View file @
f5aa726c
...
...
@@ -12,7 +12,7 @@ block adminContent
.section-block
p #{t('admin:settings.currentversion')}: #[strong= sysversion.current]
if sysversion.latest
p #{t('admin:settings.latestversion')}: #[strong= sysversion.latest] #[em (Published #{
userM
oment(sysversion.latestPublishedAt).fromNow()})]
p #{t('admin:settings.latestversion')}: #[strong= sysversion.latest] #[em (Published #{
m
oment(sysversion.latestPublishedAt).fromNow()})]
p
if sysversion.current !== sysversion.latest
button.button.is-deep-orange(v-on:click='upgrade')= t('admin:settings.upgrade')
...
...
server/views/pages/admin/users-edit.pug
View file @
f5aa726c
...
...
@@ -34,8 +34,8 @@ block adminContent
when 'ldap': i.icon-arrow-repeat-outline
default: i.icon-warning
= t('auth:providers.' + usr.provider)
td.is-centered=
userM
oment(usr.createdAt).format('lll')
td.is-centered=
userM
oment(usr.updatedAt).format('lll')
td.is-centered=
m
oment(usr.createdAt).format('lll')
td.is-centered=
m
oment(usr.updatedAt).format('lll')
.form-sections
section
label.label= t('admin:profile.email')
...
...
server/views/pages/admin/users.pug
View file @
f5aa726c
...
...
@@ -41,7 +41,7 @@ block adminContent
when 'ldap': i.icon-arrow-repeat-outline
default: i.icon-warning
= t('auth:providers.' + usr.provider)
td.is-centered=
userM
oment(usr.createdAt).format('lll')
td.is-centered=
userM
oment(usr.updatedAt).format('lll')
td.is-centered=
m
oment(usr.createdAt).format('lll')
td.is-centered=
m
oment(usr.updatedAt).format('lll')
include ../../modals/admin-createuser.pug
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