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
076e923d
Commit
076e923d
authored
Jul 22, 2018
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: save page + create event for storage targets
parent
cb84df7a
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
158 additions
and
89 deletions
+158
-89
admin-contribute.vue
client/components/admin/admin-contribute.vue
+6
-1
editor.vue
client/components/editor.vue
+2
-0
editor-code.vue
client/components/editor/editor-code.vue
+1
-0
create.gql
client/graph/editor/create.gql
+2
-2
editor.js
client/store/editor.js
+7
-6
data.yml
server/app/data.yml
+7
-0
queue.js
server/core/queue.js
+7
-3
pages.js
server/db/models/pages.js
+20
-0
storage.js
server/db/models/storage.js
+15
-0
users.js
server/db/models/users.js
+0
-1
page.js
server/graph/resolvers/page.js
+2
-9
page.graphql
server/graph/schemas/page.graphql
+6
-4
sync-storage.js
server/jobs/sync-storage.js
+20
-0
storage.js
server/modules/storage/azure/storage.js
+7
-7
storage.js
server/modules/storage/digitalocean/storage.js
+7
-7
storage.js
server/modules/storage/disk/storage.js
+7
-7
storage.js
server/modules/storage/dropbox/storage.js
+7
-7
storage.js
server/modules/storage/gdrive/storage.js
+7
-7
storage.js
server/modules/storage/git/storage.js
+7
-7
storage.js
server/modules/storage/onedrive/storage.js
+7
-7
storage.js
server/modules/storage/s3/storage.js
+7
-7
storage.js
server/modules/storage/scp/storage.js
+7
-7
No files found.
client/components/admin/admin-contribute.vue
View file @
076e923d
...
...
@@ -12,10 +12,15 @@
v-divider.mt-3
v-subheader
{{
$t
(
'admin:contribute.fundOurWork'
)
}}
.body-1.pl-3
{{
$t
(
'admin:contribute.openCollective'
)
}}
v-card-actions.m
t-3.m
l-2
v-card-actions.ml-2
v-btn(depressed, color='primary', href='https://opencollective.com/wikijs')
v-icon(left) local_atm
span
{{
$t
(
'admin:contribute.makeADonation'
)
}}
.body-1.mt-3.pl-3
{{
$t
(
'admin:contribute.tshirts'
)
}}
v-card-actions.ml-2
v-btn(depressed, color='primary', href='https://wikijs.threadless.com')
v-icon(left) shopping_cart
span
{{
$t
(
'admin:contribute.shop'
)
}}
v-divider.mt-3
v-subheader
{{
$t
(
'admin:contribute.contribute'
)
}}
.body-1.pl-3
...
...
client/components/editor.vue
View file @
076e923d
...
...
@@ -94,9 +94,11 @@ export default {
const
resp
=
await
this
.
$apollo
.
mutate
({
mutation
:
createPageMutation
,
variables
:
{
content
:
this
.
$store
.
get
(
'editor/content'
),
description
:
this
.
$store
.
get
(
'editor/description'
),
editor
:
'markdown'
,
locale
:
this
.
$store
.
get
(
'editor/locale'
),
isPrivate
:
false
,
isPublished
:
this
.
$store
.
get
(
'editor/isPublished'
),
path
:
this
.
$store
.
get
(
'editor/path'
),
publishEndDate
:
this
.
$store
.
get
(
'editor/publishEndDate'
),
...
...
client/components/editor/editor-code.vue
View file @
076e923d
...
...
@@ -220,6 +220,7 @@ export default {
},
onCmInput
:
_
.
debounce
(
function
(
newContent
)
{
linesMap
=
[]
this
.
$store
.
set
(
'editor/content'
,
newContent
)
this
.
previewHTML
=
md
.
render
(
newContent
)
this
.
$nextTick
(()
=>
{
Prism
.
highlightAllUnder
(
this
.
$refs
.
editorPreview
)
...
...
client/graph/editor/create.gql
View file @
076e923d
mutation
(
$
description
:
String
,
$editor
:
String
,
$isPublished
:
Boolean
!,
$locale
:
String
!,
$path
:
String
!,
$publishEndDate
:
Date
,
$publishStartDate
:
Date
,
$tags
:
[
String
]
,
$title
:
String
!)
{
mutation
(
$
content
:
String
!,
$description
:
String
!,
$editor
:
String
!,
$isPrivate
:
Boolean
!,
$isPublished
:
Boolean
!,
$locale
:
String
!,
$path
:
String
!,
$publishEndDate
:
Date
,
$publishStartDate
:
Date
,
$tags
:
[
String
]!
,
$title
:
String
!)
{
pages
{
create
(
description
:
$description
,
editor
:
$editor
,
isPublished
:
$isPublished
,
locale
:
$locale
,
path
:
$path
,
publishEndDate
:
$publishEndDate
,
publishStartDate
:
$publishStartDate
,
tags
:
$tags
,
title
:
$title
)
{
create
(
content
:
$content
,
description
:
$description
,
editor
:
$editor
,
isPrivate
:
$isPrivate
,
isPublished
:
$isPublished
,
locale
:
$locale
,
path
:
$path
,
publishEndDate
:
$publishEndDate
,
publishStartDate
:
$publishStartDate
,
tags
:
$tags
,
title
:
$title
)
{
responseResult
{
succeeded
errorCode
...
...
client/store/editor.js
View file @
076e923d
import
{
make
}
from
'vuex-pathify'
const
state
=
{
title
:
''
,
content
:
''
,
description
:
''
,
tags
:
[],
path
:
''
,
isPublished
:
true
,
publishStartDate
:
''
,
publishEndDate
:
''
,
locale
:
'en'
,
mode
:
'create'
mode
:
'create'
,
path
:
''
,
publishEndDate
:
''
,
publishStartDate
:
''
,
tags
:
[],
title
:
''
}
export
default
{
...
...
server/app/data.yml
View file @
076e923d
...
...
@@ -61,12 +61,19 @@ jobs:
fetchGraphLocale
:
onInit
:
false
cron
:
false
concurrency
:
0
purgeUploads
:
onInit
:
true
cron
:
'
*/15
*
*
*
*'
concurrency
:
0
syncGraphLocales
:
onInit
:
true
cron
:
'
0
0
*
*
*'
concurrency
:
0
syncStorage
:
onInit
:
false
cron
:
false
concurrency
:
1
telemetry
:
BUGSNAG_ID
:
'
bb4b324d0675bcbba10025617fd2cec8'
BUGSNAG_REMOTE
:
'
https://notify.bugsnag.com'
...
...
server/core/queue.js
View file @
076e923d
...
...
@@ -10,10 +10,14 @@ module.exports = {
init
()
{
_
.
forOwn
(
WIKI
.
data
.
jobs
,
(
queueParams
,
queueName
)
=>
{
this
.
job
[
queueName
]
=
new
Bull
(
queueName
,
{
prefix
:
`q
-
${
WIKI
.
config
.
ha
.
uid
}
`
,
prefix
:
`q
ueue
`
,
redis
:
WIKI
.
config
.
redis
})
this
.
job
[
queueName
].
process
(
path
.
join
(
WIKI
.
SERVERPATH
,
`jobs/
${
_
.
kebabCase
(
queueName
)}
.js`
))
if
(
queueParams
.
concurrency
>
0
)
{
this
.
job
[
queueName
].
process
(
queueParams
.
concurrency
,
path
.
join
(
WIKI
.
SERVERPATH
,
`jobs/
${
_
.
kebabCase
(
queueName
)}
.js`
))
}
else
{
this
.
job
[
queueName
].
process
(
path
.
join
(
WIKI
.
SERVERPATH
,
`jobs/
${
_
.
kebabCase
(
queueName
)}
.js`
))
}
})
return
this
},
...
...
@@ -36,7 +40,7 @@ module.exports = {
return
Promise
.
each
(
_
.
keys
(
WIKI
.
data
.
jobs
),
queueName
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
keyStream
=
WIKI
.
redis
.
scanStream
({
match
:
`q
-
${
WIKI
.
config
.
ha
.
uid
}
:
${
queueName
}
:*`
match
:
`q
ueue
:
${
queueName
}
:*`
})
keyStream
.
on
(
'data'
,
resultKeys
=>
{
if
(
resultKeys
.
length
>
0
)
{
...
...
server/db/models/pages.js
View file @
076e923d
const
Model
=
require
(
'objection'
).
Model
/* global WIKI */
/**
* Pages model
*/
...
...
@@ -75,4 +77,22 @@ module.exports = class Page extends Model {
this
.
createdAt
=
new
Date
().
toISOString
()
this
.
updatedAt
=
new
Date
().
toISOString
()
}
static
async
createPage
(
opts
)
{
const
page
=
await
WIKI
.
db
.
pages
.
query
().
insertAndFetch
({
authorId
:
opts
.
authorId
,
content
:
opts
.
content
,
description
:
opts
.
description
,
editorKey
:
opts
.
editor
,
isPrivate
:
opts
.
isPrivate
,
isPublished
:
opts
.
isPublished
,
localeCode
:
opts
.
locale
,
path
:
opts
.
path
,
publishEndDate
:
opts
.
publishEndDate
,
publishStartDate
:
opts
.
publishStartDate
,
title
:
opts
.
title
})
await
WIKI
.
db
.
storage
.
createPage
(
page
)
return
page
}
}
server/db/models/storage.js
View file @
076e923d
...
...
@@ -86,4 +86,19 @@ module.exports = class Storage extends Model {
WIKI
.
logger
.
error
(
err
)
}
}
static
async
createPage
(
page
)
{
const
targets
=
await
WIKI
.
db
.
storage
.
query
().
where
(
'isEnabled'
,
true
)
if
(
targets
&&
targets
.
length
>
0
)
{
_
.
forEach
(
targets
,
target
=>
{
WIKI
.
queue
.
job
.
syncStorage
.
add
({
event
:
'created'
,
target
,
page
},
{
removeOnComplete
:
true
})
})
}
}
}
server/db/models/users.js
View file @
076e923d
...
...
@@ -193,7 +193,6 @@ module.exports = class User extends Model {
}
static
async
login
(
opts
,
context
)
{
console
.
info
(
context
)
if
(
_
.
has
(
WIKI
.
auth
.
strategies
,
opts
.
strategy
))
{
_
.
set
(
context
.
req
,
'body.email'
,
opts
.
username
)
_
.
set
(
context
.
req
,
'body.password'
,
opts
.
password
)
...
...
server/graph/resolvers/page.js
View file @
076e923d
...
...
@@ -22,16 +22,9 @@ module.exports = {
},
PageMutation
:
{
async
create
(
obj
,
args
,
context
)
{
const
page
=
await
WIKI
.
db
.
pages
.
query
().
insertAndFetch
({
path
:
args
.
path
,
title
:
args
.
title
,
description
:
args
.
description
,
const
page
=
await
WIKI
.
db
.
pages
.
createPage
({
...
args
,
isPrivate
:
false
,
isPublished
:
args
.
isPublished
,
publishStartDate
:
args
.
publishStartDate
,
publishEndDate
:
args
.
publishEndDate
,
localeCode
:
args
.
locale
,
editorKey
:
args
.
editor
,
authorId
:
context
.
req
.
user
.
id
})
return
{
...
...
server/graph/schemas/page.graphql
View file @
076e923d
...
...
@@ -34,20 +34,22 @@ type PageQuery {
type
PageMutation
{
create
(
description
:
String
editor
:
String
content
:
String
!
description
:
String
!
editor
:
String
!
isPublished
:
Boolean
!
isPrivate
:
Boolean
isPrivate
:
Boolean
!
locale
:
String
!
path
:
String
!
publishEndDate
:
Date
publishStartDate
:
Date
tags
:
[
String
]
tags
:
[
String
]
!
title
:
String
!
):
PageResponse
update
(
id
:
Int
!
content
:
String
description
:
String
editor
:
String
isPublished
:
Boolean
...
...
server/jobs/sync-storage.js
0 → 100644
View file @
076e923d
require
(
'../core/worker'
)
/* global WIKI */
module
.
exports
=
async
(
job
)
=>
{
WIKI
.
logger
.
info
(
`Syncing with storage provider
${
job
.
data
.
target
.
title
}
...`
)
try
{
const
target
=
require
(
`../modules/storage/
${
job
.
data
.
target
.
key
}
/storage.js`
)
target
[
job
.
data
.
event
].
call
({
config
:
job
.
data
.
target
.
config
,
mode
:
job
.
data
.
target
.
mode
,
page
:
job
.
data
.
page
})
WIKI
.
logger
.
info
(
`Syncing with storage provider
${
job
.
data
.
target
.
title
}
: [ COMPLETED ]`
)
}
catch
(
err
)
{
WIKI
.
logger
.
error
(
`Syncing with storage provider
${
job
.
data
.
target
.
title
}
: [ FAILED ]`
)
WIKI
.
logger
.
error
(
err
.
message
)
}
}
server/modules/storage/azure/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/digitalocean/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/disk/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/dropbox/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/gdrive/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/git/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/onedrive/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/s3/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
server/modules/storage/scp/storage.js
View file @
076e923d
module
.
exports
=
{
async
activated
(
opts
)
{
async
activated
()
{
},
async
deactivated
(
opts
)
{
async
deactivated
()
{
},
async
init
(
opts
)
{
async
init
()
{
},
async
created
(
opts
)
{
async
created
()
{
},
async
updated
(
opts
)
{
async
updated
()
{
},
async
deleted
(
opts
)
{
async
deleted
()
{
},
async
renamed
(
opts
)
{
async
renamed
()
{
}
}
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