Skip to content

Commit e4b4792

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/multi-0acb442647
2 parents 1ff6fcd + 88609e9 commit e4b4792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+585
-105
lines changed

config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
"requireComplete": false,
3434
"requireBestPractice": false,
3535
"removePublicEnabled": false,
36+
"suppressInfoLogs": false,
37+
"suppressDebugLogs": false,
38+
"suppressWarningLogs": false,
39+
"suppressErrorLogs": false,
3640
"namespaces" : {
3741
"xmlns:rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
3842
"xmlns:dcterms": "http://purl.org/dc/terms/",

docker/Dockerfile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,16 @@ RUN apk add nss git openjdk8-jre openjdk8 maven python alpine-sdk libxml2-dev ya
55
WORKDIR /synbiohub
66
COPY . .
77

8-
RUN rm -rf .git
8+
# RUN rm -rf .git
99

1010
RUN cd java && mvn package
1111
RUN git config --global url."https://".insteadOf git://
1212
RUN yarn install
1313

14-
RUN mkdir /mnt/data && \
15-
mkdir /mnt/data/backup && \
16-
mkdir /mnt/data/uploads && \
17-
mkdir /mnt/data/logs && \
18-
mkdir /mnt/data/icons && \
19-
mkdir /mnt/config
20-
21-
COPY docker/config.local.json /mnt/config/config.local.json
14+
COPY docker/config.local.json config.initial.local.json
2215
COPY docker/healthcheck.js healthcheck.js
2316
COPY docker/entry.sh entry.sh
24-
25-
RUN ln -s /mnt/config/config.local.json ./config.local.json && \
26-
touch /mnt/data/synbiohub.sqlite && ln -s /mnt/data/synbiohub.sqlite ./synbiohub.sqlite && \
27-
ln -s /mnt/data/backup . && \
28-
ln -s /mnt/data/uploads . && \
29-
ln -s /mnt/data/logs . && \
30-
ln -s /mnt/data/icons public/.
17+
COPY docker/first_run.sh first_run.sh
3118

3219
EXPOSE 7777
3320

docker/entry.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22

3+
./first_run.sh
34
node synbiohub.js | tee synbiohub.log

docker/first_run.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
# make directories if needed:
4+
mkdir -p /mnt/data
5+
mkdir -p /mnt/data/backup
6+
mkdir -p /mnt/data/uploads
7+
mkdir -p /mnt/data/logs
8+
mkdir -p /mnt/data/icons
9+
mkdir -p /mnt/config
10+
11+
SBH_DIR="/synbiohub"
12+
13+
MNT_CONFIG="/mnt/config/config.local.json"
14+
if [ ! -e "$MNT_CONFIG" ]; then
15+
echo "config missing. Copying initial config"
16+
cp "$SBH_DIR/config.initial.local.json" "$MNT_CONFIG"
17+
fi
18+
19+
MNT_SQL="/mnt/data/synbiohub.sqlite"
20+
if [ ! -e "$MNT_SQL" ]; then
21+
echo "sqlite file missing. Creating."
22+
touch "$MNT_SQL"
23+
fi
24+
25+
# check for links:
26+
if [ ! -e "$SBH_DIR/config.local.json" ]; then
27+
ln -s "$MNT_CONFIG" "$SBH_DIR/config.local.json"
28+
fi
29+
30+
if [ ! -e "$SBH_DIR/synbiohub.sqlite" ]; then
31+
ln -s "$MNT_SQL" "$SBH_DIR/synbiohub.sqlite"
32+
fi
33+
34+
if [ ! -e "$SBH_DIR/data/backup" ]; then
35+
ln -s "/mnt/data/backup" "$SBH_DIR/."
36+
fi
37+
38+
if [ ! -e "$SBH_DIR/data/uploads" ]; then
39+
ln -s "/mnt/data/uploads" "$SBH_DIR/."
40+
fi
41+
42+
if [ ! -e "$SBH_DIR/data/logs" ]; then
43+
ln -s "/mnt/data/logs" "$SBH_DIR/."
44+
fi
45+
46+
if [ ! -e "$SBH_DIR/data/icons" ]; then
47+
ln -s "/mnt/data/icons" "$SBH_DIR/public/."
48+
fi

java/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
</plugins>
4343
</build>
4444
<repositories>
45-
<repository>
46-
<id>ossrh</id>
47-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
48-
</repository>
4945
<repository>
5046
<id>biojava-legacy-repo</id>
5147
<name>BioJava's Git based legacy maven repo</name>
5248
<url>https://github.com/biojava/maven-repo/raw/master/</url>
53-
</repository>
49+
</repository>
50+
<repository>
51+
<id>local-repo</id>
52+
<url>file://${project.basedir}/repo</url>
53+
</repository>
5454
</repositories>
5555
<dependencies>
5656
<dependency>
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.sbolstandard</groupId>
6+
<artifactId>libSBOLj</artifactId>
7+
<version>2.4.1-SNAPSHOT</version>
8+
<description>POM was created from install:install-file</description>
9+
</project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metadata modelVersion="1.1.0">
3+
<groupId>org.sbolstandard</groupId>
4+
<artifactId>libSBOLj</artifactId>
5+
<version>2.4.1-SNAPSHOT</version>
6+
<versioning>
7+
<snapshot>
8+
<localCopy>true</localCopy>
9+
</snapshot>
10+
<lastUpdated>20251018220309</lastUpdated>
11+
<snapshotVersions>
12+
<snapshotVersion>
13+
<extension>jar</extension>
14+
<value>2.4.1-SNAPSHOT</value>
15+
<updated>20251018220309</updated>
16+
</snapshotVersion>
17+
<snapshotVersion>
18+
<extension>pom</extension>
19+
<value>2.4.1-SNAPSHOT</value>
20+
<updated>20251018215724</updated>
21+
</snapshotVersion>
22+
</snapshotVersions>
23+
</versioning>
24+
</metadata>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metadata>
3+
<groupId>org.sbolstandard</groupId>
4+
<artifactId>libSBOLj</artifactId>
5+
<versioning>
6+
<versions>
7+
<version>2.4.1-SNAPSHOT</version>
8+
</versions>
9+
<lastUpdated>20251018220309</lastUpdated>
10+
</versioning>
11+
</metadata>

lib/actions/updateCollectionIcon.js

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const fs = require('fs')
33
const config = require('../config')
44
const extend = require('xtend')
5+
const path = require('path')
56

67
const getOwnedBy = require('../query/ownedBy')
78

@@ -13,41 +14,52 @@ const mkdirp = require('mkdirp')
1314

1415
module.exports = function (req, res) {
1516
const { graphUri, uri, url } = getUrisFromReq(req, res)
16-
return getOwnedBy(uri, graphUri).then((ownedBy) => {
17-
if (ownedBy.indexOf(config.get('databasePrefix') + 'user/' + req.user.username) === -1) {
18-
if (!req.accepts('text/html')) {
19-
res.status(403).type('text/plain').send('Not authorized to update this collection icon')
20-
} else {
21-
const locals = {
22-
config: config.get(),
23-
section: 'errors',
24-
user: req.user,
25-
errors: [ 'Not authorized to update this collection icon' ]
17+
if (req.method === 'GET') {
18+
const collectionIcons = config.get('collectionIcons')
19+
const iconFile = collectionIcons[uri]
20+
if (iconFile) {
21+
const dir = path.resolve(__dirname, '../../public')
22+
res.sendFile(iconFile, { root: dir })
23+
} else {
24+
res.status(403).type('text/plain').send('No icon for this collection')
25+
}
26+
} else {
27+
return getOwnedBy(uri, graphUri).then((ownedBy) => {
28+
if (ownedBy.indexOf(config.get('databasePrefix') + 'user/' + req.user.username) === -1) {
29+
if (!req.accepts('text/html')) {
30+
res.status(403).type('text/plain').send('Not authorized to update this collection icon')
31+
} else {
32+
const locals = {
33+
config: config.get(),
34+
section: 'errors',
35+
user: req.user,
36+
errors: [ 'Not authorized to update this collection icon' ]
37+
}
38+
res.status(403).send(pug.renderFile('templates/views/errors/errors.jade', locals))
2639
}
27-
res.status(403).send(pug.renderFile('templates/views/errors/errors.jade', locals))
2840
}
29-
}
3041

31-
if (req.file) {
32-
var iconFile = req.file
42+
if (req.file) {
43+
var iconFile = req.file
3344

34-
var collectionIcons = config.get('collectionIcons')
35-
const iconFilename = 'public/icons/' + iconFile.originalname
45+
var collectionIcons = config.get('collectionIcons')
46+
const iconFilename = 'public/icons/' + iconFile.originalname
3647

37-
mkdirp('public/icons').then(() => {
38-
fs.writeFileSync(iconFilename, iconFile.buffer)
39-
})
48+
mkdirp('public/icons').then(() => {
49+
fs.writeFileSync(iconFilename, iconFile.buffer)
50+
})
4051

41-
collectionIcons = extend(collectionIcons, {
42-
[uri]: '/icons/' + iconFile.originalname
43-
})
52+
collectionIcons = extend(collectionIcons, {
53+
[uri]: '/icons/' + iconFile.originalname
54+
})
4455

45-
config.set('collectionIcons', collectionIcons)
46-
}
47-
if (!req.accepts('text/html')) {
48-
res.status(200).type('text/plain').send('Success')
49-
} else {
50-
res.redirect(url)
51-
}
52-
})
56+
config.set('collectionIcons', collectionIcons)
57+
}
58+
if (!req.accepts('text/html')) {
59+
res.status(200).type('text/plain').send('Success')
60+
} else {
61+
res.redirect(url)
62+
}
63+
})
64+
}
5365
}

0 commit comments

Comments
 (0)