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
48077fc9
You need to sign in or sign up before continuing.
Unverified
Commit
48077fc9
authored
Jun 24, 2022
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(admin): make page extensions configurable
parent
18ac9da4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
30 deletions
+55
-30
admin-general.vue
client/components/admin/admin-general.vue
+42
-24
data.yml
server/app/data.yml
+4
-4
common.js
server/controllers/common.js
+1
-1
site.js
server/graph/resolvers/site.js
+6
-1
site.graphql
server/graph/schemas/site.graphql
+2
-0
No files found.
client/components/admin/admin-general.vue
View file @
48077fc9
...
@@ -164,6 +164,19 @@
...
@@ -164,6 +164,19 @@
//- disabled
//- disabled
//- )
//- )
v-card.mt-5.animated.fadeInUp.wait-p6s
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title.subtitle-1 URL Handling
v-card-text
v-text-field(
outlined
:label='$t(`admin:general.pageExtensions`)'
v-model='config.pageExtensions'
prepend-icon='mdi-format-text-wrapping-overflow'
:hint='$t(`admin:general.pageExtensionsHint`)'
persistent-hint
)
component(:is='activeModal')
component(:is='activeModal')
</
template
>
</
template
>
...
@@ -202,7 +215,8 @@ export default {
...
@@ -202,7 +215,8 @@ export default {
featurePageRatings
:
false
,
featurePageRatings
:
false
,
featurePageComments
:
false
,
featurePageComments
:
false
,
featurePersonalWikis
:
false
,
featurePersonalWikis
:
false
,
featureTinyPNG
:
false
featureTinyPNG
:
false
,
pageExtensions
:
''
},
},
metaRobots
:
[
metaRobots
:
[
{
text
:
'Index'
,
value
:
'index'
},
{
text
:
'Index'
,
value
:
'index'
},
...
@@ -247,32 +261,34 @@ export default {
...
@@ -247,32 +261,34 @@ export default {
await
this
.
$apollo
.
mutate
({
await
this
.
$apollo
.
mutate
({
mutation
:
gql
`
mutation
:
gql
`
mutation (
mutation (
$host: String!
$host: String
$title: String!
$title: String
$description: String!
$description: String
$robots: [String]!
$robots: [String]
$analyticsService: String!
$analyticsService: String
$analyticsId: String!
$analyticsId: String
$company: String!
$company: String
$contentLicense: String!
$contentLicense: String
$logoUrl: String!
$logoUrl: String
$featurePageRatings: Boolean!
$pageExtensions: String
$featurePageComments: Boolean!
$featurePageRatings: Boolean
$featurePersonalWikis: Boolean!
$featurePageComments: Boolean
$featurePersonalWikis: Boolean
) {
) {
site {
site {
updateConfig(
updateConfig(
host: $host,
host: $host
title: $title,
title: $title
description: $description,
description: $description
robots: $robots,
robots: $robots
analyticsService: $analyticsService,
analyticsService: $analyticsService
analyticsId: $analyticsId,
analyticsId: $analyticsId
company: $company,
company: $company
contentLicense: $contentLicense,
contentLicense: $contentLicense
logoUrl: $logoUrl,
logoUrl: $logoUrl
featurePageRatings: $featurePageRatings,
pageExtensions: $pageExtensions
featurePageComments: $featurePageComments,
featurePageRatings: $featurePageRatings
featurePageComments: $featurePageComments
featurePersonalWikis: $featurePersonalWikis
featurePersonalWikis: $featurePersonalWikis
) {
) {
responseResult {
responseResult {
...
@@ -295,6 +311,7 @@ export default {
...
@@ -295,6 +311,7 @@ export default {
company
:
_
.
get
(
this
.
config
,
'company'
,
''
),
company
:
_
.
get
(
this
.
config
,
'company'
,
''
),
contentLicense
:
_
.
get
(
this
.
config
,
'contentLicense'
,
''
),
contentLicense
:
_
.
get
(
this
.
config
,
'contentLicense'
,
''
),
logoUrl
:
_
.
get
(
this
.
config
,
'logoUrl'
,
''
),
logoUrl
:
_
.
get
(
this
.
config
,
'logoUrl'
,
''
),
pageExtensions
:
_
.
get
(
this
.
config
,
'pageExtensions'
,
''
),
featurePageRatings
:
_
.
get
(
this
.
config
,
'featurePageRatings'
,
false
),
featurePageRatings
:
_
.
get
(
this
.
config
,
'featurePageRatings'
,
false
),
featurePageComments
:
_
.
get
(
this
.
config
,
'featurePageComments'
,
false
),
featurePageComments
:
_
.
get
(
this
.
config
,
'featurePageComments'
,
false
),
featurePersonalWikis
:
_
.
get
(
this
.
config
,
'featurePersonalWikis'
,
false
)
featurePersonalWikis
:
_
.
get
(
this
.
config
,
'featurePersonalWikis'
,
false
)
...
@@ -347,6 +364,7 @@ export default {
...
@@ -347,6 +364,7 @@ export default {
company
company
contentLicense
contentLicense
logoUrl
logoUrl
pageExtensions
featurePageRatings
featurePageRatings
featurePageComments
featurePageComments
featurePersonalWikis
featurePersonalWikis
...
...
server/app/data.yml
View file @
48077fc9
...
@@ -45,6 +45,10 @@ defaults:
...
@@ -45,6 +45,10 @@ defaults:
company
:
'
'
company
:
'
'
contentLicense
:
'
'
contentLicense
:
'
'
logoUrl
:
https://static.requarks.io/logo/wikijs-butterfly.svg
logoUrl
:
https://static.requarks.io/logo/wikijs-butterfly.svg
pageExtensions
:
-
md
-
html
-
txt
mail
:
mail
:
host
:
'
'
host
:
'
'
secure
:
true
secure
:
true
...
@@ -152,8 +156,4 @@ reservedPaths:
...
@@ -152,8 +156,4 @@ reservedPaths:
-
img
-
img
-
js
-
js
-
svg
-
svg
pageExtensions
:
-
md
-
html
-
txt
# ---------------------------------
# ---------------------------------
server/controllers/common.js
View file @
48077fc9
...
@@ -414,7 +414,7 @@ router.get('/_userav/:uid', async (req, res, next) => {
...
@@ -414,7 +414,7 @@ router.get('/_userav/:uid', async (req, res, next) => {
* View document / asset
* View document / asset
*/
*/
router
.
get
(
'/*'
,
async
(
req
,
res
,
next
)
=>
{
router
.
get
(
'/*'
,
async
(
req
,
res
,
next
)
=>
{
const
stripExt
=
_
.
some
(
WIKI
.
data
.
pageExtensions
,
ext
=>
_
.
endsWith
(
req
.
path
,
`.
${
ext
}
`
))
const
stripExt
=
_
.
some
(
WIKI
.
config
.
pageExtensions
,
ext
=>
_
.
endsWith
(
req
.
path
,
`.
${
ext
}
`
))
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
})
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
})
const
isPage
=
(
stripExt
||
pageArgs
.
path
.
indexOf
(
'.'
)
===
-
1
)
const
isPage
=
(
stripExt
||
pageArgs
.
path
.
indexOf
(
'.'
)
===
-
1
)
...
...
server/graph/resolvers/site.js
View file @
48077fc9
...
@@ -18,6 +18,7 @@ module.exports = {
...
@@ -18,6 +18,7 @@ module.exports = {
company
:
WIKI
.
config
.
company
,
company
:
WIKI
.
config
.
company
,
contentLicense
:
WIKI
.
config
.
contentLicense
,
contentLicense
:
WIKI
.
config
.
contentLicense
,
logoUrl
:
WIKI
.
config
.
logoUrl
,
logoUrl
:
WIKI
.
config
.
logoUrl
,
pageExtensions
:
WIKI
.
config
.
pageExtensions
.
join
(
', '
),
...
WIKI
.
config
.
seo
,
...
WIKI
.
config
.
seo
,
...
WIKI
.
config
.
features
,
...
WIKI
.
config
.
features
,
...
WIKI
.
config
.
security
,
...
WIKI
.
config
.
security
,
...
@@ -62,6 +63,10 @@ module.exports = {
...
@@ -62,6 +63,10 @@ module.exports = {
WIKI
.
config
.
logoUrl
=
_
.
trim
(
args
.
logoUrl
)
WIKI
.
config
.
logoUrl
=
_
.
trim
(
args
.
logoUrl
)
}
}
if
(
args
.
hasOwnProperty
(
'pageExtensions'
))
{
WIKI
.
config
.
pageExtensions
=
_
.
trim
(
args
.
pageExtensions
).
split
(
','
).
map
(
p
=>
p
.
trim
().
toLowerCase
()).
filter
(
p
=>
p
!==
''
)
}
WIKI
.
config
.
seo
=
{
WIKI
.
config
.
seo
=
{
description
:
_
.
get
(
args
,
'description'
,
WIKI
.
config
.
seo
.
description
),
description
:
_
.
get
(
args
,
'description'
,
WIKI
.
config
.
seo
.
description
),
robots
:
_
.
get
(
args
,
'robots'
,
WIKI
.
config
.
seo
.
robots
),
robots
:
_
.
get
(
args
,
'robots'
,
WIKI
.
config
.
seo
.
robots
),
...
@@ -104,7 +109,7 @@ module.exports = {
...
@@ -104,7 +109,7 @@ module.exports = {
forceDownload
:
_
.
get
(
args
,
'uploadForceDownload'
,
WIKI
.
config
.
uploads
.
forceDownload
)
forceDownload
:
_
.
get
(
args
,
'uploadForceDownload'
,
WIKI
.
config
.
uploads
.
forceDownload
)
}
}
await
WIKI
.
configSvc
.
saveToDb
([
'host'
,
'title'
,
'company'
,
'contentLicense'
,
'seo'
,
'logoUrl'
,
'auth'
,
'features'
,
'security'
,
'uploads'
])
await
WIKI
.
configSvc
.
saveToDb
([
'host'
,
'title'
,
'company'
,
'contentLicense'
,
'seo'
,
'logoUrl'
,
'
pageExtensions'
,
'
auth'
,
'features'
,
'security'
,
'uploads'
])
if
(
WIKI
.
config
.
security
.
securityTrustProxy
)
{
if
(
WIKI
.
config
.
security
.
securityTrustProxy
)
{
WIKI
.
app
.
enable
(
'trust proxy'
)
WIKI
.
app
.
enable
(
'trust proxy'
)
...
...
server/graph/schemas/site.graphql
View file @
48077fc9
...
@@ -33,6 +33,7 @@ type SiteMutation {
...
@@ -33,6 +33,7 @@ type SiteMutation {
company
:
String
company
:
String
contentLicense
:
String
contentLicense
:
String
logoUrl
:
String
logoUrl
:
String
pageExtensions
:
String
authAutoLogin
:
Boolean
authAutoLogin
:
Boolean
authEnforce2FA
:
Boolean
authEnforce2FA
:
Boolean
authHideLocal
:
Boolean
authHideLocal
:
Boolean
...
@@ -74,6 +75,7 @@ type SiteConfig {
...
@@ -74,6 +75,7 @@ type SiteConfig {
company
:
String
company
:
String
contentLicense
:
String
contentLicense
:
String
logoUrl
:
String
logoUrl
:
String
pageExtensions
:
String
authAutoLogin
:
Boolean
authAutoLogin
:
Boolean
authEnforce2FA
:
Boolean
authEnforce2FA
:
Boolean
authHideLocal
:
Boolean
authHideLocal
:
Boolean
...
...
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