-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: implement a happy path to join a group
Based on https://github.com/solidcouch/geoindex and diverges here.
- Loading branch information
Showing
35 changed files
with
320 additions
and
2,464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,2 @@ | ||
## port on which the service will run (required) | ||
PORT=0 | ||
|
||
## base url of the service - defaults to localhost with the given port | ||
#BASE_URL= | ||
|
||
## set to 1 if the app is running behind reverse proxy | ||
#BEHIND_PROXY= | ||
|
||
# comma-separated uris of groups that are indexed by the service (required) | ||
INDEXED_GROUPS=_ | ||
|
||
## comma-separated uris of groups that are allowed to query the service - defaults to INDEXED_GROUPS when undefined. Uncomment (set to empty string) to allow everybody. | ||
#ALLOWED_GROUPS= | ||
|
||
## configure types of things we're interested in | ||
THING_TYPE="http://w3id.org/hospex/ns#Accommodation" | ||
|
||
## cron-style schedule to define how often the index should refresh | ||
## e.g. the example below makes the index run every 6 hours (default) | ||
#REFRESH_SCHEDULE="0 */6 * * *" | ||
|
||
## TODO configure discovery of the thing from the person's profile, probably as ldhop query JSON | ||
## defaults to whatever is needed for it to run with SolidCouch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- Implement a happy path for joining | ||
|
||
### Changed | ||
|
||
- Based on [geoindex service](https://github.com/solidcouch/geoindex) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"project": ["**/*.{js,ts}"], | ||
"entry": ["src/index.ts", "src/generate-api-docs.ts"], | ||
"ignore": ["apidocs/*"], | ||
"ignoreDependencies": ["sqlite3"] | ||
"ignore": ["apidocs/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "geoindex", | ||
"version": "0.0.1", | ||
"name": "solid-community-inbox", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
|
@@ -31,33 +31,24 @@ | |
"@koa/bodyparser": "^5.1.1", | ||
"@koa/cors": "^5.0.0", | ||
"@koa/router": "^13.1.0", | ||
"@ldhop/core": "^0.0.1-alpha.15", | ||
"@soid/koa": "^0.1.2", | ||
"@solid/access-token-verifier": "^2.0.5", | ||
"@types/koa": "^2.15.0", | ||
"@types/koa-static": "^4.0.4", | ||
"@types/koa__cors": "^5.0.0", | ||
"@types/koa__router": "^12.0.4", | ||
"@types/lodash": "^4.17.14", | ||
"@types/n3": "^1.16.0", | ||
"@types/ngeohash": "^0.6.8", | ||
"@types/node": "^22.10.5", | ||
"ajv": "^8.17.1", | ||
"ajv-formats": "^3.0.1", | ||
"cron": "^3.3.2", | ||
"css-authn": "^0.0.16", | ||
"dotenv": "^16.4.7", | ||
"helmet": "^8.0.0", | ||
"koa": "^2.15.3", | ||
"koa-helmet": "^8.0.1", | ||
"koa-static": "^5.0.0", | ||
"lodash": "^4.17.21", | ||
"n3": "^1.23.1", | ||
"ngeohash": "^0.6.3", | ||
"rdf-namespaces": "^1.11.0", | ||
"sequelize": "^6.37.5", | ||
"sqlite3": "^5.1.7", | ||
"type-fest": "^4.31.0", | ||
"typescript": "^5.7.2" | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { getAuthenticatedFetch } from '@soid/koa' | ||
import { type Middleware } from 'koa' | ||
import assert from 'node:assert' | ||
import { solid, vcard } from 'rdf-namespaces' | ||
import { AppConfig } from '../app.js' | ||
import { HttpError } from '../utils/errors.js' | ||
|
||
export const addPersonToGroup = | ||
(group: string): Middleware<{ user: string; config: AppConfig }> => | ||
async ctx => { | ||
const authFetch = await getAuthenticatedFetch(ctx.state.config.webId) | ||
const response = await authFetch(group, { | ||
headers: { 'content-type': 'text/n3' }, | ||
method: 'PATCH', | ||
body: `_:add a <${solid.InsertDeletePatch}>; | ||
<${solid.inserts}> { <${group}> <${vcard.hasMember}> <${ctx.state.user}> . }. | ||
`, | ||
}) | ||
|
||
if (!response.ok) | ||
throw new HttpError( | ||
`Adding person ${ctx.state.user} to group ${group} failed.`, | ||
response, | ||
) | ||
|
||
assert(response.ok) | ||
|
||
ctx.status = 200 | ||
} |
Oops, something went wrong.