forked from hexbear-collective/lemmy-hexbear
Browse Source
Merge upstream tag v0.7.57
Merge upstream tag v0.7.57
Merge Notes: * Lemmy server does not compile. It took several hours to go through the merge process, so I want to commit the project in its current state and have a place to revert to if anything goes wrong. ** API structs need to be double checked for correctness. They were all moved to a submodule, and Git did not catch the diffs. On the bright side, this provides us a great opportunity to mark all of our API changes as we update the vanilla upstream API structs. * Two new migrations were added upstream. I don't think these clobber any of our changes, but they modify existing records. In particular, the fake activitypub records get replaced with newly generated unique entries. We're going to want to make sure these migrations work correctly. * Endpoints need to be reviewed for security and correctness This is not an exaustive list. ** Comment *** GetComments Looks like it can leak comments from private communities. We don't have any private communities, but we're going to want to fix this. ** Community *** EditCommunity The permissions logic could be more concise. *** BanFromCommunity Admins cannot ban mods from communities. This should be changed. ** User *** Register Review Register endpoint and make sure there are no security regressions. The recent changes apparently make it impossible to bootstrap the website. * Other TODOs ** Add a site_mod helper function Site-mod permissions are broken. A helper function should make an easy drop-in replacement for many of the current admin checks, but it would be inappropriate to simply change the definition of the is_admin function. That said, is_mod_or_admin should be fair game.feature/settings-cleanup
102 changed files with 7311 additions and 4245 deletions
-
3ansible/VERSION
-
14ansible/templates/nginx.conf
-
38docker/dev/Dockerfile
-
12docker/dev/docker-compose.yml
-
6docker/dev/docker_update.sh
-
20docker/federation-test/servers.sh
-
10docker/federation-test/tests.sh
-
17docker/federation/Dockerfile
-
79docker/federation/docker-compose.yml
-
62docker/federation/nginx.conf
-
28docker/federation/run-federation-test.bash
-
24docker/federation/run-tests.sh
-
11docker/federation/start-local-instances.bash
-
9docker/prod/Dockerfile
-
4docker/prod/docker-compose.yml
-
76docker/travis/docker-compose.yml
-
4docker/travis/docker_push.sh
-
6docker/travis/run-tests.sh
-
34docs/src/about_guide.md
-
40docs/src/contributing_federation_development.md
-
447docs/src/contributing_websocket_http_api.md
-
423server/Cargo.lock
-
15server/Cargo.toml
-
8server/config/defaults.hjson
-
14server/lemmy_api_structs/Cargo.toml
-
77server/lemmy_api_structs/src/comment.rs
-
131server/lemmy_api_structs/src/community.rs
-
24server/lemmy_api_structs/src/lib.rs
-
105server/lemmy_api_structs/src/post.rs
-
127server/lemmy_api_structs/src/site.rs
-
300server/lemmy_api_structs/src/user.rs
-
4server/lemmy_db/Cargo.toml
-
10server/lemmy_db/src/activity.rs
-
4server/lemmy_db/src/category.rs
-
137server/lemmy_db/src/comment.rs
-
23server/lemmy_db/src/comment_view.rs
-
78server/lemmy_db/src/community.rs
-
28server/lemmy_db/src/community_view.rs
-
15server/lemmy_db/src/lib.rs
-
69server/lemmy_db/src/moderator.rs
-
18server/lemmy_db/src/password_reset_request.rs
-
117server/lemmy_db/src/post.rs
-
31server/lemmy_db/src/post_view.rs
-
33server/lemmy_db/src/private_message.rs
-
5server/lemmy_db/src/site.rs
-
40server/lemmy_db/src/user.rs
-
19server/lemmy_db/src/user_mention.rs
-
57server/lemmy_db/src/user_view.rs
-
19server/lemmy_rate_limit/Cargo.toml
-
15server/lemmy_rate_limit/src/lib.rs
-
6server/lemmy_rate_limit/src/rate_limiter.rs
-
6server/lemmy_utils/Cargo.toml
-
69server/lemmy_utils/src/lib.rs
-
41server/lemmy_utils/src/settings.rs
-
100server/migrations/2020-08-06-205355_update_community_post_count/down.sql
-
100server/migrations/2020-08-06-205355_update_community_post_count/up.sql
-
27server/migrations/2020-08-25-132005_add_unique_ap_ids/down.sql
-
56server/migrations/2020-08-25-132005_add_unique_ap_ids/up.sql
-
11server/src/api/claims.rs
-
503server/src/api/comment.rs
-
629server/src/api/community.rs
-
121server/src/api/mod.rs
-
552server/src/api/post.rs
-
397server/src/api/site.rs
-
1051server/src/api/user.rs
-
75server/src/apub/activities.rs
-
130server/src/apub/activity_queue.rs
-
343server/src/apub/comment.rs
-
305server/src/apub/community.rs
-
4server/src/apub/extensions/group_extensions.rs
-
30server/src/apub/extensions/signatures.rs
-
299server/src/apub/fetcher.rs
-
37server/src/apub/inbox/activities/announce.rs
-
109server/src/apub/inbox/activities/create.rs
-
157server/src/apub/inbox/activities/delete.rs
-
111server/src/apub/inbox/activities/dislike.rs
-
98server/src/apub/inbox/activities/like.rs
-
167server/src/apub/inbox/activities/remove.rs
-
545server/src/apub/inbox/activities/undo.rs
-
122server/src/apub/inbox/activities/update.rs
-
95server/src/apub/inbox/shared_inbox.rs
-
261server/src/apub/mod.rs
-
434server/src/apub/post.rs
-
138server/src/apub/private_message.rs
-
177server/src/apub/user.rs
-
14server/src/code_migrations.rs
-
84server/src/lib.rs
-
39server/src/main.rs
-
20server/src/request.rs
-
59server/src/routes/api.rs
-
80server/src/routes/feeds.rs
-
2server/src/routes/images.rs
-
3server/src/routes/index.rs
-
13server/src/routes/mod.rs
-
8server/src/routes/nodeinfo.rs
-
23server/src/routes/webfinger.rs
-
12server/src/routes/websocket.rs
-
2server/src/version.rs
-
551server/src/websocket/chat_server.rs
-
292server/src/websocket/handlers.rs
@ -1 +1,2 @@ |
|||
v0.7.41 |
|||
v0.7.57 |
|||
|
@ -1,6 +1,6 @@ |
|||
#!/bin/sh |
|||
set -e |
|||
|
|||
export COMPOSE_DOCKER_CLI_BUILD=1 |
|||
export DOCKER_BUILDKIT=1 |
|||
docker-compose up -d --no-deps --build |
|||
sudo chown -R 991:991 volumes/pictrs |
|||
sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-dev:latest |
|||
sudo docker-compose up -d |
@ -1,20 +0,0 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
|
|||
sudo docker-compose --file ../federation/docker-compose.yml --project-directory . down |
|||
sudo rm -rf volumes |
|||
|
|||
pushd ../../server/ |
|||
cargo build |
|||
popd |
|||
|
|||
pushd ../../ui |
|||
yarn |
|||
popd |
|||
|
|||
mkdir -p volumes/pictrs_{alpha,beta,gamma} |
|||
sudo chown -R 991:991 volumes/pictrs_{alpha,beta,gamma} |
|||
|
|||
sudo docker build ../../ --file ../federation/Dockerfile --tag lemmy-federation:latest |
|||
|
|||
sudo docker-compose --file ../federation/docker-compose.yml --project-directory . up |
@ -1,10 +0,0 @@ |
|||
#!/bin/bash |
|||
set -xe |
|||
|
|||
pushd ../../ui |
|||
echo "Waiting for Lemmy to start..." |
|||
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8540/api/v1/site')" != "200" ]]; do sleep 1; done |
|||
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8550/api/v1/site')" != "200" ]]; do sleep 1; done |
|||
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8560/api/v1/site')" != "200" ]]; do sleep 1; done |
|||
yarn api-test || true |
|||
popd |
@ -1,17 +0,0 @@ |
|||
FROM ekidd/rust-musl-builder:1.42.0-openssl11 |
|||
|
|||
USER root |
|||
RUN mkdir /app/dist/documentation/ -p \ |
|||
&& addgroup --gid 1001 lemmy \ |
|||
&& adduser --gecos "" --disabled-password --shell /bin/sh -u 1001 --ingroup lemmy lemmy |
|||
|
|||
# Copy resources |
|||
COPY server/config/defaults.hjson /app/config/defaults.hjson |
|||
COPY ui/dist /app/dist |
|||
COPY server/target/debug/lemmy_server /app/lemmy |
|||
|
|||
RUN chown lemmy:lemmy /app/ -R |
|||
USER lemmy |
|||
EXPOSE 8536 |
|||
WORKDIR /app |
|||
CMD ["/app/lemmy"] |
@ -7,16 +7,19 @@ services: |
|||
- "8540:8540" |
|||
- "8550:8550" |
|||
- "8560:8560" |
|||
- "8570:8570" |
|||
- "8580:8580" |
|||
volumes: |
|||
# Hack to make this work from both docker/federation/ and docker/federation-test/ |
|||
- ../federation/nginx.conf:/etc/nginx/nginx.conf |
|||
- ./nginx.conf:/etc/nginx/nginx.conf |
|||
restart: on-failure |
|||
depends_on: |
|||
- lemmy-alpha |
|||
- pictrs |
|||
- iframely |
|||
- lemmy-alpha |
|||
- lemmy-beta |
|||
- lemmy-gamma |
|||
- iframely |
|||
- lemmy-delta |
|||
- lemmy-epsilon |
|||
|
|||
pictrs: |
|||
restart: always |
|||
@ -34,7 +37,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8540 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -64,7 +67,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8550 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -94,7 +97,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8560 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -115,6 +118,68 @@ services: |
|||
volumes: |
|||
- ./volumes/postgres_gamma:/var/lib/postgresql/data |
|||
|
|||
# An instance with only an allowlist for beta |
|||
lemmy-delta: |
|||
image: lemmy-federation:latest |
|||
environment: |
|||
- LEMMY_HOSTNAME=lemmy-delta:8570 |
|||
- LEMMY_DATABASE_URL=postgres://lemmy:[email protected]_delta:5432/lemmy |
|||
- LEMMY_JWT_SECRET=changeme |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta |
|||
- LEMMY_PORT=8570 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
- LEMMY_SETUP__SITE_NAME=lemmy-delta |
|||
- LEMMY_RATE_LIMIT__POST=99999 |
|||
- LEMMY_RATE_LIMIT__REGISTER=99999 |
|||
- LEMMY_CAPTCHA__ENABLED=false |
|||
- RUST_BACKTRACE=1 |
|||
- RUST_LOG=debug |
|||
depends_on: |
|||
- postgres_delta |
|||
postgres_delta: |
|||
image: postgres:12-alpine |
|||
environment: |
|||
- POSTGRES_USER=lemmy |
|||
- POSTGRES_PASSWORD=password |
|||
- POSTGRES_DB=lemmy |
|||
volumes: |
|||
- ./volumes/postgres_delta:/var/lib/postgresql/data |
|||
|
|||
# An instance who has a blocklist, with lemmy-alpha blocked |
|||
lemmy-epsilon: |
|||
image: lemmy-federation:latest |
|||
environment: |
|||
- LEMMY_HOSTNAME=lemmy-epsilon:8580 |
|||
- LEMMY_DATABASE_URL=postgres://lemmy:[email protected]_epsilon:5432/lemmy |
|||
- LEMMY_JWT_SECRET=changeme |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha |
|||
- LEMMY_PORT=8580 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
- LEMMY_SETUP__SITE_NAME=lemmy-epsilon |
|||
- LEMMY_RATE_LIMIT__POST=99999 |
|||
- LEMMY_RATE_LIMIT__REGISTER=99999 |
|||
- LEMMY_CAPTCHA__ENABLED=false |
|||
- RUST_BACKTRACE=1 |
|||
- RUST_LOG=debug |
|||
depends_on: |
|||
- postgres_epsilon |
|||
postgres_epsilon: |
|||
image: postgres:12-alpine |
|||
environment: |
|||
- POSTGRES_USER=lemmy |
|||
- POSTGRES_PASSWORD=password |
|||
- POSTGRES_DB=lemmy |
|||
volumes: |
|||
- ./volumes/postgres_epsilon:/var/lib/postgresql/data |
|||
|
|||
iframely: |
|||
image: jolt/iframely:v1.4.3 |
|||
volumes: |
|||
|
@ -1,28 +0,0 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
|
|||
# already start rust build in the background |
|||
pushd ../../server/ || exit |
|||
cargo build & |
|||
popd || exit |
|||
|
|||
if [ "$1" = "-yarn" ]; then |
|||
pushd ../../ui/ || exit |
|||
yarn |
|||
yarn build |
|||
popd || exit |
|||
fi |
|||
|
|||
# wait for rust build to finish |
|||
pushd ../../server/ || exit |
|||
cargo build |
|||
popd || exit |
|||
|
|||
sudo docker build ../../ --file Dockerfile -t lemmy-federation:latest |
|||
|
|||
for Item in alpha beta gamma ; do |
|||
sudo mkdir -p volumes/pictrs_$Item |
|||
sudo chown -R 991:991 volumes/pictrs_$Item |
|||
done |
|||
|
|||
sudo docker-compose up |
@ -0,0 +1,11 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
|
|||
sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-federation:latest |
|||
|
|||
for Item in alpha beta gamma delta epsilon ; do |
|||
sudo mkdir -p volumes/pictrs_$Item |
|||
sudo chown -R 991:991 volumes/pictrs_$Item |
|||
done |
|||
|
|||
sudo docker-compose up |
@ -7,16 +7,20 @@ services: |
|||
- "8540:8540" |
|||
- "8550:8550" |
|||
- "8560:8560" |
|||
- "8570:8570" |
|||
- "8580:8580" |
|||
volumes: |
|||
# Hack to make this work from both docker/federation/ and docker/federation-test/ |
|||
- ../federation/nginx.conf:/etc/nginx/nginx.conf |
|||
restart: on-failure |
|||
depends_on: |
|||
- lemmy-alpha |
|||
- pictrs |
|||
- iframely |
|||
- lemmy-alpha |
|||
- lemmy-beta |
|||
- lemmy-gamma |
|||
- iframely |
|||
- lemmy-delta |
|||
- lemmy-epsilon |
|||
|
|||
pictrs: |
|||
restart: always |
|||
@ -34,7 +38,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8540 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -64,7 +68,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8550 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -94,7 +98,7 @@ services: |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon |
|||
- LEMMY_PORT=8560 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
@ -115,6 +119,68 @@ services: |
|||
volumes: |
|||
- ./volumes/postgres_gamma:/var/lib/postgresql/data |
|||
|
|||
# An instance with only an allowlist for beta |
|||
lemmy-delta: |
|||
image: dessalines/lemmy:travis |
|||
environment: |
|||
- LEMMY_HOSTNAME=lemmy-delta:8570 |
|||
- LEMMY_DATABASE_URL=postgres://lemmy:[email protected]_delta:5432/lemmy |
|||
- LEMMY_JWT_SECRET=changeme |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta |
|||
- LEMMY_PORT=8570 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
- LEMMY_SETUP__SITE_NAME=lemmy-delta |
|||
- LEMMY_RATE_LIMIT__POST=99999 |
|||
- LEMMY_RATE_LIMIT__REGISTER=99999 |
|||
- LEMMY_CAPTCHA__ENABLED=false |
|||
- RUST_BACKTRACE=1 |
|||
- RUST_LOG=debug |
|||
depends_on: |
|||
- postgres_delta |
|||
postgres_delta: |
|||
image: postgres:12-alpine |
|||
environment: |
|||
- POSTGRES_USER=lemmy |
|||
- POSTGRES_PASSWORD=password |
|||
- POSTGRES_DB=lemmy |
|||
volumes: |
|||
- ./volumes/postgres_delta:/var/lib/postgresql/data |
|||
|
|||
# An instance who has a blocklist, with lemmy-alpha blocked |
|||
lemmy-epsilon: |
|||
image: dessalines/lemmy:travis |
|||
environment: |
|||
- LEMMY_HOSTNAME=lemmy-epsilon:8580 |
|||
- LEMMY_DATABASE_URL=postgres://lemmy:[email protected]_epsilon:5432/lemmy |
|||
- LEMMY_JWT_SECRET=changeme |
|||
- LEMMY_FRONT_END_DIR=/app/dist |
|||
- LEMMY_FEDERATION__ENABLED=true |
|||
- LEMMY_FEDERATION__TLS_ENABLED=false |
|||
- LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha |
|||
- LEMMY_PORT=8580 |
|||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon |
|||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy |
|||
- LEMMY_SETUP__SITE_NAME=lemmy-epsilon |
|||
- LEMMY_RATE_LIMIT__POST=99999 |
|||
- LEMMY_RATE_LIMIT__REGISTER=99999 |
|||
- LEMMY_CAPTCHA__ENABLED=false |
|||
- RUST_BACKTRACE=1 |
|||
- RUST_LOG=debug |
|||
depends_on: |
|||
- postgres_epsilon |
|||
postgres_epsilon: |
|||
image: postgres:12-alpine |
|||
environment: |
|||
- POSTGRES_USER=lemmy |
|||
- POSTGRES_PASSWORD=password |
|||
- POSTGRES_DB=lemmy |
|||
volumes: |
|||
- ./volumes/postgres_epsilon:/var/lib/postgresql/data |
|||
|
|||
iframely: |
|||
image: dogbin/iframely:latest |
|||
volumes: |
|||
|
@ -1,5 +1,5 @@ |
|||
#!/bin/sh |
|||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin |
|||
docker tag dessalines/lemmy:travis \ |
|||
dessalines/lemmy:v0.7.41 |
|||
docker push dessalines/lemmy:v0.7.41 |
|||
dessalines/lemmy:v0.7.57 |
|||
docker push dessalines/lemmy:v0.7.57 |
@ -14,25 +14,30 @@ You need to have the following packages installed, the Docker service needs to b |
|||
|
|||
- docker |
|||
- docker-compose |
|||
- cargo |
|||
- yarn |
|||
|
|||
Then run the following |
|||
```bash |
|||
cd docker/federation |
|||
./run-federation-test.bash -yarn |
|||
./start-local-instances.bash |
|||
``` |
|||
|
|||
The federation test sets up 3 instances: |
|||
The federation test sets up 5 instances: |
|||
|
|||
Instance / Username | Location |
|||
--- | --- |
|||
lemmy_alpha | [127.0.0.1:8540](http://127.0.0.1:8540) |
|||
lemmy_beta | [127.0.0.1:8550](http://127.0.0.1:8550) |
|||
lemmy_gamma | [127.0.0.1:8560](http://127.0.0.1:8560) |
|||
Instance | Username | Location | Notes |
|||
--- | --- | --- | --- |
|||
lemmy-alpha | lemmy_alpha | [127.0.0.1:8540](http://127.0.0.1:8540) | federated with all other instances |
|||
lemmy-beta | lemmy_beta | [127.0.0.1:8550](http://127.0.0.1:8550) | federated with all other instances |
|||
lemmy-gamma | lemmy_gamma | [127.0.0.1:8560](http://127.0.0.1:8560) | federated with all other instances |
|||
lemmy-delta | lemmy_delta | [127.0.0.1:8570](http://127.0.0.1:8570) | only allows federation with lemmy-beta |
|||
lemmy-epsilon | lemmy_epsilon | [127.0.0.1:8580](http://127.0.0.1:8580) | uses blocklist, has lemmy-alpha blocked |
|||
|
|||
You can log into each using the instance name, and `lemmy` as the password, IE (`lemmy_alpha`, `lemmy`). |
|||
|
|||
To start federation between instances, visit one of them and search for a user, community or post, like this: |
|||
- `[email protected]:8540` |
|||
- `http://lemmy-beta:8550/post/3` |
|||
- `@[email protected]:8560` |
|||
|
|||
Firefox containers are a good way to test them interacting. |
|||
|
|||
## Integration tests |
|||
@ -40,8 +45,8 @@ Firefox containers are a good way to test them interacting. |
|||
To run a suite of suite of federation integration tests: |
|||
|
|||
```bash |
|||
cd docker/federation-test |
|||
./run-tests.sh |
|||
cd docker/federation |
|||
./run-tests.bash |
|||
``` |
|||
|
|||
## Running on a server |
|||
@ -68,3 +73,16 @@ cd /lemmy/ |
|||
sudo docker-compose pull |
|||
sudo docker-compose up -d |
|||
``` |
|||
|
|||
## Security Model |
|||
|
|||
- HTTP signature verify: This ensures that activity really comes from the activity that it claims |
|||
- check_is_apub_valid : Makes sure its in our allowed instances list |
|||
- Lower level checks: To make sure that the user that creates/updates/removes a post is actually on the same instance as that post |
|||
|
|||
For the last point, note that we are *not* checking whether the actor that sends the create activity for a post is |
|||
actually identical to the post's creator, or that the user that removes a post is a mod/admin. These things are checked |
|||
by the API code, and its the responsibility of each instance to check user permissions. This does not leave any attack |
|||
vector, as a normal instance user cant do actions that violate the API rules. The only one who could do that is the |
|||
admin (and the software deployed by the admin). But the admin can do anything on the instance, including send activities |
|||
from other user accounts. So we wouldnt actually gain any security by checking mod permissions or similar. |
423
server/Cargo.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,14 @@ |
|||
[package] |
|||
name = "lemmy_api_structs" |
|||
version = "0.1.0" |
|||
authors = ["Felix Ableitner <[email protected]>"] |
|||
edition = "2018" |
|||
|
|||
[lib] |
|||
name = "lemmy_api_structs" |
|||
path = "src/lib.rs" |
|||
|
|||
[dependencies] |
|||
lemmy_db = { path = "../lemmy_db" } |
|||
serde = { version = "1.0.105", features = ["derive"] } |
|||
thiserror = "1.0.20" |
@ -0,0 +1,77 @@ |
|||
use lemmy_db::comment_view::CommentView;
|
|||
use serde::{Deserialize, Serialize};
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct CreateComment {
|
|||
pub content: String,
|
|||
pub parent_id: Option<i32>,
|
|||
pub post_id: i32,
|
|||
pub form_id: Option<String>,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct EditComment {
|
|||
pub content: String,
|
|||
pub edit_id: i32,
|
|||
pub form_id: Option<String>,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct DeleteComment {
|
|||
pub edit_id: i32,
|
|||
pub deleted: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct RemoveComment {
|
|||
pub edit_id: i32,
|
|||
pub removed: bool,
|
|||
pub reason: Option<String>,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct MarkCommentAsRead {
|
|||
pub edit_id: i32,
|
|||
pub read: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct SaveComment {
|
|||
pub comment_id: i32,
|
|||
pub save: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Clone)]
|
|||
pub struct CommentResponse {
|
|||
pub comment: CommentView,
|
|||
pub recipient_ids: Vec<i32>,
|
|||
pub form_id: Option<String>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct CreateCommentLike {
|
|||
pub comment_id: i32,
|
|||
pub score: i16,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct GetComments {
|
|||
pub type_: String,
|
|||
pub sort: String,
|
|||
pub page: Option<i64>,
|
|||
pub limit: Option<i64>,
|
|||
pub community_id: Option<i32>,
|
|||
pub auth: Option<String>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct GetCommentsResponse {
|
|||
pub comments: Vec<CommentView>,
|
|||
}
|
@ -0,0 +1,131 @@ |
|||
use lemmy_db::{
|
|||
community_view::{CommunityFollowerView, CommunityModeratorView, CommunityView},
|
|||
user_view::UserView,
|
|||
};
|
|||
use serde::{Deserialize, Serialize};
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct GetCommunity {
|
|||
pub id: Option<i32>,
|
|||
pub name: Option<String>,
|
|||
pub auth: Option<String>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct GetCommunityResponse {
|
|||
pub community: CommunityView,
|
|||
pub moderators: Vec<CommunityModeratorView>,
|
|||
pub online: usize,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct CreateCommunity {
|
|||
pub name: String,
|
|||
pub title: String,
|
|||
pub description: Option<String>,
|
|||
pub icon: Option<String>,
|
|||
pub banner: Option<String>,
|
|||
pub category_id: i32,
|
|||
pub nsfw: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Clone)]
|
|||
pub struct CommunityResponse {
|
|||
pub community: CommunityView,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Debug)]
|
|||
pub struct ListCommunities {
|
|||
pub sort: String,
|
|||
pub page: Option<i64>,
|
|||
pub limit: Option<i64>,
|
|||
pub auth: Option<String>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Debug)]
|
|||
pub struct ListCommunitiesResponse {
|
|||
pub communities: Vec<CommunityView>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Clone)]
|
|||
pub struct BanFromCommunity {
|
|||
pub community_id: i32,
|
|||
pub user_id: i32,
|
|||
pub ban: bool,
|
|||
pub remove_data: Option<bool>,
|
|||
pub reason: Option<String>,
|
|||
pub expires: Option<i64>,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Clone)]
|
|||
pub struct BanFromCommunityResponse {
|
|||
pub user: UserView,
|
|||
pub banned: bool,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct AddModToCommunity {
|
|||
pub community_id: i32,
|
|||
pub user_id: i32,
|
|||
pub added: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize, Clone)]
|
|||
pub struct AddModToCommunityResponse {
|
|||
pub moderators: Vec<CommunityModeratorView>,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct EditCommunity {
|
|||
pub edit_id: i32,
|
|||
pub title: String,
|
|||
pub description: Option<String>,
|
|||
pub icon: Option<String>,
|
|||
pub banner: Option<String>,
|
|||
pub category_id: i32,
|
|||
pub nsfw: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct DeleteCommunity {
|
|||
pub edit_id: i32,
|
|||
pub deleted: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct RemoveCommunity {
|
|||
pub edit_id: i32,
|
|||
pub removed: bool,
|
|||
pub reason: Option<String>,
|
|||
pub expires: Option<i64>,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct FollowCommunity {
|
|||
pub community_id: i32,
|
|||
pub follow: bool,
|
|||
pub auth: String,
|
|||
}
|
|||
|
|||
#[derive(Serialize, Deserialize)]
|
|||
pub struct GetFollowedCommunities {
|
|||
pub auth: String,
|
|||
}
|
|||