Skip to content

Commit 9a66ee9

Browse files
committed
Merge master into v5.0.0; Change an uncertain test to reflect changes
2 parents 100b156 + e63734e commit 9a66ee9

File tree

81 files changed

+3458
-1896
lines changed

Some content is hidden

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

81 files changed

+3458
-1896
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- "8.0"
5-
- "10.0"
4+
- "8"
5+
- "10"
6+
- "lts/*"
67
- "node"
78

89
addons:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ RUN openssl req \
88
-nodes \
99
-x509 \
1010
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \
11-
-keyout cert.key \
12-
-out cert.pem
11+
-keyout privkey.pem \
12+
-out fullchain.pem
1313
CMD npm run solid start

EXAMPLES.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ solid can be started on its own by using the solid binary. Below are some exampl
1212

1313
* Starting solid as an HTTPS server with WebID+TLS authentication. This parameter requires that the user specifies the location of the key and the certificate used to start the HTTPS server with the help of the appropriate parameters.
1414

15-
`$ solid --root /var/www --webid --cert ./cert.pem --key ./key.pem`
15+
`$ solid --root /var/www --webid --cert ./fullchain.pem --key ./privkey.pem`
1616

1717
* Start HTTPS with custom error pages. solid will look for a file in the specified directory of the form <error-code>.html. If it's not found it will default to node's error page.
1818

19-
`$ solid --root /var/www/ --webid --cert ./cert.pem --key ./key.pem --error-pages ./errors/`
19+
`$ solid --root /var/www/ --webid --cert ./fullchain.pem --key ./privkey.pem --error-pages ./errors/`
2020

2121
* solid makes use of special files used for things such as access control, metadata management, subscription to changes, etc. These files are recognized by solid because of their suffix, which can be customized with the command line options that start with 'suffix'.
2222

@@ -47,8 +47,3 @@ var existingApp; //Some existing Express app independent of solid.
4747
var app = solid(options);
4848
exisingApp.use('/mount-point', app);
4949
```
50-
51-
52-
53-
54-

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,18 @@ Solid requires SSL certificates to be valid, so you cannot use self-signed certi
7272
You need an SSL certificate from a _certificate authority_, such as your domain provider or [Let's Encrypt!](https://letsencrypt.org/getting-started/).
7373

7474
For testing purposes, you can use `bin/solid-test` with a _self-signed_ certificate, generated as follows:
75+
7576
```
76-
$ openssl genrsa 2048 > ../localhost.key
77-
$ openssl req -new -x509 -nodes -sha256 -days 3650 -key ../localhost.key -subj '/CN=*.localhost' > ../localhost.cert
77+
$ openssl req -outform PEM -keyform PEM -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout ../privkey.pem -days 365 -out ../fullchain.pem
78+
7879
```
7980

80-
Note that this example creates the `localhost.cert` and `localhost.key` files
81+
Note that this example creates the `fullchain.pem` and `privkey.pem` files
8182
in a directory one level higher from the current, so that you don't
8283
accidentally commit your certificates to `solid` while you're developing.
8384

85+
If you would like to get rid of the browser warnings, import your fullchain.pem certificate into your 'Trusted Root Certificate' store.
86+
8487
### Run multi-user server (intermediate)
8588

8689
You can run `solid` so that new users can sign up, in other words, get their WebIDs _username.yourdomain.com_.
@@ -168,6 +171,7 @@ $ solid start --help
168171
--webid Enable WebID authentication and access control (uses HTTPS)
169172
--mount [value] Serve on a specific URL path (default: '/')
170173
--config-path [value]
174+
--config-file [value]
171175
--db-path [value]
172176
--auth [value] Pick an authentication strategy for WebID: `tls` or `oidc`
173177
--owner [value] Set the owner of the storage (overwrites the root ACL file)
@@ -194,9 +198,20 @@ $ solid start --help
194198
--email-auth-pass [value] Password of your email service
195199
--useApiApps Do you want to load your default apps on /api/apps?
196200
--api-apps [value] Path to the folder to mount on /api/apps
201+
--redirect-http-from [value] HTTP port or ','-separated ports to redirect to the solid server port (e.g. "80,8080").
202+
--server-name [value] A name for your server (not required, but will be presented on your server's frontpage)
203+
--server-description [value] A description of your server (not required)
204+
--server-logo [value] A logo that represents you, your brand, or your server (not required)
197205
-v, --verbose Print the logs to console
206+
-h, --help output usage information
198207
```
199208

209+
Instead of using flags, these same options can also be configured via environment variables taking the form of `SOLID_` followed by the `SNAKE_CASE` of the flag. For example `--api-apps` can be set via the `SOLID_API_APPS`environment variable, and `--serverUri` can be set with `SOLID_SERVER_URI`.
210+
211+
CLI flags take precedence over Environment variables, which take precedence over entries in the config file.
212+
213+
Configuring Solid via the config file can be a concise and convenient method and is the generally recommended approach. CLI flags can be useful when you would like to override a single configuration parameter, and using environment variables can be helpful in situations where you wish to deploy a single generic Docker image to multiple environments.
214+
200215
## Use Docker
201216

202217
Build with:
@@ -360,6 +375,12 @@ In order to test a single component, you can run
360375
npm run test-(acl|formats|params|patch)
361376
```
362377

378+
## Blacklisted usernames
379+
380+
By default Solid will not allow [certain usernames as they might cause
381+
confusion or allow vulnerabilies for social engineering](https://github.com/marteinn/The-Big-Username-Blacklist).
382+
This list is configurable via `config/usernames-blacklist.json`. Solid does not
383+
blacklist profanities by default.
363384

364385
## Contributing
365386

bin/lib/init.js

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,9 @@ module.exports = function (program) {
3131
// Prompt to the user
3232
inquirer.prompt(questions)
3333
.then((answers) => {
34-
// setting email
35-
if (answers.useEmail) {
36-
answers.email = {
37-
host: answers['email-host'],
38-
port: answers['email-port'],
39-
secure: true,
40-
auth: {
41-
user: answers['email-auth-user'],
42-
pass: answers['email-auth-pass']
43-
}
44-
}
45-
delete answers['email-host']
46-
delete answers['email-port']
47-
delete answers['email-auth-user']
48-
delete answers['email-auth-pass']
49-
}
50-
51-
// clean answers
52-
Object.keys(answers).forEach((answer) => {
53-
if (answer.startsWith('use')) {
54-
delete answers[answer]
55-
}
56-
})
34+
manipulateEmailSection(answers)
35+
manipulateServerSection(answers)
36+
cleanupAnswers(answers)
5737

5838
// write config file
5939
const config = JSON.stringify(camelize(answers), null, ' ')
@@ -71,3 +51,44 @@ module.exports = function (program) {
7151
})
7252
})
7353
}
54+
55+
function cleanupAnswers (answers) {
56+
// clean answers
57+
Object.keys(answers).forEach((answer) => {
58+
if (answer.startsWith('use')) {
59+
delete answers[answer]
60+
}
61+
})
62+
}
63+
64+
function manipulateEmailSection (answers) {
65+
// setting email
66+
if (answers.useEmail) {
67+
answers.email = {
68+
host: answers['email-host'],
69+
port: answers['email-port'],
70+
secure: true,
71+
auth: {
72+
user: answers['email-auth-user'],
73+
pass: answers['email-auth-pass']
74+
}
75+
}
76+
delete answers['email-host']
77+
delete answers['email-port']
78+
delete answers['email-auth-user']
79+
delete answers['email-auth-pass']
80+
}
81+
}
82+
83+
function manipulateServerSection (answers) {
84+
answers.server = {
85+
name: answers['server-name'],
86+
description: answers['server-description'],
87+
logo: answers['server-logo']
88+
}
89+
Object.keys(answers).forEach((answer) => {
90+
if (answer.startsWith('server-')) {
91+
delete answers[answer]
92+
}
93+
})
94+
}

bin/lib/options.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const fs = require('fs')
22
const path = require('path')
33
const validUrl = require('valid-url')
4+
const { URL } = require('url')
45

56
module.exports = [
67
// {
@@ -317,6 +318,37 @@ module.exports = [
317318
}
318319
return true
319320
}
321+
},
322+
{
323+
name: 'server-name',
324+
help: 'A name for your server (not required, but will be presented on your server\'s frontpage)',
325+
prompt: true,
326+
default: answers => new URL(answers.serverUri).hostname
327+
},
328+
{
329+
name: 'server-description',
330+
help: 'A description of your server (not required)',
331+
prompt: true
332+
},
333+
{
334+
name: 'server-logo',
335+
help: 'A logo that represents you, your brand, or your server (not required)',
336+
prompt: true
337+
},
338+
{
339+
name: 'enforceToc',
340+
help: 'Do you want to enforce Terms & Conditions for your service?',
341+
flag: true,
342+
prompt: true,
343+
default: true,
344+
when: answers => answers.multiuser
345+
},
346+
{
347+
name: 'tocUri',
348+
help: 'URI to your Terms & Conditions',
349+
prompt: true,
350+
validate: validUri,
351+
when: answers => answers.enforceToc
320352
}
321353
]
322354

bin/lib/start.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,23 @@ module.exports = function (program, server) {
1313
options
1414
.filter((option) => !option.hide)
1515
.forEach((option) => {
16+
const configName = option.name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())
17+
const snakeCaseName = configName.replace(/([A-Z])/g, '_$1')
18+
const envName = `SOLID_${snakeCaseName.toUpperCase()}`
19+
1620
let name = '--' + option.name
1721
if (!option.flag) {
1822
name += ' [value]'
1923
}
20-
start.option(name, option.help)
24+
25+
if (process.env[envName]) {
26+
const raw = process.env[envName]
27+
const envValue = /^(true|false)$/.test(raw) ? raw === 'true' : raw
28+
29+
start.option(name, option.help, envValue)
30+
} else {
31+
start.option(name, option.help)
32+
}
2133
})
2234

2335
start.option('-v, --verbose', 'Print the logs to console')

common/css/bootstrap.min.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

common/css/bootstrap.min.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

common/css/solid.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.panel-login-tls,
2+
.panel-already-registered{
3+
text-align: center;
4+
}
5+
6+
/**
7+
* Password Strength
8+
*/
9+
10+
/* Remove the bottom border on the input to make the progress bar like a part of it */
11+
.control-progress{
12+
border-bottom-left-radius: 0;
13+
border-bottom-right-radius: 0;
14+
border-bottom: 0;
15+
}
16+
17+
/* Remove the top border on the progress bar to make the bar part of the input */
18+
.form-group .progress{
19+
border-top-left-radius: 0;
20+
border-top-right-radius: 0;
21+
height: 7px;
22+
margin-bottom: 0;
23+
}
24+
25+
.form-group .progress-bar{
26+
width: 0;
27+
}
28+
29+
/**
30+
* Password strength levels sizes for the progress bar
31+
*/
32+
.progress .level-0{
33+
width: 5%
34+
}
35+
36+
.progress .level-1{
37+
width: 25%;
38+
}
39+
40+
.progress .level-2{
41+
width: 50%;
42+
}
43+
44+
.progress .level-3{
45+
width: 75%;
46+
}
47+
48+
.progress .level-4{
49+
width: 100%;
50+
}

0 commit comments

Comments
 (0)