Skip to content

Commit 19d1bf0

Browse files
authored
Merge pull request #1141 from solid/release/v5.0.0
Release v5
2 parents bbff254 + c0bbc99 commit 19d1bf0

File tree

151 files changed

+5340
-2529
lines changed

Some content is hidden

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

151 files changed

+5340
-2529
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ script:
3232
after_success:
3333
- snyk monitor
3434

35+
cache: npm
36+
3537
notifications:
3638
email:
3739

CHANGELOG.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,70 @@
11
# History
22

3+
## 5.0.0
4+
5+
- Node versions greater than 8 are supported.
6+
- Changes to vocabulary use:
7+
- `solid:inbox` is deprecated in favour of `ldp:inbox`.
8+
- `acl:defaultForNew` is deprecated in favour of `acl:default`.
9+
- Terms of Service may be added and enforced for new registrations,
10+
but is disabled by default.
11+
- DELETE operations on a resource now require that the user has write permissions on
12+
the file's container
13+
- Improved support for logout ensures users can use different
14+
identities.
15+
- The profile container is now public readable by default.
16+
- Access Control:
17+
- The Access Control List system has undergone extensive
18+
changes. Security has been tightened, and some unsafe practices that
19+
where web apps was authorized access in the past are now not
20+
permitted.
21+
- The browser-reported `Origin` header will now be checked by
22+
default, and the ACL system can be used to restrict access
23+
to applications for added security.
24+
- Users can add `trustedApp` entries to their profile using a new databrowser pane.
25+
You will see an 'A' icon added while you view a Person's profile URL
26+
with the data browser (might have to hit refresh in your browser and make sure you
27+
are viewing a WebId URL like https://localhost:8443/profile/card#me).
28+
- Logging is now verbose by default so the `-v` option has been
29+
removed and a `--quiet` option has been added to mute the log.
30+
- To be bug compliant with 4.x releases, if a rule for public readable
31+
root / does not exist, it will check in /index.html.acl (see issue #1063)
32+
- Command line options are now kebab-cased rather than camelCased,
33+
config options may be both.
34+
- Resource with no extension now have '$.ttl' appended in the filename (see upgrades notes below).
35+
- Many smaller fixes.
36+
37+
#### 5.0.0 Upgrade Notes
38+
39+
- As of v5.0.0, all Turtle files need an extension. (**Intervention needed when updating from < 5.0.0!**)
40+
- **How to upgrade?**
41+
1. Stop the server.
42+
2. Update node-solid-server to 5.0.0.
43+
3. Make a backup of your `data/` and `config/` folders.
44+
4. Invoke `solid migrate-legacy-resources -v`.
45+
This makes the files in your `data/` and `config/` folders
46+
automatically compatible with the new system.
47+
You only need to do this once.
48+
Different data folders can be migrated as well with the `-p` option:
49+
`solid migrate-legacy-resources -p my/custom/data/folder -v`
50+
5. You can now start the server again as usual.
51+
- **Why?**
52+
Before version 5.0.0, `https://pod.example/profile/card`
53+
would map to `file:///solid/profile/card`, with the _assumption_
54+
that it uses content-type `text/turtle`.
55+
Now, this URL will map to `file:///solid/profile/card$.ttl` instead,
56+
which makes the content-type automatically detectable.
57+
This fixes many of the old Content-Type-related bugs.
58+
_More information: https://www.w3.org/DesignIssues/HTTPFilenameMapping.html_
59+
360
## 4.4.0
461

562
- Introduce a quota system. Delete the /settings/serverSide.ttl in the
663
user's POD to disable, or edit to fit your resource constraints.
764

8-
965
#### Changelog is incomplete for much of the 4.x series
1066

11-
12-
## 4.1.0
67+
## 4.1.0
1368

1469
- Add support for Group Access Control Lists.
1570
- Fix `Vary` header.

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ $ solid start --help
167167
168168
--root [value] Root folder to serve (default: './data')
169169
--port [value] SSL port to use
170-
--serverUri [value] Solid server uri (default: 'https://localhost:8443')
170+
--server-uri [value] Solid server uri (default: 'https://localhost:8443')
171171
--webid Enable WebID authentication and access control (uses HTTPS)
172172
--mount [value] Serve on a specific URL path (default: '/')
173173
--config-path [value]
@@ -182,7 +182,7 @@ $ solid start --help
182182
--idp [value] Obsolete; use --multiuser
183183
--no-live Disable live support through WebSockets
184184
--proxy [value] Obsolete; use --corsProxy
185-
--corsProxy [value] Serve the CORS proxy on this path
185+
--cors-proxy [value] Serve the CORS proxy on this path
186186
--suppress-data-browser Suppress provision of a data browser
187187
--data-browser-path [value] An HTML file which is sent to allow users to browse the data (eg using mashlib.js)
188188
--suffix-acl [value] Suffix for acl files (default: '.acl')
@@ -191,18 +191,21 @@ $ solid start --help
191191
--error-pages [value] Folder from which to look for custom error pages files (files must be named <error-code>.html -- eg. 500.html)
192192
--force-user [value] Force a WebID to always be logged in (useful when offline)
193193
--strict-origin Enforce same origin policy in the ACL
194-
--useEmail Do you want to set up an email service?
194+
--use-email Do you want to set up an email service?
195195
--email-host [value] Host of your email service
196196
--email-port [value] Port of your email service
197197
--email-auth-user [value] User of your email service
198198
--email-auth-pass [value] Password of your email service
199-
--useApiApps Do you want to load your default apps on /api/apps?
199+
--use-api-apps Do you want to load your default apps on /api/apps?
200200
--api-apps [value] Path to the folder to mount on /api/apps
201201
--redirect-http-from [value] HTTP port or ','-separated ports to redirect to the solid server port (e.g. "80,8080").
202202
--server-name [value] A name for your server (not required, but will be presented on your server's frontpage)
203203
--server-description [value] A description of your server (not required)
204204
--server-logo [value] A logo that represents you, your brand, or your server (not required)
205-
-v, --verbose Print the logs to console
205+
--enforce-toc Do you want to enforce Terms & Conditions for your service?
206+
--toc-uri [value] URI to your Terms & Conditions
207+
--support-email [value] The support email you provide for your users (not required)
208+
-q, --quiet Do not print the logs to console
206209
-h, --help output usage information
207210
```
208211

@@ -226,8 +229,8 @@ docker run -p 8443:8443 --name solid node-solid-server
226229
```
227230

228231
This will enable you to login to solid on https://localhost:8443 and then create a new account
229-
but not yet use that account. After a new account is made you will need to create an entry for
230-
it in your local (/etc/)hosts file in line with the account and subdomain i.e.
232+
but not yet use that account. After a new account is made you will need to create an entry for
233+
it in your local (/etc/)hosts file in line with the account and subdomain i.e.
231234

232235
127.0.0.1 newsoliduser.localhost
233236

@@ -391,14 +394,13 @@ blacklist profanities by default.
391394

392395
## Quota
393396

394-
By default, a file `serverSide.ttl` will be installed to new PODs. Its
395-
current function is to set a quota for disk usage of just 25 MB, which
396-
is what we can be sure the current prototype can tolerate under
397-
load. This file is not writeable to users, but as server administrator
398-
you can remove it if you don't want to impose a quota. It is currently
399-
adviceable to remove it rather than set a large quota, because the
400-
current implementation will impair write performance if there is a lot
401-
of data.
397+
By default, a file `serverSide.ttl.inactive` will be installed to new
398+
PODs. If you rename it to `serverSide.ttl`, it will currently set a
399+
quota for disk usage. This file is not writeable to users, only
400+
server administrators who are authorized on the backend can modify
401+
it. It is currently adviceable to remove it or set it inactive rather
402+
than set a large quota, because the current implementation will impair
403+
write performance if there is a lot of data.
402404

403405
## Contribute to Solid
404406

bin/lib/cli-utils.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const fs = require('fs-extra')
2+
const { cyan, bold } = require('colorette')
3+
const { URL } = require('url')
4+
const LDP = require('../../lib/ldp')
5+
const AccountManager = require('../../lib/models/account-manager')
6+
const SolidHost = require('../../lib/models/solid-host')
7+
8+
module.exports.getAccountManager = getAccountManager
9+
module.exports.loadAccounts = loadAccounts
10+
module.exports.loadConfig = loadConfig
11+
module.exports.loadUsernames = loadUsernames
12+
13+
/**
14+
* Returns an instance of AccountManager
15+
*
16+
* @param {Object} config
17+
* @param {Object} [options]
18+
* @returns {AccountManager}
19+
*/
20+
function getAccountManager (config, options = {}) {
21+
const ldp = options.ldp || new LDP(config)
22+
const host = options.host || SolidHost.from({ port: config.port, serverUri: config.serverUri })
23+
return AccountManager.from({
24+
host,
25+
store: ldp,
26+
multiuser: config.multiuser
27+
})
28+
}
29+
30+
function loadConfig (program, options) {
31+
let argv = {
32+
...options,
33+
version: program.version()
34+
}
35+
let configFile = argv['configFile'] || './config.json'
36+
37+
try {
38+
const file = fs.readFileSync(configFile)
39+
40+
// Use flags with priority over config file
41+
const config = JSON.parse(file)
42+
argv = { ...config, ...argv }
43+
} catch (err) {
44+
// No file exists, not a problem
45+
console.log(cyan(bold('TIP')), 'create a config.json: `$ solid init`')
46+
}
47+
48+
return argv
49+
}
50+
51+
/**
52+
*
53+
* @param root
54+
* @param [serverUri] If not set, hostname must be set
55+
* @param [hostname] If not set, serverUri must be set
56+
* @returns {*}
57+
*/
58+
function loadAccounts ({ root, serverUri, hostname }) {
59+
const files = fs.readdirSync(root)
60+
hostname = hostname || new URL(serverUri).hostname
61+
const isUserDirectory = new RegExp(`.${hostname}$`)
62+
return files
63+
.filter(file => isUserDirectory.test(file))
64+
}
65+
66+
function loadUsernames ({ root, serverUri }) {
67+
const hostname = new URL(serverUri).hostname
68+
return loadAccounts({ root, hostname })
69+
.map(userDirectory => userDirectory.substr(0, userDirectory.length - hostname.length - 1))
70+
}

bin/lib/cli.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const program = require('commander')
22
const loadInit = require('./init')
33
const loadStart = require('./start')
44
const loadInvalidUsernames = require('./invalidUsernames')
5+
const loadMigrateLegacyResources = require('./migrateLegacyResources')
6+
const loadUpdateIndex = require('./updateIndex')
57
const { spawnSync } = require('child_process')
68
const path = require('path')
79

@@ -11,6 +13,8 @@ module.exports = function startCli (server) {
1113
loadInit(program)
1214
loadStart(program, server)
1315
loadInvalidUsernames(program)
16+
loadMigrateLegacyResources(program)
17+
loadUpdateIndex(program)
1418

1519
program.parse(process.argv)
1620
if (program.args.length === 0) program.help()
@@ -21,10 +25,15 @@ function getVersion () {
2125
// Obtain version from git
2226
const options = { cwd: __dirname, encoding: 'utf8' }
2327
const { stdout } = spawnSync('git', ['describe', '--tags'], options)
24-
return stdout.trim()
28+
const version = stdout.trim()
29+
if (version === '') {
30+
throw new Error('No git version here')
31+
}
32+
return version
2533
} catch (e) {
2634
// Obtain version from package.json
2735
const { version } = require(path.join(__dirname, '../../package.json'))
2836
return version
2937
}
3038
}
39+

bin/lib/common.js

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

bin/lib/init.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ function manipulateEmailSection (answers) {
8282

8383
function manipulateServerSection (answers) {
8484
answers.server = {
85-
name: answers['server-name'],
86-
description: answers['server-description'],
87-
logo: answers['server-logo']
85+
name: answers['server-info-name'],
86+
description: answers['server-info-description'],
87+
logo: answers['server-info-logo']
8888
}
8989
Object.keys(answers).forEach((answer) => {
90-
if (answer.startsWith('server-')) {
90+
if (answer.startsWith('server-info-')) {
9191
delete answers[answer]
9292
}
9393
})

bin/lib/invalidUsernames.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
const fs = require('fs-extra')
22
const Handlebars = require('handlebars')
33
const path = require('path')
4-
const { URL } = require('url')
54

6-
const { loadConfig } = require('./common')
5+
const { getAccountManager, loadConfig, loadUsernames } = require('./cli-utils')
76
const { isValidUsername } = require('../../lib/common/user-utils')
87
const blacklistService = require('../../lib/services/blacklist-service')
98
const { initConfigDir, initTemplateDirs } = require('../../lib/server-config')
109
const { fromServerConfig } = require('../../lib/models/oidc-manager')
1110

12-
const AccountManager = require('../../lib/models/account-manager')
1311
const EmailService = require('../../lib/services/email-service')
14-
const LDP = require('../../lib/ldp')
1512
const SolidHost = require('../../lib/models/solid-host')
1613

1714
module.exports = function (program) {
@@ -28,7 +25,7 @@ module.exports = function (program) {
2825

2926
const invalidUsernames = getInvalidUsernames(config)
3027
const host = SolidHost.from({ port: config.port, serverUri: config.serverUri })
31-
const accountManager = getAccountManager(config, host)
28+
const accountManager = getAccountManager(config, { host })
3229

3330
if (options.notify) {
3431
return notifyUsers(invalidUsernames, accountManager, config)
@@ -96,23 +93,9 @@ async function deleteUsers (usernames, accountManager, config, host) {
9693
console.info(`Deleted ${deletingUsers.length} users succeeded`)
9794
}
9895

99-
function getAccountManager (config, host) {
100-
const ldp = new LDP(config)
101-
return AccountManager.from({
102-
host,
103-
store: ldp,
104-
multiuser: config.multiuser
105-
})
106-
}
107-
10896
function getInvalidUsernames (config) {
109-
const files = fs.readdirSync(config.root)
110-
const hostname = new URL(config.serverUri).hostname
111-
const isUserDirectory = new RegExp(`.${hostname}$`)
112-
return files
113-
.filter(file => isUserDirectory.test(file))
114-
.map(userDirectory => userDirectory.substr(0, userDirectory.length - hostname.length - 1))
115-
.filter(username => !isValidUsername(username) || !blacklistService.validate(username))
97+
const usernames = loadUsernames(config)
98+
return usernames.filter(username => !isValidUsername(username) || !blacklistService.validate(username))
11699
}
117100

118101
function listUsernames (usernames) {

0 commit comments

Comments
 (0)