Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
d22e74f0
Commit
d22e74f0
authored
6 years ago
by
Nikos Marinos
Browse files
Options
Downloads
Patches
Plain Diff
work with Koosum
parent
13dcdd67
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!93
Shared data model
,
!94
Dev
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/ftp-integration/api.js
+34
-20
34 additions, 20 deletions
server/ftp-integration/api.js
server/xsweet-conversion/index.js
+5
-4
5 additions, 4 deletions
server/xsweet-conversion/index.js
yarn.lock
+197
-2141
197 additions, 2141 deletions
yarn.lock
with
236 additions
and
2165 deletions
server/ftp-integration/api.js
+
34
−
20
View file @
d22e74f0
...
...
@@ -25,6 +25,7 @@ const path = require('path')
const
{
exec
}
=
require
(
'
child_process
'
)
const
config
=
require
(
'
config
'
)
const
rfr
=
require
(
'
rfr
'
)
const
xsweetConverter
=
rfr
(
'
server/xsweet-conversion
'
)
const
{
bulkUploaderEmail
}
=
rfr
(
'
server/email
'
)
// global.globalPath = ''
...
...
@@ -164,25 +165,26 @@ function runProcess(packagePath) {
createTempDir
().
then
(
tmpPath
=>
extractFiles
(
packagePath
,
tmpPath
).
then
(
tmpPath
=>
parseManifest
(
tmpPath
,
packageName
,
submitter
).
then
(
parsedInfo
=>
parseXml
(
parsedInfo
.
metaXml
).
then
(
xmlObj
=>
convertFromInk
(
pubsweetServer
,
parsedInfo
,
token
).
then
(
async
convertedManuscript
=>
{
const
manuscriptDb
=
await
createManuscript
(
pubsweetServer
,
xmlObj
,
parsedInfo
,
convertedManuscript
,
tmpPath
,
submitter
,
packageName
,
error
=>
{
logger
.
error
(
error
)
tidyUp
(
packagePath
,
tmpPath
,
null
,
true
)
},
)
tidyUp
(
packagePath
,
tmpPath
,
manuscriptDb
)
},
),
parseXml
(
parsedInfo
.
metaXml
).
then
(
async
xmlObj
=>
{
// convertFromInk(pubsweetServer, parsedInfo, token).then(
// async convertedManuscript => {
const
manuscriptDb
=
await
createManuscript
(
pubsweetServer
,
xmlObj
,
parsedInfo
,
// convertedManuscript,
tmpPath
,
submitter
,
packageName
,
error
=>
{
logger
.
error
(
error
)
tidyUp
(
packagePath
,
tmpPath
,
null
,
true
)
},
)
tidyUp
(
packagePath
,
tmpPath
,
manuscriptDb
)
},
// ),
),
),
),
...
...
@@ -518,7 +520,7 @@ async function createManuscript(
pubsweetServer
,
xmlObj
,
parsedInfo
,
htmlManuscript
,
//
htmlManuscript,
tmpPath
,
submitter
,
packageName
,
...
...
@@ -639,6 +641,7 @@ async function createManuscript(
)
}
/*
if (htmlManuscript) {
const fileURI = `${tmpPath}/preview.html`
promises.push(
...
...
@@ -664,6 +667,7 @@ async function createManuscript(
}),
)
}
*/
let
manuscriptdb
await
Promise
.
all
(
promises
)
...
...
@@ -679,6 +683,14 @@ async function createManuscript(
submitter
.
userId
,
'
submitter
'
,
)
const
files
=
parsedInfo
.
files
const
manuscriptFileURI
=
files
.
filter
(
tmp
=>
tmp
.
type
===
'
manuscript
'
,
)[
0
].
fileURI
await
xsweetConverter
.
xsweetConvert
(
manuscriptFileURI
,
manuscriptdb
.
id
)
const
input
=
{
id
:
manuscriptdb
.
id
,
status
:
'
submitted
'
,
...
...
@@ -689,6 +701,7 @@ async function createManuscript(
return
manuscriptdb
}
/*
function convertFromInk(pubsweetServer, parsedInfo, token) {
const manuscript = parsedInfo.files.find(file => file.type === 'manuscript')
if (manuscript && manuscript.filename.endsWith('.docx')) {
...
...
@@ -718,6 +731,7 @@ function convertFromInk(pubsweetServer, parsedInfo, token) {
resolve(null)
})
}
*/
function
validateEmail
(
email
)
{
const
re
=
/^
(([^
<>()[
\]\\
.,;:
\s
@"
]
+
(\.[^
<>()[
\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
...
...
This diff is collapsed.
Click to expand it.
server/xsweet-conversion/index.js
+
5
−
4
View file @
d22e74f0
...
...
@@ -12,19 +12,20 @@ const db = require('../utils/db.js')
// '/home/yogmatee/projects/xmlValidation_files/xweet_files/tiana.docx'
/*
xsweetConvert(
'/home/yogmatee/projects/xmlValidation_files/xweet_files/tiana.docx',
'EMS90002',
)
*/
function
xsweetConvert
(
fileUrl
,
manuscriptId
)
{
module
.
exports
.
xsweetConvert
=
function
xsweetConvert
(
fileUrl
,
manuscriptId
)
{
const
options
=
{
method
:
'
POST
'
,
uri
:
'
http://localhost:3000/convertDocxToHTML
'
,
formData
:
{
docx
:
fs
.
createReadStream
(
'
/home/yogmatee/projects/xmlValidation_files/xweet_files/tiana.docx
'
,
),
docx
:
fs
.
createReadStream
(
fileUrl
),
},
headers
:
{
/* 'content-type': 'multipart/form-data' */
...
...
This diff is collapsed.
Click to expand it.
yarn.lock
+
197
−
2141
View file @
d22e74f0
source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment