solid-server 5.6.9-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.acl +10 -0
- package/.github/workflows/ci.yml +47 -0
- package/.nvmrc +1 -0
- package/.snyk +35 -0
- package/.well-known/.acl +15 -0
- package/CHANGELOG.md +198 -0
- package/CONTRIBUTING.md +139 -0
- package/CONTRIBUTORS.md +36 -0
- package/Dockerfile +22 -0
- package/LICENSE.md +23 -0
- package/README.md +453 -0
- package/bin/lib/cli-utils.js +85 -0
- package/bin/lib/cli.js +39 -0
- package/bin/lib/init.js +94 -0
- package/bin/lib/invalidUsernames.js +148 -0
- package/bin/lib/migrateLegacyResources.js +69 -0
- package/bin/lib/options.js +399 -0
- package/bin/lib/start.js +148 -0
- package/bin/lib/updateIndex.js +56 -0
- package/bin/solid +3 -0
- package/bin/solid-test +12 -0
- package/bin/solid.js +3 -0
- package/common/css/solid.css +58 -0
- package/common/fonts/glyphicons-halflings-regular.eot +0 -0
- package/common/fonts/glyphicons-halflings-regular.svg +288 -0
- package/common/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/common/fonts/glyphicons-halflings-regular.woff +0 -0
- package/common/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/common/img/.gitkeep +0 -0
- package/common/js/auth-buttons.js +65 -0
- package/common/js/solid.js +454 -0
- package/common/well-known/security.txt +2 -0
- package/config/defaults.js +25 -0
- package/config/usernames-blacklist.json +4 -0
- package/config.json-default +22 -0
- package/default-templates/emails/delete-account.js +49 -0
- package/default-templates/emails/invalid-username.js +30 -0
- package/default-templates/emails/reset-password.js +49 -0
- package/default-templates/emails/welcome.js +39 -0
- package/default-templates/new-account/.acl +26 -0
- package/default-templates/new-account/.meta +5 -0
- package/default-templates/new-account/.meta.acl +25 -0
- package/default-templates/new-account/.well-known/.acl +19 -0
- package/default-templates/new-account/favicon.ico +0 -0
- package/default-templates/new-account/favicon.ico.acl +26 -0
- package/default-templates/new-account/inbox/.acl +26 -0
- package/default-templates/new-account/private/.acl +10 -0
- package/default-templates/new-account/profile/.acl +19 -0
- package/default-templates/new-account/profile/card$.ttl +25 -0
- package/default-templates/new-account/public/.acl +19 -0
- package/default-templates/new-account/robots.txt +3 -0
- package/default-templates/new-account/robots.txt.acl +26 -0
- package/default-templates/new-account/settings/.acl +20 -0
- package/default-templates/new-account/settings/prefs.ttl +15 -0
- package/default-templates/new-account/settings/privateTypeIndex.ttl +4 -0
- package/default-templates/new-account/settings/publicTypeIndex.ttl +4 -0
- package/default-templates/new-account/settings/publicTypeIndex.ttl.acl +25 -0
- package/default-templates/new-account/settings/serverSide.ttl.acl +13 -0
- package/default-templates/new-account/settings/serverSide.ttl.inactive +12 -0
- package/default-templates/server/.acl +10 -0
- package/default-templates/server/.well-known/.acl +15 -0
- package/default-templates/server/favicon.ico +0 -0
- package/default-templates/server/favicon.ico.acl +15 -0
- package/default-templates/server/index.html +55 -0
- package/default-templates/server/robots.txt +3 -0
- package/default-templates/server/robots.txt.acl +15 -0
- package/default-views/account/account-deleted.hbs +17 -0
- package/default-views/account/delete-confirm.hbs +51 -0
- package/default-views/account/delete-link-sent.hbs +17 -0
- package/default-views/account/delete.hbs +51 -0
- package/default-views/account/invalid-username.hbs +22 -0
- package/default-views/account/register-disabled.hbs +6 -0
- package/default-views/account/register-form.hbs +132 -0
- package/default-views/account/register.hbs +24 -0
- package/default-views/auth/auth-hidden-fields.hbs +8 -0
- package/default-views/auth/change-password.hbs +58 -0
- package/default-views/auth/goodbye.hbs +23 -0
- package/default-views/auth/login-required.hbs +34 -0
- package/default-views/auth/login-tls.hbs +11 -0
- package/default-views/auth/login-username-password.hbs +28 -0
- package/default-views/auth/login.hbs +55 -0
- package/default-views/auth/no-permission.hbs +29 -0
- package/default-views/auth/password-changed.hbs +27 -0
- package/default-views/auth/reset-link-sent.hbs +21 -0
- package/default-views/auth/reset-password.hbs +52 -0
- package/default-views/auth/sharing.hbs +49 -0
- package/default-views/shared/create-account.hbs +8 -0
- package/default-views/shared/error.hbs +5 -0
- package/docs/how-to-delete-your-account.md +56 -0
- package/docs/login-and-grant-access-to-application.md +32 -0
- package/examples/custom-error-handling.js +31 -0
- package/examples/ldp-with-webid.js +12 -0
- package/examples/simple-express-app.js +20 -0
- package/examples/simple-ldp-server.js +8 -0
- package/favicon.ico +0 -0
- package/favicon.ico.acl +15 -0
- package/index.html +48 -0
- package/index.js +3 -0
- package/lib/acl-checker.js +274 -0
- package/lib/api/accounts/user-accounts.js +88 -0
- package/lib/api/authn/force-user.js +21 -0
- package/lib/api/authn/index.js +5 -0
- package/lib/api/authn/webid-oidc.js +202 -0
- package/lib/api/authn/webid-tls.js +69 -0
- package/lib/api/index.js +6 -0
- package/lib/capability-discovery.js +54 -0
- package/lib/common/fs-utils.js +43 -0
- package/lib/common/template-utils.js +50 -0
- package/lib/common/user-utils.js +28 -0
- package/lib/create-app.js +322 -0
- package/lib/create-server.js +107 -0
- package/lib/debug.js +17 -0
- package/lib/handlers/allow.js +82 -0
- package/lib/handlers/auth-proxy.js +63 -0
- package/lib/handlers/copy.js +39 -0
- package/lib/handlers/cors-proxy.js +95 -0
- package/lib/handlers/delete.js +23 -0
- package/lib/handlers/error-pages.js +212 -0
- package/lib/handlers/get.js +219 -0
- package/lib/handlers/index.js +42 -0
- package/lib/handlers/options.js +33 -0
- package/lib/handlers/patch/n3-patch-parser.js +49 -0
- package/lib/handlers/patch/sparql-update-parser.js +16 -0
- package/lib/handlers/patch.js +203 -0
- package/lib/handlers/post.js +99 -0
- package/lib/handlers/put.js +56 -0
- package/lib/handlers/restrict-to-top-domain.js +13 -0
- package/lib/header.js +136 -0
- package/lib/http-error.js +34 -0
- package/lib/ldp-container.js +161 -0
- package/lib/ldp-copy.js +73 -0
- package/lib/ldp-middleware.js +32 -0
- package/lib/ldp.js +620 -0
- package/lib/lock.js +10 -0
- package/lib/metadata.js +10 -0
- package/lib/models/account-manager.js +603 -0
- package/lib/models/account-template.js +152 -0
- package/lib/models/authenticator.js +333 -0
- package/lib/models/oidc-manager.js +53 -0
- package/lib/models/solid-host.js +131 -0
- package/lib/models/user-account.js +112 -0
- package/lib/models/webid-tls-certificate.js +184 -0
- package/lib/payment-pointer-discovery.js +83 -0
- package/lib/requests/add-cert-request.js +138 -0
- package/lib/requests/auth-request.js +234 -0
- package/lib/requests/create-account-request.js +468 -0
- package/lib/requests/delete-account-confirm-request.js +170 -0
- package/lib/requests/delete-account-request.js +144 -0
- package/lib/requests/login-request.js +205 -0
- package/lib/requests/password-change-request.js +201 -0
- package/lib/requests/password-reset-email-request.js +199 -0
- package/lib/requests/sharing-request.js +259 -0
- package/lib/resource-mapper.js +198 -0
- package/lib/server-config.js +167 -0
- package/lib/services/blacklist-service.js +33 -0
- package/lib/services/email-service.js +162 -0
- package/lib/services/token-service.js +47 -0
- package/lib/utils.js +254 -0
- package/lib/webid/index.js +13 -0
- package/lib/webid/lib/get.js +27 -0
- package/lib/webid/lib/parse.js +12 -0
- package/lib/webid/tls/index.js +185 -0
- package/package.json +172 -0
- package/renovate.json +5 -0
- package/robots.txt +3 -0
- package/robots.txt.acl +15 -0
- package/static/account-recovery.html +78 -0
- package/static/popup-redirect.html +1 -0
- package/static/signup.html +108 -0
- package/static/signup.html.acl +14 -0
package/bin/lib/start.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const options = require('./options')
|
|
4
|
+
const fs = require('fs')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const { loadConfig } = require('./cli-utils')
|
|
7
|
+
const { red, bold } = require('colorette')
|
|
8
|
+
|
|
9
|
+
module.exports = function (program, server) {
|
|
10
|
+
const start = program
|
|
11
|
+
.command('start')
|
|
12
|
+
.description('run the Solid server')
|
|
13
|
+
|
|
14
|
+
options
|
|
15
|
+
.filter((option) => !option.hide)
|
|
16
|
+
.forEach((option) => {
|
|
17
|
+
const configName = option.name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())
|
|
18
|
+
const snakeCaseName = configName.replace(/([A-Z])/g, '_$1')
|
|
19
|
+
const envName = `SOLID_${snakeCaseName.toUpperCase()}`
|
|
20
|
+
|
|
21
|
+
let name = '--' + option.name
|
|
22
|
+
if (!option.flag) {
|
|
23
|
+
name += ' [value]'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (process.env[envName]) {
|
|
27
|
+
const raw = process.env[envName]
|
|
28
|
+
const envValue = /^(true|false)$/.test(raw) ? raw === 'true' : raw
|
|
29
|
+
|
|
30
|
+
start.option(name, option.help, envValue)
|
|
31
|
+
} else {
|
|
32
|
+
start.option(name, option.help)
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
start.option('-q, --quiet', 'Do not print the logs to console')
|
|
37
|
+
|
|
38
|
+
start.action(async (options) => {
|
|
39
|
+
const config = loadConfig(program, options)
|
|
40
|
+
bin(config, server)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function bin (argv, server) {
|
|
45
|
+
if (!argv.email) {
|
|
46
|
+
argv.email = {
|
|
47
|
+
host: argv.emailHost,
|
|
48
|
+
port: argv.emailPort,
|
|
49
|
+
secure: true,
|
|
50
|
+
auth: {
|
|
51
|
+
user: argv.emailAuthUser,
|
|
52
|
+
pass: argv.emailAuthPass
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
delete argv.emailHost
|
|
56
|
+
delete argv.emailPort
|
|
57
|
+
delete argv.emailAuthUser
|
|
58
|
+
delete argv.emailAuthPass
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!argv.tokenTypesSupported) {
|
|
62
|
+
argv.tokenTypesSupported = ['legacyPop', 'dpop']
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Set up --no-*
|
|
66
|
+
argv.live = !argv.noLive
|
|
67
|
+
|
|
68
|
+
// Set up debug environment
|
|
69
|
+
if (!argv.quiet) {
|
|
70
|
+
require('debug').enable('solid:*')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Set up port
|
|
74
|
+
argv.port = argv.port || 3456
|
|
75
|
+
|
|
76
|
+
// Multiuser with no webid is not allowed
|
|
77
|
+
|
|
78
|
+
// Webid to be default in command line
|
|
79
|
+
if (argv.webid !== false) {
|
|
80
|
+
argv.webid = true
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!argv.webid && argv.multiuser) {
|
|
84
|
+
throw new Error('Server cannot operate as multiuser without webids')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Signal handling (e.g. CTRL+C)
|
|
88
|
+
if (process.platform !== 'win32') {
|
|
89
|
+
// Signal handlers don't work on Windows.
|
|
90
|
+
process.on('SIGINT', function () {
|
|
91
|
+
console.log('\nSolid stopped.')
|
|
92
|
+
process.exit()
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Overwrite root .acl if owner is specified
|
|
97
|
+
if (argv.owner) {
|
|
98
|
+
let rootPath = path.resolve(argv.root || process.cwd())
|
|
99
|
+
if (!(rootPath.endsWith('/'))) {
|
|
100
|
+
rootPath += '/'
|
|
101
|
+
}
|
|
102
|
+
rootPath += (argv.suffixAcl || '.acl')
|
|
103
|
+
|
|
104
|
+
const defaultAcl = `@prefix n0: <http://www.w3.org/ns/auth/acl#>.
|
|
105
|
+
@prefix n2: <http://xmlns.com/foaf/0.1/>.
|
|
106
|
+
|
|
107
|
+
<#owner>
|
|
108
|
+
a n0:Authorization;
|
|
109
|
+
n0:accessTo <./>;
|
|
110
|
+
n0:agent <${argv.owner}>;
|
|
111
|
+
n0:default <./>;
|
|
112
|
+
n0:mode n0:Control, n0:Read, n0:Write.
|
|
113
|
+
<#everyone>
|
|
114
|
+
a n0:Authorization;
|
|
115
|
+
n0: n2:Agent;
|
|
116
|
+
n0:accessTo <./>;
|
|
117
|
+
n0:default <./>;
|
|
118
|
+
n0:mode n0:Read.`
|
|
119
|
+
|
|
120
|
+
fs.writeFileSync(rootPath, defaultAcl)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// // Finally starting solid
|
|
124
|
+
const solid = require('../../')
|
|
125
|
+
let app
|
|
126
|
+
try {
|
|
127
|
+
app = solid.createServer(argv, server)
|
|
128
|
+
} catch (e) {
|
|
129
|
+
if (e.code === 'EACCES') {
|
|
130
|
+
if (e.syscall === 'mkdir') {
|
|
131
|
+
console.log(red(bold('ERROR')), `You need permissions to create '${e.path}' folder`)
|
|
132
|
+
} else {
|
|
133
|
+
console.log(red(bold('ERROR')), 'You need root privileges to start on this port')
|
|
134
|
+
}
|
|
135
|
+
return 1
|
|
136
|
+
}
|
|
137
|
+
if (e.code === 'EADDRINUSE') {
|
|
138
|
+
console.log(red(bold('ERROR')), 'The port ' + argv.port + ' is already in use')
|
|
139
|
+
return 1
|
|
140
|
+
}
|
|
141
|
+
console.log(red(bold('ERROR')), e.message)
|
|
142
|
+
return 1
|
|
143
|
+
}
|
|
144
|
+
app.listen(argv.port, function () {
|
|
145
|
+
console.log(`Solid server (${argv.version}) running on \u001b[4mhttps://localhost:${argv.port}/\u001b[0m`)
|
|
146
|
+
console.log('Press <ctrl>+c to stop')
|
|
147
|
+
})
|
|
148
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const cheerio = require('cheerio')
|
|
4
|
+
const LDP = require('../../lib/ldp')
|
|
5
|
+
const { URL } = require('url')
|
|
6
|
+
const debug = require('../../lib/debug')
|
|
7
|
+
const { readFile } = require('../../lib/common/fs-utils')
|
|
8
|
+
|
|
9
|
+
const { compileTemplate, writeTemplate } = require('../../lib/common/template-utils')
|
|
10
|
+
const { loadConfig, loadAccounts } = require('./cli-utils')
|
|
11
|
+
const { getName, getWebId } = require('../../lib/common/user-utils')
|
|
12
|
+
const { initConfigDir, initTemplateDirs } = require('../../lib/server-config')
|
|
13
|
+
|
|
14
|
+
module.exports = function (program) {
|
|
15
|
+
program
|
|
16
|
+
.command('updateindex')
|
|
17
|
+
.description('Update index.html in root of all PODs that haven\'t been marked otherwise')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const config = loadConfig(program, options)
|
|
20
|
+
const configPath = initConfigDir(config)
|
|
21
|
+
const templates = initTemplateDirs(configPath)
|
|
22
|
+
const indexTemplatePath = path.join(templates.account, 'index.html')
|
|
23
|
+
const indexTemplate = await compileTemplate(indexTemplatePath)
|
|
24
|
+
const ldp = new LDP(config)
|
|
25
|
+
const accounts = loadAccounts(config)
|
|
26
|
+
const usersProcessed = accounts.map(async account => {
|
|
27
|
+
const accountDirectory = path.join(config.root, account)
|
|
28
|
+
const indexFilePath = path.join(accountDirectory, '/index.html')
|
|
29
|
+
if (!isUpdateAllowed(indexFilePath)) {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
const accountUrl = getAccountUrl(account, config)
|
|
33
|
+
try {
|
|
34
|
+
const webId = await getWebId(accountDirectory, accountUrl, ldp.suffixMeta, (filePath) => readFile(filePath))
|
|
35
|
+
const name = await getName(webId, ldp.fetchGraph)
|
|
36
|
+
writeTemplate(indexFilePath, indexTemplate, { name, webId })
|
|
37
|
+
} catch (err) {
|
|
38
|
+
debug.errors(`Failed to create new index for ${account}: ${JSON.stringify(err, null, 2)}`)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
await Promise.all(usersProcessed)
|
|
42
|
+
debug.accounts(`Processed ${usersProcessed.length} users`)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getAccountUrl (name, config) {
|
|
47
|
+
const serverUrl = new URL(config.serverUri)
|
|
48
|
+
return `${serverUrl.protocol}//${name}.${serverUrl.host}/`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isUpdateAllowed (indexFilePath) {
|
|
52
|
+
const indexSource = fs.readFileSync(indexFilePath, 'utf-8')
|
|
53
|
+
const $ = cheerio.load(indexSource)
|
|
54
|
+
const allowAutomaticUpdateValue = $('meta[name="solid-allow-automatic-updates"]').prop('content')
|
|
55
|
+
return !allowAutomaticUpdateValue || allowAutomaticUpdateValue === 'true'
|
|
56
|
+
}
|
package/bin/solid
ADDED
package/bin/solid-test
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
COMMAND=$1
|
|
3
|
+
ADD_FLAGS=
|
|
4
|
+
shift
|
|
5
|
+
|
|
6
|
+
# Disable rejectUnauthorized when starting the server
|
|
7
|
+
if [ "$COMMAND" == "start" ]; then
|
|
8
|
+
ADD_FLAGS="--no-reject-unauthorized"
|
|
9
|
+
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
exec `dirname "$0"`/solid $COMMAND $ADD_FLAGS $@
|
package/bin/solid.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
}
|
|
51
|
+
|
|
52
|
+
.login-up-form .form-group {
|
|
53
|
+
margin-bottom: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.xs-header {
|
|
57
|
+
margin-top: 0px;
|
|
58
|
+
}
|
|
Binary file
|