Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70d1ffe9a2 | ||
|
|
f67e2ae35e | ||
|
|
1f3bb27e17 | ||
|
|
cff75e3a47 | ||
|
|
ff5e635dda | ||
|
|
6727e1817a | ||
|
|
c42229f78c | ||
|
|
8156c1927c | ||
|
|
088c54ddf3 | ||
|
|
6fccb6fe35 | ||
|
|
3b3f1f6b93 | ||
|
|
62189bf11d | ||
|
|
fb4949b511 | ||
|
|
d4b1788a4f | ||
|
|
587997dd67 | ||
|
|
6fc2d001b2 | ||
|
|
4eda3da75d | ||
|
|
163f7e4e2b | ||
|
|
44a5895b0c | ||
|
|
3d7d406834 | ||
|
|
bdc8be4508 | ||
|
|
9ad96f560d | ||
|
|
bc5f2beaf7 | ||
|
|
fba57318fa | ||
|
|
12bb75809f | ||
|
|
37b12c5fee | ||
|
|
830385ea2b | ||
|
|
dc63fa57b8 | ||
|
|
5252b8f320 | ||
|
|
a4ced664cf | ||
|
|
8fecf7de2d | ||
|
|
3ca29603ed | ||
|
|
8e59145826 | ||
|
|
e4f9d0b61e | ||
|
|
65938bb2a0 | ||
|
|
bb680e8cb8 | ||
|
|
52d201eee9 | ||
|
|
402f9e0d75 | ||
|
|
8492f24064 | ||
|
|
6f240828cf | ||
|
|
5ecf2d9629 | ||
|
|
f105d1f7ea | ||
|
|
f66c280b0b | ||
|
|
10ff4b3d2a | ||
|
|
bebb4d6370 | ||
|
|
cb34ab88f7 | ||
|
|
af2c61292b | ||
|
|
a3a66b6db2 | ||
|
|
5d5f1d6909 | ||
|
|
9872b78677 | ||
|
|
b478049303 | ||
|
|
b66f0acf4e | ||
|
|
679463eb3f | ||
|
|
02928caac1 | ||
|
|
e708f1ad2e | ||
|
|
0310bbe0f9 | ||
|
|
69ab8e50eb | ||
|
|
3df3c333bf | ||
|
|
99b5e2dbf3 | ||
|
|
d06f684f0d | ||
|
|
b39eadffeb | ||
|
|
9d0b5fac3e | ||
|
|
9ab87b2779 | ||
|
|
c47b6e5533 | ||
|
|
e0682fa868 | ||
|
|
bd18de35a6 | ||
|
|
bf37223849 | ||
|
|
93e13e5563 | ||
|
|
b45321f28d | ||
|
|
b218768904 | ||
|
|
53158b4cf4 | ||
|
|
12b51a211a | ||
|
|
a584134858 | ||
|
|
0aea550c6c | ||
|
|
5721bfd796 | ||
|
|
1c0dfeb9a4 | ||
|
|
f6fc0c535c | ||
|
|
1c7d1ece9c | ||
|
|
5f150b7a59 | ||
|
|
7b0377c85f | ||
|
|
f3e8cce2ed | ||
|
|
eeb873b816 | ||
|
|
f1e743c331 | ||
|
|
1265611f9e | ||
|
|
f38ac73615 | ||
|
|
a85ebd30c0 | ||
|
|
bd5901d15e | ||
|
|
6b08da458a | ||
|
|
26346cde30 | ||
|
|
47d6e22988 | ||
|
|
0646de22bd | ||
|
|
2b42377b3f | ||
|
|
8ae265c8f8 | ||
|
|
9f0b25e92b | ||
|
|
3866558d1d | ||
|
|
fb90558dec | ||
|
|
5860b71223 | ||
|
|
c65a44ba88 | ||
|
|
761cfc2cce | ||
|
|
2d293a6148 | ||
|
|
7f6837ccb1 | ||
|
|
206506f5e9 | ||
|
|
a5d493a8c9 | ||
|
|
e485f7bd47 | ||
|
|
7eb7c017a5 | ||
|
|
01808fa644 | ||
|
|
7e37f56db6 | ||
|
|
8686275b69 | ||
|
|
01e5aa4ddd | ||
|
|
c5a69d240a | ||
|
|
26dac40720 | ||
|
|
34c0f696af | ||
|
|
4a9a3d3235 | ||
|
|
17922f4dfd | ||
|
|
ea5e607779 | ||
|
|
b146e182c6 | ||
|
|
0695c08ac3 | ||
|
|
bbeeda7268 | ||
|
|
325f7605f2 | ||
|
|
1d12dff033 | ||
|
|
aecbf620a8 | ||
|
|
9268968fd4 | ||
|
|
b274ce1268 | ||
|
|
40217f3261 | ||
|
|
d61eac0a01 | ||
|
|
b2570eab38 | ||
|
|
71ca134599 | ||
|
|
d4226a289c | ||
|
|
83d4148de1 | ||
|
|
5f72435bfb | ||
|
|
7bfd7ce285 | ||
|
|
864dae4469 | ||
|
|
cafd2e6db3 | ||
|
|
73c362de96 | ||
|
|
5b3e456e09 | ||
|
|
b710493701 | ||
|
|
ce473f2741 | ||
|
|
02a05d7a9a | ||
|
|
0614bdcf18 | ||
|
|
4b6d261739 | ||
|
|
f70ec59359 | ||
|
|
ed08f80f05 | ||
|
|
2873344690 | ||
|
|
d6131af289 | ||
|
|
6b55b5c35c | ||
|
|
d405269526 | ||
|
|
08acdc0503 | ||
|
|
b9286c2c6e | ||
|
|
128ff89426 | ||
|
|
436f7da464 | ||
|
|
5d7edc4a4c | ||
|
|
eb7552e8f3 | ||
|
|
31d1d21d1e | ||
|
|
d9fb5c582f | ||
|
|
2cd75176a4 | ||
|
|
c7e8760ffe | ||
|
|
ad8d353f9a | ||
|
|
e2f61ede56 | ||
|
|
8f25bf056d | ||
|
|
123ba39520 | ||
|
|
f6dbf71964 | ||
|
|
8c2eba6cbb | ||
|
|
fcd35f5043 | ||
|
|
5f56681c01 | ||
|
|
cd5eb25948 | ||
|
|
ab526ed291 | ||
|
|
aa7e43a61e | ||
|
|
e29da1b47a | ||
|
|
d4e9acdb79 |
No files matched your search
@@ -14,6 +14,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build PrivaPub.sln -c Release
|
run: dotnet build PrivaPub.sln -c Release
|
||||||
|
|
||||||
- name: Test (unit and integration, on a throwaway mongod)
|
|
||||||
run: tools/ci/with-test-mongod.sh dotnet test PrivaPub.sln -c Release --no-build
|
|
||||||
+51
-14
@@ -12,8 +12,7 @@ env:
|
|||||||
BACKUPS: /var/backups/privapub.thepra.dev
|
BACKUPS: /var/backups/privapub.thepra.dev
|
||||||
LOCAL_URL: http://127.0.0.1:6970
|
LOCAL_URL: http://127.0.0.1:6970
|
||||||
PUBLIC_URL: https://privapub.thepra.dev
|
PUBLIC_URL: https://privapub.thepra.dev
|
||||||
MONGO_URI: mongodb://127.0.0.1:27022
|
SERVER_BACKUPS: /var/lib/privapub/backups
|
||||||
MONGO_DB: PrivaPub
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
site:
|
site:
|
||||||
@@ -28,9 +27,6 @@ jobs:
|
|||||||
echo "BUILD_REF=${GITHUB_REF_NAME:-master}" >> "$GITHUB_ENV"
|
echo "BUILD_REF=${GITHUB_REF_NAME:-master}" >> "$GITHUB_ENV"
|
||||||
echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
|
echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Test (unit and integration, on a throwaway mongod)
|
|
||||||
run: tools/ci/with-test-mongod.sh dotnet test PrivaPub.sln -c Release
|
|
||||||
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: |
|
run: |
|
||||||
rm -rf "$GITHUB_WORKSPACE/publish"
|
rm -rf "$GITHUB_WORKSPACE/publish"
|
||||||
@@ -57,12 +53,24 @@ jobs:
|
|||||||
echo "SNAPSHOT=$BACKUPS/site-$STAMP" >> "$GITHUB_ENV"
|
echo "SNAPSHOT=$BACKUPS/site-$STAMP" >> "$GITHUB_ENV"
|
||||||
ls -1dt "$BACKUPS"/site-* 2>/dev/null | tail -n +4 | xargs -r rm -rf || true
|
ls -1dt "$BACKUPS"/site-* 2>/dev/null | tail -n +4 | xargs -r rm -rf || true
|
||||||
|
|
||||||
- name: Dump the database
|
# The server's own backup (PrivaPub admin backup, owner decision 2026-10-07) of the database as the live build left it:
|
||||||
|
# the new build's command runs before its migrations. The media are listed, not linked (the runner may not link
|
||||||
|
# www-data's files; the nightly backups hold them). Never the statistics salt, which must not outlive its day (owner
|
||||||
|
# rule), nor the configuration's copy with its secrets. No deploy while a restore waits for its boot.
|
||||||
|
- name: Back up the database
|
||||||
run: |
|
run: |
|
||||||
DUMP="$BACKUPS/mongo-$(date +%Y%m%d-%H%M%S).archive.gz"
|
[ ! -e "$SERVER_BACKUPS/restore.json" ] || { echo "::error::a restore is pending or running ($SERVER_BACKUPS/restore.json): deploy after it"; exit 1; }
|
||||||
mongodump --quiet --uri "$MONGO_URI" --db "$MONGO_DB" --gzip --archive="$DUMP"
|
out=$(cd "$GITHUB_WORKSPACE/publish" && ASPNETCORE_ENVIRONMENT=Production ./PrivaPub admin backup --kind pre-deploy --db-only)
|
||||||
echo "::notice::database dumped to $DUMP ($(du -h "$DUMP" | cut -f1))"
|
echo "$out"
|
||||||
ls -1t "$BACKUPS"/mongo-*.archive.gz 2>/dev/null | tail -n +8 | xargs -r rm -f || true
|
id=$(echo "$out" | grep -oE '^[0-9]{8}-[0-9]{6}-pre-deploy' | tail -1)
|
||||||
|
[ -d "$SERVER_BACKUPS/$id" ] || { echo "::error::the backup was not made"; exit 1; }
|
||||||
|
(cd "$GITHUB_WORKSPACE/publish" && ASPNETCORE_ENVIRONMENT=Production ./PrivaPub admin backup verify "$id")
|
||||||
|
if [ -e "$SERVER_BACKUPS/$id/db/InteractionSalt.jsonl.gz" ]; then
|
||||||
|
echo "::error::the backup holds the statistics salt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "BACKUP_ID=$id" >> "$GITHUB_ENV"
|
||||||
|
echo "::notice::database backed up as $id"
|
||||||
|
|
||||||
- name: Stop, sync, start
|
- name: Stop, sync, start
|
||||||
run: |
|
run: |
|
||||||
@@ -90,13 +98,23 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Verify what is being served
|
- name: Verify what is being served
|
||||||
env:
|
|
||||||
SMOKE_TOKEN: ${{ secrets.PRIVAPUB_SMOKE_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
served=$(curl -fsS "$PUBLIC_URL/build.json" | python3 -c "import json,sys; print(json.load(sys.stdin).get('commit',''))")
|
served=$(curl -fsS "$PUBLIC_URL/build.json" | python3 -c "import json,sys; print(json.load(sys.stdin).get('commit',''))")
|
||||||
[ "$served" = "$BUILD_COMMIT" ] || { echo "::error::served build is '$served', expected '$BUILD_COMMIT'"; exit 1; }
|
[ "$served" = "$BUILD_COMMIT" ] || { echo "::error::served build is '$served', expected '$BUILD_COMMIT'"; exit 1; }
|
||||||
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Accept: application/activity+json' "$PUBLIC_URL/peasants/privapub")
|
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Accept: application/activity+json' "$PUBLIC_URL/peasants/privapub")
|
||||||
[ "$code" = "200" ] || { echo "::error::the instance actor answered $code"; exit 1; }
|
[ "$code" = "200" ] || { echo "::error::the instance actor answered $code"; exit 1; }
|
||||||
|
# SecureMode (owner decision 2026-10-04): an unsigned reader gets 401 before any lookup, so a name no persona can have
|
||||||
|
# (a hyphen is outside UserNameRegex) checks it without naming anyone; a browser asking for a persona gets its page
|
||||||
|
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Accept: application/activity+json' "$PUBLIC_URL/peasants/no-such-persona")
|
||||||
|
[ "$code" = "401" ] || { echo "::error::an unsigned GET of a persona answered $code, not 401: SecureMode is off"; exit 1; }
|
||||||
|
directory=$(curl -fsS "$PUBLIC_URL/api/v1/directory?local=true&limit=1") || { echo "::error::the directory did not answer"; exit 1; }
|
||||||
|
persona=$(echo "$directory" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d[0]['username'] if d else '')")
|
||||||
|
if [ -z "$persona" ]; then
|
||||||
|
echo "::notice::no persona in the directory: the browser redirect is not checked"
|
||||||
|
else
|
||||||
|
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Accept: text/html' "$PUBLIC_URL/peasants/$persona")
|
||||||
|
[ "$code" = "302" ] || { echo "::error::a browser asking for @$persona got $code, not a redirect"; exit 1; }
|
||||||
|
fi
|
||||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$PUBLIC_URL/.well-known/nodeinfo")
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$PUBLIC_URL/.well-known/nodeinfo")
|
||||||
[ "$code" = "200" ] || { echo "::error::nodeinfo answered $code"; exit 1; }
|
[ "$code" = "200" ] || { echo "::error::nodeinfo answered $code"; exit 1; }
|
||||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$PUBLIC_URL/swagger/index.html")
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$PUBLIC_URL/swagger/index.html")
|
||||||
@@ -106,6 +124,25 @@ jobs:
|
|||||||
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/activity+json' \
|
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/activity+json' \
|
||||||
--data '{"type":"Follow","actor":"https://example.org/users/x","object":"'"$PUBLIC_URL"'/peasants/privapub"}' "$PUBLIC_URL/human-centipede")
|
--data '{"type":"Follow","actor":"https://example.org/users/x","object":"'"$PUBLIC_URL"'/peasants/privapub"}' "$PUBLIC_URL/human-centipede")
|
||||||
[ "$code" = "401" ] || { echo "::error::an unsigned inbox POST answered $code"; exit 1; }
|
[ "$code" = "401" ] || { echo "::error::an unsigned inbox POST answered $code"; exit 1; }
|
||||||
tools/smoke/mastodon-api.sh "$PUBLIC_URL" "$SMOKE_TOKEN"
|
tools/smoke/mastodon-api.sh "$PUBLIC_URL"
|
||||||
[ -n "$SMOKE_TOKEN" ] || echo "::warning::PRIVAPUB_SMOKE_TOKEN is not set, so the signed-in API was not checked"
|
open=$(curl -fsS "$PUBLIC_URL/nodeinfo/2.1" | python3 -c "import json,sys; print(json.load(sys.stdin)['openRegistrations'])")
|
||||||
|
enabled=$(curl -fsS "$PUBLIC_URL/api/v2/instance" | python3 -c "import json,sys; print(json.load(sys.stdin)['registrations']['enabled'])")
|
||||||
|
[ "$open" = "$enabled" ] || { echo "::error::NodeInfo says registrations are $open, the instance API $enabled"; exit 1; }
|
||||||
|
curl -fsS "$PUBLIC_URL/stargazing" | grep -q 'The crawler is <strong>on</strong>' \
|
||||||
|
|| { echo "::error::/stargazing does not say the crawler is on"; exit 1; }
|
||||||
echo "::notice::serving $served"
|
echo "::notice::serving $served"
|
||||||
|
|
||||||
|
# The deploy no longer signs in (owner decision 2026-10-17): it kept a login of its own, deploy-smoke, whose @thepra
|
||||||
|
# is the administrator's now. Its checks are the anonymous ones above.
|
||||||
|
|
||||||
|
# The server fetches DB-IP Lite itself (GeoUpdater) about 30 s after it starts and then daily; the deploy only checks.
|
||||||
|
- name: Geolocation databases are current
|
||||||
|
run: |
|
||||||
|
for kind in city asn; do
|
||||||
|
db="/var/lib/privapub/geo/dbip-$kind-lite.mmdb"
|
||||||
|
for i in $(seq 1 60); do [ -s "$db" ] && break; sleep 10; done
|
||||||
|
[ -s "$db" ] || { echo "::error::$db is missing: the server has not fetched DB-IP Lite"; exit 1; }
|
||||||
|
days=$(( ($(date +%s) - $(stat -c %Y "$db")) / 86400 ))
|
||||||
|
[ "$days" -le 40 ] || { echo "::error::$db was installed $days days ago"; exit 1; }
|
||||||
|
done
|
||||||
|
curl -fsS "$PUBLIC_URL/stargazing" | grep -o 'DB-IP Lite [0-9-]*' | head -1 | sed 's/^/::notice::locating with /'
|
||||||
@@ -257,6 +257,7 @@ Generated_Code/
|
|||||||
# because we have git ;-)
|
# because we have git ;-)
|
||||||
_UpgradeReport_Files/
|
_UpgradeReport_Files/
|
||||||
Backup*/
|
Backup*/
|
||||||
|
!PrivaPub/Infrastructure/Backup/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
ServiceFabricBackup/
|
ServiceFabricBackup/
|
||||||
@@ -401,7 +402,12 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
PrivaPub/media-store/
|
PrivaPub/media-store/
|
||||||
PrivaPub/media-store-proxy/
|
PrivaPub/media-store-proxy/
|
||||||
|
PrivaPub/media-store-trash/
|
||||||
|
PrivaPub/media-store-incoming/
|
||||||
|
PrivaPub/media-store-backups/
|
||||||
tools/pasture/.publish/
|
tools/pasture/.publish/
|
||||||
|
tools/pasture/.flood/
|
||||||
.claude/worktrees/
|
.claude/worktrees/
|
||||||
tools/pasture/.ca/
|
tools/pasture/.ca/
|
||||||
tools/pasture/.state/
|
tools/pasture/.state/
|
||||||
|
tools/pasture/out/
|
||||||
+322
-38
@@ -8,33 +8,109 @@ PrivaPub is an ActivityPub server written in C#. This document follows
|
|||||||
- [ActivityPub](https://www.w3.org/TR/activitypub/) (server-to-server)
|
- [ActivityPub](https://www.w3.org/TR/activitypub/) (server-to-server)
|
||||||
- [WebFinger](https://webfinger.net/)
|
- [WebFinger](https://webfinger.net/)
|
||||||
- [HTTP Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures), `rsa-sha256` / `hs2019` with RSA keys
|
- [HTTP Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures), `rsa-sha256` / `hs2019` with RSA keys
|
||||||
|
(`hs2019` hashed with SHA-256, or SHA-512 as some sign it; a `SHA-256=` or `SHA-512=` digest)
|
||||||
|
- [HTTP Message Signatures](https://www.rfc-editor.org/rfc/rfc9421) (RFC 9421) and Content-Digest (RFC 9530), verified on
|
||||||
|
deliveries and signed fetches: `rsa-v1_5-sha256` and `rsa-pss-sha512` with RSA keys
|
||||||
- [NodeInfo](https://nodeinfo.diaspora.software/) 2.0 and 2.1
|
- [NodeInfo](https://nodeinfo.diaspora.software/) 2.0 and 2.1
|
||||||
|
- Object integrity proofs ([FEP-8b32](https://codeberg.org/fediverse/fep/src/branch/main/fep/8b32/fep-8b32.md),
|
||||||
|
`eddsa-jcs-2022`, JSON canonicalised by [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785)) by Ed25519 keys published
|
||||||
|
as Multikeys ([FEP-521a](https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md)), on what personas
|
||||||
|
send to relays and verified on what is forwarded
|
||||||
|
|
||||||
## Tested against
|
## Tested against
|
||||||
|
|
||||||
- **GoToSocial 0.22.1, end to end.** It runs in a private network on the workstation (`tools/pasture/`) and is driven
|
End to end, in a private network on the workstation (`tools/pasture/`), each peer driven through its own client API
|
||||||
through its own client API. Checked both ways:
|
and every run starting clean, with signed fetches required (as privapub.thepra.dev runs):
|
||||||
- follows, including to a locked account;
|
- **GoToSocial 0.22.1**
|
||||||
- public posts with a content warning;
|
- **Mastodon 4.7.3**
|
||||||
- replies with notifications;
|
- **Misskey 2026.10**
|
||||||
- likes and boosts;
|
- **Sharkey 2025.4.7**
|
||||||
- direct messages;
|
- **Akkoma 3.20.1**
|
||||||
- edits and deletes;
|
- **Lemmy 1.0.0-beta.2**, and **Lemmy 0.19.20** (built with the platform's roots, so it trusts the pasture's CA)
|
||||||
- unfollow.
|
- **PeerTube 8.3.1**
|
||||||
- **Mastodon, Misskey, Lemmy and PeerTube, by unit tests only.** The tests feed the parser documents written in each
|
- **Pixelfed 0.14.4**
|
||||||
server's shape. No live exchange with any of them has run yet.
|
- **WordPress 7.1.2 with ActivityPub 9.3.1**
|
||||||
|
- **Friendica 2026.05**
|
||||||
|
- **Mobilizon 5.2.4**
|
||||||
|
- **Gancio 1.28.2**
|
||||||
|
- **Funkwhale 2.0.11**
|
||||||
|
- **PieFed 1.7.17**
|
||||||
|
- **Mbin 1.10.1**
|
||||||
|
- **NodeBB 4.16.1**
|
||||||
|
- **Smithereen 1.0.3**
|
||||||
|
- **Mitra 5.9.1**
|
||||||
|
- **snac2 2.95**
|
||||||
|
- **WriteFreely 0.17.2**
|
||||||
|
- **Owncast 0.3.0**
|
||||||
|
- **Ghost 6.67** with its ActivityPub service 1.2.14
|
||||||
|
- **BookWyrm 0.9.3**
|
||||||
|
- **Vernissage 1.43.0**
|
||||||
|
- **Hubzilla 11.4.1** with its pubcrawl addon
|
||||||
|
- **Forte 26.9.10** (portable identities: actors served through `/.well-known/apgateway/did:key:…`)
|
||||||
|
- **Castopod 1.15.5** (podcasts as actors, their episodes with the sound)
|
||||||
|
- **Ktistec 3.13.0**
|
||||||
|
- **Activity-Relay 2.0.9** and **aode-relay 0.3.129**, as relays PrivaPub reads from
|
||||||
|
- in the town only (a seeded community checked server by server): **Hollo 0.9.19**, **Iceshrimp.NET 2026.1.2-beta**,
|
||||||
|
**Pleroma 2.10.2**
|
||||||
|
|
||||||
|
Checked both ways, where the peer has the feature:
|
||||||
|
- follows, locked accounts included;
|
||||||
|
- every visibility, content warnings, replies and their notifications;
|
||||||
|
- likes, boosts and emoji reactions with their undos;
|
||||||
|
- direct messages;
|
||||||
|
- polls;
|
||||||
|
- quotes;
|
||||||
|
- images with alt text;
|
||||||
|
- edits with history and deletes;
|
||||||
|
- communities and circles;
|
||||||
|
- blocks and unfollows.
|
||||||
|
|
||||||
|
`docs/INTEROP.md` has each peer's evidence and what is still expected to fail. The platforms not in the pasture are
|
||||||
|
read from documents in their published shape (`docs/INTEROP.md` records each one); there is no test project.
|
||||||
|
|
||||||
## Supported FEPs
|
## Supported FEPs
|
||||||
|
|
||||||
- [FEP-67ff: FEDERATION.md](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md)
|
- [FEP-67ff: FEDERATION.md](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md)
|
||||||
- [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md)
|
- [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md)
|
||||||
- [FEP-2c59: Discovery of a WebFinger address from an ActivityPub actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2c59/fep-2c59.md)
|
- [FEP-2c59: Discovery of a WebFinger address from an ActivityPub actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2c59/fep-2c59.md):
|
||||||
|
every actor names its handle, and a peer's `webfinger` on another domain than its actor's host (Mastodon's
|
||||||
|
`LOCAL_DOMAIN`) is the handle shown once that domain's WebFinger points back to the actor; asked again on a rename
|
||||||
|
- [FEP-d556: Server-Level Actor Discovery Using WebFinger](https://codeberg.org/fediverse/fep/src/branch/main/fep/d556/fep-d556.md)
|
||||||
|
(WebFinger for the server's origin links its instance actor as `…#Service`) and
|
||||||
|
[FEP-2677: Identifying the Application Actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2677/fep-2677.md)
|
||||||
|
(`/.well-known/nodeinfo` links it as `…#Application`)
|
||||||
|
- [FEP-844e: Capability discovery](https://codeberg.org/fediverse/fep/src/branch/main/fep/844e/fep-844e.md): the instance
|
||||||
|
actor's `implements`, and every other actor's `generator`, name RFC 9421 (verified with RSA keys)
|
||||||
- [FEP-1b12: Group federation](https://codeberg.org/fediverse/fep/src/branch/main/fep/1b12/fep-1b12.md) (communities; see "Groups")
|
- [FEP-1b12: Group federation](https://codeberg.org/fediverse/fep/src/branch/main/fep/1b12/fep-1b12.md) (communities; see "Groups")
|
||||||
|
- [FEP-044f: Consent-respecting quote posts](https://codeberg.org/fediverse/fep/src/branch/main/fep/044f/fep-044f.md)
|
||||||
|
(`QuoteAuthorization` at `/parrot-licences/{id}`; checked with Mastodon both ways)
|
||||||
|
- [FEP-9967: Polls](https://codeberg.org/fediverse/fep/src/branch/main/fep/9967/fep-9967.md)
|
||||||
|
- [FEP-c0e0: Emoji reactions](https://codeberg.org/fediverse/fep/src/branch/main/fep/c0e0/fep-c0e0.md) (`EmojiReact`, and Misskey's
|
||||||
|
`Like` with content)
|
||||||
|
- [FEP-5feb: Search indexing consent](https://codeberg.org/fediverse/fep/src/branch/main/fep/5feb/fep-5feb.md) (`indexable`)
|
||||||
|
- [FEP-521a: Representing actor's public keys](https://codeberg.org/fediverse/fep/src/branch/main/fep/521a/fep-521a.md) and
|
||||||
|
[FEP-8b32: Object Integrity Proofs](https://codeberg.org/fediverse/fep/src/branch/main/fep/8b32/fep-8b32.md) (see
|
||||||
|
"Integrity proofs")
|
||||||
|
- [FEP-171b: Conversation Containers](https://codeberg.org/fediverse/fep/src/branch/main/fep/171b/fep-171b.md), received:
|
||||||
|
a thread owner's `Add` of someone's `Create`, `Update` or `Delete` to the thread's context is taken as that activity
|
||||||
|
passed on by the owner (on its FEP-8b32 proof, or as its origin has it)
|
||||||
|
- [FEP-8fcf: Followers collection synchronization across servers](https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md)
|
||||||
|
(sent and honoured; see "Followers synchronisation")
|
||||||
|
- [FEP-5624: Per-object reply control policies](https://codeberg.org/fediverse/fep/src/branch/main/fep/5624/fep-5624.md):
|
||||||
|
read (see "Replies its author approves")
|
||||||
|
- [FEP-7888: Demystifying the context property](https://codeberg.org/fediverse/fep/src/branch/main/fep/7888/fep-7888.md)
|
||||||
|
and [FEP-f228: Backfilling conversations](https://codeberg.org/fediverse/fep/src/branch/main/fep/f228/fep-f228.md):
|
||||||
|
a root post serves its `context` collection, and a remote thread is read from its `context` (or `contextHistory`)
|
||||||
|
before its `replies` (see "Activities")
|
||||||
|
- [FEP-7628: Move actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/7628/fep-7628.md): received; a persona's
|
||||||
|
follows move with the account (see `Move` under "Activities")
|
||||||
|
- [FEP-ae0c: Fediverse Relay Protocols](https://codeberg.org/fediverse/fep/src/branch/main/fep/ae0c/fep-ae0c.md): the
|
||||||
|
instance actor follows the relays configured, and their `Announce`s are taken as their origin vouches (see "Relays")
|
||||||
|
- [FEP-8967: Generic attachments, link previews](https://codeberg.org/fediverse/fep/src/branch/main/fep/8967/fep-8967.md):
|
||||||
|
received; a `preview` builds the card
|
||||||
|
|
||||||
Planned (see `docs/ROADMAP.md`, phases P5 to P8, and the per-platform notes in `docs/INTEROP.md`): FEP-044f (quotes),
|
Planned (see `docs/ROADMAP.md`, the completion program, and the per-platform notes in `docs/INTEROP.md`): FEP-9098
|
||||||
FEP-9967 (polls), FEP-c0e0 (emoji reactions), FEP-9098 (custom emoji), FEP-7888 and FEP-f228 (threads), FEP-7628 (Move),
|
custom emoji offered (R7) and FEP-8967 link attachments sent (R10).
|
||||||
FEP-8fcf (followers synchronisation), FEP-5feb (`indexable`), FEP-8967 (link attachments), FEP-521a and FEP-8b32 (keys
|
|
||||||
and integrity proofs), FEP-ae0c (relays).
|
|
||||||
|
|
||||||
## Actors
|
## Actors
|
||||||
|
|
||||||
@@ -52,15 +128,28 @@ actor document, a collection, NodeInfo or a delivery relates two avatars of the
|
|||||||
| Activities | `/peasants/{name}/grunts/{id}` |
|
| Activities | `/peasants/{name}/grunts/{id}` |
|
||||||
| Quote permissions (`QuoteAuthorization`) | `/peasants/{name}/parrot-licences/{id}` |
|
| Quote permissions (`QuoteAuthorization`) | `/peasants/{name}/parrot-licences/{id}` |
|
||||||
| Direct-message context | `/peasants/{name}/whispers/{id}` |
|
| Direct-message context | `/peasants/{name}/whispers/{id}` |
|
||||||
|
| A persona's wall (FEP-400e) | `/peasants/{name}/graffiti` |
|
||||||
|
| Followers on the asking server (FEP-8fcf) | `/peasants/{name}/groupies/roll-call` |
|
||||||
| Profile and post pages | `/@{name}`, `/@{name}/{id}` |
|
| Profile and post pages | `/@{name}`, `/@{name}/{id}` |
|
||||||
|
|
||||||
The names are the project's own and are stable; resolve actors through WebFinger, not by guessing a path.
|
The names are the project's own and are stable; resolve actors through WebFinger, not by guessing a path.
|
||||||
|
|
||||||
- The key is `{actor}#main-key`, RSA 2048, served as SPKI PEM with `owner` set to the actor.
|
- The key is `{actor}#main-key`, RSA 2048, served as SPKI PEM with `owner` set to the actor.
|
||||||
- `published` on an actor is a whole day, chosen at random up to two weeks before the account was made, so two
|
- `published` on an actor is a whole day, chosen at random up to two weeks before the account was made, so two
|
||||||
personas made on the same day do not share a date. `indexable` is `false`.
|
personas made on the same day do not share a date. `indexable` is `false` unless the persona turns it on, and
|
||||||
|
`discoverable` is `true` unless it turns that off.
|
||||||
- The instance actor is `/peasants/privapub` (type `Application`). It signs every fetch PrivaPub makes, so no avatar's key
|
- The instance actor is `/peasants/privapub` (type `Application`). It signs every fetch PrivaPub makes, so no avatar's key
|
||||||
is used to read another server's content.
|
is used to read another server's content. Its `name` is the server's name and its `summary` the server's short
|
||||||
|
description, as the administrator sets them (the server's settings; until then "PrivaPub" and a sentence saying what it
|
||||||
|
does); NodeInfo's `metadata.nodeName` and `nodeDescription` come from the same settings. It also answers at the server's root (`/`) for a request that asks for
|
||||||
|
ActivityPub, as Lemmy's site actor does: PieFed sends a community's announces to the inbox of the Application at a
|
||||||
|
peer's root, and to `/inbox` when there is none.
|
||||||
|
- The reporter is `/peasants/privapub_reports` (type `Service`, "Reports from <host>"), one for the whole server with
|
||||||
|
its own key. It sends the reports Lemmy, PieFed and Mbin take in Lemmy's shape (see **Reports** below) and does
|
||||||
|
nothing else: nobody follows or mentions it, the Mastodon API has no account for it, and it has no page.
|
||||||
|
- The reader of feeds is `/peasants/privapub_feeds` (type `Service`, "Feeds read on <host>"), one for the whole server
|
||||||
|
with its own key. When a persona here follows a feed, the reader follows each community in it, and stops following one
|
||||||
|
no feed read here holds any more; no community and no feed learns which persona reads it. It does nothing else.
|
||||||
|
|
||||||
## Groups
|
## Groups
|
||||||
|
|
||||||
@@ -68,16 +157,38 @@ A group is either a **community** or a **circle**.
|
|||||||
|
|
||||||
- A **community** follows [FEP-1b12](https://codeberg.org/fediverse/fep/src/branch/main/fep/1b12/fep-1b12.md). Posts
|
- A **community** follows [FEP-1b12](https://codeberg.org/fediverse/fep/src/branch/main/fep/1b12/fep-1b12.md). Posts
|
||||||
addressed to it (in `to`, `cc` or `audience`) are accepted according to its posting policy (followers, anyone, or
|
addressed to it (in `to`, `cc` or `audience`) are accepted according to its posting policy (followers, anyone, or
|
||||||
moderators only) and the group `Announce`s the whole activity, with `audience` set, to its followers. A new post is
|
moderators only) and the group `Announce`s the whole activity, with `audience` set, to its followers and to the
|
||||||
|
author's own server, whether anyone there follows it or not (Lemmy keeps its user's post pending until then). A new post is
|
||||||
also announced as an object so Mastodon shows it. Updates and deletes of community content are announced too. A
|
also announced as an object so Mastodon shows it. Updates and deletes of community content are announced too. A
|
||||||
top-level post is a `Page` with a `name`. Members are counted at `/flock`; moderators are listed at `/wardens`, which
|
top-level post is a `Page` with a `name`. Members are counted at `/flock`; moderators are listed at `/wardens`, which
|
||||||
the actor's `attributedTo` points to, with `postingRestrictedToMods` as Lemmy expects. A mention of a community posts into it.
|
the actor's `attributedTo` points to, with `postingRestrictedToMods` as Lemmy expects. A mention of a community posts into it.
|
||||||
- A **circle** is private. Its actor is not discoverable and every follow is a request. Its posts are addressed to the
|
- A **circle** is private. Its actor is not discoverable and every follow is a request. Its posts are addressed to the
|
||||||
circle and its members collection, delivered to each member's own inbox and never announced. They are served only
|
circle and its members collection, delivered to each member's own inbox and never announced. Each member's copy also
|
||||||
to a signed request from a member, or from the instance actor of a member's server; anyone else gets 404. A
|
names that member in `cc`, so servers that keep only posts naming one of their accounts (Mastodon, GoToSocial) keep
|
||||||
Mastodon member's replies reach only the people they mention.
|
it; it names no other member. The posts are served only to a signed request from a member, or from the instance actor
|
||||||
|
of a member's server, and that copy names the member (or the members on that server); anyone else gets 404. A
|
||||||
|
Mastodon member's replies reach only the people they mention. Its owner lets a request in with an `Accept` of the
|
||||||
|
Follow, and declines one or takes a member from elsewhere out with a `Reject` of it, as Mastodon removes a follower.
|
||||||
- Announces from **remote** groups (Lemmy communities) are followed through to the activity: the object is fetched
|
- Announces from **remote** groups (Lemmy communities) are followed through to the activity: the object is fetched
|
||||||
from its own origin, never taken from the announce.
|
from its own origin, never taken from the announce. They are taken from a group someone here follows, and also when
|
||||||
|
they relay a vote on one of our posts in a thread of that group (Lemmy sends a vote to the community alone). A post
|
||||||
|
keeps the group its `audience` names, however it arrived.
|
||||||
|
- A post in a remote group followed here that the group's own server delivers itself, as its author's `Create` with the
|
||||||
|
group as its `audience` (Mbin sends a magazine's threads that way, with no announce), is kept as if announced: the
|
||||||
|
group's server speaks for posts in it. The same from another server is not.
|
||||||
|
- A remote community's **moderation** reaches the posts it holds. A removal (`Announce{Delete}`) is believed at once
|
||||||
|
from a community on the post's own server, which speaks for it (PieFed keeps serving a thread its moderator removed),
|
||||||
|
and from a community elsewhere once the post's origin answers it gone. A lock sent as it is (`Lock`, Mbin) is taken
|
||||||
|
from the post's own server only. A lock (`Announce{Lock}`, or `commentsEnabled: false` on the post) refuses replies,
|
||||||
|
ours included, until `Undo{Lock}`. A ban of a persona (`Announce{Block}` with the community as `target`) shows as
|
||||||
|
`blocked_by` on the community and refuses the persona's posts and replies there until the `Undo`. A post moved to
|
||||||
|
another community (PieFed's `Announce{Move{object: post, origin, target}}`, relayed by the community it leaves) goes
|
||||||
|
there with its thread; a move into a community this server hosts is not taken.
|
||||||
|
- **Feeds** (Lemmy 1.0's multi-communities and PieFed's feeds, `type: Feed`) are read as accounts whose following is
|
||||||
|
their communities: the feed's `following` collection, read once a day with its counts, and each community in it read in
|
||||||
|
turn. A persona following a feed is followed through the server (owner decision 2026-10-07): the reader of feeds
|
||||||
|
follows its communities, the feed itself is sent nothing, and the persona reads the feed's threads in a timeline of
|
||||||
|
its own (`GET /api/v1/timelines/feed/:id`; the feeds it reads are `GET /api/v1/feeds`), not in its home.
|
||||||
|
|
||||||
## Activities
|
## Activities
|
||||||
|
|
||||||
@@ -86,28 +197,97 @@ Received:
|
|||||||
| Activity | Effect |
|
| Activity | Effect |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `Follow` | follows an avatar or community; `Accept` is sent unless the community approves members by hand |
|
| `Follow` | follows an avatar or community; `Accept` is sent unless the community approves members by hand |
|
||||||
| `Accept{Follow}`, `Reject{Follow}` | completes or ends a follow an avatar requested |
|
| `Accept{Follow}`, `Reject{Follow}` | completes or ends a follow an avatar requested; once a follow holds, the account's latest public posts are read from its outbox's first page (twenty at most, once a day), so its profile is not empty; homes get only what arrives from then on |
|
||||||
|
| `Accept{Join}`, `Reject{Join}` | from the event's server: a persona's participation in the event is accepted or refused |
|
||||||
| `Undo{Follow, Like, Announce}` | reverses it |
|
| `Undo{Follow, Like, Announce}` | reverses it |
|
||||||
| `Create{Note, Article, Page, Question, Video, Audio, Event, ChatMessage, …}` | stored when a local avatar follows the author, is addressed or mentioned, when it replies to a local post, or when it is addressed to a community the author follows; a public parent is fetched to complete the thread |
|
| `Create{Note, Article, Page, Question, Video, Audio, Event, ChatMessage, …}` | stored when a local avatar follows the author, is addressed or mentioned, when it replies to a local post, or when it is addressed to a community the author follows (a persona is addressed by its actor id or by its profile page, as Mbin addresses its private messages); a public parent is fetched to complete the thread |
|
||||||
| `Update{Note}` | replaces the content; the previous version is kept |
|
| `Update{Note}` | replaces the content; the previous version is kept |
|
||||||
| `Update{Person}` | refetches the actor |
|
| `Update{Person}` | refetches the actor |
|
||||||
| `Like` | counted and notified, on posts the liker could see |
|
| `Like` | counted and notified, on posts the liker could see |
|
||||||
| `Dislike` | counted as a downvote (Lemmy, PieFed, Mbin, Friendica); `Undo` takes it back |
|
| `Dislike` | counted as a downvote (Lemmy, PieFed, Mbin, Friendica); `Undo` takes it back |
|
||||||
| `EmojiReact`, `Like` with an emoji `content` | an emoji reaction (FEP-c0e0; Pleroma, Akkoma, Iceshrimp.NET, Misskey, Sharkey), Unicode or a custom emoji from its `tag`; a `Like` whose content is ❤ stays a favourite; `Undo` takes it back |
|
| `EmojiReact`, `Like` with an emoji `content` | an emoji reaction (FEP-c0e0; Pleroma, Akkoma, Iceshrimp.NET, Misskey, Sharkey), Unicode or a custom emoji from its `tag`; a `Like` whose content is ❤ stays a favourite; `Undo` takes it back |
|
||||||
| `Join` | answered with `Ignore`: PrivaPub hosts no events yet (FEP-8a8e) |
|
| `Warn` (Lemmy 1.0) | a community moderator's warning about a persona's post there becomes the persona's `moderation_warning` notification, believed from the community's own server or an account its moderators collection lists |
|
||||||
|
| `Resolve{Flag}` (Lemmy 1.0) | a report we sent is marked resolved by the server holding what was reported (kept beside our own moderators' resolution) |
|
||||||
|
| `Join` | answered with `Ignore`: PrivaPub hosts no events of its own yet (FEP-8a8e) |
|
||||||
| `Announce` | counted and notified for local posts; shown to followers of the announcer, with the original refetched from its origin |
|
| `Announce` | counted and notified for local posts; shown to followers of the announcer, with the original refetched from its origin |
|
||||||
| `Delete` | deletes the object, or the actor and its follows; a deleted object id is remembered for 90 days, so a late `Create` cannot bring it back |
|
| `Delete` | deletes the object, or the actor and its follows; a deleted object id is remembered for 90 days, so a late `Create` cannot bring it back, though a new post its server publishes under that id after the deletion (Gancio numbers events from the last one kept) is kept |
|
||||||
| `Flag` | becomes a report for this server's moderators |
|
| `Flag` | becomes a report for this server's moderators |
|
||||||
|
| `Move` | an account moving: believed as Mastodon believes it, when the account sends it about itself and the new account, read again from its server, names it in `alsoKnownAs`. The old account then shows where it went (`moved`), and, as Mastodon does it (owner decision 2026-10-05), the personas following it follow the new one instead (a Follow to its server, an Undo to the old), in the same lists; a mute or a block of the old account carries over |
|
||||||
|
| `Add`/`Remove` on the actor's `featured` | the account pins or unpins one of its own posts (fetched from its server when not held); inside a community's announce, the community features a post made in it. Its profile shows them first (`pinned=true`). The collection itself is read with the account's counts, at most once a day. On the account's wall (`sm:wall`), see "Walls". Any other target (a community's moderators) is dropped; one on the account's own server that PrivaPub does not know has its document read again first, at most hourly |
|
||||||
|
| `Block` of a persona | the follows between them end, the blocker's posts and notifications are hidden from the persona, nothing of the persona's is addressed to the blocker, and the relationship says `blocked_by`; `Undo{Block}` lifts it |
|
||||||
|
|
||||||
Sent: `Follow`, `Undo{Follow}`, `Create{Note}`, `Create{Question}` and poll votes, `EmojiReact` and its `Undo`, `Update{Note}`, `Update{Person}`, `Delete{Tombstone}`, `Accept{Follow}`,
|
Sent: `Follow`, `Undo{Follow}`, `Create{Note}`, `Create{Question}` and poll votes, `EmojiReact` and its `Undo`, `Update{Note}`, `Update{Person}`, `Delete{Tombstone}`, `Accept{Follow}`,
|
||||||
`Reject{Follow}`, `Like`, `Announce` and their `Undo`, `Flag`. A deleted post answers 410 with a `Tombstone`.
|
`Reject{Follow}`, `Like`, `Dislike`, `Announce` and their `Undo`, `Flag`, `Join` and `Leave` of a remote event, and the
|
||||||
|
replies to a persona's posts passed on to its followers. A deleted post answers 410 with a `Tombstone`.
|
||||||
|
|
||||||
|
- **Votes.** A favourite is a `Like`, a downvote a `Dislike`; a persona has one vote a post, and a changed vote is sent
|
||||||
|
as the new vote alone, as Lemmy sends one (an `Undo` of the old one beside it could arrive after it and take the new
|
||||||
|
one away). `Undo` is sent only when the vote is taken back. A vote on a post in a remote community goes to the
|
||||||
|
community, which counts it and passes it on, as Lemmy sends one, and to the post's author only when it lives on
|
||||||
|
another server: one copy a server, since PieFed drops a second copy of an activity it has just seen.
|
||||||
|
|
||||||
- **Attachments** are `Document`s with `mediaType`, `name` (alt text), `blurhash`, `focalPoint`, `width` and `height`.
|
- **Attachments** are `Document`s with `mediaType`, `name` (alt text), `blurhash`, `focalPoint`, `width` and `height`.
|
||||||
Uploaded files have all metadata removed.
|
Uploaded files have all metadata removed.
|
||||||
- **Pinned posts** are the actor's `featured` collection (`/trophies`); `featuredTags` is `/tattoos`.
|
- **Threads** (owner decision 2026-10-06). A persona's public or unlisted post outside any group names its `replies`
|
||||||
|
(`…/scribbles/{id}/replies`) and its conversation, `context` (FEP-7888): the root post's `…/scribbles/{id}/context`,
|
||||||
|
which a reply inherits from its parent, ours or another server's. Both list only the public and unlisted posts
|
||||||
|
PrivaPub holds, the context every one under the root (at most 500); followers-only, circle, direct and local-only posts
|
||||||
|
name neither, and their collections answer 404. Mastodon completes a thread from them.
|
||||||
|
- **Followers synchronisation** (FEP-8fcf, owner decision 2026-10-06). A persona's delivery addressed to its followers
|
||||||
|
carries a signed `Collection-Synchronization` header: its `followers`, its roll-call (`…/groupies/roll-call`) and the
|
||||||
|
digest (XOR of each id's SHA-256) of its accepted followers on the receiving server only. The roll-call answers a
|
||||||
|
signed request with the persona's followers on the signer's server and nobody else's; unsigned, 401. A server whose
|
||||||
|
view differs mends itself from it, Mastodon both ways (checked live). Mastodon's `Undo{Follow}` for a follow it never
|
||||||
|
knew of has one id per account (`…#follows//undo`); when it comes again after a new follow, it ends that follow too.
|
||||||
|
Honoured the other way: when a delivery's header digests the sender's followers here otherwise than the personas
|
||||||
|
following it, PrivaPub reads the list it names (same origin, signed by the instance actor). A follow the list leaves out
|
||||||
|
ends, but only when the list is the one the digest describes; a request it lists is taken as accepted; a persona it
|
||||||
|
lists that follows nothing there sends `Undo{Follow}`, as Mastodon does.
|
||||||
|
- **Walls** (FEP-400e, Smithereen's; owner decision 2026-10-06). A persona's actor names its `wall`
|
||||||
|
(`…/graffiti`, `sm:wall`) and Smithereen's `privacySettings`: its followers may write on it (`wallPosting`), everyone
|
||||||
|
may read it (`wallPostVisibility`). A public post that is not a reply, sent with the wall as its `target` by an account
|
||||||
|
following the persona, is hosted: the persona is notified (as a mention), it reaches the persona's home and its
|
||||||
|
followers' here, and the persona's followers' servers and the author's are told with `Add{Note}` (the wall as the
|
||||||
|
target). Anything else written there is dropped. The persona may delete it (`DELETE /api/v1/statuses/:id`), which
|
||||||
|
sends `Remove{Note}` with the wall as a plain id; Smithereen deletes the post then, as it does when an owner deletes a
|
||||||
|
post on its wall. The wall lists the persona's public posts that start a thread and what was written on it, newest
|
||||||
|
first. An account elsewhere that tells its followers here, with `Add{Note}` on its own wall, of a post written there
|
||||||
|
has it shown to them as on its wall (`privapub.wall` on the status); a `Remove` there takes it away.
|
||||||
|
- **Pinned posts** are the actor's `featured` collection (`/trophies`); `featuredTags` is `/tattoos`. A pin or an unpin
|
||||||
|
is told to the post's audience as `Add` or `Remove` on `featured`, as Mastodon tells it.
|
||||||
- **Blocks are sent.** A blocked remote account receives `Block` from the blocking account (and `Reject{Follow}` if it
|
- **Blocks are sent.** A blocked remote account receives `Block` from the blocking account (and `Reject{Follow}` if it
|
||||||
followed); an unblock sends `Undo{Block}`.
|
followed); an unblock sends `Undo{Block}`. A server's block of a whole server sends that server nothing; the
|
||||||
- **Reports** are sent as `Flag` by the instance actor, never by the reporting account.
|
administrator may list it at `/api/v1/instance/domain_blocks` (off for each block by default, its name partly hidden
|
||||||
|
when asked, with its SHA-256 digest), as Mastodon lists its blocks.
|
||||||
|
- **Reports** are sent as `Flag`, never by the reporting account and never naming it.
|
||||||
|
- To the reported account's server: from the instance actor, with the account and the posts as `object` and the
|
||||||
|
persona's words in `content`.
|
||||||
|
- To a community on a server whose NodeInfo names Lemmy, PieFed or Mbin (owner decision 2026-10-06, the second place
|
||||||
|
PrivaPub decides by a server's software; PieFed and Mbin once the pasture showed each keeps such a report with its
|
||||||
|
reason): one `Flag` per reported post or comment that was made in that community (its own
|
||||||
|
`audience`, else its thread's), from the reporter, `to` the community, the post alone as `object`, the words (or,
|
||||||
|
with none, the category) in `summary` and `content`, sent to the community's inbox. Lemmy refuses a Flag from an
|
||||||
|
`Application`, with no `to` or with no reason; PieFed drops one from an `Application`; Mbin reads the reason from
|
||||||
|
`summary` alone. Such a server gets no instance actor's Flag: an account alone, or a post outside its communities,
|
||||||
|
is not reported there, since Lemmy takes neither (PieFed would take an account alone from the reporter; that is not
|
||||||
|
sent yet).
|
||||||
|
- **Direct messages** go out as a `Note` addressed to their recipients, except a message to one account elsewhere that
|
||||||
|
writes to us as `ChatMessage`s (Pleroma's type), or whose server takes nothing else: Lemmy before 1.0 and Mbin, as
|
||||||
|
their NodeInfo names them (owner decision 2026-10-05, the first place PrivaPub decides by a server's software). That
|
||||||
|
message goes out as a `ChatMessage`, to the account alone, without a mention in its text.
|
||||||
|
- **Replies are passed on** (inbox forwarding; owner decision 2026-10-05). A public or unlisted reply from another server
|
||||||
|
to a persona's public, unlisted or followers-only post goes on to the persona's followers as its author's server sent
|
||||||
|
and signed it, the way Mastodon forwards it: to every follower's server but the replier's own. Its `Update` and
|
||||||
|
`Delete` follow the same way. Nothing is passed on for a local-only post, a group's post or a reply that is not public
|
||||||
|
or unlisted. A server that receives it checks it as it checks any forwarded activity: Mastodon, Misskey and Sharkey
|
||||||
|
keep it only when its author LD-signed it (Mastodon does; Misskey 2026.10 and Akkoma do not), others read the reply
|
||||||
|
from its origin.
|
||||||
|
- **Events** (owner decision 2026-10-05). A persona joins another server's event with a `Join` and leaves it with a
|
||||||
|
`Leave`, both sent to the event's organiser only (`…/grunts/join-<id>`, `…/grunts/leave-<id>`). The organiser's
|
||||||
|
server answers `Accept` (Mobilizon at once for an open event) or `Reject`, which the persona sees as
|
||||||
|
`privapub.event.participation`: `pending`, `accepted` or `rejected`. An event that takes participants by invitation
|
||||||
|
or on another site (Mobilizon's `joinMode` `invite` or `external`) is refused before anything is sent (422). Who
|
||||||
|
takes part is public on the event's server.
|
||||||
|
|
||||||
A `Create`'s `Note` carries Mastodon's `content`, `contentMap`, `summary` and `sensitive`, plus `Mention` and `Hashtag`
|
A `Create`'s `Note` carries Mastodon's `content`, `contentMap`, `summary` and `sensitive`, plus `Mention` and `Hashtag`
|
||||||
tags.
|
tags.
|
||||||
@@ -117,6 +297,8 @@ tags.
|
|||||||
content, one per choice, counted once per voter. Counts are refreshed with an `Update{Question}` at most every three
|
content, one per choice, counted once per voter. Counts are refreshed with an `Update{Question}` at most every three
|
||||||
minutes. Our own votes on other servers' polls are sent the same way to the poll's author only, without `published`.
|
minutes. Our own votes on other servers' polls are sent the same way to the poll's author only, without `published`.
|
||||||
An incoming `Update` without a newer `updated` only refreshes counts and details; it is never recorded as an edit.
|
An incoming `Update` without a newer `updated` only refreshes counts and details; it is never recorded as an edit.
|
||||||
|
A post's earlier versions in `formerRepresentations` (Pleroma, Akkoma) are its edit history, read as the post itself is:
|
||||||
|
a post first met after its edits has them, and an edit that carries them brings the versions missed in between.
|
||||||
|
|
||||||
**Quotes** (FEP-044f, with the older keys):
|
**Quotes** (FEP-044f, with the older keys):
|
||||||
- **Received.** A quote is read from `quote`, `quoteUrl`, `quoteUri`, `_misskey_quote` or a FEP-e232 `Link` tag.
|
- **Received.** A quote is read from `quote`, `quoteUrl`, `quoteUri`, `_misskey_quote` or a FEP-e232 `Link` tag.
|
||||||
@@ -139,6 +321,28 @@ An incoming `Update` without a newer `updated` only refreshes counts and details
|
|||||||
`Delete{stamp}`.
|
`Delete{stamp}`.
|
||||||
- Followers-only posts and DMs can never be quoted.
|
- Followers-only posts and DMs can never be quoted.
|
||||||
|
|
||||||
|
**Interaction policies** (GoToSocial's `canReply`, `canLike`, `canAnnounce`, with the older `always` and
|
||||||
|
`approvalRequired`):
|
||||||
|
- **Read** on every remote post; one left out means anyone, automatically. A persona is let in at once when the rule
|
||||||
|
names the public, the persona itself, the author's followers while it follows the author, or the accounts the author
|
||||||
|
follows while the author follows it.
|
||||||
|
- **Shut out:** the client API answers 422 to a reply, favourite or boost the rule does not allow at all.
|
||||||
|
- **Asked first:** a `ReplyRequest`, `LikeRequest` or `AnnounceRequest` (the interaction as its `instrument`) goes to the
|
||||||
|
author alone, and the interaction waits (`privapub.approval: pending`). The author's `Accept` brings an authorization
|
||||||
|
(`result`), which must be on the author's origin, attributed to them and naming the interaction and the post; only then
|
||||||
|
does the reply go out with `replyAuthorization`, the boost with `announceAuthorization` and the like with
|
||||||
|
`likeAuthorization`. A `Reject` leaves it ours alone (`rejected`), and takes a like or a boost back.
|
||||||
|
- **As a third party,** a reply that a post's policy does not let in at once is kept only with an authorization that
|
||||||
|
verifies the same way. A rule naming a collection we cannot list (followers, following) lets the reply in.
|
||||||
|
- **Shown** to clients as GoToSocial's `interaction_policy` (`can_favourite`, `can_reply`, `can_reblog`).
|
||||||
|
- Our own posts state only `canQuote`: anyone may reply to, like and boost them.
|
||||||
|
|
||||||
|
**Replies its author approves** (FEP-5624's `canReply`, as PeerTube sets it on a video whose comments are moderated; a
|
||||||
|
`null` one says nothing): a persona it names, or that the post mentions, may reply, and the reply waits
|
||||||
|
(`privapub.approval: pending`), its `Create` going to the author alone. The author's `ApproveReply`, signed by the author
|
||||||
|
and naming the post answered, lets it out to its audience with `replyApproval`; a `RejectReply` leaves it ours alone
|
||||||
|
(`rejected`). An empty `canReply` refuses every reply (422).
|
||||||
|
|
||||||
**Custom emoji** (`Emoji` tags) are read on posts, display names, bios and profile fields, at most 64 per object.
|
**Custom emoji** (`Emoji` tags) are read on posts, display names, bios and profile fields, at most 64 per object.
|
||||||
**Profiles** keep their header, profile fields, `manuallyApprovesFollowers`, `published`, `movedTo`, `indexable`,
|
**Profiles** keep their header, profile fields, `manuallyApprovesFollowers`, `published`, `movedTo`, `indexable`,
|
||||||
`memorial` and avatar and header descriptions. A post's title becomes `name` and is also the first, bold line of `content`, because Mastodon does not show
|
`memorial` and avatar and header descriptions. A post's title becomes `name` and is also the first, bold line of `content`, because Mastodon does not show
|
||||||
@@ -162,6 +366,36 @@ The page's OpenGraph and Twitter tags give the title, description and image; the
|
|||||||
days and shared by every account on the server. Images are served to clients only through PrivaPub's media proxy.
|
days and shared by every account on the server. Images are served to clients only through PrivaPub's media proxy.
|
||||||
`Federation:FetchLinkPreviews=false` turns page fetching off.
|
`Federation:FetchLinkPreviews=false` turns page fetching off.
|
||||||
|
|
||||||
|
## Relays
|
||||||
|
|
||||||
|
PrivaPub reads from the relays `Federation:Relays` names, and those its administrator adds in the server's settings (by
|
||||||
|
their actor's address, or their inbox's), none by default. Its instance actor follows `Public` at each, as Mastodon
|
||||||
|
subscribes (`Federation/Relays/Relays.cs`, a minute after start, every six hours and at once when the administrator adds
|
||||||
|
or removes one: an unanswered or refused subscription is asked again a day later, and a relay no longer named gets the
|
||||||
|
`Undo`, unless the same relay is still named under another address). What an accepted relay passes on comes to the federated timeline, never to anyone's home: a public post it
|
||||||
|
forwards as its author sent it (Activity-Relay), read again from its origin like any forwarded post, and a post it
|
||||||
|
announces (aode-relay), kept as its author's and never as the relay's boost. Nothing else is taken from a relay. A
|
||||||
|
persona's public post outside any group, its edit and its deletion also go to the relays that accepted us (owner decision
|
||||||
|
2026-10-06), as Mastodon sends them; nothing less public, and no boost. Mastodon takes a post Activity-Relay forwards
|
||||||
|
only with an LD signature or an FEP-8b32 proof: PrivaPub's carry a proof, so they reach Mastodon through both kinds of
|
||||||
|
relay (checked live).
|
||||||
|
|
||||||
|
## Server descriptions and the crawler
|
||||||
|
|
||||||
|
PrivaPub keeps statistics about servers, never about accounts (see `/stargazing` on the server).
|
||||||
|
- **Describing a server:** a server it exchanges activities with is described at most once a week, from:
|
||||||
|
- `/.well-known/nodeinfo` and the NodeInfo document it links;
|
||||||
|
- `/api/v2/instance`, falling back to `/api/v1/instance`.
|
||||||
|
|
||||||
|
These requests are unsigned, because they are not ActivityPub documents.
|
||||||
|
- **The crawler** is on at privapub.thepra.dev. It identifies as
|
||||||
|
`PrivaPub-Stargazer/<version> (+https://privapub.thepra.dev/stargazing)`.
|
||||||
|
- **What it reads:** `/robots.txt`, then the documents above and `/api/v1/instance/peers`, and nothing else: no
|
||||||
|
accounts, posts or directories.
|
||||||
|
- **How often:** one server a minute, each at most weekly.
|
||||||
|
- **Opting out:** in robots.txt, the crawler obeys the group `PrivaPub-Stargazer`, then `PrivaPub`, then `*`. A
|
||||||
|
robots.txt that answers with a server error or times out also keeps it out, as do this server's domain blocks.
|
||||||
|
|
||||||
## Local-only posts
|
## Local-only posts
|
||||||
|
|
||||||
Posts with a location (shown to nearby users of this server) never leave the server, in any form.
|
Posts with a location (shown to nearby users of this server) never leave the server, in any form.
|
||||||
@@ -174,21 +408,71 @@ Posts with a location (shown to nearby users of this server) never leave the ser
|
|||||||
- **Origins.** An actor document is accepted only from the address it names as its `id`. A key only if its actor lists
|
- **Origins.** An actor document is accepted only from the address it names as its `id`. A key only if its actor lists
|
||||||
it with `owner` set to the actor and on the actor's origin. An activity's `id`, and any object it creates, updates or
|
it with `owner` set to the actor and on the actor's origin. An activity's `id`, and any object it creates, updates or
|
||||||
deletes, must be on its actor's origin. An embedded object from another origin is fetched from that origin.
|
deletes, must be on its actor's origin. An embedded object from another origin is fetched from that origin.
|
||||||
|
- **Another account of the same server.** An object attributed to another account of the actor's own server (Mobilizon's
|
||||||
|
organiser creates, edits and deletes the group's event) is that server's to vouch for: a creation or an edit is
|
||||||
|
taken as the server has the object, a deletion once it answers 404 or 410. Attributed to an account elsewhere, it is
|
||||||
|
refused (400).
|
||||||
|
- **Forwarded activities** (ActivityPub's inbox forwarding: a thread's server passing on the replies in it, signed with
|
||||||
|
its own key) are answered 202 and believed only as far as their origin vouches for them: a created or edited post
|
||||||
|
is read again from its author's server, a deletion of a public or unlisted post is applied once that server answers
|
||||||
|
404 or 410, and anything else is dropped. LD signatures are not verified. A reply forwarded this way is kept when
|
||||||
|
someone here follows the author of the post it answers, as Mastodon does.
|
||||||
|
- **Follow requests** still unanswered are sent again after 15 minutes, an hour, 6 hours, a day, two and four days: a
|
||||||
|
server can take a Follow and lose its answer (Lemmy 1.0 sends nothing it queued for a server before it started
|
||||||
|
sending there), and one that holds the follow answers it again. Each is the same follow under a new id
|
||||||
|
(`…/follow-<id>-again-<n>`), since Lemmy ignores an id it has seen; an answer naming any of them counts.
|
||||||
- **Fetching.** All fetches are signed by the instance actor. They go only to public addresses, follow at most three
|
- **Fetching.** All fetches are signed by the instance actor. They go only to public addresses, follow at most three
|
||||||
redirects and read at most 1 MB.
|
redirects and read at most 1 MB.
|
||||||
|
- **Threads.** A reply's missing parents are fetched, up to 10 levels. When someone here opens a public remote thread,
|
||||||
|
its replies are read from their servers, at most once an hour: the thread's conversation container (FEP-171b's
|
||||||
|
`contextHistory`: the posts its owner's `Add`s brought in) or its `context` collection (FEP-7888) if it has one, else
|
||||||
|
its `replies` (PeerTube's `comments`) and theirs, two levels down; 5 pages and 100 posts at most. Only public and
|
||||||
|
unlisted replies are kept, each fetched from its own origin. A thread collection read whole, which counts its posts or
|
||||||
|
holds them all, is asked again with `If-None-Match` and its last ETag; a 304 ends the read.
|
||||||
|
- **Reading our documents (SecureMode).** privapub.thepra.dev answers ActivityPub GETs only when they are signed, like
|
||||||
|
Mastodon's authorized fetch; the server's own actors (the instance actor `/peasants/privapub`, the reporter
|
||||||
|
`/peasants/privapub_reports` and the reader of feeds `/peasants/privapub_feeds`) are the exception, since their keys
|
||||||
|
are needed first.
|
||||||
|
A browser asking for HTML is redirected to the public page instead.
|
||||||
|
- **Posts that are not public** (followers-only, direct, circle) are served to a signed request from someone they were
|
||||||
|
for, or from the instance actor of a server where someone they were for lives, and to nobody else (404). Once deleted
|
||||||
|
they answer those same readers 410. A direct message's `context`, `/peasants/{name}/whispers/{id}`, is an
|
||||||
|
`OrderedCollection` of the conversation's posts for its participants.
|
||||||
- **HTML.** Received HTML is sanitised to Mastodon's allowlist.
|
- **HTML.** Received HTML is sanitised to Mastodon's allowlist.
|
||||||
- **Keys we cannot fetch for now.** When a sender's key cannot be fetched because its server timed out or answered
|
- **Keys we cannot fetch for now.** When a sender's key cannot be fetched because its server timed out or answered
|
||||||
5xx, the inbox answers 503 with `Retry-After: 300` rather than 401.
|
5xx, the inbox answers 503 with `Retry-After: 300` rather than 401.
|
||||||
- **Activity ids.** `Create` and `Announce` ids dereference. `Follow`, `Like`, `Block` and the `Accept`, `Reject` and
|
- **Activity ids.** `Create` and `Announce` ids dereference, a community's announces included, until the post they
|
||||||
`Undo` that answer them do not, because serving them would reveal who follows, likes and blocks whom; they are always
|
carry is deleted (then 410); a persona's boost id sends a browser to the boosted post. `Follow`, `Like`, `Block` and
|
||||||
sent with their object embedded.
|
the `Accept`, `Reject` and `Undo` that answer them do not, because serving them would reveal who follows, likes and
|
||||||
- **Delivery.** Failed deliveries are retried with Mastodon's backoff (16 attempts). A host that keeps failing is paused,
|
blocks whom. Neither do `Update`, `Delete`, `EmojiReact`, `QuoteRequest` and its answers, `Flag`, `Ignore` or poll
|
||||||
starting at an hour and growing to a week.
|
votes. All of them are always sent with their object embedded. Every boost and every favourite is an activity of its
|
||||||
|
own (`announce-{boost}`, `like-{favourite}`), so one given again after its `Undo` is new to the server it reaches.
|
||||||
|
- **Hashtags.** A post's `Hashtag` links go to `/tags/{tag}`, a public page of this server's public posts with that tag.
|
||||||
|
- **Delivery.** An activity goes once to each server, to its shared inbox when the server has one, whoever there it
|
||||||
|
follows, names or answers (a circle post excepted: each member's copy names that member). Failed deliveries are
|
||||||
|
retried with Mastodon's backoff (16 attempts). A host that keeps failing is paused,
|
||||||
|
starting at an hour and growing to a week: unreachable, timing out, or a gateway answering 502, 503 or 504. A 500 is
|
||||||
|
the server failing on that one activity, retried on its own while its other deliveries go on. A server can also take a Follow (202) and drop it afterwards, as Pleroma
|
||||||
|
does when it cannot yet fetch our actor, so a follow request still unanswered is sent again, same activity, when the
|
||||||
|
persona follows once more, at most once an hour.
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
- Our own posts carry no custom emoji: emoji are received and shown, not offered.
|
- Our own posts carry no custom emoji: emoji are received and shown, not offered.
|
||||||
- Remote media is fetched through this server's proxy when a local client displays it. Video and audio are streamed
|
- Remote media is fetched through this server's proxy when a local client displays it. Video and audio are streamed
|
||||||
through it with byte ranges passed on, so a PeerTube file is never fetched whole for one viewer.
|
through it with byte ranges passed on, so a PeerTube file is never fetched whole for one viewer.
|
||||||
- Collections expose counts, not members.
|
- Collections expose counts, not members: `/groupies` and `/stalking` give the same totals as the Mastodon API's
|
||||||
- Only `rsa-sha256`-style keys are verified. RFC 9421 signatures are planned.
|
follower and following counts, and the outbox's `totalItems` is the persona's post count, though only public posts
|
||||||
|
are listed. `/api/v1/instance/peers` is empty: which servers this one talks to is not published.
|
||||||
|
- HTTP signatures are verified with RSA keys only, under draft-cavage or RFC 9421. What PrivaPub sends is signed with
|
||||||
|
draft-cavage only, which every server reads.
|
||||||
|
- **Integrity proofs** (FEP-8b32, FEP-521a). Every persona has an Ed25519 key of its own (never shared between personas),
|
||||||
|
named in its actor's `assertionMethod` as a `Multikey` (`…#ed25519-key`, `publicKeyMultibase`); the terms are defined
|
||||||
|
in the actor's own context, so no context document has to be fetched. A persona's activity going to a relay carries a
|
||||||
|
`DataIntegrityProof` (`eddsa-jcs-2022`, `proofPurpose` `assertionMethod`) over the activity as delivered; Mastodon
|
||||||
|
4.7 verifies it (checked against its own verifier), so what the relay forwards reaches it. Nothing else carries one:
|
||||||
|
Mitra takes a proof over the HTTP signature, and refuses one by a key it has not read yet without reading the actor
|
||||||
|
again, which every server that knew a persona before it had its key would do. What a persona passes on of others'
|
||||||
|
carries theirs or none. Received: an actor's own Multikeys (at most five, under its id, controlled by it) are kept;
|
||||||
|
a forwarded activity whose proof one of them verifies is taken as it came, instead of being read again from its origin
|
||||||
|
(an unknown key of the actor's has the actor read again first).
|
||||||
@@ -12,6 +12,9 @@ namespace PrivaPub.ClientModels.Admin
|
|||||||
|
|
||||||
public bool Suspend { get; set; } = true;
|
public bool Suspend { get; set; } = true;
|
||||||
public bool RejectMedia { get; set; }
|
public bool RejectMedia { get; set; }
|
||||||
|
// listed at /api/v1/instance/domain_blocks (off by default: it tells the blocked server, and everyone, of the block)
|
||||||
|
public bool Published { get; set; } = false;
|
||||||
|
public bool Obfuscate { get; set; } = false;//listed with part of its name hidden
|
||||||
|
|
||||||
[StringLength(1000, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
[StringLength(1000, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
public string PublicComment { get; set; }
|
public string PublicComment { get; set; }
|
||||||
@@ -28,6 +31,8 @@ namespace PrivaPub.ClientModels.Admin
|
|||||||
public bool RejectMedia { get; set; }
|
public bool RejectMedia { get; set; }
|
||||||
public string PublicComment { get; set; }
|
public string PublicComment { get; set; }
|
||||||
public string PrivateComment { get; set; }
|
public string PrivateComment { get; set; }
|
||||||
|
public bool Published { get; set; } = false;
|
||||||
|
public bool Obfuscate { get; set; } = false;
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// the staff's log, newest first (GET /clientapi/moderator/log?before=&limit=): Next is the `before` of the next page,
|
||||||
|
// null on the last
|
||||||
|
public class ViewAdminActionsPage
|
||||||
|
{
|
||||||
|
public List<ViewAdminAction> Items { get; set; } = [];
|
||||||
|
public string Next { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewAdminAction
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public DateTime At { get; set; }
|
||||||
|
// who acted: a login name (to administrators; to a moderator only its own), "cli" for the command line, null when not
|
||||||
|
// told (an act on a persona of the acting login keeps nobody's name)
|
||||||
|
public string By { get; set; }
|
||||||
|
public bool ByYou { get; set; } = false;
|
||||||
|
public string Action { get; set; }//e.g. domain_block.insert, settings.update, report.resolve, root.promote
|
||||||
|
public string TargetKind { get; set; }//root, persona, account, domain, report, settings, rule, announcement, emoji, relay, backup
|
||||||
|
public string TargetId { get; set; }
|
||||||
|
public string TargetLabel { get; set; }
|
||||||
|
public string ReportId { get; set; }
|
||||||
|
public string Note { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// an announcement as the administrator's page shows it (/clientapi/admin/announcements/list): its Markdown and what it
|
||||||
|
// renders to, whether it is published and shown now, how many personas dismissed it and its reactions
|
||||||
|
public class ViewAnnouncement
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
public string Html { get; set; }
|
||||||
|
public DateTime? StartsAt { get; set; }
|
||||||
|
public DateTime? EndsAt { get; set; }
|
||||||
|
public bool AllDay { get; set; } = false;
|
||||||
|
public bool IsPublished { get; set; } = false;
|
||||||
|
public bool IsShown { get; set; } = false;//published and not ended
|
||||||
|
public DateTime? PublishedAt { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
public long Reads { get; set; } = 0;
|
||||||
|
public List<ViewAnnouncementReaction> Reactions { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewAnnouncementReaction
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public long Count { get; set; } = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert (no Id) and update (its Id)
|
||||||
|
public class AnnouncementForm
|
||||||
|
{
|
||||||
|
[StringLength(64, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(5000, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Text { get; set; }//Markdown
|
||||||
|
|
||||||
|
public DateTime? StartsAt { get; set; }
|
||||||
|
public DateTime? EndsAt { get; set; }//once past, it is no longer shown
|
||||||
|
public bool AllDay { get; set; } = false;
|
||||||
|
public bool IsPublished { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// the server's backups as the administrator's page shows them, with what is running and the last restore
|
||||||
|
public class ViewBackups
|
||||||
|
{
|
||||||
|
public List<ViewBackup> Backups { get; set; } = [];
|
||||||
|
public string Running { get; set; }//"backup" or "restore" while one runs
|
||||||
|
public ViewRestoreWaiting Waiting { get; set; }
|
||||||
|
public ViewRestore LastRestore { get; set; }
|
||||||
|
public string Host { get; set; }//what a restore asks to be typed
|
||||||
|
public long FreeBytes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewBackup
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Kind { get; set; }//nightly, manual, pre-deploy, pre-restore, uploaded
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public long Bytes { get; set; }//the database's files
|
||||||
|
public long MediaBytes { get; set; }
|
||||||
|
public int MediaFiles { get; set; }
|
||||||
|
public int MediaMissing { get; set; }
|
||||||
|
public bool DbOnly { get; set; }
|
||||||
|
public bool Consistent { get; set; }
|
||||||
|
public int Collections { get; set; }
|
||||||
|
public long Documents { get; set; }
|
||||||
|
public string AppCommit { get; set; }
|
||||||
|
public int MigrationNumber { get; set; }
|
||||||
|
public int RootsDeletedSince { get; set; }//logins deleted after it, which a restore deletes again
|
||||||
|
public string NotRestorable { get; set; }//why not, from its manifest; hashes are checked when asked
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewRestoreWaiting
|
||||||
|
{
|
||||||
|
public string Backup { get; set; }
|
||||||
|
public string State { get; set; }
|
||||||
|
public int Attempts { get; set; }
|
||||||
|
public string RequestedBy { get; set; }
|
||||||
|
public DateTime RequestedAt { get; set; }
|
||||||
|
public string Error { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewRestore
|
||||||
|
{
|
||||||
|
public string Backup { get; set; }
|
||||||
|
public DateTime BackupCreatedAt { get; set; }
|
||||||
|
public string PreRestore { get; set; }
|
||||||
|
public string RequestedBy { get; set; }
|
||||||
|
public DateTime RestoredAt { get; set; }
|
||||||
|
public bool Abandoned { get; set; }
|
||||||
|
public string Error { get; set; }
|
||||||
|
public long Documents { get; set; }
|
||||||
|
public int Collections { get; set; }
|
||||||
|
public int MediaRestored { get; set; }
|
||||||
|
public int MediaMissing { get; set; }
|
||||||
|
public int RootsDeleted { get; set; }
|
||||||
|
public int PersonasDeleted { get; set; }
|
||||||
|
public int GroupsDeleted { get; set; }
|
||||||
|
public int PostsDeleted { get; set; }
|
||||||
|
public List<string> RootsTombstoned { get; set; } = [];
|
||||||
|
public List<string> PersonasTombstoned { get; set; } = [];
|
||||||
|
public List<string> GroupsTombstoned { get; set; } = [];
|
||||||
|
public int PostsGone { get; set; }
|
||||||
|
public int MediaTrashed { get; set; }
|
||||||
|
public int ProtectiveKept { get; set; }
|
||||||
|
public int SessionsEnded { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// a backup downloaded or restored: the administrator's password again, and for a restore the server's host typed out
|
||||||
|
public class BackupPasswordForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(200, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RestoreBackupForm : BackupPasswordForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(253, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Host { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// a download link good for a while, for one backup
|
||||||
|
public class ViewBackupTicket
|
||||||
|
{
|
||||||
|
public string Url { get; set; }
|
||||||
|
public DateTime ExpiresAt { get; set; }
|
||||||
|
public long Bytes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// a backup being uploaded in pieces: how much has arrived
|
||||||
|
public class ViewBackupUpload
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public long Received { get; set; }
|
||||||
|
public long ChunkBytes { get; set; }//the largest piece accepted
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// a report as moderators read it: who sent it ("local" for a persona here, never which one; or the remote actor), whom
|
||||||
|
// and which posts it is about, and whether it was resolved
|
||||||
|
public class ViewReport
|
||||||
|
{
|
||||||
|
public string ID { get; set; }
|
||||||
|
public string Reporter { get; set; }
|
||||||
|
public string TargetAccountId { get; set; }
|
||||||
|
public string TargetActorURI { get; set; }
|
||||||
|
public List<string> PostIds { get; set; } = new();
|
||||||
|
public List<string> ObjectURIs { get; set; } = new();
|
||||||
|
public string Category { get; set; }
|
||||||
|
public List<string> RuleIds { get; set; } = [];//the server's rules it says were broken
|
||||||
|
public List<string> Rules { get; set; } = [];//their texts, in the same order (a deleted rule's too)
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public bool Forwarded { get; set; }
|
||||||
|
public bool IsResolved { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public DateTime? ResolvedAt { get; set; }
|
||||||
|
public DateTime? RemoteResolvedAt { get; set; }//the server holding what was reported said it dealt with it
|
||||||
|
public string RemoteResolvedBy { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// The server's own settings as the administrator's page shows them (GET /clientapi/admin/settings): what the instance
|
||||||
|
// API, NodeInfo, the instance actor, the web pages and the emails say of the server, its rules, its relays, its media
|
||||||
|
// limits next to the configured ones, and whether its weekly activity is published. Registrations are read-only: they
|
||||||
|
// stay in the configuration (Registrations:Mode).
|
||||||
|
public class ViewServerSettings
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string ShortDescription { get; set; }
|
||||||
|
public string Description { get; set; }//Markdown
|
||||||
|
public DateTime? DescriptionUpdatedAt { get; set; }
|
||||||
|
public string ContactEmail { get; set; }
|
||||||
|
public string ContactAccountId { get; set; }
|
||||||
|
public ViewContactAccount ContactAccount { get; set; }//null when none is set, or it is gone
|
||||||
|
public string ThumbnailUrl { get; set; }//what the instance API shows (the default picture when none was uploaded)
|
||||||
|
public bool ThumbnailIsDefault { get; set; } = true;
|
||||||
|
public string PrivacyPolicy { get; set; }//Markdown
|
||||||
|
public DateTime? PrivacyPolicyUpdatedAt { get; set; }
|
||||||
|
public string TermsOfService { get; set; }//Markdown; null: none
|
||||||
|
public DateTime? TermsEffectiveAt { get; set; }
|
||||||
|
public List<ViewServerRule> Rules { get; set; } = [];//deleted ones too (IsDeleted), as old reports name them
|
||||||
|
public List<ViewRelay> Relays { get; set; } = [];
|
||||||
|
public ViewMediaLimits Media { get; set; } = new();
|
||||||
|
public string RegistrationMode { get; set; }//"Invitations" or "Open", from the configuration
|
||||||
|
public bool PublishActivity { get; set; } = false;
|
||||||
|
public DateTime? UpdatedAt { get; set; }//null: never saved, every value is the default
|
||||||
|
public string UpdatedBy { get; set; }//the administrator's login, or "cli"
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewContactAccount
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Handle { get; set; }//user@host
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewServerRule
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
public string Hint { get; set; }
|
||||||
|
public int Position { get; set; } = 0;
|
||||||
|
public bool IsDeleted { get; set; } = false;
|
||||||
|
public DateTime? DeletedAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// the administrator's overrides (null: the configured value holds), what the configuration says, and the hard caps
|
||||||
|
public class ViewMediaLimits
|
||||||
|
{
|
||||||
|
public long? QuotaBytesPerRoot { get; set; }
|
||||||
|
public long? MaxImageBytes { get; set; }
|
||||||
|
public long? MaxVideoBytes { get; set; }
|
||||||
|
public int? MaxSeconds { get; set; }
|
||||||
|
public long ConfiguredQuotaBytesPerRoot { get; set; } = 0;//0: no quota
|
||||||
|
public long ConfiguredMaxImageBytes { get; set; } = 0;
|
||||||
|
public long ConfiguredMaxVideoBytes { get; set; } = 0;
|
||||||
|
public int ConfiguredMaxSeconds { get; set; } = 0;
|
||||||
|
public long EffectiveQuotaBytesPerRoot { get; set; } = 0;
|
||||||
|
public long EffectiveMaxImageBytes { get; set; } = 0;
|
||||||
|
public long EffectiveMaxVideoBytes { get; set; } = 0;
|
||||||
|
public int EffectiveMaxSeconds { get; set; } = 0;
|
||||||
|
public long HardMaxImageBytes { get; set; } = ServerMediaLimitsForm.HardMaxImageBytes;
|
||||||
|
public long HardMaxVideoBytes { get; set; } = ServerMediaLimitsForm.HardMaxVideoBytes;
|
||||||
|
public int HardMaxSeconds { get; set; } = ServerMediaLimitsForm.HardMaxSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST /clientapi/admin/settings: everything the page edits at once (relays and the thumbnail have their own routes).
|
||||||
|
// A rule keeps its id when the form names it; one without an id is new; one left out is deleted (kept, marked).
|
||||||
|
public class ServerSettingsForm
|
||||||
|
{
|
||||||
|
public const int MaxRules = 50;
|
||||||
|
public const int MaxText = 20000;
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(64, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Title", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[StringLength(500, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string ShortDescription { get; set; }
|
||||||
|
|
||||||
|
[StringLength(MaxText, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Description", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[EmailAddress(ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(254, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Email", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string ContactEmail { get; set; }
|
||||||
|
|
||||||
|
[StringLength(64, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string ContactAccountId { get; set; }//a local persona's account id (its Mastodon id), or none
|
||||||
|
|
||||||
|
[StringLength(MaxText, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string PrivacyPolicy { get; set; }
|
||||||
|
|
||||||
|
[StringLength(MaxText, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string TermsOfService { get; set; }//empty: none
|
||||||
|
|
||||||
|
public DateTime? TermsEffectiveAt { get; set; }//a date; today when terms are given without one
|
||||||
|
|
||||||
|
[MaxLength(MaxRules, ErrorMessageResourceName = "MaxLengthArray", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public List<ServerRuleForm> Rules { get; set; } = [];
|
||||||
|
|
||||||
|
public ServerMediaLimitsForm Media { get; set; } = new();
|
||||||
|
|
||||||
|
public bool PublishActivity { get; set; } = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ServerRuleForm
|
||||||
|
{
|
||||||
|
[StringLength(64, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Id { get; set; }//an existing rule's id, or none for a new rule
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(500, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
[StringLength(1000, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Hint { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// null keeps the configured value
|
||||||
|
public class ServerMediaLimitsForm
|
||||||
|
{
|
||||||
|
public const long HardMaxImageBytes = 40L * 1024 * 1024;
|
||||||
|
public const long HardMaxVideoBytes = 99L * 1024 * 1024;
|
||||||
|
public const int HardMaxSeconds = 4 * 3600;
|
||||||
|
|
||||||
|
[Range(0L, long.MaxValue, ErrorMessageResourceName = "Range", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public long? QuotaBytesPerRoot { get; set; }//0: no quota
|
||||||
|
|
||||||
|
[Range(1L, HardMaxImageBytes, ErrorMessageResourceName = "Range", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public long? MaxImageBytes { get; set; }
|
||||||
|
|
||||||
|
[Range(1L, HardMaxVideoBytes, ErrorMessageResourceName = "Range", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public long? MaxVideoBytes { get; set; }
|
||||||
|
|
||||||
|
[Range(1, HardMaxSeconds, ErrorMessageResourceName = "Range", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public int? MaxSeconds { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// a relay the instance actor subscribes to: named by the configuration (Federation:Relays, removed only there) or by
|
||||||
|
// the settings (added and removed from the page)
|
||||||
|
public class ViewRelay
|
||||||
|
{
|
||||||
|
public string Address { get; set; }
|
||||||
|
public string Source { get; set; }//"configuration" or "settings"
|
||||||
|
public string State { get; set; }//"pending", "accepted", "rejected", or "none" before its first request
|
||||||
|
public string ActorURI { get; set; }
|
||||||
|
public DateTime? RequestedAt { get; set; }
|
||||||
|
public DateTime? AnsweredAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RelayForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(2048, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string Address { get; set; }//the relay's actor (https://relay.example/actor) or its inbox
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
namespace PrivaPub.ClientModels.Admin
|
||||||
|
{
|
||||||
|
// /clientapi/admin/statistics/overview: the last days' federation at a glance; counters keyed as the ledger keys them
|
||||||
|
public class ViewStatisticsOverview
|
||||||
|
{
|
||||||
|
public int Days { get; set; }
|
||||||
|
public Dictionary<string, long> Channels { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Inbound { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Outbound { get; set; } = new();
|
||||||
|
public double? DeliverySuccess { get; set; }
|
||||||
|
public ViewLatency DeliveryLatencyMs { get; set; } = new();
|
||||||
|
public ViewHostCounts Hosts { get; set; } = new();
|
||||||
|
public int Accounts { get; set; }
|
||||||
|
public ViewLedgerCounts Ledger { get; set; } = new();
|
||||||
|
public ViewMediaTotals Media { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
// what media take on the server: the uploads and pictures kept, the remote media cache, the trash waiting its grace
|
||||||
|
public class ViewMediaTotals
|
||||||
|
{
|
||||||
|
public long MediaBytes { get; set; }
|
||||||
|
public long MediaFiles { get; set; }
|
||||||
|
public long ProxyCacheBytes { get; set; }
|
||||||
|
public long TrashBytes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewLatency
|
||||||
|
{
|
||||||
|
public int? P50 { get; set; }
|
||||||
|
public int? P95 { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHostCounts
|
||||||
|
{
|
||||||
|
public int Active { get; set; }
|
||||||
|
public long Known { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewLedgerCounts
|
||||||
|
{
|
||||||
|
public long Written { get; set; }
|
||||||
|
public long Dropped { get; set; }
|
||||||
|
public long Failed { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// /clientapi/admin/statistics/hosts: one page of the servers we exchanged with
|
||||||
|
public class ViewHostsPage
|
||||||
|
{
|
||||||
|
public int Total { get; set; }
|
||||||
|
public int Page { get; set; }
|
||||||
|
public List<ViewHostRow> Hosts { get; set; } = new();
|
||||||
|
public string Attribution { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHostRow
|
||||||
|
{
|
||||||
|
public string Host { get; set; }
|
||||||
|
public string Software { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public long In { get; set; }
|
||||||
|
public long Out { get; set; }
|
||||||
|
public long Refused { get; set; }
|
||||||
|
public long Failures { get; set; }
|
||||||
|
public int? LatencyP50 { get; set; }
|
||||||
|
public int Accounts { get; set; }
|
||||||
|
public DateTime? DescribedAt { get; set; }
|
||||||
|
public ViewHostDelivery Delivery { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHostDelivery
|
||||||
|
{
|
||||||
|
public int ConsecutiveFailures { get; set; }
|
||||||
|
public DateTime? UnavailableUntil { get; set; }
|
||||||
|
public DateTime? LastSuccessAt { get; set; }
|
||||||
|
public DateTime? LastFailureAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// /clientapi/admin/statistics/crawler: how far the crawler got
|
||||||
|
public class ViewCrawler
|
||||||
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
public long Touched { get; set; }
|
||||||
|
public long Crawled { get; set; }
|
||||||
|
public long Due { get; set; }
|
||||||
|
public long RobotsDisallowed { get; set; }
|
||||||
|
public List<ViewCrawledHost> Recent { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewCrawledHost
|
||||||
|
{
|
||||||
|
public string Host { get; set; }
|
||||||
|
public string Seen { get; set; }
|
||||||
|
public DateTime? LastCrawledAt { get; set; }
|
||||||
|
public int? PeersCount { get; set; }
|
||||||
|
public bool? RobotsDisallowed { get; set; }
|
||||||
|
public string CrawlError { get; set; }
|
||||||
|
public string Software { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// /clientapi/admin/statistics/hosts/{host}: one server, what it says of itself, its days and its latest events
|
||||||
|
public class ViewHostDetail
|
||||||
|
{
|
||||||
|
public string Host { get; set; }
|
||||||
|
public ViewHostInstance Instance { get; set; }
|
||||||
|
public List<ViewHostDay> Days { get; set; } = [];
|
||||||
|
public List<ViewInteractionEvent> Events { get; set; } = [];
|
||||||
|
public string Attribution { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHostInstance
|
||||||
|
{
|
||||||
|
public string Software { get; set; }
|
||||||
|
public string SoftwareVersion { get; set; }
|
||||||
|
public string NodeName { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string NodeDescription { get; set; }
|
||||||
|
public bool? OpenRegistrations { get; set; }
|
||||||
|
public string RegistrationMode { get; set; }
|
||||||
|
public long? UsersTotal { get; set; }
|
||||||
|
public long? UsersActiveMonth { get; set; }
|
||||||
|
public long? LocalPosts { get; set; }
|
||||||
|
public List<string> Languages { get; set; } = [];
|
||||||
|
public string Seen { get; set; }
|
||||||
|
public DateTime? FirstSeenAt { get; set; }
|
||||||
|
public DateTime? LastSeenAt { get; set; }
|
||||||
|
public DateTime? DescribedAt { get; set; }
|
||||||
|
public string DescriptionError { get; set; }
|
||||||
|
public DateTime? LastSuccessAt { get; set; }
|
||||||
|
public DateTime? LastFailureAt { get; set; }
|
||||||
|
public string LastError { get; set; }
|
||||||
|
public int ConsecutiveFailures { get; set; }
|
||||||
|
public DateTime? UnavailableUntil { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public string City { get; set; }
|
||||||
|
public int? Asn { get; set; }
|
||||||
|
public string AsnOrg { get; set; }
|
||||||
|
public string Cdn { get; set; }
|
||||||
|
public string InstanceApi { get; set; }
|
||||||
|
public string SourceUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHostDay
|
||||||
|
{
|
||||||
|
public DateTime Day { get; set; }
|
||||||
|
public Dictionary<string, long> Counters { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Latency { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Bytes { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Reads { get; set; } = new();
|
||||||
|
public int Accounts { get; set; }
|
||||||
|
public bool Live { get; set; }//today's or a day not rolled up yet, folded from its events
|
||||||
|
}
|
||||||
|
|
||||||
|
// one ledger entry: what was received, delivered or fetched, and how it ended; never who
|
||||||
|
public class ViewInteractionEvent
|
||||||
|
{
|
||||||
|
public DateTime At { get; set; }
|
||||||
|
public string Host { get; set; }
|
||||||
|
public string Channel { get; set; }
|
||||||
|
public string Activity { get; set; }
|
||||||
|
public string Object { get; set; }
|
||||||
|
public string Purpose { get; set; }
|
||||||
|
public string Trigger { get; set; }
|
||||||
|
public string Outcome { get; set; }
|
||||||
|
public string Reason { get; set; }
|
||||||
|
public int? Status { get; set; }
|
||||||
|
public int? LatencyMs { get; set; }
|
||||||
|
public int? WaitMs { get; set; }
|
||||||
|
public long? Bytes { get; set; }
|
||||||
|
public int? Attempt { get; set; }
|
||||||
|
public string Audience { get; set; }
|
||||||
|
public string LocalKind { get; set; }
|
||||||
|
public string Inbox { get; set; }
|
||||||
|
public string Signature { get; set; }
|
||||||
|
public List<string> Features { get; set; } = [];
|
||||||
|
public long? AgeSeconds { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// /clientapi/admin/statistics/server: the server's own day, its client API and the documents it served
|
||||||
|
public class ViewServerDay
|
||||||
|
{
|
||||||
|
public DateTime Day { get; set; }
|
||||||
|
public Dictionary<string, long> Client { get; set; } = new();
|
||||||
|
public Dictionary<string, long> ClientLatency { get; set; } = new();
|
||||||
|
public Dictionary<string, long> Served { get; set; } = new();
|
||||||
|
public long LedgerWritten { get; set; }
|
||||||
|
public long LedgerDropped { get; set; }
|
||||||
|
public long LedgerFailed { get; set; }
|
||||||
|
public int Accounts { get; set; }
|
||||||
|
public int Hosts { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace PrivaPub.ClientModels.Group
|
||||||
|
{
|
||||||
|
// someone in a group, or asking to join it, as its owner and moderators see them
|
||||||
|
public class ViewGroupMember
|
||||||
|
{
|
||||||
|
public string ActorUri { get; set; }
|
||||||
|
public string Handle { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
|
public bool IsLocal { get; set; }
|
||||||
|
public bool IsPending { get; set; }
|
||||||
|
public string Role { get; set; }//owner, moderator, member
|
||||||
|
public DateTime Since { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,5 +34,10 @@ namespace PrivaPub.ClientModels
|
|||||||
public bool ThemeIsDarkMode { get; set; } = false;
|
public bool ThemeIsDarkMode { get; set; } = false;
|
||||||
|
|
||||||
public string InvitationPassword { get; set; }
|
public string InvitationPassword { get; set; }
|
||||||
|
|
||||||
|
// the authenticator app's code, or one of the recovery codes, for a login with two-factor sign-in; asked for with a
|
||||||
|
// 428 once the password was right
|
||||||
|
[StringLength(32, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string OneTimeCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,132 +60,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to (necessary in case of password recovery).
|
|
||||||
/// </summary>
|
|
||||||
public static string _necessary_in_case_of_password_recovery_ {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("(necessary in case of password recovery)", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to (<a class="is-underlined has-text-info" tabindex="-1" target="_blank" href="https://keepassxc.org/">password manager</a> suggested).
|
|
||||||
/// </summary>
|
|
||||||
public static string _password_manager_suggested_ {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("(password manager suggested)", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Amount.
|
|
||||||
/// </summary>
|
|
||||||
public static string Amount {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Amount", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Answer id.
|
|
||||||
/// </summary>
|
|
||||||
public static string AnswerId {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("AnswerId", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Answer text.
|
|
||||||
/// </summary>
|
|
||||||
public static string AnswerText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("AnswerText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Custom character(emoji).
|
|
||||||
/// </summary>
|
|
||||||
public static string Character {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Character", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Colour.
|
|
||||||
/// </summary>
|
|
||||||
public static string ColourIndex {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ColourIndex", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Comment id.
|
|
||||||
/// </summary>
|
|
||||||
public static string CommentId {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("CommentId", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Comment text.
|
|
||||||
/// </summary>
|
|
||||||
public static string CommentText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("CommentText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Confrontation.
|
|
||||||
/// </summary>
|
|
||||||
public static string Confrontation {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Confrontation", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Confrontation id.
|
|
||||||
/// </summary>
|
|
||||||
public static string ConfrontationId {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ConfrontationId", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Context.
|
|
||||||
/// </summary>
|
|
||||||
public static string Context {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Context", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to End date.
|
|
||||||
/// </summary>
|
|
||||||
public static string DateEnd {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DateEnd", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Start date.
|
|
||||||
/// </summary>
|
|
||||||
public static string DateStart {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DateStart", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Description.
|
/// Looks up a localized string similar to Description.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -195,60 +69,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Discussion.
|
|
||||||
/// </summary>
|
|
||||||
public static string Discussion {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Discussion", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to End date.
|
|
||||||
/// </summary>
|
|
||||||
public static string DiscussionEndDate {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DiscussionEndDate", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to End time.
|
|
||||||
/// </summary>
|
|
||||||
public static string DiscussionEndTime {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DiscussionEndTime", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Discussion id.
|
|
||||||
/// </summary>
|
|
||||||
public static string DiscussionId {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DiscussionId", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Discussion text.
|
|
||||||
/// </summary>
|
|
||||||
public static string DiscussionText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DiscussionText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Discussion title.
|
|
||||||
/// </summary>
|
|
||||||
public static string DiscussionTitle {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("DiscussionTitle", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Email.
|
/// Looks up a localized string similar to Email.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -267,42 +87,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Max amount of confrontations.
|
|
||||||
/// </summary>
|
|
||||||
public static string ExpectedMaxConfrontationsBeforeClosingAndShowing {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ExpectedMaxConfrontationsBeforeClosingAndShowing", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Fact.
|
|
||||||
/// </summary>
|
|
||||||
public static string Fact {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Fact", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Facts.
|
|
||||||
/// </summary>
|
|
||||||
public static string Facts {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Facts", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to File id.
|
|
||||||
/// </summary>
|
|
||||||
public static string FileId {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("FileId", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Groups.
|
/// Looks up a localized string similar to Groups.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -312,15 +96,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Include the first answer in the invitation preview? (making it more engaging to join the discussion).
|
|
||||||
/// </summary>
|
|
||||||
public static string IncludeFirstAnswerInInvitation {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("IncludeFirstAnswerInInvitation", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Invitation code.
|
/// Looks up a localized string similar to Invitation code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -330,15 +105,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Invitation code or link.
|
|
||||||
/// </summary>
|
|
||||||
public static string InvitationCodeLink {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("InvitationCodeLink", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Invitation password.
|
/// Looks up a localized string similar to Invitation password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -348,42 +114,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Require password for preview.
|
|
||||||
/// </summary>
|
|
||||||
public static string IsPasswordProtectedForPreview {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("IsPasswordProtectedForPreview", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Require password to show the preview.
|
|
||||||
/// </summary>
|
|
||||||
public static string IsPasswordProtectedForPreviewText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("IsPasswordProtectedForPreviewText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Add password protection.
|
|
||||||
/// </summary>
|
|
||||||
public static string IsPasswordProtectedText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("IsPasswordProtectedText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to IsStructured.
|
|
||||||
/// </summary>
|
|
||||||
public static string IsStructured {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("IsStructured", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Language id.
|
/// Looks up a localized string similar to Language id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -426,15 +156,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Enable notifications?(useful to receive app updates).
|
|
||||||
/// </summary>
|
|
||||||
public static string NativeNotificationsEnabled {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("NativeNotificationsEnabled", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to New password.
|
/// Looks up a localized string similar to New password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -462,15 +183,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to One time only.
|
|
||||||
/// </summary>
|
|
||||||
public static string OneTime {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("OneTime", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Password.
|
/// Looks up a localized string similar to Password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -480,24 +192,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Perception.
|
|
||||||
/// </summary>
|
|
||||||
public static string Perception {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Perception", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Perceptions.
|
|
||||||
/// </summary>
|
|
||||||
public static string Perceptions {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Perceptions", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Prefer system theme.
|
/// Looks up a localized string similar to Prefer system theme.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -516,96 +210,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Recurring.
|
|
||||||
/// </summary>
|
|
||||||
public static string Recurring {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Recurring", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Scan for:.
|
|
||||||
/// </summary>
|
|
||||||
public static string Scan_for_ {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Scan for:", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Search.
|
|
||||||
/// </summary>
|
|
||||||
public static string SearchText {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("SearchText", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Sharing Secret Code.
|
|
||||||
/// </summary>
|
|
||||||
public static string ShareCode {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ShareCode", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Show donator badge.
|
|
||||||
/// </summary>
|
|
||||||
public static string ShowDonatorBadge {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ShowDonatorBadge", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Show the logs tab to support troubleshooting..
|
|
||||||
/// </summary>
|
|
||||||
public static string ShowLogs {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("ShowLogs", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Take type.
|
|
||||||
/// </summary>
|
|
||||||
public static string TakeType {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TakeType", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Simple.
|
|
||||||
/// </summary>
|
|
||||||
public static string TakeTypeSimple {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TakeTypeSimple", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Structured.
|
|
||||||
/// </summary>
|
|
||||||
public static string TakeTypeStructured {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TakeTypeStructured", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Theme image.
|
|
||||||
/// </summary>
|
|
||||||
public static string Theme_image {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Theme image", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Dark mode.
|
/// Looks up a localized string similar to Dark mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -615,15 +219,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Ticks.
|
|
||||||
/// </summary>
|
|
||||||
public static string Ticks {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Ticks", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Title.
|
/// Looks up a localized string similar to Title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -633,24 +228,6 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Update reason.
|
|
||||||
/// </summary>
|
|
||||||
public static string UpdateReason {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("UpdateReason", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Submit anonymously.
|
|
||||||
/// </summary>
|
|
||||||
public static string UpsertUserTakeIsAnonymous {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("UpsertUserTakeIsAnonymous", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Username.
|
/// Looks up a localized string similar to Username.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -659,23 +236,5 @@ namespace PrivaPub.ClientModels.Resources {
|
|||||||
return ResourceManager.GetString("Username", resourceCulture);
|
return ResourceManager.GetString("Username", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Username to search and add.
|
|
||||||
/// </summary>
|
|
||||||
public static string Username_to_search_and_add {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Username to search and add", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Usernames to search and add.
|
|
||||||
/// </summary>
|
|
||||||
public static string Usernames_to_search_and_add {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Usernames to search and add", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(необходимо в случай на възстановяване на парола)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">предложен мениджър на пароли</a>)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Сума</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Отговор id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Текст на отговора</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Персонализиран символ (емотикон)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Цвят</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Коментар id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Текст на коментара</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Конфронтация</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Конфронтация id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Контекст</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Крайна дата</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Начална дата</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Описание</value>
|
<value>Описание</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Дискусия</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Крайна дата</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Краен час</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Дискусия id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Текст за обсъждане</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Заглавие на дискусията</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Имейл</value>
|
<value>Имейл</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Емотикони</value>
|
<value>Емотикони</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Максимален брой конфронтации</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Факт</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Факти</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Идентификатор на файла</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Групи</value>
|
<value>Групи</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Да включите първия отговор в предварителния преглед на поканата? (за да се включите в дискусията по-ангажиращо)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Код на поканата</value>
|
<value>Код на поканата</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Код или връзка за покана</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Парола за покана</value>
|
<value>Парола за покана</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Изискване на парола за предварителен преглед</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Изискване на парола за показване на предварителния преглед</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Добавяне на защита с парола</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Идентификатор на езика</value>
|
<value>Идентификатор на езика</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Име</value>
|
<value>Име</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Активиране на известията?(полезно за получаване на актуализации на приложението)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Нова парола</value>
|
<value>Нова парола</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Стара парола</value>
|
<value>Стара парола</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Само веднъж</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Парола</value>
|
<value>Парола</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Възприемане</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Възприятия</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Предпочитайте темата на системата</value>
|
<value>Предпочитайте темата на системата</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Код за възстановяване</value>
|
<value>Код за възстановяване</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Повтарящи се</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Сканиране за:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Търсене</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Споделяне на тайния код</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Покажи значката на дарителя</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Покажете раздела с дневници, за да подпомогнете отстраняването на неизправности.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Вид на вземането</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Прост</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Структуриран</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Изображение на темата</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Тъмен режим</value>
|
<value>Тъмен режим</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Кърлежи</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Заглавие</value>
|
<value>Заглавие</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Причина за актуализиране</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Подайте анонимно</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Потребителско име</value>
|
<value>Потребителско име</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Потребителско име за търсене и добавяне</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Потребителски имена за търсене и добавяне</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nutné v případě obnovení hesla)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">správce hesel</a> navrženo)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Částka</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Odpověď id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Text odpovědi</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Vlastní znak(emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Barva</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Komentář id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Text komentáře</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontace</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id konfrontace</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontext</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Datum ukončení</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Datum zahájení</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Popis</value>
|
<value>Popis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskuse</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Datum ukončení</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Čas ukončení</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskuze id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Text k diskusi</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Název diskuse</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maximální počet konfrontací</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Identifikátor souboru</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Skupiny</value>
|
<value>Skupiny</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Zahrnout první odpověď do náhledu pozvánky? (abyste se mohli zapojit do diskuse)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kód pozvánky</value>
|
<value>Kód pozvánky</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Pozvánkový kód nebo odkaz</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Heslo pozvánky</value>
|
<value>Heslo pozvánky</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Vyžadovat heslo pro náhled</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Vyžadování hesla pro zobrazení náhledu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Přidání ochrany heslem</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Identifikace jazyka</value>
|
<value>Identifikace jazyka</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Název</value>
|
<value>Název</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Povolit oznámení?(užitečné pro příjem aktualizací aplikace)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nové heslo</value>
|
<value>Nové heslo</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Staré heslo</value>
|
<value>Staré heslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Pouze jednou</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Heslo</value>
|
<value>Heslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Vnímání</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Vnímání</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Preferovat systémové téma</value>
|
<value>Preferovat systémové téma</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Kód obnovy</value>
|
<value>Kód obnovy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Opakující se</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Vyhledat:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Vyhledávání</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Sdílení tajného kódu</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Zobrazit odznak dárce</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Zobrazit kartu protokolů pro podporu řešení problémů.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Vezměte si typ</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Jednoduché</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturovaný</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Tématický obrázek</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tmavý režim</value>
|
<value>Tmavý režim</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Klíšťata</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Název</value>
|
<value>Název</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Důvod aktualizace</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Anonymní odeslání</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Uživatelské jméno</value>
|
<value>Uživatelské jméno</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Uživatelské jméno pro vyhledávání a přidávání</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Uživatelská jména pro vyhledávání a přidávání</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nødvendig i tilfælde af inddrivelse af adgangskode)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">password manager</a> foreslået)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Beløb</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Svar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Svar tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Brugerdefineret tegn (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Farve</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Kommentar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Kommentar tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontation</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontation id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Slutdato</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Startdato</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Beskrivelse</value>
|
<value>Beskrivelse</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Slutdato</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Sluttidspunkt</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskussion id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Tekst til drøftelse</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Diskussionstitel</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maksimalt antal konfrontationer</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Fil id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupper</value>
|
<value>Grupper</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Medtage det første svar i forhåndsvisningen af invitationen? (gør det mere indbydende at deltage i diskussionen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kode for indbydelse</value>
|
<value>Kode for indbydelse</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Indbydelseskode eller link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Adgangskode til invitationen</value>
|
<value>Adgangskode til invitationen</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Kræver adgangskode til visning af preview</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Kræver adgangskode for at vise forhåndsvisningen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Tilføj adgangskodebeskyttelse</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Sprog-id</value>
|
<value>Sprog-id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Navn</value>
|
<value>Navn</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Aktiver notifikationer? (nyttigt for at modtage opdateringer til appen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Ny adgangskode</value>
|
<value>Ny adgangskode</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Gammel adgangskode</value>
|
<value>Gammel adgangskode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Kun én gang</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Adgangskode</value>
|
<value>Adgangskode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Opfattelse</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Opfattelser</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Foretrækker systemtema</value>
|
<value>Foretrækker systemtema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Kode for inddrivelse</value>
|
<value>Kode for inddrivelse</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Tilbagevendende</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scan efter:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Søg på</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Deling af den hemmelige kode</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Vis donator-badge</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Vis fanen Logfiler for at støtte fejlfinding.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Tag type</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Enkel</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Struktureret</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Temabillede</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Mørk tilstand</value>
|
<value>Mørk tilstand</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Flåter</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titel</value>
|
<value>Titel</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Årsag til opdatering</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Indsend anonymt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Brugernavn</value>
|
<value>Brugernavn</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Brugernavn til at søge og tilføje</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Brugernavne til at søge og tilføje</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(notwendig für die Wiederherstellung des Passworts)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">Passwortmanager</a> vorgeschlagen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Betrag</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Antwort id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Antwort-Text</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Benutzerdefiniertes Zeichen (Emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Farbe</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Kommentar</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Text kommentieren</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontation</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontation id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontext</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Datum des Endes</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Datum des Beginns</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Beschreibung</value>
|
<value>Beschreibung</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Datum des Endes</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Endzeit</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskussion id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Text zur Diskussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titel der Diskussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-Mail</value>
|
<value>E-Mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maximale Anzahl von Konfrontationen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Tatsache</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakten</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Datei-ID</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Gruppen</value>
|
<value>Gruppen</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Die erste Antwort in die Vorschau der Einladung aufnehmen? (um den Anreiz zur Teilnahme an der Diskussion zu erhöhen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Einladungs-Code</value>
|
<value>Einladungs-Code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Einladungscode oder Link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Passwort für die Einladung</value>
|
<value>Passwort für die Einladung</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Passwort für Vorschau erforderlich</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Passwort erforderlich, um die Vorschau anzuzeigen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Passwortschutz hinzufügen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Sprache id</value>
|
<value>Sprache id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Name</value>
|
<value>Name</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Benachrichtigungen aktivieren?(nützlich, um App-Updates zu erhalten)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Neues Passwort</value>
|
<value>Neues Passwort</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Altes Passwort</value>
|
<value>Altes Passwort</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Nur einmalig</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Passwort</value>
|
<value>Passwort</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Wahrnehmung</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Wahrnehmungen</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Systemthema bevorzugen</value>
|
<value>Systemthema bevorzugen</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Wiederherstellungscode</value>
|
<value>Wiederherstellungscode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Wiederkehrende</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scannen Sie nach:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Suche</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Gemeinsamer Geheimcode</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Spenderausweis anzeigen</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Zeigen Sie die Registerkarte Protokolle an, um die Fehlersuche zu unterstützen.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Typ nehmen</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Einfach</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturiert</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Thema Bild</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Dunkler Modus</value>
|
<value>Dunkler Modus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Zecken</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titel</value>
|
<value>Titel</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Grund für die Aktualisierung</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Anonym einreichen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Benutzername</value>
|
<value>Benutzername</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Benutzername zum Suchen und Hinzufügen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Nutzernamen zum Suchen und Hinzufügen</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(απαραίτητο σε περίπτωση ανάκτησης κωδικού πρόσβασης)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">διαχειριστής κωδικών πρόσβασης</a> προτείνεται)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Ποσό</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Απάντηση id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Κείμενο απάντησης</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Προσαρμοσμένος χαρακτήρας (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Χρώμα</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Σχόλιο id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Κείμενο σχολιασμού</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Αντιπαράθεση</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>id αντιπαράθεσης</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Πλαίσιο</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Ημερομηνία λήξης</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Ημερομηνία έναρξης</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Περιγραφή</value>
|
<value>Περιγραφή</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Συζήτηση</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Ημερομηνία λήξης</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Ώρα λήξης</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Συζήτηση id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Κείμενο συζήτησης</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Τίτλος συζήτησης</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Ηλεκτρονικό ταχυδρομείο</value>
|
<value>Ηλεκτρονικό ταχυδρομείο</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Μέγιστος αριθμός αντιπαραθέσεων</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Γεγονός</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Γεγονότα</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>id αρχείου</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Ομάδες</value>
|
<value>Ομάδες</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Να συμπεριλάβετε την πρώτη απάντηση στην προεπισκόπηση της πρόσκλησης; (καθιστώντας την πιο ελκυστική για να συμμετάσχετε στη συζήτηση)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Κωδικός πρόσκλησης</value>
|
<value>Κωδικός πρόσκλησης</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Κωδικός πρόσκλησης ή σύνδεσμος</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Κωδικός πρόσκλησης</value>
|
<value>Κωδικός πρόσκλησης</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Απαίτηση κωδικού πρόσβασης για προεπισκόπηση</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Απαιτείται κωδικός πρόσβασης για την εμφάνιση της προεπισκόπησης</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Προσθήκη προστασίας με κωδικό πρόσβασης</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Id γλώσσας</value>
|
<value>Id γλώσσας</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Όνομα</value>
|
<value>Όνομα</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Ενεργοποίηση ειδοποιήσεων; (χρήσιμο για να λαμβάνετε ενημερώσεις εφαρμογών)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Νέος κωδικός πρόσβασης</value>
|
<value>Νέος κωδικός πρόσβασης</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Παλαιός κωδικός πρόσβασης</value>
|
<value>Παλαιός κωδικός πρόσβασης</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Μόνο μία φορά</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Κωδικός πρόσβασης</value>
|
<value>Κωδικός πρόσβασης</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Αντίληψη</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Αντιλήψεις</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Προτιμήστε το θέμα του συστήματος</value>
|
<value>Προτιμήστε το θέμα του συστήματος</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Κωδικός ανάκτησης</value>
|
<value>Κωδικός ανάκτησης</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Επαναλαμβανόμενο</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Σάρωση για:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Αναζήτηση</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Κοινή χρήση μυστικού κώδικα</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Εμφάνιση σήματος δωρητή</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Εμφάνιση της καρτέλας αρχείων καταγραφής για την υποστήριξη της αντιμετώπισης προβλημάτων.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Πάρτε τον τύπο</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Απλό</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Δομημένο</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Εικόνα θέματος</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Σκοτεινή λειτουργία</value>
|
<value>Σκοτεινή λειτουργία</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Κρότωνες</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Τίτλος</value>
|
<value>Τίτλος</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Αιτία ενημέρωσης</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Υποβάλετε ανώνυμα</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Όνομα χρήστη</value>
|
<value>Όνομα χρήστη</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Όνομα χρήστη για αναζήτηση και προσθήκη</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Ονόματα χρηστών για αναζήτηση και προσθήκη</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(necesario en caso de recuperación de la contraseña)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">gestor de contraseñas</a> sugerido)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Importe</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Respuesta</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Texto de respuesta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Carácter personalizado (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Color</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Comentario id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Texto de los comentarios</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confrontación</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Identificación de la confrontación</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Contexto</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Fecha de finalización</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Fecha de inicio</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Descripción</value>
|
<value>Descripción</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discusión</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Fecha de finalización</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Hora de finalización</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Discusión</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Texto de debate</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Título del debate</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Envíe un correo electrónico a</value>
|
<value>Envíe un correo electrónico a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Máxima cantidad de enfrentamientos</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Datos</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Hechos</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>ID de archivo</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupos</value>
|
<value>Grupos</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>¿Incluir la primera respuesta en la vista previa de la invitación? (para que sea más atractivo participar en el debate)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Código de invitación</value>
|
<value>Código de invitación</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Código o enlace de invitación</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Contraseña de la invitación</value>
|
<value>Contraseña de la invitación</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Requerir contraseña para la vista previa</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Requiere contraseña para mostrar la vista previa</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Añadir protección por contraseña</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Id. de idioma</value>
|
<value>Id. de idioma</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nombre</value>
|
<value>Nombre</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Activar las notificaciones (útiles para recibir las actualizaciones de la aplicación)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nueva contraseña</value>
|
<value>Nueva contraseña</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Contraseña antigua</value>
|
<value>Contraseña antigua</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Una sola vez</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Contraseña</value>
|
<value>Contraseña</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Percepción</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Percepciones</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Prefiero el tema del sistema</value>
|
<value>Prefiero el tema del sistema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Código de recuperación</value>
|
<value>Código de recuperación</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Recurrente</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Busca:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Buscar en</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Compartir el código secreto</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Mostrar el distintivo de donante</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Mostrar la pestaña de registros para apoyar la resolución de problemas.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Toma de tipo</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Simple</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Estructurado</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Imagen del tema</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Modo oscuro</value>
|
<value>Modo oscuro</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Garrapatas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Título</value>
|
<value>Título</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Motivo de actualización</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Presentar de forma anónima</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Nombre de usuario</value>
|
<value>Nombre de usuario</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Nombre de usuario para buscar y añadir</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Nombres de usuario para buscar y añadir</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(vajalik parooli taastamise korral)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">Password manager</a> soovitatav)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Summa</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Vastus id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Vastuse tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Kohandatud märk (emotikoni)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Värv</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Kommentaar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Kommentaaride tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Vastasseis</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Vastasseisu id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Lõppkuupäev</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Alguskuupäev</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Kirjeldus</value>
|
<value>Kirjeldus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Arutelu</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Lõppkuupäev</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Lõpuaeg</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Arutelu id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Arutelu tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Arutelu pealkiri</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-post</value>
|
<value>E-post</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Vastasseisude maksimaalne arv</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Faktid</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Faili id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Rühmad</value>
|
<value>Rühmad</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Lisage esimene vastus kutse eelvaates? (muudab aruteluga liitumise atraktiivsemaks)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kutse kood</value>
|
<value>Kutse kood</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Kutse kood või link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Kutse parool</value>
|
<value>Kutse parool</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Nõuab eelvaate jaoks parooli</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Eelvaate kuvamiseks nõutakse parooli</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Lisage paroolikaitse</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Keele id</value>
|
<value>Keele id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nimi</value>
|
<value>Nimi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Teavituste lubamine?(kasulik, et saada rakenduse uuendusi)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Uus parool</value>
|
<value>Uus parool</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Vana parool</value>
|
<value>Vana parool</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Ainult üks kord</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Parool</value>
|
<value>Parool</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Tajumine</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Arvamused</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Eelistage süsteemi teemat</value>
|
<value>Eelistage süsteemi teemat</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Taastamiskood</value>
|
<value>Taastamiskood</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Korduvad</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Skaneeri:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Otsi</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Salajase koodi jagamine</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Näita doonori märki</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Näidake veaotsingu toetamiseks logide vahekaarti.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Võtke tüüp</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Lihtne</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Struktureeritud</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Teema pilt</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tume režiim</value>
|
<value>Tume režiim</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Puugid</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Pealkiri</value>
|
<value>Pealkiri</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Uuendamise põhjus</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Esitage anonüümselt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Kasutajanimi</value>
|
<value>Kasutajanimi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Kasutajanimi otsimiseks ja lisamiseks</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Kasutajanimed otsimiseks ja lisamiseks</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(tarvitaan salasanan palautuksen yhteydessä)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">salasananhallinta</a> ehdotettu)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Määrä</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Vastaa id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Vastaus teksti</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Mukautettu merkki (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Väri</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Kommentti id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Kommenttiteksti</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Vastakkainasettelu</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Vastakkainasettelu id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Konteksti</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Loppupäivä</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Aloituspäivä</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Kuvaus</value>
|
<value>Kuvaus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Keskustelu</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Loppupäivä</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Loppuaika</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Keskustelu id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Keskusteluteksti</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Keskustelun otsikko</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Sähköposti</value>
|
<value>Sähköposti</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Vastakkainasettelujen enimmäismäärä</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Faktat</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Tiedoston id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Ryhmät</value>
|
<value>Ryhmät</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Sisällytä ensimmäinen vastaus kutsun esikatseluun? (mikä tekee keskusteluun osallistumisesta houkuttelevampaa)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kutsun koodi</value>
|
<value>Kutsun koodi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Kutsukoodi tai linkki</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Kutsun salasana</value>
|
<value>Kutsun salasana</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Vaadi salasana esikatselua varten</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Vaadi salasana esikatselun näyttämiseksi</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Lisää salasanasuojaus</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Kielitunnus</value>
|
<value>Kielitunnus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nimi</value>
|
<value>Nimi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Ota ilmoitukset käyttöön?(hyödyllinen sovelluksen päivitysten saamiseksi)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Uusi salasana</value>
|
<value>Uusi salasana</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Vanha salasana</value>
|
<value>Vanha salasana</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Vain kerran</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Salasana</value>
|
<value>Salasana</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Havainto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Käsitykset</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Suositeltava järjestelmäteema</value>
|
<value>Suositeltava järjestelmäteema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Palautuskoodi</value>
|
<value>Palautuskoodi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Toistuvat</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Etsi:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Etsi</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Salaisen koodin jakaminen</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Näytä lahjoittajan merkki</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Näytä lokit-välilehti vianmäärityksen tueksi.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Ota tyyppi</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Yksinkertainen</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturoitu</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Aiheen kuva</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tumma tila</value>
|
<value>Tumma tila</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Punkit</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Otsikko</value>
|
<value>Otsikko</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Päivityksen syy</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Lähetä nimettömänä</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Käyttäjätunnus</value>
|
<value>Käyttäjätunnus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Käyttäjätunnus hakuun ja lisäämiseen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Käyttäjätunnukset, joita voit etsiä ja lisätä</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nécessaire en cas de récupération du mot de passe)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">gestionnaire de mots de passe</a> suggéré)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Montant</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Réponse id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Texte de réponse</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Caractère personnalisé (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Couleur</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Commentaire</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Texte du commentaire</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confrontation</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Confrontation id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Contexte</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Date de fin</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Date de début</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Description</value>
|
<value>Description</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Date de fin</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Heure de fin</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>ID de discussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Texte de discussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titre de la discussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Courriel</value>
|
<value>Courriel</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Nombre maximal de confrontations</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fait</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Faits et chiffres</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Identifiant du fichier</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Groupes</value>
|
<value>Groupes</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Inclure la première réponse dans l'aperçu de l'invitation ? (ce qui rend plus attrayant le fait de rejoindre la discussion)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Code d'invitation</value>
|
<value>Code d'invitation</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Code ou lien d'invitation</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Mot de passe de l'invitation</value>
|
<value>Mot de passe de l'invitation</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Exiger un mot de passe pour la prévisualisation</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Exiger un mot de passe pour afficher l'aperçu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Ajouter une protection par mot de passe</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>EstStructuré</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Identifiant de langue</value>
|
<value>Identifiant de langue</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nom</value>
|
<value>Nom</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Activer les notifications ? (utile pour recevoir les mises à jour de l'application)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nouveau mot de passe</value>
|
<value>Nouveau mot de passe</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Ancien mot de passe</value>
|
<value>Ancien mot de passe</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>En une seule fois</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Mot de passe</value>
|
<value>Mot de passe</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Perception</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Perceptions</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Préférer le thème du système</value>
|
<value>Préférer le thème du système</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Code de récupération</value>
|
<value>Code de récupération</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Récurrent</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scanner pour :</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Recherche</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Partage du code secret</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Afficher le badge de donateur</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Affichez l'onglet des journaux pour faciliter le dépannage.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Type de prise</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Simple</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Structuré</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Image du thème</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Mode foncé</value>
|
<value>Mode foncé</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Tiques</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titre</value>
|
<value>Titre</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Raison de la mise à jour</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Soumettre anonymement</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Nom d'utilisateur</value>
|
<value>Nom d'utilisateur</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Nom d'utilisateur pour rechercher et ajouter</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Noms d'utilisateur à rechercher et à ajouter</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(jelszó helyreállítása esetén szükséges)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">jelszókezelő</a> javasolt)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Összeg</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Válasz id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Válasz szöveg</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Egyéni karakter (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Színes</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Megjegyzés id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Megjegyzés szövege</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontáció</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontációs azonosító</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontextus</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Végdátum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Kezdeti időpont</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Leírás</value>
|
<value>Leírás</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Megbeszélés</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Végdátum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Végidő</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Megbeszélés id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Megbeszélés szövege</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Vita címe</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>A konfrontációk maximális száma</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Tény</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Tények</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Fájl azonosító</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Csoportok</value>
|
<value>Csoportok</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Az első válasz szerepeljen a meghívó előnézetében? (így vonzóbbá teszi a vitához való csatlakozást)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Meghívó kód</value>
|
<value>Meghívó kód</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Meghívó kód vagy link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Meghívó jelszó</value>
|
<value>Meghívó jelszó</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Jelszó megkövetelése az előnézethez</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Jelszó megkövetelése az előnézet megjelenítéséhez</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Jelszóvédelem hozzáadása</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Nyelvi azonosító</value>
|
<value>Nyelvi azonosító</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Név</value>
|
<value>Név</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Értesítések engedélyezése?(hasznos az alkalmazás frissítéseinek fogadásához)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Új jelszó</value>
|
<value>Új jelszó</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Régi jelszó</value>
|
<value>Régi jelszó</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Csak egyszeri alkalom</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Jelszó</value>
|
<value>Jelszó</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Percepció</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Perceptions</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>A rendszer témájának előnyben részesítése</value>
|
<value>A rendszer témájának előnyben részesítése</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Helyreállítási kód</value>
|
<value>Helyreállítási kód</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Visszatérő</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Keresés:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Keresés</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Titkos kód megosztása</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Adományozói jelvény megjelenítése</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>A naplók lap megjelenítése a hibaelhárítás támogatására.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Vegye a típust</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Egyszerű</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturált</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Témakép</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Sötét üzemmód</value>
|
<value>Sötét üzemmód</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Kullancsok</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Cím</value>
|
<value>Cím</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Frissítés oka</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Névtelenül beküldeni</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Felhasználónév</value>
|
<value>Felhasználónév</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Felhasználónév kereséshez és hozzáadáshoz</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Felhasználónevek keresése és hozzáadása</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(necessaria in caso di recupero password)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(è suggerito l'uso del <a class="is-underlined has-text-info" tabindex="-1" target="_blank" href="https://keepassxc.org/">gestore password</a>)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Importo</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>ID risposta</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Testo risposta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Carattere personalizzato (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Colore</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>ID commento</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Testo commento</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confronto</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id confronto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Contesto</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Data di fine</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Data di inizio</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Descrizione</value>
|
<value>Descrizione</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discussione</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Data di fine</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Tempo di fine</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>ID discussione</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Testo discussione</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titolo discussione</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Email</value>
|
<value>Email</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Quantità massima di scontri</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fatto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>I fatti</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>ID file</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Gruppi</value>
|
<value>Gruppi</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Includere la prima risposta nell'anteprima dell'invito? (rendendo più coinvolgente l'adesione alla discussione)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Codice d'invito</value>
|
<value>Codice d'invito</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Collegamento o codice di invito</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Password dell'invito</value>
|
<value>Password dell'invito</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Richiedi la password per l'anteprima</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Richiedi la password per l'anteprima della discussione</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Aggiungere la protezione con password</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>È strutturato</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>ID lingua</value>
|
<value>ID lingua</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nome</value>
|
<value>Nome</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Abilitare le notifiche?(utili per percepire aggiornamenti)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nuova password</value>
|
<value>Nuova password</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,78 +150,24 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Attuale password</value>
|
<value>Attuale password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Paga una volta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Password</value>
|
<value>Password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>La percezione</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Percezioni</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Preferire il tema di sistema</value>
|
<value>Preferire il tema di sistema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Codice di recupero</value>
|
<value>Codice di recupero</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Ricorrente</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scansione per:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Ricerca</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Condivisione del codice segreto</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Mostra il badge del donatore</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Mostra il tab dei log a supporto della risoluzione dei problemi.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Prendi il tipo</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Semplice</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strutturato</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Immagine a tema</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Modalità scura</value>
|
<value>Modalità scura</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Zecche</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titolo</value>
|
<value>Titolo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Motivo dell'aggiornamento</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Invia in forma anonima</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Soprannome</value>
|
<value>Soprannome</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Soprannome da ricercare e aggiungere</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Soprannomi da ricercare e aggiungere</value>
|
|
||||||
</data>
|
|
||||||
<data name="AvatarId" xml:space="preserve">
|
<data name="AvatarId" xml:space="preserve">
|
||||||
<value>Avatar</value>
|
<value>Avatar</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(パスワード復旧時に必要)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">パスワードマネージャー</a>の提案)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>金額</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>回答ID</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>回答テキスト</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>カスタムキャラクター(絵文字)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>カラー</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>コメントID</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>コメント文</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>対決</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>コンフロンティアID</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>コンテキスト</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>終了日</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>開始日</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>商品説明</value>
|
<value>商品説明</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>ディスカッション</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>終了日</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>終了時間</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>ディスカッションID</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>ディスカッションテキスト</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>議論のタイトル</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>電子メール</value>
|
<value>電子メール</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>絵文字</value>
|
<value>絵文字</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>対決の最大量</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>事実</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>事実</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>ファイルID</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>グループ</value>
|
<value>グループ</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>招待状のプレビューに最初の回答を含める?(議論への参加をより魅力的にするために)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>招待状コード</value>
|
<value>招待状コード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>招待コードまたはリンク</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>招待状のパスワード</value>
|
<value>招待状のパスワード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>プレビューにパスワードが必要</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>プレビューを表示するにはパスワードが必要です</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>パスワード保護機能の追加</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>言語ID</value>
|
<value>言語ID</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>名前</value>
|
<value>名前</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>通知を有効にしますか?(アプリの更新情報を受け取るのに便利です)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>新しいパスワード</value>
|
<value>新しいパスワード</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>古いパスワード</value>
|
<value>古いパスワード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>1回限り</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>パスワード</value>
|
<value>パスワード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>パーセプション</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>認知度</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>システムテーマを優先する</value>
|
<value>システムテーマを優先する</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>リカバリーコード</value>
|
<value>リカバリーコード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>リカーリング</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>スキャンしてください:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>検索</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>秘密の暗号を共有する</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>寄付者バッジを表示する</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>トラブルシューティングをサポートするために、ログタブを表示します。</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>テイクタイプ</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>シンプル</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>構造化</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>テーマイメージ</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>ダークモード</value>
|
<value>ダークモード</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>ダニ</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>タイトル</value>
|
<value>タイトル</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>更新理由</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>匿名で投稿する</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>ユーザー名</value>
|
<value>ユーザー名</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>検索して追加するユーザー名</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>検索して追加するユーザー名</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(būtina slaptažodžio atkūrimo atveju)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">paslapčių tvarkyklė</a> siūloma)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Suma</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Atsakymas id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Atsakymo tekstas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Pasirinktinis simbolis (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Spalva</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Komentaras id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Komentaro tekstas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontacija</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontacijos id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontekstas</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Galutinė data</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Pradžios data</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Aprašymas</value>
|
<value>Aprašymas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskusija</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Galutinė data</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Pabaigos laikas</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskusijos id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Diskusijos tekstas</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Diskusijos pavadinimas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>El. paštas</value>
|
<value>El. paštas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Didžiausias konfrontacijų skaičius</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Faktas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Faktai</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Failo ID</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupės</value>
|
<value>Grupės</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Įtraukti pirmąjį atsakymą į kvietimo peržiūrą? (kad būtų patraukliau prisijungti prie diskusijos)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kvietimo kodas</value>
|
<value>Kvietimo kodas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Kvietimo kodas arba nuoroda</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Kvietimo slaptažodis</value>
|
<value>Kvietimo slaptažodis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Reikalauti slaptažodžio peržiūrai</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Reikalauti slaptažodžio, kad būtų rodoma peržiūra</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Pridėti apsaugą slaptažodžiu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Kalbos ID</value>
|
<value>Kalbos ID</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Pavadinimas</value>
|
<value>Pavadinimas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Įjungti pranešimus? (naudinga norint gauti programėlės atnaujinimus)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Naujas slaptažodis</value>
|
<value>Naujas slaptažodis</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Senasis slaptažodis</value>
|
<value>Senasis slaptažodis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Tik vieną kartą</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Slaptažodis</value>
|
<value>Slaptažodis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Suvokimas</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Suvokimas</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Pirmenybė sistemos temai</value>
|
<value>Pirmenybė sistemos temai</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Atkūrimo kodas</value>
|
<value>Atkūrimo kodas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Pasikartojantis</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Ieškoti:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Paieška</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Dalijimasis slaptuoju kodu</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Rodyti rėmėjo ženklelį</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Parodykite skirtuką "Žurnalai", kad galėtumėte padėti šalinti trikdžius.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Paimkite tipą</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Paprastas</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Struktūrinis</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Temos vaizdas</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tamsus režimas</value>
|
<value>Tamsus režimas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Erkės</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Pavadinimas</value>
|
<value>Pavadinimas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Atnaujinimo priežastis</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Pateikti anonimiškai</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Vartotojo vardas</value>
|
<value>Vartotojo vardas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Vartotojo vardas paieškai ir pridėjimui</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Vartotojų vardų paieška ir pridėjimas</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nepieciešams paroles atjaunošanas gadījumā)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">vārdu pārvaldnieks</a> ierosināts)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Summa</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Atbilde id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Atbildes teksts</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Pielāgots raksturs (emodži)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Krāsa</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Komentārs id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Komentāru teksts</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontācija</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontācijas id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Konteksts</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Beigu datums</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Sākuma datums</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Apraksts</value>
|
<value>Apraksts</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskusija</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Beigu datums</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Beigu laiks</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskusijas id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Diskusijas teksts</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Diskusijas nosaukums</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-pasts</value>
|
<value>E-pasts</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emocijas</value>
|
<value>Emocijas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maksimālais konfrontāciju skaits</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakti</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakti</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Faila id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupas</value>
|
<value>Grupas</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Iekļaut pirmo atbildi uzaicinājuma priekšskatījumā? (lai iesaistīšanās diskusijā būtu saistošāka)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Uzaicinājuma kods</value>
|
<value>Uzaicinājuma kods</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Uzaicinājuma kods vai saite</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Uzaicinājuma parole</value>
|
<value>Uzaicinājuma parole</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Pieprasīt paroli priekšskatīšanai</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Pieprasīt paroli, lai parādītu priekšskatījumu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Pievienojiet paroles aizsardzību</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Valodas identifikators</value>
|
<value>Valodas identifikators</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nosaukums</value>
|
<value>Nosaukums</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Ieslēgt paziņojumus?(noderīgi, lai saņemtu lietotnes atjauninājumus)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Jauna parole</value>
|
<value>Jauna parole</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Vecā parole</value>
|
<value>Vecā parole</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Tikai vienu reizi</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Parole</value>
|
<value>Parole</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Uztvere</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Uzskati</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Dodiet priekšroku sistēmas tēmai</value>
|
<value>Dodiet priekšroku sistēmas tēmai</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Atgūšanas kods</value>
|
<value>Atgūšanas kods</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Atkārtoti</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Skenēt, lai atrastu:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Meklēšana</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Koplietošanas slepenais kods</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Rādīt ziedotāja nozīmīti</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Parādiet cilni žurnāli, lai atbalstītu problēmu novēršanu.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Veikt veidu</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Vienkāršs</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturēts</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Tēmas attēls</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tumšais režīms</value>
|
<value>Tumšais režīms</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Ērces</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Nosaukums</value>
|
<value>Nosaukums</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Atjaunināšanas iemesls</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Iesniedziet anonīmi</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Lietotājvārds</value>
|
<value>Lietotājvārds</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Lietotājvārds, lai meklētu un pievienotu</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Meklēšanas un pievienošanas lietotājvārdi</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nodig in geval van wachtwoordherstel)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">wachtwoord manager</a> voorgesteld)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Bedrag</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Antwoord id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Antwoord tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Aangepast karakter (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Kleur</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Commentaar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Commentaar tekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confrontatie</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Confrontatie id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Context</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Einddatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Startdatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Beschrijving</value>
|
<value>Beschrijving</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discussie</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Einddatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Eindtijd</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Discussie id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Besprekingstekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titel van de discussie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maximum aantal confrontaties</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Feit</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Feiten</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Bestand id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Groepen</value>
|
<value>Groepen</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Het eerste antwoord opnemen in de preview van de uitnodiging? (maakt het aantrekkelijker om deel te nemen aan de discussie)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Uitnodiging code</value>
|
<value>Uitnodiging code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Uitnodigingscode of link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Uitnodiging wachtwoord</value>
|
<value>Uitnodiging wachtwoord</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Wachtwoord nodig voor preview</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Wachtwoord vereist om de preview te tonen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Wachtwoordbeveiliging toevoegen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Taal id</value>
|
<value>Taal id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Naam</value>
|
<value>Naam</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Meldingen inschakelen?(handig om app updates te ontvangen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nieuw wachtwoord</value>
|
<value>Nieuw wachtwoord</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Oud wachtwoord</value>
|
<value>Oud wachtwoord</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Eenmalig</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Wachtwoord</value>
|
<value>Wachtwoord</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Perceptie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Percepties</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Voorkeur systeemthema</value>
|
<value>Voorkeur systeemthema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Herstelcode</value>
|
<value>Herstelcode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Terugkerend</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scan voor:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Zoeken op</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Het delen van de geheime code</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Toon donateur badge</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Toon de logs tab ter ondersteuning van troubleshooting.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Neem type</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Eenvoudig</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Gestructureerd</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Thema-afbeelding</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Donkere modus</value>
|
<value>Donkere modus</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Teken</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titel</value>
|
<value>Titel</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Update reden</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Anoniem indienen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Gebruikersnaam</value>
|
<value>Gebruikersnaam</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Gebruikersnaam om te zoeken en toe te voegen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Gebruikersnamen om te zoeken en toe te voegen</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(konieczne w przypadku odzyskiwania hasła)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">password manager</a> sugerowane)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Kwota</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Odpowiedź</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Odpowiedź</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Znak niestandardowy (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Kolor</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Komentarz id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Tekst komentarza</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontacja</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontacja id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Data końcowa</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Data rozpoczęcia</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Opis</value>
|
<value>Opis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Dyskusja</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Data końcowa</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Czas zakończenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Dyskusja id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Tekst do dyskusji</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Tytuł dyskusji</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maksymalna ilość konfrontacji</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakty</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Id pliku</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupy</value>
|
<value>Grupy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Zamieścić pierwszą odpowiedź w podglądzie zaproszenia? (sprawia, że dołączenie do dyskusji jest bardziej zachęcające)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kod zaproszenia</value>
|
<value>Kod zaproszenia</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Kod lub link do zaproszenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Hasło do zaproszenia</value>
|
<value>Hasło do zaproszenia</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Wymagaj hasła do podglądu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Wymagaj hasła, aby wyświetlić podgląd</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Dodaj ochronę hasłem</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Język id</value>
|
<value>Język id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nazwa</value>
|
<value>Nazwa</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Włączyć powiadomienia? (przydatne do otrzymywania aktualizacji aplikacji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nowe hasło</value>
|
<value>Nowe hasło</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Stare hasło</value>
|
<value>Stare hasło</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Tylko jeden raz</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Hasło</value>
|
<value>Hasło</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Percepcja</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Spostrzeżenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Preferowany motyw systemowy</value>
|
<value>Preferowany motyw systemowy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Kod odzyskiwania</value>
|
<value>Kod odzyskiwania</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Powtarzające się</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Skanuj dla:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Szukaj</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Dzielenie się tajnym kodem</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Pokaż odznakę darczyńcy</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Pokaż kartę logów, aby ułatwić rozwiązywanie problemów.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Rodzaj ujęcia</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Proste</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturalne</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Obrazek tematyczny</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tryb ciemny</value>
|
<value>Tryb ciemny</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Kleszcze</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Tytuł</value>
|
<value>Tytuł</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Powód aktualizacji</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Zgłoś się anonimowo</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Nazwa użytkownika</value>
|
<value>Nazwa użytkownika</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Nazwa użytkownika do wyszukiwania i dodawania</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Nazwy użytkowników do wyszukiwania i dodawania</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(necessário em caso de recuperação de senha)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">gerenciador de palavras-passe</a> sugerido)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Montante</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Responder id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Responder texto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Personalidade(emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Cor</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Comentar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Comentar texto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confrontação</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id de confronto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Contexto</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Data final</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Data de início</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Descrição</value>
|
<value>Descrição</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discussão</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Data final</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Tempo final</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Id de discussão</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Texto para discussão</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Título do debate</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Email</value>
|
<value>Email</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Quantidade máxima de confrontos</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Facto</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fatos</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Identificação do arquivo</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupos</value>
|
<value>Grupos</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Incluir a primeira resposta na pré-visualização do convite? (tornando-a mais envolvente para participar da discussão)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Código de convite</value>
|
<value>Código de convite</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Código do convite ou link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Senha do convite</value>
|
<value>Senha do convite</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Exigir senha para visualização</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Exigir senha para mostrar a visualização</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Adicionar proteção por senha</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Identificação do idioma</value>
|
<value>Identificação do idioma</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nome</value>
|
<value>Nome</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Habilitar notificações?(útil para receber atualizações de aplicativos)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nova senha</value>
|
<value>Nova senha</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Senha antiga</value>
|
<value>Senha antiga</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Só uma vez</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Senha</value>
|
<value>Senha</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Percepção</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Percepções</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Tema do sistema de preferências</value>
|
<value>Tema do sistema de preferências</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Código de recuperação</value>
|
<value>Código de recuperação</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Recurrente</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Procura por:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Pesquisa</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Partilha do Código Secreto</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Mostrar crachá do doador</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Mostrar o separador de registos para suportar a resolução de problemas.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Tirar tipo</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Simples</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Estruturado</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Imagem temática</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Modo escuro</value>
|
<value>Modo escuro</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Carraças</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Título</value>
|
<value>Título</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Motivo da actualização</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Submeter de forma anónima</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Nome de usuário</value>
|
<value>Nome de usuário</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Nome de usuário para pesquisar e adicionar</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Nomes de usuário para pesquisar e adicionar</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(necessary in case of password recovery)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="_blank" href="https://keepassxc.org/">password manager</a> suggested)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Amount</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Answer id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Answer text</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Custom character(emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Colour</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Comment id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Comment text</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confrontation</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Confrontation id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Context</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>End date</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Start date</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Description</value>
|
<value>Description</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>End date</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>End time</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Discussion id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Discussion text</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Discussion title</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Email</value>
|
<value>Email</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Max amount of confrontations</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fact</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Facts</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>File id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Groups</value>
|
<value>Groups</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Include the first answer in the invitation preview? (making it more engaging to join the discussion)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Invitation code</value>
|
<value>Invitation code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Invitation code or link</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Invitation password</value>
|
<value>Invitation password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Require password for preview</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Require password to show the preview</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Add password protection</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Language id</value>
|
<value>Language id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Name</value>
|
<value>Name</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Enable notifications?(useful to receive app updates)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>New password</value>
|
<value>New password</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,78 +150,24 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Old password</value>
|
<value>Old password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>One time only</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Password</value>
|
<value>Password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Perception</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Perceptions</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Prefer system theme</value>
|
<value>Prefer system theme</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Recovery code</value>
|
<value>Recovery code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Recurring</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scan for:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Search</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Sharing Secret Code</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Show donator badge</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Show the logs tab to support troubleshooting.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Take type</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Simple</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Structured</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Theme image</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Dark mode</value>
|
<value>Dark mode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Ticks</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Title</value>
|
<value>Title</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Update reason</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Submit anonymously</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Username</value>
|
<value>Username</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Username to search and add</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Usernames to search and add</value>
|
|
||||||
</data>
|
|
||||||
<data name="AvatarId" xml:space="preserve">
|
<data name="AvatarId" xml:space="preserve">
|
||||||
<value>Avatar</value>
|
<value>Avatar</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(necesar în cazul recuperării parolei)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">manager de parole</a> sugerat)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Suma</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Răspuns id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Text de răspuns</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Caracter personalizat (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Culoare</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Comentariu id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Comentariu text</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Confruntare</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id de confruntare</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Context</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Data de încheiere</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Data de începere</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Descriere</value>
|
<value>Descriere</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Discuție</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Data de încheiere</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Ora de sfârșit</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Discuție id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Text de discuție</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titlul discuției</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Email</value>
|
<value>Email</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Numărul maxim de confruntări</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fapt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fapte</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>ID fișier</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupuri</value>
|
<value>Grupuri</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Includeți primul răspuns în previzualizarea invitației? (pentru a face mai atractivă participarea la discuție)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Codul de invitație</value>
|
<value>Codul de invitație</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Cod sau link de invitație</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Parola de invitație</value>
|
<value>Parola de invitație</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Necesită o parolă pentru previzualizare</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Necesită o parolă pentru a afișa previzualizarea</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Adăugați protecție prin parolă</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>ID-ul limbii</value>
|
<value>ID-ul limbii</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Nume</value>
|
<value>Nume</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Activați notificările?(util pentru a primi actualizări ale aplicației)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Parolă nouă</value>
|
<value>Parolă nouă</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Parolă veche</value>
|
<value>Parolă veche</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>O singură dată</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Parola</value>
|
<value>Parola</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Percepție</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Percepții</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Preferați tema de sistem</value>
|
<value>Preferați tema de sistem</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Cod de recuperare</value>
|
<value>Cod de recuperare</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Recurent</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Scanează pentru:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Căutare</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Partajarea codului secret</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Arată insigna de donator</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Afișați fila jurnale pentru a sprijini depanarea.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Tipul de luare</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Simplu</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Structurat</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Imagine tematică</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Mod întunecat</value>
|
<value>Mod întunecat</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Căpușe</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titlu</value>
|
<value>Titlu</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Motivul actualizării</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Trimiteți în mod anonim</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Nume utilizator</value>
|
<value>Nume utilizator</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Nume de utilizator pentru a căuta și adăuga</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Nume de utilizator pentru căutare și adăugare</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(необходимо в случае восстановления пароля)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(Предлагается <a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">password manager</a>)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Сумма</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Идентификатор ответа</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Текст ответа</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Пользовательский символ (эмодзи)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Цвет</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Идентификатор комментария</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Текст комментария</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Противостояние</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Идентификатор противостояния</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Контекст</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Дата окончания</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Дата начала</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Описание</value>
|
<value>Описание</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Обсуждение</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Дата окончания</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Время окончания</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Обсуждаемый иди</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Текст для обсуждения</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Название дискуссии</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>Электронная почта</value>
|
<value>Электронная почта</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Максимальное количество противостояний</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Факт</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Факты</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Идентификатор файла</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Группы</value>
|
<value>Группы</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Включить первый ответ в предварительный просмотр приглашения? (что делает его более привлекательным для участия в обсуждении)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Код приглашения</value>
|
<value>Код приглашения</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Код приглашения или ссылка</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Пароль приглашения</value>
|
<value>Пароль приглашения</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Требуется пароль для предварительного просмотра</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Требуется пароль для показа предварительного просмотра</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Добавить защиту паролем</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Языковой идентификатор</value>
|
<value>Языковой идентификатор</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Имя</value>
|
<value>Имя</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Включить уведомления? (полезно для получения обновлений приложения)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Новый пароль</value>
|
<value>Новый пароль</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Старый пароль</value>
|
<value>Старый пароль</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Только один раз</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Пароль</value>
|
<value>Пароль</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Восприятие</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Восприятие</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Предпочитайте системную тему</value>
|
<value>Предпочитайте системную тему</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Код восстановления</value>
|
<value>Код восстановления</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Повторяющийся</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Сканирование для:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Поиск</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Обмен секретным кодом</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Показать значок жертвователя</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Покажите вкладку журналов для поддержки поиска и устранения неисправностей.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Возьмите тип</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Простой</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Структурированный</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Тематическое изображение</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Темный режим</value>
|
<value>Темный режим</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Клещи</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Название</value>
|
<value>Название</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Причина обновления</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Подавать анонимно</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Имя пользователя</value>
|
<value>Имя пользователя</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Имя пользователя для поиска и добавления</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Имена пользователей для поиска и добавления</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(potrebné v prípade obnovenia hesla)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">správca hesiel</a> navrhnuté)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Suma</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Odpoveď id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Text odpovede</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Vlastný znak (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Farba</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Komentár id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Text komentára</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontácia</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id konfrontácie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontext</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Dátum ukončenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Dátum začiatku</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Popis</value>
|
<value>Popis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskusia</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Dátum ukončenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Čas ukončenia</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskusia id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Text diskusie</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Názov diskusie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-mail</value>
|
<value>E-mail</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Maximálny počet konfrontácií</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Skutočnosť</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakty</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Identifikátor súboru</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Skupiny</value>
|
<value>Skupiny</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Zahrnúť prvú odpoveď do náhľadu pozvánky? (aby bolo zapojenie do diskusie pútavejšie)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Pozývací kód</value>
|
<value>Pozývací kód</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Pozývací kód alebo odkaz</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Heslo pozvánky</value>
|
<value>Heslo pozvánky</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Vyžadovať heslo pre náhľad</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Vyžadovať heslo na zobrazenie náhľadu</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Pridanie ochrany heslom</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Identifikátor jazyka</value>
|
<value>Identifikátor jazyka</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Názov</value>
|
<value>Názov</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Povolenie oznámení?(užitočné na prijímanie aktualizácií aplikácie)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nové heslo</value>
|
<value>Nové heslo</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Staré heslo</value>
|
<value>Staré heslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Iba jedenkrát</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Heslo</value>
|
<value>Heslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Vnímanie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Vnímanie</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Uprednostniť tému systému</value>
|
<value>Uprednostniť tému systému</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Kód obnovy</value>
|
<value>Kód obnovy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Opakujúce sa</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Vyhľadávanie:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Vyhľadávanie</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Zdieľanie tajného kódu</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Zobraziť odznak darcu</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Zobrazenie karty protokolov na podporu riešenia problémov.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Vezmite si typ</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Jednoduché</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Štruktúrované</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Obrázok témy</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Tmavý režim</value>
|
<value>Tmavý režim</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Kliešte</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Názov</value>
|
<value>Názov</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Dôvod aktualizácie</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Odoslať anonymne</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Používateľské meno</value>
|
<value>Používateľské meno</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Používateľské meno na vyhľadávanie a pridávanie</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Používateľské mená na vyhľadávanie a pridávanie</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(potrebno v primeru obnovitve gesla)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">predlagani upravitelj gesel</a>)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Znesek</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Odgovor id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Besedilo odgovora</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Znak po meri (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Barva</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Id komentarja</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Besedilo komentarja</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontacija</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Id konfrontacije</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontekst</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Končni datum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Datum začetka</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Opis</value>
|
<value>Opis</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Razprava</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Končni datum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Končni čas</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Razprava id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Besedilo za razpravo</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Naslov razprave</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-pošta</value>
|
<value>E-pošta</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Največje število soočenj</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Dejstva</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Dejstva</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Id datoteke</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Skupine</value>
|
<value>Skupine</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Vključiti prvi odgovor v predogled vabila? (da bo vključitev v razpravo bolj privlačna)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Koda vabila</value>
|
<value>Koda vabila</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Koda vabila ali povezava</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Geslo za povabilo</value>
|
<value>Geslo za povabilo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Zahtevajte geslo za predogled</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Zahtevajte geslo za prikaz predogleda</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Dodajanje zaščite z geslom</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Id jezika</value>
|
<value>Id jezika</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Ime</value>
|
<value>Ime</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Omogočite obvestila? (koristno za prejemanje posodobitev aplikacije)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Novo geslo</value>
|
<value>Novo geslo</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Staro geslo</value>
|
<value>Staro geslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Samo enkrat</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Geslo</value>
|
<value>Geslo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Zaznavanje</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Dojemanje</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Prednost sistemske teme</value>
|
<value>Prednost sistemske teme</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Koda za obnovitev</value>
|
<value>Koda za obnovitev</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Ponavljajoče se</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Iskanje za:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Iskanje</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Deljenje skrivne kode</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Prikaži značko donatorja</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Prikažite zavihek dnevniki za podporo pri odpravljanju težav.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Vrsta posnetka</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Enostavno</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturiran</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Slika teme</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Temni način</value>
|
<value>Temni način</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Klopi</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Naslov</value>
|
<value>Naslov</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Razlog za posodobitev</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Pošlji anonimno</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Uporabniško ime</value>
|
<value>Uporabniško ime</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Uporabniško ime za iskanje in dodajanje</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Uporabniška imena za iskanje in dodajanje</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(nödvändig vid återställning av lösenord)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">password manager</a> föreslås)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>Belopp</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>Svar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>Svarstext</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>Anpassat tecken (emoji)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>Färg</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>Kommentar id</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>Kommentar</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>Konfrontation</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>Konfrontation id</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>Kontext</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>Slutdatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>Startdatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>Beskrivning</value>
|
<value>Beskrivning</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>Diskussion</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>Slutdatum</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>Sluttid</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>Diskussion id</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>Diskussionstext</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>Titel på diskussionen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>E-post</value>
|
<value>E-post</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>Emoji</value>
|
<value>Emoji</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>Max antal konfrontationer</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>Fakta</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>Filid</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>Grupper</value>
|
<value>Grupper</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>Inkludera det första svaret i förhandsgranskningen av inbjudan? (för att göra det mer lockande att delta i diskussionen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>Kod för inbjudan</value>
|
<value>Kod för inbjudan</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>Inbjudningskod eller länk</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>Lösenord för inbjudan</value>
|
<value>Lösenord för inbjudan</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>Kräver lösenord för förhandsgranskning</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>Kräver lösenord för att visa förhandsgranskningen</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>Lägg till lösenordsskydd</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>IsStructured</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>Språk-id</value>
|
<value>Språk-id</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>Namn</value>
|
<value>Namn</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>Aktivera meddelanden (användbart för att få uppdateringar av appen)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>Nytt lösenord</value>
|
<value>Nytt lösenord</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>Gammalt lösenord</value>
|
<value>Gammalt lösenord</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>Endast en gång</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>Lösenord</value>
|
<value>Lösenord</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>Uppfattning</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>Uppfattningar</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>Föredrar systemtema</value>
|
<value>Föredrar systemtema</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>Kod för återvinning</value>
|
<value>Kod för återvinning</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>Återkommande</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>Skanna efter:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>Sök på</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>Att dela med sig av den hemliga koden</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>Visa donatormärket</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>Visa fliken Loggar för att underlätta felsökning.</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>Typ av tagning</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>Enkelt</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>Strukturerad</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>Tema bild</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>Mörkt läge</value>
|
<value>Mörkt läge</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>Fästingar</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>Titel</value>
|
<value>Titel</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>Orsak till uppdatering</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>Skicka in anonymt</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>Användarnamn</value>
|
<value>Användarnamn</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>Användarnamn för att söka och lägga till</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>Användarnamn att söka och lägga till</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -117,123 +117,30 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="(necessary in case of password recovery)" xml:space="preserve">
|
|
||||||
<value>(在恢复密码的情况下是必要的)</value>
|
|
||||||
</data>
|
|
||||||
<data name="(password manager suggested)" xml:space="preserve">
|
|
||||||
<value>(<a class="is-underlined has-text-info" tabindex="-1" target="blank" href="https://keepassxc.org/">密码管理器</a>建议)</value>
|
|
||||||
</data>
|
|
||||||
<data name="Amount" xml:space="preserve">
|
|
||||||
<value>数量</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerId" xml:space="preserve">
|
|
||||||
<value>答案是</value>
|
|
||||||
</data>
|
|
||||||
<data name="AnswerText" xml:space="preserve">
|
|
||||||
<value>回答文本</value>
|
|
||||||
</data>
|
|
||||||
<data name="Character" xml:space="preserve">
|
|
||||||
<value>自定义字符(表情符号)</value>
|
|
||||||
</data>
|
|
||||||
<data name="ColourIndex" xml:space="preserve">
|
|
||||||
<value>颜色</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentId" xml:space="preserve">
|
|
||||||
<value>评论编号</value>
|
|
||||||
</data>
|
|
||||||
<data name="CommentText" xml:space="preserve">
|
|
||||||
<value>评论文本</value>
|
|
||||||
</data>
|
|
||||||
<data name="Confrontation" xml:space="preserve">
|
|
||||||
<value>对抗</value>
|
|
||||||
</data>
|
|
||||||
<data name="ConfrontationId" xml:space="preserve">
|
|
||||||
<value>对抗的身份</value>
|
|
||||||
</data>
|
|
||||||
<data name="Context" xml:space="preserve">
|
|
||||||
<value>背景介绍</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateEnd" xml:space="preserve">
|
|
||||||
<value>结束日期</value>
|
|
||||||
</data>
|
|
||||||
<data name="DateStart" xml:space="preserve">
|
|
||||||
<value>开始日期</value>
|
|
||||||
</data>
|
|
||||||
<data name="Description" xml:space="preserve">
|
<data name="Description" xml:space="preserve">
|
||||||
<value>描述</value>
|
<value>描述</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Discussion" xml:space="preserve">
|
|
||||||
<value>讨论</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndDate" xml:space="preserve">
|
|
||||||
<value>结束日期</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionEndTime" xml:space="preserve">
|
|
||||||
<value>结束时间</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionId" xml:space="preserve">
|
|
||||||
<value>讨论的内容</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionText" xml:space="preserve">
|
|
||||||
<value>讨论文本</value>
|
|
||||||
</data>
|
|
||||||
<data name="DiscussionTitle" xml:space="preserve">
|
|
||||||
<value>讨论题目</value>
|
|
||||||
</data>
|
|
||||||
<data name="Email" xml:space="preserve">
|
<data name="Email" xml:space="preserve">
|
||||||
<value>电子邮件</value>
|
<value>电子邮件</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Emoji" xml:space="preserve">
|
<data name="Emoji" xml:space="preserve">
|
||||||
<value>表情符号</value>
|
<value>表情符号</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ExpectedMaxConfrontationsBeforeClosingAndShowing" xml:space="preserve">
|
|
||||||
<value>对抗的最大数量</value>
|
|
||||||
</data>
|
|
||||||
<data name="Fact" xml:space="preserve">
|
|
||||||
<value>事实</value>
|
|
||||||
</data>
|
|
||||||
<data name="Facts" xml:space="preserve">
|
|
||||||
<value>事实</value>
|
|
||||||
</data>
|
|
||||||
<data name="FileId" xml:space="preserve">
|
|
||||||
<value>文件编号</value>
|
|
||||||
</data>
|
|
||||||
<data name="Groups" xml:space="preserve">
|
<data name="Groups" xml:space="preserve">
|
||||||
<value>群体</value>
|
<value>群体</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IncludeFirstAnswerInInvitation" xml:space="preserve">
|
|
||||||
<value>在邀请预览中包括第一个答案?(使其更加吸引人加入讨论)</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationCode" xml:space="preserve">
|
<data name="InvitationCode" xml:space="preserve">
|
||||||
<value>邀请函代码</value>
|
<value>邀请函代码</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="InvitationCodeLink" xml:space="preserve">
|
|
||||||
<value>邀请函代码或链接</value>
|
|
||||||
</data>
|
|
||||||
<data name="InvitationPassword" xml:space="preserve">
|
<data name="InvitationPassword" xml:space="preserve">
|
||||||
<value>邀请函密码</value>
|
<value>邀请函密码</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IsPasswordProtectedForPreview" xml:space="preserve">
|
|
||||||
<value>预览时需要密码</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedForPreviewText" xml:space="preserve">
|
|
||||||
<value>需要密码才能显示预览</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsPasswordProtectedText" xml:space="preserve">
|
|
||||||
<value>添加密码保护</value>
|
|
||||||
</data>
|
|
||||||
<data name="IsStructured" xml:space="preserve">
|
|
||||||
<value>是结构化的</value>
|
|
||||||
</data>
|
|
||||||
<data name="LanguageId" xml:space="preserve">
|
<data name="LanguageId" xml:space="preserve">
|
||||||
<value>语言标识</value>
|
<value>语言标识</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Name" xml:space="preserve">
|
<data name="Name" xml:space="preserve">
|
||||||
<value>命名</value>
|
<value>命名</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NativeNotificationsEnabled" xml:space="preserve">
|
|
||||||
<value>启用通知?(对接收应用程序的更新很有用)</value>
|
|
||||||
</data>
|
|
||||||
<data name="NewPassword" xml:space="preserve">
|
<data name="NewPassword" xml:space="preserve">
|
||||||
<value>新密码</value>
|
<value>新密码</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -243,76 +150,22 @@
|
|||||||
<data name="OldPassword" xml:space="preserve">
|
<data name="OldPassword" xml:space="preserve">
|
||||||
<value>旧密码</value>
|
<value>旧密码</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OneTime" xml:space="preserve">
|
|
||||||
<value>仅限一次</value>
|
|
||||||
</data>
|
|
||||||
<data name="Password" xml:space="preserve">
|
<data name="Password" xml:space="preserve">
|
||||||
<value>密码</value>
|
<value>密码</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Perception" xml:space="preserve">
|
|
||||||
<value>感知</value>
|
|
||||||
</data>
|
|
||||||
<data name="Perceptions" xml:space="preserve">
|
|
||||||
<value>观念</value>
|
|
||||||
</data>
|
|
||||||
<data name="PreferSystemTheming" xml:space="preserve">
|
<data name="PreferSystemTheming" xml:space="preserve">
|
||||||
<value>倾向于系统主题</value>
|
<value>倾向于系统主题</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="RecoveryCode" xml:space="preserve">
|
<data name="RecoveryCode" xml:space="preserve">
|
||||||
<value>恢复代码</value>
|
<value>恢复代码</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Recurring" xml:space="preserve">
|
|
||||||
<value>经常性的</value>
|
|
||||||
</data>
|
|
||||||
<data name="Scan for:" xml:space="preserve">
|
|
||||||
<value>进行扫描:</value>
|
|
||||||
</data>
|
|
||||||
<data name="SearchText" xml:space="preserve">
|
|
||||||
<value>搜索</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShareCode" xml:space="preserve">
|
|
||||||
<value>分享秘密代码</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowDonatorBadge" xml:space="preserve">
|
|
||||||
<value>显示捐赠者徽章</value>
|
|
||||||
</data>
|
|
||||||
<data name="ShowLogs" xml:space="preserve">
|
|
||||||
<value>显示日志标签以支持故障排除。</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeType" xml:space="preserve">
|
|
||||||
<value>采取类型</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeSimple" xml:space="preserve">
|
|
||||||
<value>简单</value>
|
|
||||||
</data>
|
|
||||||
<data name="TakeTypeStructured" xml:space="preserve">
|
|
||||||
<value>结构化</value>
|
|
||||||
</data>
|
|
||||||
<data name="Theme image" xml:space="preserve">
|
|
||||||
<value>主题图片</value>
|
|
||||||
</data>
|
|
||||||
<data name="ThemeIsDarkMode" xml:space="preserve">
|
<data name="ThemeIsDarkMode" xml:space="preserve">
|
||||||
<value>黑暗模式</value>
|
<value>黑暗模式</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Ticks" xml:space="preserve">
|
|
||||||
<value>蜱虫</value>
|
|
||||||
</data>
|
|
||||||
<data name="Title" xml:space="preserve">
|
<data name="Title" xml:space="preserve">
|
||||||
<value>标题</value>
|
<value>标题</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="UpdateReason" xml:space="preserve">
|
|
||||||
<value>更新原因</value>
|
|
||||||
</data>
|
|
||||||
<data name="UpsertUserTakeIsAnonymous" xml:space="preserve">
|
|
||||||
<value>匿名提交</value>
|
|
||||||
</data>
|
|
||||||
<data name="Username" xml:space="preserve">
|
<data name="Username" xml:space="preserve">
|
||||||
<value>帐号</value>
|
<value>帐号</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Username to search and add" xml:space="preserve">
|
|
||||||
<value>搜索和添加的用户名</value>
|
|
||||||
</data>
|
|
||||||
<data name="Usernames to search and add" xml:space="preserve">
|
|
||||||
<value>搜索和添加的用户名</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels
|
||||||
|
{
|
||||||
|
// The server's first login, made while it has no administrator (/clientapi/user/setup), with its first persona.
|
||||||
|
public class SetupForm : LoginForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(32, MinimumLength = 3, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
RegularExpression(Constants.UserNameRegex, ErrorMessageResourceName = "InvalidUserName", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string AvatarUserName { get; set; }
|
||||||
|
|
||||||
|
[StringLength(64, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public string AvatarName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
// The login's email address, set only with its password and only once a code sent to it comes back
|
||||||
|
// (/clientapi/user/email, /email/verify).
|
||||||
|
public class EmailChangeForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
EmailAddress(ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(254, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Email", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
DataType(DataType.Password),
|
||||||
|
PasswordPropertyText(true),
|
||||||
|
StringLength(Constants.MaxPasswordLength, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Password", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EmailCodeForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(16, MinimumLength = 6, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "RecoveryCode", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Code { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// what only the login's password may do (removing its email address)
|
||||||
|
public class PasswordForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
DataType(DataType.Password),
|
||||||
|
PasswordPropertyText(true),
|
||||||
|
StringLength(Constants.MaxPasswordLength, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Password", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewAccount
|
||||||
|
{
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Email { get; set; }
|
||||||
|
public bool IsEmailValidated { get; set; } = false;
|
||||||
|
public string PendingEmail { get; set; }//waiting for its code
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public bool TwoFactorEnabled { get; set; } = false;
|
||||||
|
public int RecoveryCodesLeft { get; set; } = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a code from the authenticator app (six digits) or a recovery code
|
||||||
|
public class TotpCodeForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(32, MinimumLength = 6, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "RecoveryCode", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Code { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TotpDisableForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
DataType(DataType.Password),
|
||||||
|
PasswordPropertyText(true),
|
||||||
|
StringLength(Constants.MaxPasswordLength, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Password", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(32, MinimumLength = 6, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "RecoveryCode", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Code { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// what an authenticator app needs: the secret, as text and as the otpauth:// URI its QR code holds
|
||||||
|
public class ViewTotpSetup
|
||||||
|
{
|
||||||
|
public string Secret { get; set; }
|
||||||
|
public string OtpAuthUri { get; set; }
|
||||||
|
public string QrDataUri { get; set; }//an SVG image, as a data: URI
|
||||||
|
}
|
||||||
|
|
||||||
|
// shown once: the recovery codes, and this device's new session (turning two-factor on ends every other one)
|
||||||
|
public class ViewTotpEnabled
|
||||||
|
{
|
||||||
|
public List<string> RecoveryCodes { get; set; } = [];
|
||||||
|
public JwtUser Session { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
// Deleting one's own login, and with it every persona and group it owns, asks for the password again.
|
||||||
|
public class RemoveSelfForm
|
||||||
|
{
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = "Password", ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
{
|
{
|
||||||
public class UsersIds
|
public class UsersIds
|
||||||
{
|
{
|
||||||
public IList<string> UserIdList { get; set; } = Array.Empty<string>();
|
public List<string> UserIdList { get; set; } = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
// A persona's archive (owner decision 2026-10-07): made for it to take away, in Mastodon's account-archive layout, and
|
||||||
|
// restored into it. States: none, queued, running, ready (export) or done (import), failed, stopped.
|
||||||
|
public class ViewPersonaArchive
|
||||||
|
{
|
||||||
|
public string ExportState { get; set; }
|
||||||
|
public DateTime? ExportAskedAt { get; set; }
|
||||||
|
public DateTime? ExportReadyAt { get; set; }
|
||||||
|
public DateTime? ExportExpiresAt { get; set; }
|
||||||
|
public long ExportBytes { get; set; }
|
||||||
|
public string ExportError { get; set; }
|
||||||
|
|
||||||
|
public string ImportState { get; set; }
|
||||||
|
public DateTime? ImportAskedAt { get; set; }
|
||||||
|
public DateTime? ImportEndedAt { get; set; }
|
||||||
|
public List<string> ImportParts { get; set; } = [];
|
||||||
|
public long ImportDone { get; set; }
|
||||||
|
public long ImportTotal { get; set; }
|
||||||
|
public Dictionary<string, int> ImportCounts { get; set; } = [];//what was imported and what skipped, by why
|
||||||
|
public string ImportError { get; set; }
|
||||||
|
public string ImportFrom { get; set; }//the archive's actor
|
||||||
|
public bool ImportSameActor { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// the parts of an archive to import: posts (with their media), profile, follows, blocks, mutes, domainblocks, lists,
|
||||||
|
// bookmarks, filters, tags, notificationpolicy, pins; and only when asked, located, scheduled, likes (which tell their
|
||||||
|
// authors)
|
||||||
|
public class ImportPersonaArchiveForm
|
||||||
|
{
|
||||||
|
public string UploadId { get; set; }
|
||||||
|
public List<string> Parts { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewArchiveTicket
|
||||||
|
{
|
||||||
|
public string Url { get; set; }
|
||||||
|
public DateTime ExpiresAt { get; set; }
|
||||||
|
public long Bytes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewArchiveUpload
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public long Received { get; set; }
|
||||||
|
public long ChunkBytes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
public class ViewServerSetup
|
||||||
|
{
|
||||||
|
// no administrator yet: the first login made through /clientapi/user/setup becomes it
|
||||||
|
public bool IsPending { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
// /clientapi/user/storage: what the login's media take (every persona's uploads and pictures), and its quota when the
|
||||||
|
// server sets one
|
||||||
|
public class ViewStorage
|
||||||
|
{
|
||||||
|
public long MediaBytes { get; set; }
|
||||||
|
public long MediaFiles { get; set; }
|
||||||
|
public long? QuotaBytes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,5 +21,8 @@ namespace PrivaPub.ClientModels.User
|
|||||||
public bool ThemeIsDarkMode { get; set; } = false;
|
public bool ThemeIsDarkMode { get; set; } = false;
|
||||||
public bool ThemeIsLightGray { get; set; } = false;
|
public bool ThemeIsLightGray { get; set; } = false;
|
||||||
public bool ThemeIsDarkGray { get; set; } = false;
|
public bool ThemeIsDarkGray { get; set; } = false;
|
||||||
|
|
||||||
|
// when a client last saved these; null until one did, so a client signing in keeps its own until then
|
||||||
|
public DateTime? SavedAt { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
using PrivaPub.Api.Mastodon.Auth;
|
|
||||||
using PrivaPub.Api.Mastodon.Infrastructure;
|
|
||||||
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Api
|
|
||||||
{
|
|
||||||
public class MastodonParamsTests
|
|
||||||
{
|
|
||||||
static async Task<MastodonParams> Read(string query = "", string contentType = default, string body = default)
|
|
||||||
{
|
|
||||||
var context = new DefaultHttpContext();
|
|
||||||
context.Request.QueryString = new QueryString(query);
|
|
||||||
if (body != default)
|
|
||||||
{
|
|
||||||
context.Request.ContentType = contentType;
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(body);
|
|
||||||
context.Request.Body = new MemoryStream(bytes);
|
|
||||||
context.Request.ContentLength = bytes.Length;
|
|
||||||
}
|
|
||||||
return await MastodonParams.Read(context.Request, TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Absent_values_are_null_not_false_or_zero()
|
|
||||||
{
|
|
||||||
var parameters = await Read();
|
|
||||||
|
|
||||||
Assert.Null(parameters.Bool("sensitive"));
|
|
||||||
Assert.Null(parameters.Int("limit"));
|
|
||||||
Assert.Null(parameters.Get("status"));
|
|
||||||
Assert.Empty(parameters.List("media_ids"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Reads_rails_style_arrays_from_the_query()
|
|
||||||
{
|
|
||||||
var parameters = await Read("?id[]=1&id[]=2&limit=5&local=true");
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "1", "2" }, parameters.List("id"));
|
|
||||||
Assert.Equal(5, parameters.Int("limit"));
|
|
||||||
Assert.True(parameters.Bool("local"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Reads_forms_and_nested_keys()
|
|
||||||
{
|
|
||||||
var parameters = await Read(contentType: "application/x-www-form-urlencoded",
|
|
||||||
body: "status=hi&media_ids[]=a&media_ids[]=b&poll[options][]=x&poll[options][]=y&sensitive=0");
|
|
||||||
|
|
||||||
Assert.Equal("hi", parameters.Get("status"));
|
|
||||||
Assert.Equal(new[] { "a", "b" }, parameters.List("media_ids"));
|
|
||||||
Assert.Equal(new[] { "x", "y" }, parameters.List("poll[options]"));
|
|
||||||
Assert.False(parameters.Bool("sensitive"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Reads_json_bodies_the_same_way()
|
|
||||||
{
|
|
||||||
var parameters = await Read(contentType: "application/json",
|
|
||||||
body: """{"status":"hi","media_ids":["a","b"],"poll":{"options":["x","y"],"expires_in":300},"sensitive":true,"source":{"privacy":"unlisted"}}""");
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "a", "b" }, parameters.List("media_ids"));
|
|
||||||
Assert.Equal(new[] { "x", "y" }, parameters.List("poll[options]"));
|
|
||||||
Assert.Equal(300, parameters.Int("poll[expires_in]"));
|
|
||||||
Assert.True(parameters.Bool("sensitive"));
|
|
||||||
Assert.Equal("unlisted", parameters.Get("source[privacy]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(new[] { "read" }, "read:statuses", true)]
|
|
||||||
[InlineData(new[] { "read:statuses" }, "read:statuses", true)]
|
|
||||||
[InlineData(new[] { "read:accounts" }, "read:statuses", false)]
|
|
||||||
[InlineData(new[] { "write" }, "read:statuses", false)]
|
|
||||||
[InlineData(new[] { "follow" }, "write:follows", true)]
|
|
||||||
[InlineData(new[] { "follow" }, "write:statuses", false)]
|
|
||||||
public void Scopes_grant_like_mastodons(string[] granted, string required, bool expected) =>
|
|
||||||
Assert.Equal(expected, MastodonScopes.Grants(granted, required));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Api.Mastodon.Infrastructure;
|
|
||||||
using PrivaPub.Api.Mastodon.Mappers;
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Api
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class PersonaSeparationTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Nothing_shown_to_one_persona_names_its_sibling()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, sibling) = await _harness.Persona("sibling", root);
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = bob.UserName }, token);
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = sibling.Id, Target = bob.UserName }, token);
|
|
||||||
await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = sibling.Id, Text = "from the sibling" }, token);
|
|
||||||
await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "from alice" }, token);
|
|
||||||
await _harness.Posts.InsertPost(bobRoot, new InsertPostForm { AvatarId = bob.Id, Text = "hi both" }, token);
|
|
||||||
|
|
||||||
var mapper = new MastodonMapper(_harness.Db, _harness.Local);
|
|
||||||
var account = await mapper.Local(alice, withSource: true, token);
|
|
||||||
var homeIds = (await _harness.Db.TimelineEntries.Match(e => e.AvatarId == alice.Id).ExecuteAsync(token)).Select(e => e.PostId).ToList();
|
|
||||||
var home = await _harness.Db.Posts.Match(p => homeIds.Contains(p.ID)).ExecuteAsync(token);
|
|
||||||
var statuses = await mapper.Statuses(home, alice.Id, token);
|
|
||||||
var bobAsSeenByAlice = await mapper.Account(bob.Id, token);
|
|
||||||
|
|
||||||
var json = JsonSerializer.Serialize(new object[] { account, statuses, bobAsSeenByAlice }, MastodonJson.Options);
|
|
||||||
Assert.DoesNotContain(sibling.Id, json);
|
|
||||||
Assert.DoesNotContain(sibling.UserName, json);
|
|
||||||
Assert.DoesNotContain(root, json);
|
|
||||||
Assert.Contains("hi both", json);
|
|
||||||
Assert.Equal(2, bobAsSeenByAlice.FollowersCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using PrivaPub.Api.Mastodon.Mappers;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Api
|
|
||||||
{
|
|
||||||
public class StatusContentTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void A_remote_article_shows_its_title_above_its_body() =>
|
|
||||||
Assert.Equal("<p><strong>Rain & sun</strong></p><p>body</p>", MastodonMapper.Content(new Post
|
|
||||||
{
|
|
||||||
IsFederatedCopy = true, ObjectType = "Article", Title = "Rain & sun", ContentHtml = "<p>body</p>"
|
|
||||||
}));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_remote_note_keeps_its_content_alone() =>
|
|
||||||
Assert.Equal("<p>body</p>", MastodonMapper.Content(new Post
|
|
||||||
{
|
|
||||||
IsFederatedCopy = true, ObjectType = "Note", Title = "a poll choice", ContentHtml = "<p>body</p>"
|
|
||||||
}));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_remote_event_without_a_body_shows_its_excerpt() =>
|
|
||||||
Assert.Equal("<p><strong>Meetup</strong></p><p>Saturday <10:00></p>", MastodonMapper.Content(new Post
|
|
||||||
{
|
|
||||||
IsFederatedCopy = true, ObjectType = "Event", Title = "Meetup", Excerpt = "Saturday <10:00>", ContentHtml = string.Empty
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
using PrivaPub.Domain.Content;
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Infrastructure.Http;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
public class ContentRendererTests
|
|
||||||
{
|
|
||||||
const string Base = "https://privapub.test";
|
|
||||||
readonly ContentRenderer _renderer = new(new StubLocalActors(), new StubRemoteActors());
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Decorates_local_and_remote_mentions_and_hashtags()
|
|
||||||
{
|
|
||||||
var rendered = await _renderer.Markdown("hello @alice and @bob@m.example about #Fedi **now** <script>x</script>", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Contains("<span class=\"h-card\" translate=\"no\"><a href=\"https://privapub.test/peasants/alice\" class=\"u-url mention\"", rendered.Html);
|
|
||||||
Assert.Contains("href=\"https://m.example/@bob\"", rendered.Html);
|
|
||||||
Assert.Contains("href=\"https://privapub.test/tags/fedi\" class=\"mention hashtag\"", rendered.Html);
|
|
||||||
Assert.Contains("<strong>now</strong>", rendered.Html);
|
|
||||||
Assert.DoesNotContain("<script>", rendered.Html);
|
|
||||||
Assert.Equal(new[] { "https://m.example/users/bob", "https://privapub.test/peasants/alice" }, rendered.Mentions.Select(m => m.ActorUri).Order(StringComparer.Ordinal));
|
|
||||||
Assert.Equal("fedi", Assert.Single(rendered.Tags));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("`@alice` in code")]
|
|
||||||
[InlineData("mail me@alice.example")]
|
|
||||||
[InlineData("@nobody is unknown")]
|
|
||||||
[InlineData("see https://x.example/page#alice")]
|
|
||||||
public async Task Leaves_what_is_not_a_mention_alone(string text)
|
|
||||||
{
|
|
||||||
var rendered = await _renderer.Markdown(text, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Empty(rendered.Mentions);
|
|
||||||
Assert.DoesNotContain("h-card", rendered.Html);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("issue #123")]
|
|
||||||
[InlineData("it's fine")]
|
|
||||||
[InlineData("[link](https://x.example/#tag)")]
|
|
||||||
public async Task Leaves_what_is_not_a_hashtag_alone(string text) =>
|
|
||||||
Assert.Empty((await _renderer.Markdown(text, TestContext.Current.CancellationToken)).Tags);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Renders_plain_text_like_mastodon()
|
|
||||||
{
|
|
||||||
var rendered = await _renderer.PlainText("line one\nline <two>\n\nsee https://x.example/a?b=1. #Tag", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal("<p>line one<br>line <two></p><p>see <a href=\"https://x.example/a?b=1\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https://x.example/a?b=1</a>. "
|
|
||||||
+ "<a href=\"https://privapub.test/tags/tag\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>Tag</span></a></p>", rendered.Html);
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class StubLocalActors : ILocalActorService
|
|
||||||
{
|
|
||||||
public string BaseAddress => Base;
|
|
||||||
|
|
||||||
public Task<LocalActor> FindByUserName(string userName, CancellationToken token) =>
|
|
||||||
Task.FromResult(userName.Equals("alice", StringComparison.OrdinalIgnoreCase)
|
|
||||||
? new LocalActor { Id = "a1", UserName = "alice", BaseAddress = Base, Kind = LocalActorKind.Person }
|
|
||||||
: default);
|
|
||||||
|
|
||||||
public Task<LocalActor> FindById(LocalActorKind kind, string id, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public Task<LocalActor> FindByUri(string actorUri, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public Task<LocalActor> GetInstanceActor(CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public Task<bool> IsUserNameTaken(string userName, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public Task<bool> TryReserveUserName(string userName, LocalActorKind kind, string ownerId, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public LocalActor FromAvatar(Avatar avatar) => throw new NotSupportedException();
|
|
||||||
public LocalActor FromGroup(GroupEntity group) => throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class StubRemoteActors : IRemoteActorService
|
|
||||||
{
|
|
||||||
public Task<string> ResolveHandle(string handle, CancellationToken token) =>
|
|
||||||
Task.FromResult(handle == "bob@m.example" ? "https://m.example/users/bob" : default);
|
|
||||||
|
|
||||||
public Task<ForeignAvatar> GetActor(string actorUri, bool refresh, CancellationToken token) =>
|
|
||||||
Task.FromResult(actorUri == "https://m.example/users/bob"
|
|
||||||
? new ForeignAvatar { ID = "f1", ActorURI = actorUri, UserName = "bob", Url = "https://m.example/@bob", InboxURL = actorUri + "/inbox" }
|
|
||||||
: default);
|
|
||||||
|
|
||||||
public Task<FetchedJson> FetchObject(string uri, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
public Task<ForeignAvatar> GetActorByKeyId(string keyId, bool refresh, CancellationToken token) => throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class FollowTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_local_follow_is_accepted_at_once_and_notified()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
|
|
||||||
var result = await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = "@" + bob.UserName }, token);
|
|
||||||
|
|
||||||
Assert.True(result.IsValid);
|
|
||||||
var following = await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(FollowState.Accepted, following.State);
|
|
||||||
Assert.True(following.TargetIsLocal);
|
|
||||||
Assert.True((await DB.Default.Find<Follower>().Match(f => f.LocalActorId == bob.Id && f.ActorURI == alice.Uri).ExecuteSingleAsync(token)).IsAccepted);
|
|
||||||
Assert.Equal(NotificationType.Follow, (await DB.Default.Find<Notification>().Match(n => n.AvatarId == bob.Id).ExecuteSingleAsync(token)).Type);
|
|
||||||
Assert.Empty(await _harness.Outgoing(bob.Inbox));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Someone_elses_persona_cannot_be_made_to_follow()
|
|
||||||
{
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
|
|
||||||
var result = await _harness.Follows.Follow("someone-else", new FollowForm { AvatarId = alice.Id, Target = bob.UserName }, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.False(result.IsValid);
|
|
||||||
Assert.Equal(404, result.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_remote_follow_is_requested_then_accepted()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = carol.Id }, token);
|
|
||||||
|
|
||||||
var following = await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(FollowState.Requested, following.State);
|
|
||||||
var follow = Assert.Single(await _harness.Outgoing(carol.Id + "/inbox"));
|
|
||||||
Assert.Equal("Follow", follow["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(alice.Uri, follow["actor"]!.GetValue<string>());
|
|
||||||
Assert.StartsWith(alice.Uri + "/grunts/follow-", follow["id"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var accept = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{carol.Id}#accepts/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Accept",
|
|
||||||
["actor"] = carol.Id,
|
|
||||||
["object"] = follow.DeepClone()
|
|
||||||
};
|
|
||||||
Assert.Equal(202, (await _harness.Deliver(carol, $"/peasants/{alice.UserName}/mouth", accept)).StatusCode);
|
|
||||||
Assert.Equal(FollowState.Accepted, (await DB.Default.Find<Following>().OneAsync(following.ID, token)).State);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_accept_from_someone_else_changes_nothing_and_a_reject_ends_the_request()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = carol.Id }, token);
|
|
||||||
var following = await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{mallory.Id}#accepts/{Guid.NewGuid():N}", ["type"] = "Accept", ["actor"] = mallory.Id, ["object"] = following.FollowActivityURI
|
|
||||||
});
|
|
||||||
Assert.Equal(FollowState.Requested, (await DB.Default.Find<Following>().OneAsync(following.ID, token)).State);
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{carol.Id}#rejects/{Guid.NewGuid():N}", ["type"] = "Reject", ["actor"] = carol.Id, ["object"] = following.FollowActivityURI
|
|
||||||
});
|
|
||||||
Assert.Null(await DB.Default.Find<Following>().OneAsync(following.ID, token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Unfollowing_a_remote_account_sends_an_undo()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = carol.Id }, token);
|
|
||||||
|
|
||||||
await _harness.Follows.Unfollow(root, new FollowForm { AvatarId = alice.Id, Target = carol.Id }, token);
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
var undo = (await _harness.Outgoing(carol.Id + "/inbox")).Single(a => a["type"]!.GetValue<string>() == "Undo");
|
|
||||||
Assert.Equal("Follow", undo["object"]!["type"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
using PrivaPub.Domain.Content;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
public class LinkPreviewTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Reads_open_graph_then_twitter_then_the_page_title()
|
|
||||||
{
|
|
||||||
var preview = LinkPreviews.Read("https://news.example/a?utm_source=x", new Uri("https://news.example/a"), """
|
|
||||||
<html><head><title>Fallback title</title>
|
|
||||||
<meta property="og:title" content="Rain & sun">
|
|
||||||
<meta name="twitter:description" content="A <b>long</b> story">
|
|
||||||
<meta property="og:image" content="/img/cover.jpg">
|
|
||||||
<meta property="og:site_name" content="News">
|
|
||||||
</head><body></body></html>
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("Rain & sun", preview.Title);
|
|
||||||
Assert.Equal("A long story", preview.Description);
|
|
||||||
Assert.Equal("https://news.example/img/cover.jpg", preview.ImageURL);
|
|
||||||
Assert.Equal("News", preview.SiteName);
|
|
||||||
Assert.False(preview.Failed);
|
|
||||||
Assert.True(LinkPreviews.Read("https://x.example", new Uri("https://x.example"), "<html><body>nothing</body></html>").Failed);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Picks_the_first_real_link_and_skips_mentions_tags_quotes_and_ourselves() =>
|
|
||||||
Assert.Equal("https://blog.example/post", LinkPreviews.FirstLink(new Post
|
|
||||||
{
|
|
||||||
Url = "https://m.example/@a/1",
|
|
||||||
ContentHtml = """
|
|
||||||
<p><span class="h-card"><a href="https://m.example/@bob" class="u-url mention">@bob</a></span>
|
|
||||||
<a href="https://m.example/tags/x" class="mention hashtag" rel="tag">#x</a>
|
|
||||||
<span class="quote-inline">RE: <a href="https://k.example/notes/1">link</a></span>
|
|
||||||
<a href="https://privapub.test/@me">me</a>
|
|
||||||
<a href="https://m.example/@a/1">self</a>
|
|
||||||
<a href="https://blog.example/post">read this</a></p>
|
|
||||||
"""
|
|
||||||
}, "https://privapub.test"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using NetVips;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Media;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Rendering;
|
|
||||||
using PrivaPub.Models.Media;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MediaFlowTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static byte[] Png(int width, int height)
|
|
||||||
{
|
|
||||||
using var image = (Image.Black(width, height, bands: 3) + new double[] { 10, 120, 200 }).Cast(Enums.BandFormat.Uchar);
|
|
||||||
return image.WriteToBuffer(".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
static IFormFile Upload(byte[] bytes, string contentType) =>
|
|
||||||
new FormFile(new MemoryStream(bytes), 0, bytes.Length, "file", "picture") { Headers = new HeaderDictionary(), ContentType = contentType };
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_upload_is_attached_once_and_federated_with_its_alt_text()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, mallory) = await _harness.Persona("mallory");
|
|
||||||
|
|
||||||
var upload = await _harness.Media.Upload(alice, Upload(Png(300, 200), "image/png"), "a blue square", "0.25,-0.5", token);
|
|
||||||
Assert.True(upload.Ok);
|
|
||||||
Assert.True(File.Exists(Path.Combine(_harness.Media.Root, upload.Attachment.FilePath)));
|
|
||||||
|
|
||||||
var stolen = await _harness.Statuses.Publish(mallory, new StatusDraft { Text = "mine", MediaIds = new[] { upload.Attachment.ID } }, token);
|
|
||||||
Assert.False(stolen.Ok);
|
|
||||||
|
|
||||||
var posted = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "look", MediaIds = new[] { upload.Attachment.ID } }, token);
|
|
||||||
Assert.True(posted.Ok);
|
|
||||||
Assert.Equal(posted.Post.ID, (await DB.Default.Find<MediaAttachment>().OneAsync(upload.Attachment.ID, token)).PostId);
|
|
||||||
|
|
||||||
var note = ActivityPubRenderer.Note(posted.Post, alice, default, default);
|
|
||||||
var attachment = note["attachment"]![0]!;
|
|
||||||
Assert.Equal("a blue square", attachment["name"]!.GetValue<string>());
|
|
||||||
Assert.Equal(300, attachment["width"]!.GetValue<int>());
|
|
||||||
Assert.Equal(-0.5f, attachment["focalPoint"]![1]!.GetValue<float>());
|
|
||||||
Assert.StartsWith("https://privapub.test/media/files/", attachment["url"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var reused = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "again", MediaIds = new[] { upload.Attachment.ID } }, token);
|
|
||||||
Assert.False(reused.Ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Unsupported_files_are_refused()
|
|
||||||
{
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
|
|
||||||
var outcome = await _harness.Media.Upload(alice, Upload(System.Text.Encoding.UTF8.GetBytes("<svg/>"), "image/svg+xml"), default, default, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.False(outcome.Ok);
|
|
||||||
Assert.Equal(422, outcome.Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_proxy_serves_signed_remote_media_and_nothing_else()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var path = $"/files/{Guid.NewGuid():N}.png";
|
|
||||||
_harness.Peer.ServeFile(path, Png(10, 10), "image/png");
|
|
||||||
var proxy = new MediaProxy(_harness.Local, Peer.Http(), _harness.Media, new StaticOptions<MediaOptions>(new MediaOptions()));
|
|
||||||
|
|
||||||
var wrapped = proxy.Wrap(_harness.Peer.A + path);
|
|
||||||
var parts = new Uri(wrapped).AbsolutePath.Split('/');
|
|
||||||
var (file, contentType) = await proxy.Fetch(parts[3], parts[4], token);
|
|
||||||
var (tampered, _) = await proxy.Fetch(parts[3].Replace(parts[3][0], parts[3][0] == 'A' ? 'B' : 'A'), parts[4], token);
|
|
||||||
|
|
||||||
Assert.StartsWith("https://privapub.test/media/proxy/", wrapped);
|
|
||||||
Assert.Equal("image/png", contentType);
|
|
||||||
Assert.True(File.Exists(file));
|
|
||||||
Assert.StartsWith(_harness.Media.ProxyRoot, file);
|
|
||||||
Assert.Null(tampered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using NetVips;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Media;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
public class MediaProcessingTests
|
|
||||||
{
|
|
||||||
static byte[] JpegWithMetadata(int width, int height)
|
|
||||||
{
|
|
||||||
using var image = (Image.Black(width, height, bands: 3) + new double[] { 200, 40, 90 }).Cast(Enums.BandFormat.Uchar);
|
|
||||||
using var tagged = image.Mutate(m =>
|
|
||||||
{
|
|
||||||
m.Set(GValue.GStrType, "exif-ifd0-ImageDescription", "where I live");
|
|
||||||
m.Set(GValue.GStrType, "exif-ifd0-Artist", "Alice Smith");
|
|
||||||
m.Set(GValue.GStrType, "exif-ifd2-UserComment", "at home");
|
|
||||||
m.Set(GValue.BlobType, "xmp-data", System.Text.Encoding.UTF8.GetBytes("<x:xmpmeta xmlns:x='adobe:ns:meta/'><secret/></x:xmpmeta>"));
|
|
||||||
});
|
|
||||||
return tagged.WriteToBuffer(".jpg");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Uploaded_images_lose_every_kind_of_metadata()
|
|
||||||
{
|
|
||||||
var input = JpegWithMetadata(800, 600);
|
|
||||||
using (var original = Image.NewFromBuffer(input))
|
|
||||||
Assert.Contains("exif-data", original.GetFields());
|
|
||||||
|
|
||||||
var processed = MediaService.ProcessImage(input, 4096, 640, animated: false);
|
|
||||||
|
|
||||||
using var output = Image.NewFromBuffer(processed.Bytes);
|
|
||||||
var fields = output.GetFields();
|
|
||||||
Assert.DoesNotContain("exif-data", fields);
|
|
||||||
Assert.DoesNotContain("xmp-data", fields);
|
|
||||||
Assert.DoesNotContain("iptc-data", fields);
|
|
||||||
Assert.DoesNotContain(fields, f => f.StartsWith("exif-ifd"));
|
|
||||||
Assert.Equal((800, 600), (processed.Width, processed.Height));
|
|
||||||
Assert.Equal("image/jpeg", processed.ContentType);
|
|
||||||
using var preview = Image.NewFromBuffer(processed.Preview);
|
|
||||||
Assert.Equal(640, Math.Max(preview.Width, preview.Height));
|
|
||||||
Assert.DoesNotContain("exif-data", preview.GetFields());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Large_images_are_capped()
|
|
||||||
{
|
|
||||||
var processed = MediaService.ProcessImage(JpegWithMetadata(5000, 2500), 4096, 640, animated: false);
|
|
||||||
|
|
||||||
Assert.Equal((4096, 2048), (processed.Width, processed.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_blurhash_is_well_formed()
|
|
||||||
{
|
|
||||||
var processed = MediaService.ProcessImage(JpegWithMetadata(64, 64), 4096, 640, animated: false);
|
|
||||||
|
|
||||||
Assert.Equal(28, processed.Blurhash.Length);
|
|
||||||
Assert.Equal('L', processed.Blurhash[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_white_image_encodes_white_as_its_average()
|
|
||||||
{
|
|
||||||
var pixels = Enumerable.Range(0, 16 * 16).SelectMany(_ => new byte[] { 255, 255, 255 }).ToArray();
|
|
||||||
|
|
||||||
var hash = Blurhash.Encode(pixels, 16, 16);
|
|
||||||
|
|
||||||
Assert.Equal(28, hash.Length);
|
|
||||||
Assert.Equal("TSUA", hash[2..6]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.Domain.Privacy;
|
|
||||||
using PrivaPub.Federation.Outbox;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class NearbyTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_located_post_reaches_only_those_within_its_radius_and_never_leaves_the_server()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var latitude = 10 + Random.Shared.NextDouble() * 50;
|
|
||||||
var longitude = 10 + Random.Shared.NextDouble() * 50;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var (carolRoot, carol) = await _harness.Persona("carol");
|
|
||||||
var follower = new RemoteActor(_harness.Peer, "follower");
|
|
||||||
await _harness.FollowedBy(alice, follower);
|
|
||||||
|
|
||||||
var created = await _harness.Posts.InsertPost(aliceRoot, new InsertPostForm
|
|
||||||
{
|
|
||||||
AvatarId = alice.Id, Text = "free bread at the bakery", Latitude = latitude, Longitude = longitude, RangeKm = 5
|
|
||||||
}, token);
|
|
||||||
var post = await DB.Default.Find<Post>().OneAsync(((ViewPost)created.Data).Id, token);
|
|
||||||
|
|
||||||
var three = (List<ViewPost>)(await _harness.Posts.Nearby(bobRoot, bob.Id, latitude + 0.027, longitude, token)).Data;
|
|
||||||
var eight = (List<ViewPost>)(await _harness.Posts.Nearby(carolRoot, carol.Id, latitude + 0.072, longitude, token)).Data;
|
|
||||||
|
|
||||||
Assert.Equal(PostVisibility.LocalGeo, post.Visibility);
|
|
||||||
Assert.Equal(Math.Round(latitude, 2), post.Geo.Coordinates[1]);
|
|
||||||
Assert.Contains(three, p => p.Id == post.ID);
|
|
||||||
Assert.InRange(three.First(p => p.Id == post.ID).DistanceKm.Value, 2.0, 4.0);
|
|
||||||
Assert.DoesNotContain(eight, p => p.Id == post.ID);
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(post, bob.Id, token));
|
|
||||||
var outgoing = (await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.Deliver).ExecuteAsync(token))
|
|
||||||
.Select(j => JsonSerializer.Deserialize<DeliveryPayload>(j.Payload))
|
|
||||||
.Where(p => p.Body.Contains(post.ID));
|
|
||||||
Assert.Empty(outgoing);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_located_post_cannot_be_direct_or_in_a_group()
|
|
||||||
{
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
|
|
||||||
var result = await _harness.Statuses.Publish(alice, new PrivaPub.Domain.Statuses.StatusDraft
|
|
||||||
{
|
|
||||||
Text = "x", Latitude = 45, Longitude = 7, Visibility = PostVisibility.Direct
|
|
||||||
}, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.False(result.Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.ClientModels;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class OutboxTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<ForeignAvatar> Known(RemoteActor actor) =>
|
|
||||||
await _harness.Remote.GetActor(actor.Id, refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_audience_follows_mastodons_table()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var follower = new RemoteActor(_harness.Peer, "follower");
|
|
||||||
var mentioned = await Known(new RemoteActor(_harness.Peer, "mentioned"));
|
|
||||||
var parentAuthor = await Known(new RemoteActor(_harness.Peer, "parent"));
|
|
||||||
await _harness.FollowedBy(alice, follower);
|
|
||||||
var mention = new PostMention { ActorURI = mentioned.ActorURI };
|
|
||||||
|
|
||||||
async Task<IReadOnlyList<string>> Audience(PostVisibility visibility, string replyTo = default) =>
|
|
||||||
await _harness.Outbox.Audience(alice, new Post { Visibility = visibility, Mentions = new() { mention }, To = new() { mentioned.ActorURI }, InReplyToAccountId = replyTo }, token);
|
|
||||||
|
|
||||||
Assert.Equal(new[] { follower.SharedInbox, mentioned.InboxURL }, await Audience(PostVisibility.Public));
|
|
||||||
Assert.Equal(new[] { follower.SharedInbox, mentioned.InboxURL, parentAuthor.InboxURL }, await Audience(PostVisibility.Unlisted, parentAuthor.ID));
|
|
||||||
Assert.Equal(new[] { follower.SharedInbox, mentioned.InboxURL }, await Audience(PostVisibility.FollowersOnly));
|
|
||||||
Assert.Equal(new[] { mentioned.InboxURL }, await Audience(PostVisibility.Direct, parentAuthor.ID));
|
|
||||||
Assert.Empty(await Audience(PostVisibility.Circle));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_post_is_created_edited_and_deleted_for_its_audience()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var follower = new RemoteActor(_harness.Peer, "follower");
|
|
||||||
await _harness.FollowedBy(alice, follower);
|
|
||||||
|
|
||||||
var created = await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "first", Visibility = "followersonly" }, token);
|
|
||||||
var postId = ((ViewPost)created.Data).Id;
|
|
||||||
await _harness.Posts.UpdatePost(root, new UpdatePostForm { AvatarId = alice.Id, PostId = postId, Text = "second", SpoilerText = "cw" }, token);
|
|
||||||
await _harness.Posts.DeletePost(root, new DeletePostForm { AvatarId = alice.Id, PostId = postId }, token);
|
|
||||||
|
|
||||||
var sent = await _harness.Outgoing(follower.SharedInbox);
|
|
||||||
Assert.Equal(new[] { "Create", "Update", "Delete" }, sent.Select(a => a["type"]!.GetValue<string>()));
|
|
||||||
Assert.DoesNotContain(sent[0]["to"]!.AsArray(), n => n!.GetValue<string>().EndsWith("#Public"));
|
|
||||||
Assert.Equal("cw", sent[1]["object"]!["summary"]!.GetValue<string>());
|
|
||||||
Assert.NotNull(sent[1]["object"]!["updated"]);
|
|
||||||
Assert.Equal(sent[0]["to"]!.ToJsonString(), sent[2]["to"]!.ToJsonString());
|
|
||||||
|
|
||||||
var stored = await DB.Default.Find<Post>().OneAsync(postId, token);
|
|
||||||
Assert.NotNull(stored.DeletedAt);
|
|
||||||
Assert.Null(stored.ContentHtml);
|
|
||||||
Assert.Empty(stored.Revisions);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Someone_elses_post_cannot_be_edited()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var (otherRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var created = await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "mine" }, token);
|
|
||||||
|
|
||||||
var result = await _harness.Posts.UpdatePost(otherRoot, new UpdatePostForm { AvatarId = bob.Id, PostId = ((ViewPost)created.Data).Id, Text = "yours" }, token);
|
|
||||||
|
|
||||||
Assert.False(result.IsValid);
|
|
||||||
Assert.Equal(404, result.StatusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class RelationshipTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_block_cuts_follows_both_ways_and_hides_the_account()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
await _harness.Follows.Follow(aliceRoot, new FollowForm { AvatarId = alice.Id, Target = bob.UserName }, token);
|
|
||||||
await _harness.Follows.Follow(bobRoot, new FollowForm { AvatarId = bob.Id, Target = alice.UserName }, token);
|
|
||||||
|
|
||||||
await _harness.Relationships.Block(alice, bob.Uri, bob.Id, token);
|
|
||||||
await _harness.Posts.InsertPost(bobRoot, new InsertPostForm { AvatarId = bob.Id, Text = $"hey @{alice.UserName}" }, token);
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id || f.AvatarId == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id || f.LocalActorId == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == alice.Id && e.AuthorAccountId == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<Notification>().Match(n => n.AvatarId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_blocked_remote_account_is_refused_when_it_follows()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await _harness.Relationships.Block(alice, mallory.Id, default, token);
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(mallory)}/follows/{Guid.NewGuid():N}", ["type"] = "Follow", ["actor"] = mallory.Id, ["object"] = alice.Uri
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
var sent = (await _harness.Outgoing(mallory.Id + "/inbox")).Select(a => a["type"]!.GetValue<string>()).ToList();
|
|
||||||
Assert.Equal(new[] { "Block", "Reject" }, sent.Order());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_block_is_told_to_the_blocked_server_and_so_is_the_unblock()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(mallory)}/follows/{Guid.NewGuid():N}", ["type"] = "Follow", ["actor"] = mallory.Id, ["object"] = alice.Uri
|
|
||||||
});
|
|
||||||
|
|
||||||
await _harness.Relationships.Block(alice, mallory.Id, default, token);
|
|
||||||
await _harness.Relationships.Unblock(alice, mallory.Id, token);
|
|
||||||
|
|
||||||
var sent = await _harness.Outgoing(mallory.Id + "/inbox");
|
|
||||||
var block = Assert.Single(sent, a => a["type"]!.GetValue<string>() == "Block");
|
|
||||||
Assert.Equal(mallory.Id, block["object"]!.GetValue<string>());
|
|
||||||
Assert.Equal(alice.Uri, block["actor"]!.GetValue<string>());
|
|
||||||
var undo = Assert.Single(sent, a => a["type"]!.GetValue<string>() == "Undo");
|
|
||||||
Assert.Equal(block["id"]!.GetValue<string>(), undo["object"]!["id"]!.GetValue<string>());
|
|
||||||
Assert.False(await DB.Default.Find<Block>().Match(b => b.AvatarId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_muted_account_stays_out_of_home_and_notifications()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
await _harness.Follows.Follow(aliceRoot, new FollowForm { AvatarId = alice.Id, Target = bob.UserName }, token);
|
|
||||||
await _harness.Relationships.Mute(alice, bob.Uri, bob.Id, hideNotifications: true, default, token);
|
|
||||||
|
|
||||||
await _harness.Posts.InsertPost(bobRoot, new InsertPostForm { AvatarId = bob.Id, Text = $"hey @{alice.UserName}" }, token);
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<Notification>().Match(n => n.AvatarId == alice.Id && n.Type == NotificationType.Mention).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_report_is_forwarded_by_the_instance_not_the_persona()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var foreign = await _harness.Remote.GetActor(mallory.Id, refresh: false, token);
|
|
||||||
|
|
||||||
var report = await _harness.Reports.File(alice, foreign.ID, Array.Empty<string>(), "spam everywhere", "spam", forward: true, token);
|
|
||||||
|
|
||||||
Assert.True(report.Forwarded);
|
|
||||||
var flag = Assert.Single(await _harness.Outgoing(mallory.Id + "/inbox"));
|
|
||||||
Assert.Equal("Flag", flag["type"]!.GetValue<string>());
|
|
||||||
Assert.EndsWith("/peasants/privapub", flag["actor"]!.GetValue<string>());
|
|
||||||
Assert.DoesNotContain(alice.UserName, flag.ToJsonString());
|
|
||||||
Assert.DoesNotContain(alice.Id, flag.ToJsonString());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_inbound_flag_becomes_a_report_for_moderators()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var reporter = new RemoteActor(_harness.Peer, "reporter");
|
|
||||||
await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "bad post" }, token);
|
|
||||||
var post = await DB.Default.Find<PrivaPub.Models.Post.Post>().Match(p => p.GroupUserId == alice.Id).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
await _harness.Deliver(reporter, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(reporter)}/flags/{Guid.NewGuid():N}", ["type"] = "Flag", ["actor"] = reporter.Id,
|
|
||||||
["content"] = "please look", ["object"] = new JsonArray(alice.Uri, post.ObjectURI)
|
|
||||||
});
|
|
||||||
|
|
||||||
var report = await DB.Default.Find<Report>().Match(r => r.TargetAccountId == alice.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(reporter.Id, report.ReporterActorURI);
|
|
||||||
Assert.Equal(new[] { post.ID }, report.PostIds);
|
|
||||||
Assert.Equal("please look", report.Comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class TimelineTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<List<ViewPost>> Home(string root, string avatarId) =>
|
|
||||||
(List<ViewPost>)(await _harness.Timelines.Home(root, avatarId, default, 40, TestContext.Current.CancellationToken)).Data;
|
|
||||||
|
|
||||||
async Task Accepted(string root, string avatarId, RemoteActor target)
|
|
||||||
{
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = avatarId, Target = target.Id }, TestContext.Current.CancellationToken);
|
|
||||||
await DB.Default.Update<Following>().Match(f => f.AvatarId == avatarId && f.TargetActorURI == target.Id)
|
|
||||||
.Modify(f => f.State, FollowState.Accepted).ExecuteAsync(TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
static JsonObject Create(RemoteActor author, string inReplyTo = default, string text = "hello", params (string Uri, string Name)[] mentions)
|
|
||||||
{
|
|
||||||
var origin = new Uri(author.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{origin}/notes/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = author.Id,
|
|
||||||
["content"] = $"<p>{text}</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public),
|
|
||||||
["cc"] = new JsonArray(mentions.Select(m => (JsonNode)m.Uri).Prepend(author.Id + "/followers").ToArray()),
|
|
||||||
["tag"] = new JsonArray(mentions.Select(m => (JsonNode)new JsonObject { ["type"] = "Mention", ["href"] = m.Uri, ["name"] = m.Name }).ToArray())
|
|
||||||
};
|
|
||||||
if (inReplyTo != default)
|
|
||||||
note["inReplyTo"] = inReplyTo;
|
|
||||||
return new JsonObject { ["id"] = $"{origin}/activities/{Guid.NewGuid():N}", ["type"] = "Create", ["actor"] = author.Id, ["object"] = note };
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_local_post_reaches_the_author_and_local_followers_only()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var (carolRoot, carol) = await _harness.Persona("carol");
|
|
||||||
await _harness.Follows.Follow(bobRoot, new FollowForm { AvatarId = bob.Id, Target = alice.UserName }, token);
|
|
||||||
|
|
||||||
await _harness.Posts.InsertPost(aliceRoot, new InsertPostForm { AvatarId = alice.Id, Text = "for my followers" }, token);
|
|
||||||
|
|
||||||
Assert.Single(await Home(aliceRoot, alice.Id));
|
|
||||||
Assert.Equal("<p>for my followers</p>", Assert.Single(await Home(bobRoot, bob.Id)).ContentHtml);
|
|
||||||
Assert.Empty(await Home(carolRoot, carol.Id));
|
|
||||||
Assert.Equal(404, (await _harness.Timelines.Home(carolRoot, bob.Id, default, 20, token)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_followed_remote_account_is_kept_and_its_replies_follow_mastodons_rule()
|
|
||||||
{
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var dave = new RemoteActor(_harness.Peer, "dave");
|
|
||||||
await Accepted(bobRoot, bob.Id, carol);
|
|
||||||
|
|
||||||
var top = Create(carol, text: "top");
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", top);
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Create(carol, top["object"]!["id"]!.GetValue<string>(), "self reply"));
|
|
||||||
await _harness.Deliver(dave, "/human-centipede", Create(dave, text: "dave alone"));
|
|
||||||
var daveRoot = Create(dave, text: "unfollowed root");
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Create(carol, $"{new Uri(dave.Id).GetLeftPart(UriPartial.Authority)}/notes/unknown", "reply to a stranger"));
|
|
||||||
|
|
||||||
var home = (await Home(bobRoot, bob.Id)).Select(p => p.ContentHtml).ToList();
|
|
||||||
Assert.Contains("<p>top</p>", home);
|
|
||||||
Assert.Contains("<p>self reply</p>", home);
|
|
||||||
Assert.DoesNotContain("<p>dave alone</p>", home);
|
|
||||||
Assert.DoesNotContain("<p>reply to a stranger</p>", home);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_reply_brings_its_public_parent_and_the_grandparent_is_queued()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var dave = new RemoteActor(_harness.Peer, "dave");
|
|
||||||
await Accepted(bobRoot, bob.Id, carol);
|
|
||||||
var origin = new Uri(dave.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
var grandparentId = $"{origin}/notes/{Guid.NewGuid():N}";
|
|
||||||
var parentId = $"{origin}/notes/{Guid.NewGuid():N}";
|
|
||||||
_harness.Peer.Serve(new Uri(parentId).AbsolutePath, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = parentId, ["type"] = "Note", ["attributedTo"] = dave.Id, ["content"] = "<p>parent</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["inReplyTo"] = grandparentId
|
|
||||||
}.ToJsonString());
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Create(carol, parentId, "reply to dave"));
|
|
||||||
|
|
||||||
var parent = await DB.Default.Find<PrivaPub.Models.Post.Post>().Match(p => p.ObjectURI == parentId).ExecuteSingleAsync(token);
|
|
||||||
var reply = await DB.Default.Find<PrivaPub.Models.Post.Post>().Match(p => p.InReplyToURI == parentId).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(parent.ID, reply.AnsweringToPostId);
|
|
||||||
Assert.Equal(parent.AuthorAccountId, reply.InReplyToAccountId);
|
|
||||||
Assert.True(await DB.Default.Find<PrivaPub.Models.Jobs.Job>().Match(j => j.DedupeKey == "ancestors|" + parent.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.DoesNotContain("<p>reply to dave</p>", (await Home(bobRoot, bob.Id)).Select(p => p.ContentHtml));
|
|
||||||
Assert.DoesNotContain("<p>parent</p>", (await Home(bobRoot, bob.Id)).Select(p => p.ContentHtml));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_remote_delete_takes_the_post_out_of_home()
|
|
||||||
{
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
await Accepted(bobRoot, bob.Id, carol);
|
|
||||||
var create = Create(carol, text: "soon gone");
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", create);
|
|
||||||
Assert.Single(await Home(bobRoot, bob.Id));
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{new Uri(carol.Id).GetLeftPart(UriPartial.Authority)}/deletes/{Guid.NewGuid():N}", ["type"] = "Delete", ["actor"] = carol.Id,
|
|
||||||
["object"] = new JsonObject { ["id"] = create["object"]!["id"]!.GetValue<string>(), ["type"] = "Tombstone" }
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Empty(await Home(bobRoot, bob.Id));
|
|
||||||
Assert.False(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == bob.Id).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_mention_notifies_the_persona()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Create(carol, mentions: (bob.Uri, "@" + bob.Handle)));
|
|
||||||
|
|
||||||
var notifications = (List<ViewNotification>)(await _harness.Timelines.Notifications(bobRoot, bob.Id, default, 20, token)).Data;
|
|
||||||
var mention = Assert.Single(notifications);
|
|
||||||
Assert.Equal("Mention", mention.Type);
|
|
||||||
Assert.Equal(carol.Id, mention.FromActorURI);
|
|
||||||
await _harness.Timelines.MarkNotificationsRead(bobRoot, bob.Id, token);
|
|
||||||
Assert.True(((List<ViewNotification>)(await _harness.Timelines.Notifications(bobRoot, bob.Id, default, 20, token)).Data).Single().IsRead);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Privacy;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Domain
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public class VisibilityPolicyTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public async Task Who_sees_what()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var conversation = new DmGroup { Members = new() { new GroupMember { AvatarId = "alice" }, new GroupMember { AvatarId = "https://r.example/u/bob", IsForeign = true } } };
|
|
||||||
var circle = new GroupEntity { UserName = $"c{Guid.NewGuid():N}"[..20], Members = new() { new GroupMember { AvatarId = "carol" } } };
|
|
||||||
await DB.Default.SaveAsync(conversation, token);
|
|
||||||
await DB.Default.SaveAsync(circle, token);
|
|
||||||
|
|
||||||
var direct = new Post { Visibility = PostVisibility.Direct, ConversationId = conversation.ID, GroupUserId = "dave" };
|
|
||||||
var circlePost = new Post { Visibility = PostVisibility.Circle, GroupId = circle.ID };
|
|
||||||
var followersOnly = new Post { Visibility = PostVisibility.FollowersOnly, Mentions = new() { new PostMention { IsLocal = true, AccountId = "erin" } } };
|
|
||||||
var deleted = new Post { Visibility = PostVisibility.Public, DeletedAt = DateTime.UtcNow };
|
|
||||||
|
|
||||||
Assert.True(await VisibilityPolicy.CanSee(new Post(), default, token));
|
|
||||||
Assert.True(await VisibilityPolicy.CanSee(direct, "alice", token));
|
|
||||||
Assert.True(await VisibilityPolicy.CanSee(direct, "dave", token));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(direct, "carol", token));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(direct, default, token));
|
|
||||||
Assert.True(await VisibilityPolicy.CanSee(circlePost, "carol", token));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(circlePost, "alice", token));
|
|
||||||
Assert.True(await VisibilityPolicy.CanSee(followersOnly, "erin", token));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(followersOnly, "alice", token));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(deleted, "alice", token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
using PrivaPub.Federation.Actors;
|
|
||||||
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ActorFeaturesTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void A_rich_actor_reports_the_extensions_it_uses()
|
|
||||||
{
|
|
||||||
using var rsa = RSA.Create(4096);
|
|
||||||
var actor = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = "https://social.example/users/a",
|
|
||||||
["type"] = "Person",
|
|
||||||
["featured"] = "https://social.example/users/a/featured",
|
|
||||||
["alsoKnownAs"] = new JsonArray("https://old.example/users/a"),
|
|
||||||
["endpoints"] = new JsonObject { ["sharedInbox"] = "https://social.example/inbox" },
|
|
||||||
["assertionMethod"] = new JsonArray(),
|
|
||||||
["attachment"] = new JsonArray(new JsonObject { ["type"] = "PropertyValue", ["name"] = "x", ["value"] = "y" }),
|
|
||||||
["manuallyApprovesFollowers"] = true,
|
|
||||||
["discoverable"] = false,
|
|
||||||
["indexable"] = true,
|
|
||||||
["isCat"] = true,
|
|
||||||
["_misskey_summary"] = "hi",
|
|
||||||
["publicKey"] = new JsonObject { ["id"] = "https://social.example/users/a#main-key", ["publicKeyPem"] = rsa.ExportSubjectPublicKeyInfoPem() }
|
|
||||||
};
|
|
||||||
|
|
||||||
var features = ActorFeatures.Detect(JsonDocument.Parse(actor.ToJsonString()).RootElement);
|
|
||||||
|
|
||||||
Assert.Equal(new[]
|
|
||||||
{
|
|
||||||
"featured", "also-known-as", "shared-inbox", "fep-521a-assertion-method", "property-value", "misskey", "is-cat",
|
|
||||||
"indexable", "undiscoverable", "locked", "key:rsa-4096"
|
|
||||||
}, features);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_bare_actor_reports_nothing_and_junk_is_survived()
|
|
||||||
{
|
|
||||||
Assert.Empty(ActorFeatures.Detect(JsonDocument.Parse("{\"id\":\"https://a.example/u\",\"type\":\"Person\"}").RootElement));
|
|
||||||
Assert.Equal(new[] { "public-key-array" },
|
|
||||||
ActorFeatures.Detect(JsonDocument.Parse("{\"publicKey\":[{\"publicKeyPem\":\"not a key\"}]}").RootElement));
|
|
||||||
Assert.Empty(ActorFeatures.Detect(JsonDocument.Parse("[1,2]").RootElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
using PrivaPub.Federation.Actors;
|
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ActorProfileTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Reads_a_mastodon_profile_with_its_header_fields_emoji_and_lock()
|
|
||||||
{
|
|
||||||
using var json = JsonDocument.Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://m.example/users/ann", "type": "Person", "preferredUsername": "ann", "name": "Ann :sparkle:",
|
|
||||||
"inbox": "https://m.example/users/ann/inbox", "manuallyApprovesFollowers": true, "indexable": true, "memorial": false,
|
|
||||||
"published": "2023-04-01T00:00:00Z", "movedTo": "https://n.example/users/ann",
|
|
||||||
"icon": { "type": "Image", "url": "https://m.example/a.png", "summary": "a cat" },
|
|
||||||
"image": { "type": "Image", "url": "https://m.example/h.png", "name": "mountains" },
|
|
||||||
"tag": [{ "type": "Emoji", "name": ":sparkle:", "icon": { "type": "Image", "url": "https://m.example/emoji/sparkle.png" } }],
|
|
||||||
"attachment": [
|
|
||||||
{ "type": "PropertyValue", "name": "Site", "value": "<a href=\"https://ann.example\" rel=\"me\">ann.example</a><script>x</script>" },
|
|
||||||
{ "type": "PropertyValue", "name": "Pronouns", "value": "she/her" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
var actor = ActorDocument.Parse(json.RootElement);
|
|
||||||
|
|
||||||
Assert.True(actor.Locked);
|
|
||||||
Assert.True(actor.Indexable);
|
|
||||||
Assert.Equal("https://m.example/h.png", actor.Header);
|
|
||||||
Assert.Equal("a cat", actor.IconDescription);
|
|
||||||
Assert.Equal("mountains", actor.HeaderDescription);
|
|
||||||
Assert.Equal("https://n.example/users/ann", actor.MovedTo);
|
|
||||||
Assert.Equal(new DateTime(2023, 4, 1, 0, 0, 0, DateTimeKind.Utc), actor.Published);
|
|
||||||
Assert.Equal("sparkle", Assert.Single(actor.Emojis).Shortcode);
|
|
||||||
Assert.Equal(new[] { "Site", "Pronouns" }, actor.Fields.Keys);
|
|
||||||
Assert.DoesNotContain("<script>", actor.Fields["Site"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Api.Mastodon.Mappers;
|
|
||||||
using PrivaPub.Domain.Privacy;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.FederatedSeeds;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class AuthorGoneRuleTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public async Task A_post_whose_author_is_gone_is_neither_shown_nor_public_nor_seen_by_anyone()
|
|
||||||
{
|
|
||||||
var gone = new Post { Visibility = PostVisibility.Public, AuthorGone = true, GroupUserId = "alice" };
|
|
||||||
|
|
||||||
Assert.False(VisibilityPolicy.Shown(gone));
|
|
||||||
Assert.False(VisibilityPolicy.IsPublic.Compile()(gone));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(gone, default, TestContext.Current.CancellationToken));
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(gone, "alice", TestContext.Current.CancellationToken));
|
|
||||||
Assert.True(VisibilityPolicy.Shown(new Post()));
|
|
||||||
Assert.False(VisibilityPolicy.Shown(new Post { DeletedAt = DateTime.UtcNow }));
|
|
||||||
Assert.False(VisibilityPolicy.Shown(default));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class AuthorGoneTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<Post> Delivered(RemoteActor author, JsonObject note)
|
|
||||||
{
|
|
||||||
await _harness.Deliver(author, "/human-centipede", Create(author, note));
|
|
||||||
return await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(note)).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Deleting_itself_keeps_every_post_of_the_account_but_hides_them_and_drops_its_follows_and_rows()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var ghost = new RemoteActor(_harness.Peer, "ghost");
|
|
||||||
var friend = new RemoteActor(_harness.Peer, "friend");
|
|
||||||
await Follows(alice.Id, ghost);
|
|
||||||
await Follows(alice.Id, friend);
|
|
||||||
await _harness.FollowedBy(alice, ghost);
|
|
||||||
var post = await Delivered(ghost, PublicNote(ghost, "<p>soon gone</p>"));
|
|
||||||
var friends = await Delivered(friend, PublicNote(friend, "<p>still here</p>"));
|
|
||||||
await _harness.Deliver(ghost, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(ghost, "announces"), ["type"] = "Announce", ["actor"] = ghost.Id, ["object"] = friends.ObjectURI,
|
|
||||||
["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
var ghostAccount = await DB.Default.Find<ForeignAvatar>().Match(f => f.ActorURI == ghost.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.True(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == alice.Id && e.AuthorAccountId == ghostAccount.ID).ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
Assert.Equal(202, (await _harness.Deliver(ghost, "/human-centipede", Activity(ghost, "Delete", JsonValue.Create(ghost.Id)!))).StatusCode);
|
|
||||||
|
|
||||||
var kept = await DB.Default.Find<Post>().Match(p => p.ActorURI == ghost.Id).ExecuteAsync(token);
|
|
||||||
Assert.Equal(2, kept.Count);
|
|
||||||
Assert.All(kept, p => Assert.True(p.AuthorGone));
|
|
||||||
Assert.Contains(kept, p => p.ID == post.ID && p.ContentHtml == "<p>soon gone</p>");
|
|
||||||
Assert.Contains(kept, p => p.ReblogOfPostId == friends.ID);
|
|
||||||
Assert.False((await DB.Default.Find<Post>().OneAsync(friends.ID, token)).AuthorGone);
|
|
||||||
Assert.All(kept, p => Assert.False(VisibilityPolicy.Shown(p)));
|
|
||||||
foreach (var hidden in kept)
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(hidden, alice.Id, token));
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ActorURI == ghost.Id).Match(VisibilityPolicy.IsPublic).ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
Assert.Equal(AvatarAccountState.Deleted, (await DB.Default.Find<ForeignAvatar>().OneAsync(ghostAccount.ID, token)).AccountState);
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.ActorURI == ghost.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<Following>().Match(f => f.TargetActorURI == ghost.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<TimelineEntry>().Match(e => e.AuthorAccountId == ghostAccount.ID).ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
var mapper = new MastodonMapper(_harness.Db, _harness.Local);
|
|
||||||
Assert.Empty(await mapper.Statuses(kept, alice.Id, token));
|
|
||||||
var home = (List<PrivaPub.ClientModels.Post.ViewPost>)(await _harness.Timelines.Home(root, alice.Id, default, 40, token)).Data;
|
|
||||||
Assert.DoesNotContain(home, v => v.AuthorActorURI == ghost.Id);
|
|
||||||
Assert.Contains(home, v => v.Id == friends.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_post_by_an_account_already_gone_is_hidden_from_the_moment_it_is_stored()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var ghost = new RemoteActor(_harness.Peer, "ghost");
|
|
||||||
await _harness.FollowedBy(alice, ghost);
|
|
||||||
await _harness.Deliver(ghost, "/human-centipede", Activity(ghost, "Delete", JsonValue.Create(ghost.Id)!));
|
|
||||||
var late = PublicNote(ghost, "<p>from beyond</p>");
|
|
||||||
_harness.Peer.Serve(new Uri(IdOf(late)).AbsolutePath, late.ToJsonString());
|
|
||||||
|
|
||||||
var stored = await _harness.RemotePosts.StoreContext(IdOf(late), 0, token);
|
|
||||||
|
|
||||||
Assert.NotNull(stored);
|
|
||||||
Assert.True(stored.AuthorGone);
|
|
||||||
Assert.False(await VisibilityPolicy.CanSee(stored, alice.Id, token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class AuthorGoneOverHttpTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<(HttpStatusCode Status, JsonNode Body)> Get(HttpClient client, string path)
|
|
||||||
{
|
|
||||||
var response = await client.GetAsync(path, TestContext.Current.CancellationToken);
|
|
||||||
var text = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
return (response.StatusCode, string.IsNullOrEmpty(text) || response.Content.Headers.ContentType?.MediaType?.Contains("json") != true ? default : JsonNode.Parse(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<List<string>> Ids(HttpClient client, string path)
|
|
||||||
{
|
|
||||||
var (status, body) = await Get(client, path);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, status);
|
|
||||||
return body!.AsArray().Select(s => IdOf(s!)).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<bool> Found(HttpClient client, string path) => (await Get(client, path)).Status == HttpStatusCode.OK;
|
|
||||||
|
|
||||||
sealed record Seen(bool Status, bool Context, bool FavouritedBy, bool RebloggedBy, bool History, bool Many, bool Boost, bool InAncestors,
|
|
||||||
bool BoostersListed, bool OnProfile, bool OnTag, bool OnPublic, bool OnHome, bool Notified, bool InConversation, bool Searched,
|
|
||||||
bool Favourited, bool Bookmarked, bool Provenance, bool InCommunityOutbox);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Every_lookup_treats_a_post_whose_author_deleted_itself_as_not_found()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "reader");
|
|
||||||
var bearer = await _host.MastodonToken(persona);
|
|
||||||
using var client = _host.As(bearer);
|
|
||||||
var (privateKey, publicKey) = PrivaPub.Federation.Actors.Keys.NewKeyPair();
|
|
||||||
var community = new GroupEntity
|
|
||||||
{
|
|
||||||
UserName = $"commons{Guid.NewGuid():N}"[..20], Kind = GroupKind.Community, PostingPolicy = PostingPolicy.Anyone,
|
|
||||||
PrivateKey = privateKey, PublicKey = publicKey, Members = new() { new GroupMember { AvatarId = persona.Id, Role = GroupRole.Owner } }
|
|
||||||
};
|
|
||||||
await DB.Default.SaveAsync(community, token);
|
|
||||||
var personaUri = $"{PrivaPubHost.Base}/peasants/{persona.UserName}";
|
|
||||||
var communityUri = $"{PrivaPubHost.Base}/peasants/{community.UserName}";
|
|
||||||
var ghost = new RemoteActor(_peer, "ghost");
|
|
||||||
var friend = new RemoteActor(_peer, "friend");
|
|
||||||
await Follows(persona.Id, ghost);
|
|
||||||
await Follows(persona.Id, friend);
|
|
||||||
var tag = $"gone{Guid.NewGuid():N}"[..16];
|
|
||||||
|
|
||||||
var note = PublicNote(ghost, $"<p>hello #{tag}</p>", personaUri, communityUri);
|
|
||||||
note["tag"] = new JsonArray(
|
|
||||||
new JsonObject { ["type"] = "Mention", ["href"] = personaUri, ["name"] = "@reader" },
|
|
||||||
new JsonObject { ["type"] = "Hashtag", ["name"] = "#" + tag, ["href"] = $"{Origin(ghost)}/tags/{tag}" });
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, await DeliverSigned(_host, ghost, Create(ghost, note)));
|
|
||||||
var friendsNote = PublicNote(friend, "<p>a friend's post</p>");
|
|
||||||
await DeliverSigned(_host, friend, Create(friend, friendsNote));
|
|
||||||
var reply = PublicNote(friend, "<p>a reply</p>");
|
|
||||||
reply["inReplyTo"] = IdOf(note);
|
|
||||||
await DeliverSigned(_host, friend, Create(friend, reply));
|
|
||||||
await DeliverSigned(_host, friend, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(friend, "announces"), ["type"] = "Announce", ["actor"] = friend.Id, ["object"] = IdOf(note), ["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
var ghostBoostId = NewId(ghost, "announces");
|
|
||||||
await DeliverSigned(_host, ghost, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = ghostBoostId, ["type"] = "Announce", ["actor"] = ghost.Id, ["object"] = IdOf(friendsNote), ["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
var dm = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(ghost, "notes"), ["type"] = "Note", ["attributedTo"] = ghost.Id, ["content"] = "<p>psst</p>", ["to"] = new JsonArray(personaUri),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = personaUri, ["name"] = "@reader" })
|
|
||||||
};
|
|
||||||
await DeliverSigned(_host, ghost, Create(ghost, dm));
|
|
||||||
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(note)).ExecuteSingleAsync(token);
|
|
||||||
var friends = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(friendsNote)).ExecuteSingleAsync(token);
|
|
||||||
var replyPost = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(reply)).ExecuteSingleAsync(token);
|
|
||||||
var ghostBoost = await DB.Default.Find<Post>().Match(p => p.ObjectURI == ghostBoostId).ExecuteSingleAsync(token);
|
|
||||||
var dmPost = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(dm)).ExecuteSingleAsync(token);
|
|
||||||
var ghostAccount = await DB.Default.Find<ForeignAvatar>().Match(f => f.ActorURI == ghost.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(community.ID, post.GroupId);
|
|
||||||
//search looks up https addresses only, which the peer does not have
|
|
||||||
var searchable = new Post
|
|
||||||
{
|
|
||||||
ObjectURI = $"https://ghost{Guid.NewGuid():N}.example/notes/1", ActorURI = ghost.Id, AuthorAccountId = ghostAccount.ID, IsFederatedCopy = true,
|
|
||||||
Visibility = PostVisibility.Public, ContentHtml = "<p>found by its address</p>"
|
|
||||||
};
|
|
||||||
await DB.Default.SaveAsync(searchable, token);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await client.PostAsync($"/api/v1/statuses/{post.ID}/favourite", default, token)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await client.PostAsync($"/api/v1/statuses/{post.ID}/bookmark", default, token)).StatusCode);
|
|
||||||
|
|
||||||
async Task<Seen> Look()
|
|
||||||
{
|
|
||||||
var home = (await Get(client, "/api/v1/timelines/home?limit=40")).Body!.AsArray();
|
|
||||||
var notifications = (await Get(client, "/api/v1/notifications?limit=30")).Body!.AsArray();
|
|
||||||
var conversations = (await Get(client, "/api/v1/conversations")).Body!.AsArray();
|
|
||||||
var search = (await Get(client, $"/api/v2/search?type=statuses&q={Uri.EscapeDataString(searchable.ObjectURI)}")).Body!;
|
|
||||||
using var anonymous = _host.Client();
|
|
||||||
using var outboxRequest = new HttpRequestMessage(HttpMethod.Get, $"/peasants/{community.UserName}/anus?page=true");
|
|
||||||
outboxRequest.Headers.Accept.ParseAdd("application/activity+json");
|
|
||||||
var outbox = JsonNode.Parse(await (await anonymous.SendAsync(outboxRequest, token)).Content.ReadAsStringAsync(token))!;
|
|
||||||
return new Seen(
|
|
||||||
await Found(client, $"/api/v1/statuses/{post.ID}"),
|
|
||||||
await Found(client, $"/api/v1/statuses/{post.ID}/context"),
|
|
||||||
await Found(client, $"/api/v1/statuses/{post.ID}/favourited_by"),
|
|
||||||
await Found(client, $"/api/v1/statuses/{post.ID}/reblogged_by"),
|
|
||||||
await Found(client, $"/api/v1/statuses/{post.ID}/history"),
|
|
||||||
(await Ids(client, $"/api/v1/statuses?id[]={post.ID}")).Contains(post.ID),
|
|
||||||
await Found(client, $"/api/v1/statuses/{ghostBoost.ID}"),
|
|
||||||
(await Get(client, $"/api/v1/statuses/{replyPost.ID}/context")).Body!["ancestors"]!.AsArray().Any(a => IdOf(a!) == post.ID),
|
|
||||||
(await Ids(client, $"/api/v1/statuses/{friends.ID}/reblogged_by")).Contains(ghostAccount.ID),
|
|
||||||
(await Ids(client, $"/api/v1/accounts/{ghostAccount.ID}/statuses")).Count > 0,
|
|
||||||
(await Ids(client, $"/api/v1/timelines/tag/{tag}")).Contains(post.ID),
|
|
||||||
(await Ids(client, $"/api/v1/timelines/public?remote=true&limit=1&max_id={IdAbove(post.ID)}")).Contains(post.ID),
|
|
||||||
home.Any(s => IdOf(s!) == post.ID || IdOf(s!) == ghostBoost.ID || s!["reblog"] is JsonObject inner && IdOf(inner) == post.ID),
|
|
||||||
notifications.Any(n => n!["status"] is JsonObject status && IdOf(status) == post.ID),
|
|
||||||
conversations.Any(c => c!["last_status"] is JsonObject last && IdOf(last) == dmPost.ID),
|
|
||||||
search["statuses"]!.AsArray().Count > 0,
|
|
||||||
(await Ids(client, "/api/v1/favourites")).Contains(post.ID),
|
|
||||||
(await Ids(client, "/api/v1/bookmarks")).Contains(post.ID),
|
|
||||||
await Found(client, $"/api/privapub/v1/statuses/{post.ID}/provenance"),
|
|
||||||
outbox["orderedItems"]!.AsArray().Any(a => a!["object"]?.GetValue<string>() == post.ObjectURI));
|
|
||||||
}
|
|
||||||
|
|
||||||
var before = await Look();
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, await DeliverSigned(_host, ghost, Activity(ghost, "Delete", JsonValue.Create(ghost.Id)!)));
|
|
||||||
var after = await Look();
|
|
||||||
|
|
||||||
var everything = new Seen(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);
|
|
||||||
var nothing = new Seen(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
|
|
||||||
Assert.Equal(everything, before);
|
|
||||||
Assert.Equal(nothing, after);
|
|
||||||
Assert.True(await DB.Default.Find<Post>().Match(p => p.ID == post.ID && p.AuthorGone && p.DeletedAt == null).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(await Found(client, $"/api/v1/statuses/{friends.ID}"));
|
|
||||||
Assert.True(await Found(client, $"/api/v1/statuses/{replyPost.ID}"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class CommunityEditsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
async Task<(RemoteActor Community, RemoteActor Poster, JsonObject Note, Post Post)> Announced()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var community = new RemoteActor(_harness.Peer, "cats", type: "Group");
|
|
||||||
var poster = new RemoteActor(_harness.Peer, "poster");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = community.Id }, token);
|
|
||||||
await DB.Default.Update<Following>().Match(f => f.AvatarId == alice.Id).Modify(f => f.State, FollowState.Accepted).ExecuteAsync(token);
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(poster)}/notes/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Page",
|
|
||||||
["name"] = "a title",
|
|
||||||
["attributedTo"] = poster.Id,
|
|
||||||
["content"] = "<p>first</p>",
|
|
||||||
["to"] = new JsonArray(community.Id, Addressing.Public),
|
|
||||||
["audience"] = community.Id,
|
|
||||||
["published"] = DateTime.UtcNow.AddMinutes(-5).ToString("O")
|
|
||||||
};
|
|
||||||
_harness.Peer.Serve(new Uri(note["id"]!.GetValue<string>()).AbsolutePath, note.ToJsonString());
|
|
||||||
await Announce(community, new JsonObject { ["id"] = $"{Origin(poster)}/create/{Guid.NewGuid():N}", ["type"] = "Create", ["actor"] = poster.Id, ["object"] = note.DeepClone() });
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == note["id"]!.GetValue<string>()).ExecuteSingleAsync(token);
|
|
||||||
return (community, poster, note, post);
|
|
||||||
}
|
|
||||||
|
|
||||||
Task Announce(RemoteActor community, JsonObject inner) =>
|
|
||||||
_harness.Deliver(community, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(community)}/announce/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Announce",
|
|
||||||
["actor"] = community.Id,
|
|
||||||
["to"] = new JsonArray(Addressing.Public),
|
|
||||||
["object"] = inner
|
|
||||||
});
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_community_edit_is_an_edit_only_when_newer_and_keeps_its_history()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (community, poster, note, post) = await Announced();
|
|
||||||
|
|
||||||
var refresh = (JsonObject)note.DeepClone();
|
|
||||||
_harness.Peer.Serve(new Uri(note["id"]!.GetValue<string>()).AbsolutePath, refresh.ToJsonString());
|
|
||||||
await Announce(community, new JsonObject { ["id"] = $"{Origin(poster)}/update/{Guid.NewGuid():N}", ["type"] = "Update", ["actor"] = poster.Id, ["object"] = note["id"]!.GetValue<string>() });
|
|
||||||
var afterRefresh = await DB.Default.Find<Post>().OneAsync(post.ID, token);
|
|
||||||
|
|
||||||
var edit = (JsonObject)note.DeepClone();
|
|
||||||
edit["content"] = "<p>second</p>";
|
|
||||||
edit["updated"] = DateTime.UtcNow.ToString("O");
|
|
||||||
_harness.Peer.Serve(new Uri(note["id"]!.GetValue<string>()).AbsolutePath, edit.ToJsonString());
|
|
||||||
await Announce(community, new JsonObject { ["id"] = $"{Origin(poster)}/update/{Guid.NewGuid():N}", ["type"] = "Update", ["actor"] = poster.Id, ["object"] = note["id"]!.GetValue<string>() });
|
|
||||||
var afterEdit = await DB.Default.Find<Post>().OneAsync(post.ID, token);
|
|
||||||
var record = await DB.Default.Find<ObjectRecord>().Match(r => r.ObjectURI == post.ObjectURI).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
Assert.Empty(afterRefresh.Revisions);
|
|
||||||
Assert.Null(afterRefresh.EditedAt);
|
|
||||||
Assert.Equal("<p>second</p>", afterEdit.ContentHtml);
|
|
||||||
Assert.Equal("a title", afterEdit.Title);
|
|
||||||
Assert.Single(afterEdit.Revisions);
|
|
||||||
Assert.NotNull(afterEdit.EditedAt);
|
|
||||||
Assert.Equal(2, record.Revisions.Count);
|
|
||||||
Assert.Equal(new[] { "refresh", "edit" }, _harness.Ledger.Of("in").Where(e => e.Activity == "Announce" && e.Object == "Update").Select(e => e.Reason));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_community_delete_leaves_a_tombstone_and_no_trace()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (community, poster, note, post) = await Announced();
|
|
||||||
_harness.Peer.Serve(new Uri(note["id"]!.GetValue<string>()).AbsolutePath, new JsonObject { ["id"] = note["id"]!.GetValue<string>(), ["type"] = "Tombstone" }.ToJsonString());
|
|
||||||
|
|
||||||
await Announce(community, new JsonObject { ["id"] = $"{Origin(poster)}/delete/{Guid.NewGuid():N}", ["type"] = "Delete", ["actor"] = poster.Id, ["object"] = note["id"]!.GetValue<string>() });
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ID == post.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<ObjectRecord>().Match(r => r.ObjectURI == post.ObjectURI).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<TimelineEntry>().Match(e => e.PostId == post.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(await DB.Default.Find<DeletedObject>().Match(d => d.ObjectURI == post.ObjectURI).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_fetched_object_does_not_wear_the_signature_of_the_activity_that_caused_the_fetch()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, _, _, post) = await Announced();
|
|
||||||
|
|
||||||
var record = await DB.Default.Find<ObjectRecord>().Match(r => r.ObjectURI == post.ObjectURI).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
Assert.Equal(ObjectPath.Fetched, record.Path);
|
|
||||||
Assert.Null(record.KeyId);
|
|
||||||
Assert.Null(record.SignatureScheme);
|
|
||||||
Assert.Empty(record.SignedHeaders);
|
|
||||||
Assert.Null(record.ActivityContext);
|
|
||||||
Assert.Equal("Announce", record.ActivityType);
|
|
||||||
Assert.InRange(record.ReceivedAt, DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow.AddSeconds(1));
|
|
||||||
Assert.Contains("fep-1b12-audience", record.Extensions);
|
|
||||||
Assert.NotNull(record.ContextNamespaces);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
using PrivaPub.Federation.Objects;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ContentSanitizerTests
|
|
||||||
{
|
|
||||||
[Theory]
|
|
||||||
[InlineData("<script>alert(1)</script><p>hi</p>", "<p>hi</p>")]
|
|
||||||
[InlineData("<p onclick=\"alert(1)\">hi</p>", "<p>hi</p>")]
|
|
||||||
[InlineData("<img src=x onerror=alert(1)>", "")]
|
|
||||||
[InlineData("<a href=\"javascript:alert(1)\">x</a>", "<a rel=\"nofollow noopener noreferrer\" target=\"_blank\">x</a>")]
|
|
||||||
[InlineData("<a href=\"data:text/html,<script>alert(1)</script>\">x</a>", "<a rel=\"nofollow noopener noreferrer\" target=\"_blank\">x</a>")]
|
|
||||||
[InlineData("<a href=\"/relative\">x</a>", "<a rel=\"nofollow noopener noreferrer\" target=\"_blank\">x</a>")]
|
|
||||||
[InlineData("<iframe src=\"https://evil.example\"></iframe>text", "text")]
|
|
||||||
[InlineData("<style>body{display:none}</style><p>x</p>", "<p>x</p>")]
|
|
||||||
[InlineData("<svg><script>alert(1)</script></svg>", "")]
|
|
||||||
[InlineData("<p style=\"position:fixed\">x</p>", "<p>x</p>")]
|
|
||||||
[InlineData("<form action=\"https://evil.example\"><input name=p></form>ok", "ok")]
|
|
||||||
[InlineData("<p>a<!-- comment -->b</p>", "<p>ab</p>")]
|
|
||||||
[InlineData("<div><p>kept</p></div>", "<p>kept</p>")]
|
|
||||||
[InlineData("<h2>Title</h2>", "<p><strong>Title</strong></p>")]
|
|
||||||
[InlineData("<span class=\"evil big\">x</span>", "<span>x</span>")]
|
|
||||||
public void Removes_what_is_not_allowed(string input, string expected) =>
|
|
||||||
Assert.Equal(expected, ContentSanitizer.Html(input));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_mastodon_mention_and_hashtag_markup()
|
|
||||||
{
|
|
||||||
var html = "<p><span class=\"h-card\" translate=\"no\"><a href=\"https://m.example/@alice\" class=\"u-url mention\">@<span>alice</span></a></span> "
|
|
||||||
+ "<a href=\"https://m.example/tags/fedi\" class=\"mention hashtag\" rel=\"tag\">#<span>fedi</span></a> "
|
|
||||||
+ "<a href=\"https://example.org/a-long-link\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">example.org/a-long</span></a></p>";
|
|
||||||
|
|
||||||
var sanitized = ContentSanitizer.Html(html);
|
|
||||||
|
|
||||||
Assert.Contains("class=\"h-card\"", sanitized);
|
|
||||||
Assert.Contains("class=\"u-url mention\"", sanitized);
|
|
||||||
Assert.Contains("class=\"mention hashtag\"", sanitized);
|
|
||||||
Assert.Contains("class=\"invisible\"", sanitized);
|
|
||||||
Assert.Contains("class=\"ellipsis\"", sanitized);
|
|
||||||
Assert.Contains("href=\"https://m.example/@alice\"", sanitized);
|
|
||||||
Assert.DoesNotContain("rel=\"tag\"", sanitized);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("")]
|
|
||||||
[InlineData(" ")]
|
|
||||||
[InlineData(null)]
|
|
||||||
public void Empty_input_is_empty(string input) =>
|
|
||||||
Assert.Equal(string.Empty, ContentSanitizer.Html(input));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging.Abstractions;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Moderation;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class DomainBlocksTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void A_block_covers_subdomains_but_not_lookalikes()
|
|
||||||
{
|
|
||||||
var blocks = new DomainBlocks(NullLogger<DomainBlocks>.Instance);
|
|
||||||
blocks.Load(new[] { new DomainBlock { Domain = "evil.example", Severity = DomainBlockSeverity.Silence } });
|
|
||||||
|
|
||||||
Assert.NotNull(blocks.Find("evil.example"));
|
|
||||||
Assert.NotNull(blocks.Find("A.Evil.Example."));
|
|
||||||
Assert.Null(blocks.Find("notevil.example"));
|
|
||||||
Assert.False(blocks.IsSuspended("evil.example"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_suspension_is_found_from_any_subdomain()
|
|
||||||
{
|
|
||||||
var blocks = new DomainBlocks(NullLogger<DomainBlocks>.Instance);
|
|
||||||
blocks.Load(new[]
|
|
||||||
{
|
|
||||||
new DomainBlock { Domain = " Spam.Example. ", Severity = DomainBlockSeverity.Suspend },
|
|
||||||
new DomainBlock { Domain = "", Severity = DomainBlockSeverity.Suspend }
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.True(blocks.IsSuspended("deep.inside.spam.example"));
|
|
||||||
Assert.False(blocks.IsSuspended("example"));
|
|
||||||
Assert.Null(blocks.Find(default));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Federation.Rendering;
|
|
||||||
using PrivaPub.Federation.Signing;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class GroupTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<(GroupEntity Entity, PrivaPub.Federation.Actors.LocalActor Actor)> Group(GroupKind kind, PostingPolicy policy, string ownerId, params string[] remoteMembers)
|
|
||||||
{
|
|
||||||
var (privateKey, publicKey) = PrivaPub.Federation.Actors.Keys.NewKeyPair();
|
|
||||||
var group = new GroupEntity
|
|
||||||
{
|
|
||||||
UserName = $"{kind}{Guid.NewGuid():N}"[..20].ToLowerInvariant(),
|
|
||||||
Kind = kind,
|
|
||||||
PostingPolicy = policy,
|
|
||||||
PrivateKey = privateKey,
|
|
||||||
PublicKey = publicKey,
|
|
||||||
Members = new() { new GroupMember { AvatarId = ownerId, Role = GroupRole.Owner } }
|
|
||||||
};
|
|
||||||
group.Members.AddRange(remoteMembers.Select(m => new GroupMember { AvatarId = m, IsForeign = true }));
|
|
||||||
await DB.Default.SaveAsync(group);
|
|
||||||
return (group, _harness.Local.FromGroup(group));
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
static JsonObject Create(RemoteActor author, IEnumerable<string> to, string audience = default)
|
|
||||||
{
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(author)}/notes/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = author.Id,
|
|
||||||
["content"] = "<p>to the group</p>",
|
|
||||||
["to"] = new JsonArray(to.Select(t => (JsonNode)t).ToArray())
|
|
||||||
};
|
|
||||||
if (audience != default)
|
|
||||||
note["audience"] = audience;
|
|
||||||
return new JsonObject { ["id"] = $"{Origin(author)}/activities/{Guid.NewGuid():N}", ["type"] = "Create", ["actor"] = author.Id, ["object"] = note };
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_follower_posting_to_a_community_is_announced_activity_and_object()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, owner) = await _harness.Persona("owner");
|
|
||||||
var (_, community) = await Group(GroupKind.Community, PostingPolicy.Followers, owner.Id);
|
|
||||||
var lemmy = new RemoteActor(_harness.Peer, "lemmy");
|
|
||||||
var stranger = new RemoteActor(_harness.Peer, "stranger");
|
|
||||||
await _harness.FollowedBy(community, lemmy);
|
|
||||||
|
|
||||||
await _harness.Deliver(lemmy, "/human-centipede", Create(lemmy, new[] { community.Uri, Addressing.Public }, community.Uri));
|
|
||||||
await _harness.Deliver(stranger, "/human-centipede", Create(stranger, new[] { community.Uri, Addressing.Public }, community.Uri));
|
|
||||||
|
|
||||||
Assert.True(await DB.Default.Find<Post>().Match(p => p.GroupId == community.Id && p.ActorURI == lemmy.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.GroupId == community.Id && p.ActorURI == stranger.Id).ExecuteAnyAsync(token));
|
|
||||||
var announces = (await _harness.Outgoing(lemmy.SharedInbox)).Where(a => a["actor"]!.GetValue<string>() == community.Uri).ToList();
|
|
||||||
Assert.Equal(2, announces.Count);
|
|
||||||
Assert.Contains(announces, a => a["object"] is JsonObject inner && inner["type"]!.GetValue<string>() == "Create" && a["audience"]!.GetValue<string>() == community.Uri);
|
|
||||||
Assert.Contains(announces, a => a["object"] is JsonValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_open_community_takes_posts_from_anyone()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, owner) = await _harness.Persona("owner");
|
|
||||||
var (_, community) = await Group(GroupKind.Community, PostingPolicy.Anyone, owner.Id);
|
|
||||||
var stranger = new RemoteActor(_harness.Peer, "stranger");
|
|
||||||
|
|
||||||
await _harness.Deliver(stranger, "/human-centipede", Create(stranger, new[] { community.Uri, Addressing.Public }));
|
|
||||||
|
|
||||||
Assert.True(await DB.Default.Find<Post>().Match(p => p.GroupId == community.Id && p.ActorURI == stranger.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Mentioning_a_community_posts_into_it_as_a_titled_page()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, community) = await Group(GroupKind.Community, PostingPolicy.Anyone, alice.Id);
|
|
||||||
var follower = new RemoteActor(_harness.Peer, "follower");
|
|
||||||
await _harness.FollowedBy(community, follower);
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = $"@{community.UserName} a new thread", PlainText = true }, token);
|
|
||||||
|
|
||||||
Assert.Equal(community.Id, outcome.Post.GroupId);
|
|
||||||
var note = ActivityPubRenderer.Note(outcome.Post, alice, community, default);
|
|
||||||
Assert.Equal("Page", note["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(community.Uri, note["audience"]!.GetValue<string>());
|
|
||||||
Assert.False(string.IsNullOrEmpty(note["name"]!.GetValue<string>()));
|
|
||||||
Assert.Contains(await _harness.Outgoing(follower.SharedInbox), a => a["type"]!.GetValue<string>() == "Announce");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circle_post_goes_only_to_members_and_only_members_may_read_it()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var member = new RemoteActor(_harness.Peer, "member");
|
|
||||||
var outsider = new RemoteActor(_harness.Peer, "outsider");
|
|
||||||
var (circleEntity, circle) = await Group(GroupKind.Circle, PostingPolicy.Followers, alice.Id, member.Id);
|
|
||||||
await _harness.Remote.GetActor(member.Id, refresh: false, token);
|
|
||||||
var follower = new RemoteActor(_harness.Peer, "follower");
|
|
||||||
await _harness.FollowedBy(alice, follower);
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "just us", GroupId = circle.Id }, token);
|
|
||||||
|
|
||||||
Assert.Equal(PostVisibility.Circle, outcome.Post.Visibility);
|
|
||||||
var create = Assert.Single(await _harness.Outgoing(member.Id + "/inbox"));
|
|
||||||
Assert.Equal(new[] { circle.Uri, circle.Flock }, create["object"]!["to"]!.AsArray().Select(t => t!.GetValue<string>()));
|
|
||||||
Assert.DoesNotContain(Addressing.Public, create.ToJsonString());
|
|
||||||
Assert.Empty(await _harness.Outgoing(follower.SharedInbox));
|
|
||||||
Assert.Empty((await _harness.Outgoing(member.SharedInbox)).Where(a => a["type"]!.GetValue<string>() == "Announce"));
|
|
||||||
|
|
||||||
var authorizer = new SignedFetchAuthorizer(_harness.Remote);
|
|
||||||
var path = new Uri(outcome.Post.ObjectURI).AbsolutePath;
|
|
||||||
var asMember = await authorizer.Requester(member.Get(Harness.Host, path), token);
|
|
||||||
var asOutsider = await authorizer.Requester(outsider.Get(Harness.Host, path), token);
|
|
||||||
Assert.True(SignedFetchAuthorizer.MayReadCircle(circleEntity, asMember));
|
|
||||||
Assert.False(SignedFetchAuthorizer.MayReadCircle(circleEntity, asOutsider));
|
|
||||||
Assert.False(SignedFetchAuthorizer.MayReadCircle(circleEntity, default));
|
|
||||||
Assert.True(circle.IsCircle);
|
|
||||||
Assert.False(circle.Discoverable);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Only_circle_members_can_post_into_a_circle()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var member = new RemoteActor(_harness.Peer, "member");
|
|
||||||
var outsider = new RemoteActor(_harness.Peer, "outsider");
|
|
||||||
var (_, circle) = await Group(GroupKind.Circle, PostingPolicy.Followers, alice.Id, member.Id);
|
|
||||||
|
|
||||||
await _harness.Deliver(member, "/human-centipede", Create(member, new[] { circle.Uri, circle.Flock }));
|
|
||||||
await _harness.Deliver(outsider, "/human-centipede", Create(outsider, new[] { circle.Uri, circle.Flock }));
|
|
||||||
|
|
||||||
var stored = await DB.Default.Find<Post>().Match(p => p.GroupId == circle.Id).ExecuteAsync(token);
|
|
||||||
Assert.Equal(member.Id, Assert.Single(stored).ActorURI);
|
|
||||||
Assert.Equal(PostVisibility.Circle, stored[0].Visibility);
|
|
||||||
Assert.True(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == alice.Id && e.PostId == stored[0].ID).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_followed_remote_community_announcing_a_post_puts_it_in_home()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var lemmyCommunity = new RemoteActor(_harness.Peer, "cats", type: "Group");
|
|
||||||
var poster = new RemoteActor(_harness.Peer, "poster");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = lemmyCommunity.Id }, token);
|
|
||||||
await DB.Default.Update<Following>().Match(f => f.AvatarId == alice.Id).Modify(f => f.State, FollowState.Accepted).ExecuteAsync(token);
|
|
||||||
var create = Create(poster, new[] { lemmyCommunity.Id, Addressing.Public }, lemmyCommunity.Id);
|
|
||||||
var noteId = create["object"]!["id"]!.GetValue<string>();
|
|
||||||
_harness.Peer.Serve(new Uri(noteId).AbsolutePath, create["object"]!.ToJsonString());
|
|
||||||
|
|
||||||
await _harness.Deliver(lemmyCommunity, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(lemmyCommunity)}/activities/announce/{Guid.NewGuid():N}", ["type"] = "Announce", ["actor"] = lemmyCommunity.Id,
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["object"] = create
|
|
||||||
});
|
|
||||||
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(lemmyCommunity.Id, post.AudienceURI);
|
|
||||||
Assert.True(await DB.Default.Find<TimelineEntry>().Match(e => e.AvatarId == alice.Id && e.PostId == post.ID).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Federation.Signing;
|
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class HttpSignaturesTests
|
|
||||||
{
|
|
||||||
const string Host = "privapub.test";
|
|
||||||
const string KeyId = "https://mastodon.example/users/alice#main-key";
|
|
||||||
static readonly DateTimeOffset Now = new(2026, 10, 1, 12, 0, 0, TimeSpan.Zero);
|
|
||||||
static readonly byte[] Body = Encoding.UTF8.GetBytes("""{"type":"Follow","actor":"https://mastodon.example/users/alice"}""");
|
|
||||||
|
|
||||||
readonly RSA _key = RSA.Create(2048);
|
|
||||||
|
|
||||||
string PublicKey => _key.ExportSubjectPublicKeyInfoPem();
|
|
||||||
|
|
||||||
DefaultHttpContext MastodonRequest(string signedTarget = "/peasants/bob/mouth", DateTimeOffset? signedAt = default,
|
|
||||||
string headers = "(request-target) host date digest content-type", byte[] signedBody = default, string extra = "")
|
|
||||||
{
|
|
||||||
var date = (signedAt ?? Now).ToString("r", CultureInfo.InvariantCulture);
|
|
||||||
var digest = HttpSignatures.Digest(signedBody ?? Body);
|
|
||||||
var values = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
["(request-target)"] = $"post {signedTarget}",
|
|
||||||
["host"] = Host,
|
|
||||||
["date"] = date,
|
|
||||||
["digest"] = digest,
|
|
||||||
["content-type"] = "application/activity+json"
|
|
||||||
};
|
|
||||||
var signingString = string.Join("\n", headers.Split(' ').Select(h => $"{h}: {values[h]}"));
|
|
||||||
var signature = Convert.ToBase64String(_key.SignData(Encoding.UTF8.GetBytes(signingString), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1));
|
|
||||||
|
|
||||||
var context = new DefaultHttpContext();
|
|
||||||
context.Request.Method = "POST";
|
|
||||||
context.Request.Host = new HostString(Host);
|
|
||||||
context.Request.Path = "/peasants/bob/mouth";
|
|
||||||
context.Features.Get<IHttpRequestFeature>().RawTarget = "/peasants/bob/mouth";
|
|
||||||
context.Request.Headers["Date"] = date;
|
|
||||||
context.Request.Headers["Digest"] = digest;
|
|
||||||
context.Request.Headers["Content-Type"] = "application/activity+json";
|
|
||||||
context.Request.Headers["Signature"] = $"keyId=\"{KeyId}\",algorithm=\"rsa-sha256\",headers=\"{headers}\",signature=\"{signature}\"{extra}";
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
string Check(HttpContext context, byte[] body = default)
|
|
||||||
{
|
|
||||||
var parameters = HttpSignatures.Parse(context.Request.Headers["Signature"].ToString());
|
|
||||||
var problem = HttpSignatures.CheckRequest(context.Request, parameters, body ?? Body, Now);
|
|
||||||
if (problem != default)
|
|
||||||
return problem;
|
|
||||||
return HttpSignatures.Verify(PublicKey, HttpSignatures.SigningString(context.Request, parameters), parameters.Signature)
|
|
||||||
? default
|
|
||||||
: "does not verify";
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Accepts_a_mastodon_style_delivery() =>
|
|
||||||
Assert.Null(Check(MastodonRequest()));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_tampered_body() =>
|
|
||||||
Assert.Equal("the digest does not match the body", Check(MastodonRequest(), Encoding.UTF8.GetBytes("""{"type":"Delete"}""")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_signature_for_another_inbox() =>
|
|
||||||
Assert.Equal("does not verify", Check(MastodonRequest(signedTarget: "/peasants/carol/mouth")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_signature_older_than_an_hour() =>
|
|
||||||
Assert.Equal("the Date header is outside the allowed window", Check(MastodonRequest(signedAt: Now.AddMinutes(-61))));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Accepts_a_clock_slightly_ahead() =>
|
|
||||||
Assert.Null(Check(MastodonRequest(signedAt: Now.AddMinutes(10))));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_clock_far_ahead() =>
|
|
||||||
Assert.Equal("the Date header is outside the allowed window", Check(MastodonRequest(signedAt: Now.AddMinutes(20))));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_signature_without_the_request_target() =>
|
|
||||||
Assert.Equal("(request-target) is not signed", Check(MastodonRequest(headers: "host date digest")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_signature_without_the_host() =>
|
|
||||||
Assert.Equal("host is not signed", Check(MastodonRequest(headers: "(request-target) date digest")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_a_body_whose_digest_is_not_signed() =>
|
|
||||||
Assert.Equal("the digest is not signed", Check(MastodonRequest(headers: "(request-target) host date")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_an_expired_signature() =>
|
|
||||||
Assert.Equal("the signature has expired",
|
|
||||||
Check(MastodonRequest(extra: $",expires=\"{Now.AddMinutes(-20).ToUnixTimeSeconds()}\"")));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Signs_with_the_raw_request_target()
|
|
||||||
{
|
|
||||||
var context = MastodonRequest(signedTarget: "/peasants/b%6Fb/mouth");
|
|
||||||
context.Features.Get<IHttpRequestFeature>().RawTarget = "/peasants/b%6Fb/mouth";
|
|
||||||
|
|
||||||
Assert.Null(Check(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Verifies_its_own_outbound_signature()
|
|
||||||
{
|
|
||||||
var (privateKey, publicKey) = Keys.NewKeyPair();
|
|
||||||
var signer = new LocalActor { UserName = "bob", BaseAddress = "https://privapub.test", PrivateKeyPem = privateKey };
|
|
||||||
using var outbound = new HttpRequestMessage(HttpMethod.Post, "https://mastodon.example/users/alice/inbox");
|
|
||||||
HttpSignatures.Sign(outbound, signer, Body);
|
|
||||||
|
|
||||||
var context = new DefaultHttpContext();
|
|
||||||
context.Request.Method = "POST";
|
|
||||||
context.Request.Host = new HostString("mastodon.example");
|
|
||||||
context.Request.Path = "/users/alice/inbox";
|
|
||||||
context.Features.Get<IHttpRequestFeature>().RawTarget = "/users/alice/inbox";
|
|
||||||
foreach (var header in outbound.Headers)
|
|
||||||
context.Request.Headers[header.Key] = string.Join(", ", header.Value);
|
|
||||||
var parameters = HttpSignatures.Parse(context.Request.Headers["Signature"].ToString());
|
|
||||||
|
|
||||||
Assert.Equal("https://privapub.test/peasants/bob#main-key", parameters.KeyId);
|
|
||||||
Assert.Null(HttpSignatures.CheckRequest(context.Request, parameters, Body));
|
|
||||||
Assert.True(HttpSignatures.Verify(publicKey, HttpSignatures.SigningString(context.Request, parameters), parameters.Signature));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class InboundRoutingTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
static string NewId(RemoteActor actor, string kind) => $"{Origin(actor)}/{kind}/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
async Task<Post> LocalPost(string text)
|
|
||||||
{
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = text }, TestContext.Current.CancellationToken);
|
|
||||||
return await DB.Default.Find<Post>().Match(p => p.GroupUserId == alice.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_downvote_counts_and_its_undo_takes_it_back()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var post = await LocalPost("vote on me");
|
|
||||||
var lemmy = new RemoteActor(_harness.Peer, "voter");
|
|
||||||
var dislike = new JsonObject { ["id"] = NewId(lemmy, "activities/dislike"), ["type"] = "Dislike", ["actor"] = lemmy.Id, ["object"] = post.ObjectURI };
|
|
||||||
|
|
||||||
await _harness.Deliver(lemmy, "/human-centipede", dislike);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).DownvotesCount);
|
|
||||||
|
|
||||||
await _harness.Deliver(lemmy, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(lemmy, "activities/undo"), ["type"] = "Undo", ["actor"] = lemmy.Id, ["object"] = dislike.DeepClone()
|
|
||||||
});
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).DownvotesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_delete_that_arrives_first_keeps_the_post_from_coming_back()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var noteId = NewId(mallory, "notes");
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "activities/delete"), ["type"] = "Delete", ["actor"] = mallory.Id,
|
|
||||||
["object"] = new JsonObject { ["id"] = noteId, ["type"] = "Tombstone" }
|
|
||||||
});
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "activities/create"), ["type"] = "Create", ["actor"] = mallory.Id,
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId, ["type"] = "Note", ["attributedTo"] = mallory.Id, ["content"] = "<p>late</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["cc"] = new JsonArray(alice.Uri),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" })
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_lemmy_private_message_arrives_as_a_direct_message()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var lemmy = new RemoteActor(_harness.Peer, "pm");
|
|
||||||
var messageId = NewId(lemmy, "private_message");
|
|
||||||
|
|
||||||
await _harness.Deliver(lemmy, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(lemmy, "activities/create"), ["type"] = "Create", ["actor"] = lemmy.Id, ["to"] = new JsonArray(alice.Uri),
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = messageId, ["type"] = "ChatMessage", ["attributedTo"] = lemmy.Id, ["to"] = new JsonArray(alice.Uri),
|
|
||||||
["content"] = "<p>psst</p>", ["mediaType"] = "text/html", ["published"] = DateTime.UtcNow.ToString("O")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var message = await DB.Default.Find<Post>().Match(p => p.ObjectURI == messageId).ExecuteFirstAsync(token);
|
|
||||||
Assert.NotNull(message);
|
|
||||||
Assert.Equal(PostVisibility.Direct, message.Visibility);
|
|
||||||
Assert.NotNull(message.ConversationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_unreachable_key_asks_the_sender_to_retry_instead_of_refusing()
|
|
||||||
{
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var offline = new RemoteActor(_harness.Peer, "offline", origin: "http://127.0.0.1:9");
|
|
||||||
|
|
||||||
var result = await _harness.Deliver(offline, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(offline, "follows"), ["type"] = "Follow", ["actor"] = offline.Id, ["object"] = alice.Uri
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Equal(503, result.StatusCode);
|
|
||||||
Assert.Equal(300, result.RetryAfterSeconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_join_of_a_local_post_is_answered_with_ignore()
|
|
||||||
{
|
|
||||||
var post = await LocalPost("not an event");
|
|
||||||
var mobilizon = new RemoteActor(_harness.Peer, "joiner");
|
|
||||||
|
|
||||||
await _harness.Deliver(mobilizon, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mobilizon, "join"), ["type"] = "Join", ["actor"] = mobilizon.Id, ["object"] = post.ObjectURI
|
|
||||||
});
|
|
||||||
|
|
||||||
var answer = Assert.Single(await _harness.Outgoing(mobilizon.Id + "/inbox"));
|
|
||||||
Assert.Equal("Ignore", answer["type"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.FederatedSeeds;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class InboxGapTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static JsonObject Follow(RemoteActor follower, string target) =>
|
|
||||||
new() { ["id"] = NewId(follower, "follows"), ["type"] = "Follow", ["actor"] = follower.Id, ["object"] = target };
|
|
||||||
|
|
||||||
Task<ForeignAvatar> Stored(RemoteActor actor) =>
|
|
||||||
DB.Default.Find<ForeignAvatar>().Match(f => f.ActorURI == actor.Id).ExecuteSingleAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
PrivaPub.Models.Statistics.InteractionEvent Processed(string activity) => _harness.Ledger.Of("in").Last(e => e.Activity == activity);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_actor_update_refreshes_the_account_from_its_origin_even_when_its_updated_is_older()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var bob = new RemoteActor(_harness.Peer, "bob");
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", Follow(bob, alice.Uri));
|
|
||||||
var before = await Stored(bob);
|
|
||||||
using var rotated = RSA.Create(2048);
|
|
||||||
var document = bob.Document();
|
|
||||||
document["name"] = "Bob Renamed";
|
|
||||||
document["summary"] = "<p>a new bio<script>alert(1)</script></p>";
|
|
||||||
document["publicKey"]!["publicKeyPem"] = rotated.ExportSubjectPublicKeyInfoPem();
|
|
||||||
_harness.Peer.Serve(new Uri(bob.Id).AbsolutePath, document.ToJsonString());
|
|
||||||
var embedded = (JsonObject)document.DeepClone();
|
|
||||||
embedded["name"] = "What the activity claims";
|
|
||||||
embedded["updated"] = "2001-01-01T00:00:00Z";
|
|
||||||
|
|
||||||
var result = await _harness.Deliver(bob, "/human-centipede", Activity(bob, "Update", embedded));
|
|
||||||
|
|
||||||
var after = await Stored(bob);
|
|
||||||
Assert.Equal(202, result.StatusCode);
|
|
||||||
Assert.Null(before.Name);
|
|
||||||
Assert.Equal(before.ID, after.ID);
|
|
||||||
Assert.Equal("Bob Renamed", after.Name);
|
|
||||||
Assert.Equal("<p>a new bio</p>", after.Biography);
|
|
||||||
Assert.Equal(bob.KeyId, after.PublicKeyId);
|
|
||||||
Assert.NotEqual(before.PublicKey, after.PublicKey);
|
|
||||||
Assert.Equal(rotated.ExportSubjectPublicKeyInfoPem(), after.PublicKey);
|
|
||||||
Assert.Equal(("accepted", "actor-refresh"), (Processed("Update").Outcome, Processed("Update").Reason));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_key_moved_to_a_new_id_replaces_the_old_one()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var bob = new RemoteActor(_harness.Peer, "bob");
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", Follow(bob, alice.Uri));
|
|
||||||
using var rotated = RSA.Create(2048);
|
|
||||||
var document = bob.Document();
|
|
||||||
document["publicKey"] = new JsonObject { ["id"] = bob.Id + "#key-2", ["owner"] = bob.Id, ["publicKeyPem"] = rotated.ExportSubjectPublicKeyInfoPem() };
|
|
||||||
_harness.Peer.Serve(new Uri(bob.Id).AbsolutePath, document.ToJsonString());
|
|
||||||
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", Activity(bob, "Update", JsonValue.Create(bob.Id)!));
|
|
||||||
|
|
||||||
var after = await Stored(bob);
|
|
||||||
Assert.Equal(bob.Id + "#key-2", after.PublicKeyId);
|
|
||||||
Assert.Equal(rotated.ExportSubjectPublicKeyInfoPem(), after.PublicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Undoing_a_follow_removes_the_follower_by_the_activity_id_or_by_its_object()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var bob = new RemoteActor(_harness.Peer, "bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var bobFollows = Follow(bob, alice.Uri);
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", bobFollows);
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Follow(carol, alice.Uri));
|
|
||||||
Assert.Equal(2, await DB.Default.CountAsync<Follower>(f => f.LocalActorId == alice.Id, token));
|
|
||||||
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", Activity(bob, "Undo", JsonValue.Create(IdOf(bobFollows))!));
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id && f.ActorURI == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.Equal(("accepted", "undone"), (Processed("Undo").Outcome, Processed("Undo").Reason));
|
|
||||||
|
|
||||||
var forgotten = Follow(carol, alice.Uri);
|
|
||||||
forgotten["id"] = NewId(carol, "follows");
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Activity(carol, "Undo", forgotten));
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id).ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", Activity(carol, "Undo", forgotten));
|
|
||||||
Assert.Equal(("dropped", "unknown-object"), (Processed("Undo").Outcome, Processed("Undo").Reason));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_rejected_quote_request_marks_the_quote_rejected_and_only_the_quoted_author_can_reject_it()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var ann = new RemoteActor(_harness.Peer, "ann");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var note = PublicNote(ann, "<p>ask me first</p>", alice.Uri);
|
|
||||||
note["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" });
|
|
||||||
note["interactionPolicy"] = new JsonObject { ["canQuote"] = new JsonObject { ["manualApproval"] = new JsonArray(Addressing.Public) } };
|
|
||||||
await _harness.Deliver(ann, "/human-centipede", Create(ann, note));
|
|
||||||
var original = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(note)).ExecuteSingleAsync(token);
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "may I?", QuotedStatusId = original.ID }, token);
|
|
||||||
Assert.Equal(QuoteState.Pending, outcome.Post.QuoteState);
|
|
||||||
var request = Assert.Single(await _harness.Outgoing(ann.Id + "/inbox"), a => a["type"]!.GetValue<string>() == "QuoteRequest");
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", Activity(mallory, "Reject", JsonValue.Create(IdOf(request))!));
|
|
||||||
Assert.Equal(QuoteState.Pending, (await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token)).QuoteState);
|
|
||||||
|
|
||||||
await _harness.Deliver(ann, "/human-centipede", Activity(ann, "Reject", request));
|
|
||||||
|
|
||||||
var quoting = await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token);
|
|
||||||
Assert.Equal(QuoteState.Rejected, quoting.QuoteState);
|
|
||||||
Assert.Null(quoting.QuoteAuthorizationURI);
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(original.ID, token)).QuotesCount);
|
|
||||||
Assert.Equal(("accepted", "quote-answer"), (Processed("Reject").Outcome, Processed("Reject").Reason));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_followed_community_announcing_a_vote_or_its_undo_is_recorded_and_changes_nothing_yet()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var community = new RemoteActor(_harness.Peer, "cats", type: "Group");
|
|
||||||
var stranger = new RemoteActor(_harness.Peer, "dogs", type: "Group");
|
|
||||||
var poster = new RemoteActor(_harness.Peer, "poster");
|
|
||||||
var voter = new RemoteActor(_harness.Peer, "voter");
|
|
||||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = community.Id }, token);
|
|
||||||
await DB.Default.Update<Following>().Match(f => f.AvatarId == alice.Id).Modify(f => f.State, FollowState.Accepted).ExecuteAsync(token);
|
|
||||||
var page = PublicNote(poster, "<p>a post</p>", community.Id);
|
|
||||||
page["type"] = "Page";
|
|
||||||
page["name"] = "a title";
|
|
||||||
page["audience"] = community.Id;
|
|
||||||
_harness.Peer.Serve(new Uri(IdOf(page)).AbsolutePath, page.ToJsonString());
|
|
||||||
await _harness.Deliver(community, "/human-centipede", Activity(community, "Announce", Create(poster, page)));
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(page)).ExecuteSingleAsync(token);
|
|
||||||
var like = new JsonObject { ["id"] = NewId(voter, "likes"), ["type"] = "Like", ["actor"] = voter.Id, ["object"] = post.ObjectURI, ["audience"] = community.Id };
|
|
||||||
|
|
||||||
await _harness.Deliver(community, "/human-centipede", Activity(community, "Announce", like));
|
|
||||||
var liked = Processed("Announce");
|
|
||||||
await _harness.Deliver(community, "/human-centipede", Activity(community, "Announce", Activity(voter, "Undo", like)));
|
|
||||||
var unliked = Processed("Announce");
|
|
||||||
await _harness.Deliver(stranger, "/human-centipede", Activity(stranger, "Announce", like));
|
|
||||||
var unfollowed = Processed("Announce");
|
|
||||||
|
|
||||||
//votes relayed by a community are a documented gap (docs/INTEROP.md, Lemmy: "Announces of activities other than Create")
|
|
||||||
Assert.Equal(("dropped", "unsupported", "Like"), (liked.Outcome, liked.Reason, liked.Object));
|
|
||||||
Assert.Equal(("dropped", "unsupported", "Undo"), (unliked.Outcome, unliked.Reason, unliked.Object));
|
|
||||||
Assert.Equal(("dropped", "not-followed"), (unfollowed.Outcome, unfollowed.Reason));
|
|
||||||
var after = await DB.Default.Find<Post>().OneAsync(post.ID, token);
|
|
||||||
Assert.Equal(0, after.FavouritesCount);
|
|
||||||
Assert.False(await DB.Default.Find<Favourite>().Match(f => f.PostId == post.ID).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_locked_persona_holds_a_follow_until_it_decides_and_answers_with_the_original_follow()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, open) = await _harness.Persona("alice");
|
|
||||||
await DB.Default.Update<Avatar>().MatchID(open.Id).Modify(a => a.Settings.IsLocked, true).ExecuteAsync(token);
|
|
||||||
var alice = await _harness.Local.FindById(LocalActorKind.Person, open.Id, token);
|
|
||||||
var bob = new RemoteActor(_harness.Peer, "bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var bobFollows = Follow(bob, alice.Uri);
|
|
||||||
var carolFollows = Follow(carol, alice.Uri);
|
|
||||||
Assert.True(alice.ManuallyApprovesFollowers);
|
|
||||||
|
|
||||||
await _harness.Deliver(bob, "/human-centipede", bobFollows);
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", carolFollows);
|
|
||||||
|
|
||||||
var pending = await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id).ExecuteAsync(token);
|
|
||||||
Assert.Equal(2, pending.Count);
|
|
||||||
Assert.All(pending, f => Assert.False(f.IsAccepted));
|
|
||||||
Assert.Equal(("accepted", "pending"), (Processed("Follow").Outcome, Processed("Follow").Reason));
|
|
||||||
var requests = await DB.Default.Find<Notification>().Match(n => n.AvatarId == alice.Id).ExecuteAsync(token);
|
|
||||||
Assert.Equal(2, requests.Count);
|
|
||||||
Assert.All(requests, n => Assert.Equal(NotificationType.FollowRequest, n.Type));
|
|
||||||
Assert.Empty(await _harness.Outgoing(bob.Id + "/inbox"));
|
|
||||||
Assert.Empty(await _harness.Delivery.FollowerInboxes(alice, token));
|
|
||||||
|
|
||||||
var bobAccount = await Stored(bob);
|
|
||||||
var carolAccount = await Stored(carol);
|
|
||||||
Assert.True(await _harness.Follows.Decide(alice, bobAccount.ID, accept: true, token));
|
|
||||||
Assert.True(await _harness.Follows.Decide(alice, carolAccount.ID, accept: false, token));
|
|
||||||
Assert.False(await _harness.Follows.Decide(alice, carolAccount.ID, accept: true, token));
|
|
||||||
|
|
||||||
var accept = Assert.Single(await _harness.Outgoing(bob.Id + "/inbox"));
|
|
||||||
Assert.Equal("Accept", accept["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(alice.Uri, accept["actor"]!.GetValue<string>());
|
|
||||||
Assert.Equal(IdOf(bobFollows), IdOf(accept["object"]!));
|
|
||||||
Assert.Equal(bob.Id, accept["object"]!["actor"]!.GetValue<string>());
|
|
||||||
var reject = Assert.Single(await _harness.Outgoing(carol.Id + "/inbox"));
|
|
||||||
Assert.Equal("Reject", reject["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(IdOf(carolFollows), IdOf(reject["object"]!));
|
|
||||||
Assert.True((await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id && f.ActorURI == bob.Id).ExecuteSingleAsync(token)).IsAccepted);
|
|
||||||
Assert.False(await DB.Default.Find<Follower>().Match(f => f.LocalActorId == alice.Id && f.ActorURI == carol.Id).ExecuteAnyAsync(token));
|
|
||||||
Assert.Contains(await DB.Default.Find<Notification>().Match(n => n.AvatarId == alice.Id && n.Type == NotificationType.Follow).ExecuteAsync(token),
|
|
||||||
n => n.FromAccountId == bobAccount.ID);
|
|
||||||
Assert.Equal(new[] { bob.Id + "/inbox" }, await _harness.Delivery.FollowerInboxes(alice, token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,331 +0,0 @@
|
|||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Timelines;
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Federation.Inbox.Handlers;
|
|
||||||
using PrivaPub.Federation.Inbox;
|
|
||||||
using PrivaPub.Federation.Moderation;
|
|
||||||
using PrivaPub.Domain.Social;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Federation.Outbox;
|
|
||||||
using PrivaPub.Infrastructure.Jobs;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Models;
|
|
||||||
using PrivaPub.StaticServices;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class InboxScenarioTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string Host = "privapub.test";
|
|
||||||
const string Base = "https://" + Host;
|
|
||||||
|
|
||||||
Peer _peer;
|
|
||||||
LocalActorService _local;
|
|
||||||
InboxReceiver _receiver;
|
|
||||||
InboxProcessor _processor;
|
|
||||||
DomainBlocks _blocks;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
var cache = new MemoryCache(new MemoryCacheOptions());
|
|
||||||
_local = new LocalActorService(new DbEntities(), new StaticOptions<AppConfiguration>(new AppConfiguration { BackendBaseAddress = Base }));
|
|
||||||
var remote = new RemoteActorService(Peer.Http(cache), _local, cache, new DbEntities());
|
|
||||||
var queue = new JobQueue();
|
|
||||||
var delivery = new DeliveryService(new DbEntities(), queue);
|
|
||||||
var db = new DbEntities();
|
|
||||||
_blocks = new DomainBlocks(NullLogger<DomainBlocks>.Instance);
|
|
||||||
_receiver = new InboxReceiver(_local, remote, queue, _blocks, NullLogger<InboxReceiver>.Instance);
|
|
||||||
var remotePosts = new RemotePosts(db, _local, remote, _blocks, queue, new ObjectRecords(queue), new NoPreviews());
|
|
||||||
var quotes = new QuoteService(db, remote, remotePosts, _local, delivery, new OutboxPublisher(db, _local, delivery));
|
|
||||||
_processor = new InboxProcessor(remote, new IActivityHandler[]
|
|
||||||
{
|
|
||||||
new FollowHandler(db, _local, remote, delivery),
|
|
||||||
new UndoHandler(db, _local, new Reactions(db, delivery)),
|
|
||||||
new CreateHandler(db, _local, remote, delivery, _blocks, new Fanout(db), remotePosts, new GroupDistributor(delivery), new ObjectRecords(queue), new PollService(db, _local, delivery, queue), new NoPreviews(), quotes),
|
|
||||||
new DeleteHandler(db, _local, remote, delivery, new GroupDistributor(delivery), quotes),
|
|
||||||
new UpdateHandler(db, _local, remote, new GroupDistributor(delivery), new ObjectRecords(queue), quotes)
|
|
||||||
}, NullLogger<InboxProcessor>.Instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<LocalActor> LocalAvatar(string name)
|
|
||||||
{
|
|
||||||
var (privateKey, publicKey) = Keys.NewKeyPair();
|
|
||||||
var avatar = new Avatar { UserName = $"{name}{Guid.NewGuid():N}"[..20], PrivateKey = privateKey, PublicKey = publicKey };
|
|
||||||
await DB.Default.SaveAsync(avatar, TestContext.Current.CancellationToken);
|
|
||||||
return _local.FromAvatar(avatar);
|
|
||||||
}
|
|
||||||
|
|
||||||
static JsonObject DirectCreate(RemoteActor author, string to, string context = default, string objectOrigin = default, string attributedTo = default)
|
|
||||||
{
|
|
||||||
var id = $"{objectOrigin ?? Origin(author.Id)}/notes/{Guid.NewGuid():N}";
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = id,
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = attributedTo ?? author.Id,
|
|
||||||
["content"] = "<p>psst</p>",
|
|
||||||
["to"] = new JsonArray(to),
|
|
||||||
["cc"] = new JsonArray()
|
|
||||||
};
|
|
||||||
if (context != default)
|
|
||||||
note["context"] = context;
|
|
||||||
return new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(author.Id)}/activities/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Create",
|
|
||||||
["actor"] = author.Id,
|
|
||||||
["to"] = new JsonArray(to),
|
|
||||||
["object"] = note
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<InboxResult> Deliver(RemoteActor sender, string path, JsonNode activity)
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var result = await _receiver.Receive(sender.Post(Host, path, activity), default, token);
|
|
||||||
var dedupe = "inbox|" + (activity is JsonObject ? activity["id"]?.GetValue<string>() : default);
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.DedupeKey == dedupe).ExecuteFirstAsync(token);
|
|
||||||
if (job != default)
|
|
||||||
Assert.Equal(JobResult.Done, (await _processor.Handle(job, token)).Result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(string uri) => new Uri(uri).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_context_cannot_pull_a_stranger_into_an_existing_conversation()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
var context = $"{_peer.A}/contexts/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
var first = await Deliver(bob, $"/peasants/{alice.UserName}/mouth", DirectCreate(bob, alice.Uri, context));
|
|
||||||
var injected = await Deliver(mallory, $"/peasants/{alice.UserName}/mouth", DirectCreate(mallory, alice.Uri, context));
|
|
||||||
|
|
||||||
Assert.Equal(202, first.StatusCode);
|
|
||||||
Assert.Equal(202, injected.StatusCode);
|
|
||||||
var bobDm = await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id && p.Visibility == PostVisibility.Direct).ExecuteSingleAsync(token);
|
|
||||||
var malloryDm = await DB.Default.Find<Post>().Match(p => p.ActorURI == mallory.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.NotEqual(bobDm.ConversationId, malloryDm.ConversationId);
|
|
||||||
var bobConversation = await DB.Default.Find<DmGroup>().OneAsync(bobDm.ConversationId, token);
|
|
||||||
Assert.DoesNotContain(bobConversation.Members, m => m.AvatarId == mallory.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Replies_between_the_same_people_land_in_the_same_conversation()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
|
|
||||||
await Deliver(bob, $"/peasants/{alice.UserName}/mouth", DirectCreate(bob, alice.Uri));
|
|
||||||
await Deliver(bob, $"/peasants/{alice.UserName}/mouth", DirectCreate(bob, alice.Uri));
|
|
||||||
|
|
||||||
var dms = await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id && p.Visibility == PostVisibility.Direct).ExecuteAsync(token);
|
|
||||||
Assert.Equal(2, dms.Count);
|
|
||||||
Assert.Single(dms.Select(d => d.ConversationId).Distinct());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_activity_id_on_another_origin_is_refused()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
var create = DirectCreate(mallory, alice.Uri);
|
|
||||||
create["id"] = $"{_peer.B}/activities/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
var result = await Deliver(mallory, $"/peasants/{alice.UserName}/mouth", create);
|
|
||||||
|
|
||||||
Assert.Equal(400, result.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_note_put_in_someone_elses_mouth_is_refused()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
var victim = new RemoteActor(_peer, "victim");
|
|
||||||
|
|
||||||
var result = await Deliver(mallory, $"/peasants/{alice.UserName}/mouth", DirectCreate(mallory, alice.Uri, attributedTo: victim.Id));
|
|
||||||
|
|
||||||
Assert.Equal(400, result.StatusCode);
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ActorURI == victim.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_cross_origin_object_is_fetched_from_its_origin_before_it_is_believed()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
|
|
||||||
var result = await Deliver(mallory, $"/peasants/{alice.UserName}/mouth", DirectCreate(mallory, alice.Uri, objectOrigin: _peer.B));
|
|
||||||
|
|
||||||
Assert.Equal(202, result.StatusCode);
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ActorURI == mallory.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
static JsonObject PublicCreate(RemoteActor author, string inReplyTo = default, params string[] cc)
|
|
||||||
{
|
|
||||||
var id = $"{Origin(author.Id)}/notes/{Guid.NewGuid():N}";
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = id,
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = author.Id,
|
|
||||||
["content"] = "<p>hello</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public),
|
|
||||||
["cc"] = new JsonArray(cc.Prepend(author.Id + "/followers").Select(c => (JsonNode)c).ToArray())
|
|
||||||
};
|
|
||||||
if (inReplyTo != default)
|
|
||||||
note["inReplyTo"] = inReplyTo;
|
|
||||||
return new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(author.Id)}/activities/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Create",
|
|
||||||
["actor"] = author.Id,
|
|
||||||
["object"] = note
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_public_reply_to_a_local_post_is_kept_and_counted()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var parent = new Post { GroupUserId = alice.Id, AuthorAccountId = alice.Id, ActorURI = alice.Uri, Text = "hi" };
|
|
||||||
parent.ID = (string)parent.GenerateNewID();
|
|
||||||
parent.ObjectURI = alice.PostUri(parent.ID);
|
|
||||||
await DB.Default.SaveAsync(parent, token);
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
|
|
||||||
await Deliver(bob, "/human-centipede", PublicCreate(bob, parent.ObjectURI));
|
|
||||||
|
|
||||||
var reply = await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(PostVisibility.Public, reply.Visibility);
|
|
||||||
Assert.Equal(parent.ID, reply.AnsweringToPostId);
|
|
||||||
Assert.Equal(alice.Id, reply.InReplyToAccountId);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(parent.ID, token)).RepliesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_public_post_nobody_here_asked_for_is_dropped()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
|
|
||||||
await Deliver(bob, "/human-centipede", PublicCreate(bob));
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_mention_is_kept_and_linked_to_the_local_persona()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var create = PublicCreate(bob, default, alice.Uri);
|
|
||||||
create["object"]!["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@" + alice.Handle });
|
|
||||||
|
|
||||||
await Deliver(bob, "/human-centipede", create);
|
|
||||||
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id).ExecuteSingleAsync(token);
|
|
||||||
var mention = Assert.Single(post.Mentions);
|
|
||||||
Assert.True(mention.IsLocal);
|
|
||||||
Assert.Equal(alice.Id, mention.AccountId);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_suspended_domain_is_dropped_before_its_key_is_fetched()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob", _peer.B);
|
|
||||||
_blocks.Load(new[] { new DomainBlock { Domain = "localhost", Severity = DomainBlockSeverity.Suspend } });
|
|
||||||
var before = _peer.Requests.Count;
|
|
||||||
|
|
||||||
var result = await Deliver(bob, $"/peasants/{alice.UserName}/mouth", DirectCreate(bob, alice.Uri));
|
|
||||||
|
|
||||||
Assert.Equal(202, result.StatusCode);
|
|
||||||
Assert.Equal(before, _peer.Requests.Count);
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ActorURI == bob.Id).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_bad_signature_is_a_401()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
var request = mallory.Post(Host, $"/peasants/{alice.UserName}/mouth", DirectCreate(mallory, alice.Uri));
|
|
||||||
request.Headers["Signature"] = request.Headers["Signature"].ToString().Replace("signature=\"", "signature=\"AAAA");
|
|
||||||
|
|
||||||
Assert.Equal(401, (await _receiver.Receive(request, alice, token)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Junk_is_a_400_never_a_500()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var alice = await LocalAvatar("alice");
|
|
||||||
var mallory = new RemoteActor(_peer, "mallory");
|
|
||||||
|
|
||||||
foreach (var junk in new JsonNode[] { new JsonArray(1, 2), JsonValue.Create("x"), new JsonObject { ["type"] = "Create" } })
|
|
||||||
Assert.Equal(400, (await Deliver(mallory, $"/peasants/{alice.UserName}/mouth", junk)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circle_only_takes_follow_requests()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (privateKey, publicKey) = Keys.NewKeyPair();
|
|
||||||
var circle = new GroupEntity { UserName = $"circle{Guid.NewGuid():N}"[..20], PrivateKey = privateKey, PublicKey = publicKey };
|
|
||||||
await DB.Default.SaveAsync(circle, token);
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var actor = _local.FromGroup(circle);
|
|
||||||
var follow = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{bob.Id}/follows/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Follow",
|
|
||||||
["actor"] = bob.Id,
|
|
||||||
["object"] = actor.Uri
|
|
||||||
};
|
|
||||||
|
|
||||||
Assert.True(actor.IsCircle);
|
|
||||||
Assert.True(actor.ManuallyApprovesFollowers);
|
|
||||||
Assert.False(actor.Discoverable);
|
|
||||||
Assert.Equal(202, (await Deliver(bob, "/human-centipede", follow)).StatusCode);
|
|
||||||
var request = await DB.Default.Find<Follower>().Match(f => f.LocalActorId == circle.ID).ExecuteSingleAsync(token);
|
|
||||||
Assert.False(request.IsAccepted);
|
|
||||||
Assert.DoesNotContain(circle.Members, m => m.AvatarId == bob.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class InteractionTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<(string Root, Post Post)> LocalPost(string visibility = default)
|
|
||||||
{
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
var view = (ViewPost)(await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "like me", Visibility = visibility },
|
|
||||||
TestContext.Current.CancellationToken)).Data;
|
|
||||||
return (root, await DB.Default.Find<Post>().OneAsync(view.Id));
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_like_counts_once_notifies_and_can_be_undone()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, post) = await LocalPost();
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var like = new JsonObject { ["id"] = $"{Origin(carol)}/likes/{Guid.NewGuid():N}", ["type"] = "Like", ["actor"] = carol.Id, ["object"] = post.ObjectURI };
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", like);
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject { ["id"] = $"{Origin(carol)}/likes/{Guid.NewGuid():N}", ["type"] = "Like", ["actor"] = carol.Id, ["object"] = post.ObjectURI });
|
|
||||||
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).FavouritesCount);
|
|
||||||
Assert.Equal(NotificationType.Favourite, (await DB.Default.Find<Notification>().Match(n => n.AvatarId == post.GroupUserId).ExecuteSingleAsync(token)).Type);
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(carol)}/undos/{Guid.NewGuid():N}", ["type"] = "Undo", ["actor"] = carol.Id, ["object"] = like
|
|
||||||
});
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).FavouritesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_stranger_cannot_like_a_followers_only_post()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, post) = await LocalPost("followersonly");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(mallory)}/likes/{Guid.NewGuid():N}", ["type"] = "Like", ["actor"] = mallory.Id, ["object"] = post.ObjectURI
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).FavouritesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_boost_of_a_local_post_counts_notifies_and_can_be_undone()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, post) = await LocalPost();
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var announce = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(carol)}/announces/{Guid.NewGuid():N}", ["type"] = "Announce", ["actor"] = carol.Id, ["object"] = post.ObjectURI,
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["cc"] = new JsonArray(carol.Id + "/followers")
|
|
||||||
};
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", announce);
|
|
||||||
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).ReblogsCount);
|
|
||||||
Assert.Equal(NotificationType.Reblog, (await DB.Default.Find<Notification>().Match(n => n.AvatarId == post.GroupUserId).ExecuteSingleAsync(token)).Type);
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(carol)}/undos/{Guid.NewGuid():N}", ["type"] = "Undo", ["actor"] = carol.Id, ["object"] = announce["id"]!.GetValue<string>()
|
|
||||||
});
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).ReblogsCount);
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ObjectURI == announce["id"]!.GetValue<string>()).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_followed_account_boosting_a_remote_post_puts_it_in_home()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var carol = new RemoteActor(_harness.Peer, "carol");
|
|
||||||
var dave = new RemoteActor(_harness.Peer, "dave");
|
|
||||||
var stranger = new RemoteActor(_harness.Peer, "stranger");
|
|
||||||
await _harness.Follows.Follow(bobRoot, new FollowForm { AvatarId = bob.Id, Target = carol.Id }, token);
|
|
||||||
await DB.Default.Update<Following>().Match(f => f.AvatarId == bob.Id).Modify(f => f.State, FollowState.Accepted).ExecuteAsync(token);
|
|
||||||
var noteId = $"{Origin(dave)}/notes/{Guid.NewGuid():N}";
|
|
||||||
_harness.Peer.Serve(new Uri(noteId).AbsolutePath, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId, ["type"] = "Note", ["attributedTo"] = dave.Id, ["content"] = "<p>worth sharing</p>", ["to"] = new JsonArray(Addressing.Public)
|
|
||||||
}.ToJsonString());
|
|
||||||
|
|
||||||
await _harness.Deliver(stranger, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(stranger)}/announces/{Guid.NewGuid():N}", ["type"] = "Announce", ["actor"] = stranger.Id, ["object"] = noteId,
|
|
||||||
["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
await _harness.Deliver(carol, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{Origin(carol)}/announces/{Guid.NewGuid():N}", ["type"] = "Announce", ["actor"] = carol.Id, ["object"] = noteId,
|
|
||||||
["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
|
|
||||||
var home = (List<ViewPost>)(await _harness.Timelines.Home(bobRoot, bob.Id, default, 20, token)).Data;
|
|
||||||
var boosted = Assert.Single(home);
|
|
||||||
Assert.Equal("<p>worth sharing</p>", boosted.ReblogOf.ContentHtml);
|
|
||||||
Assert.Equal(carol.Id, boosted.AuthorActorURI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,537 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using OpenIddict.Abstractions;
|
|
||||||
|
|
||||||
using PrivaPub.Api.Mastodon.Auth;
|
|
||||||
using PrivaPub.Domain.Content;
|
|
||||||
using PrivaPub.Domain.Media;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Federation.Inbox;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Federation.Outbox;
|
|
||||||
using PrivaPub.Federation.Signing;
|
|
||||||
using PrivaPub.Infrastructure.Http;
|
|
||||||
using PrivaPub.Infrastructure.Jobs;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Media;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.FederatedSeeds;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class JobHandlerTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class PeerDescriber : InstanceDescriber
|
|
||||||
{
|
|
||||||
readonly string _peer;
|
|
||||||
|
|
||||||
public PeerDescriber(IFederationHttp http, string peer) : base(http) => _peer = peer;
|
|
||||||
|
|
||||||
protected override string Address(string url) => _peer + new Uri(url).PathAndQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Ancestors_are_fetched_one_job_at_a_time_and_stop_at_the_depth_limit()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var poster = new RemoteActor(_harness.Peer, "poster");
|
|
||||||
var chain = new List<JsonObject>();
|
|
||||||
for (var i = 0; i < RemotePosts.MaxDepth + 3; i++)
|
|
||||||
{
|
|
||||||
var note = PublicNote(poster, $"<p>number {i}</p>");
|
|
||||||
if (i > 0)
|
|
||||||
note["inReplyTo"] = IdOf(chain[^1]);
|
|
||||||
_harness.Peer.Serve(new Uri(IdOf(note)).AbsolutePath, note.ToJsonString());
|
|
||||||
chain.Add(note);
|
|
||||||
}
|
|
||||||
var leaf = new Post
|
|
||||||
{
|
|
||||||
ObjectURI = NewId(poster, "notes"), ActorURI = poster.Id, IsFederatedCopy = true, Visibility = PostVisibility.Public,
|
|
||||||
InReplyToURI = IdOf(chain[^1]), ContentHtml = "<p>the leaf</p>"
|
|
||||||
};
|
|
||||||
await DB.Default.SaveAsync(leaf, token);
|
|
||||||
await _harness.Queue.Enqueue(JobKind.FetchAncestors, JsonSerializer.Serialize(new AncestorsPayload(leaf.ID, 1)), "127.0.0.1", "ancestors|" + leaf.ID, token);
|
|
||||||
var handler = new AncestorsJobHandler(_harness.Db, _harness.RemotePosts);
|
|
||||||
|
|
||||||
var keys = new List<string> { "ancestors|" + leaf.ID };
|
|
||||||
var ran = 0;
|
|
||||||
while (await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.FetchAncestors && j.State == JobState.Pending && keys.Contains(j.DedupeKey))
|
|
||||||
.ExecuteFirstAsync(token) is { } job)
|
|
||||||
{
|
|
||||||
Assert.Equal(JobResult.Done, (await handler.Handle(job, token)).Result);
|
|
||||||
await DB.Default.Update<Job>().MatchID(job.ID).Modify(j => j.State, JobState.Done).ExecuteAsync(token);
|
|
||||||
ran++;
|
|
||||||
var uris = chain.Select(IdOf).ToList();
|
|
||||||
keys = (await DB.Default.Find<Post>().Match(p => uris.Contains(p.ObjectURI)).ExecuteAsync(token)).Select(p => "ancestors|" + p.ID).Append("ancestors|" + leaf.ID).ToList();
|
|
||||||
Assert.True(ran <= RemotePosts.MaxDepth, "the chain did not stop");
|
|
||||||
}
|
|
||||||
|
|
||||||
var all = chain.Select(IdOf).ToList();
|
|
||||||
var stored = (await DB.Default.Find<Post>().Match(p => all.Contains(p.ObjectURI)).ExecuteAsync(token)).ToDictionary(p => p.ObjectURI);
|
|
||||||
Assert.Equal(RemotePosts.MaxDepth, ran);
|
|
||||||
Assert.Equal(all.Skip(3), stored.Keys.OrderBy(all.IndexOf));
|
|
||||||
Assert.Equal(stored[all[^1]].ID, (await DB.Default.Find<Post>().OneAsync(leaf.ID, token)).AnsweringToPostId);
|
|
||||||
for (var i = 4; i < all.Count; i++)
|
|
||||||
Assert.Equal(stored[all[i - 1]].ID, stored[all[i]].AnsweringToPostId);
|
|
||||||
Assert.Null(stored[all[3]].AnsweringToPostId);
|
|
||||||
Assert.Equal(all[2], stored[all[3]].InReplyToURI);
|
|
||||||
Assert.DoesNotContain(_harness.Peer.Requests, r => r.Path == new Uri(all[2]).AbsolutePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<(LocalActor Alice, RemoteActor Mallory, Post Poll)> LocalPoll()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "follows"), ["type"] = "Follow", ["actor"] = mallory.Id, ["object"] = alice.Uri
|
|
||||||
});
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "which?", Poll = new PollDraft(new[] { "tea", "coffee" }, 3600, false, false) }, token);
|
|
||||||
Assert.True(outcome.Ok);
|
|
||||||
return (alice, mallory, outcome.Post);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<List<JsonObject>> Updates(RemoteActor to) =>
|
|
||||||
(await _harness.Outgoing(to.Id + "/inbox")).Where(a => a["type"]!.GetValue<string>() == "Update").ToList();
|
|
||||||
|
|
||||||
static int[] Counts(JsonNode question) =>
|
|
||||||
question["oneOf"]!.AsArray().Select(o => o!["replies"]!["totalItems"]!.GetValue<int>()).ToArray();
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_poll_refresh_sends_the_new_counts_to_followers_as_an_update()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, mallory, poll) = await LocalPoll();
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
Assert.True((await _harness.Polls.Vote(bob, poll, new[] { 1 }, token)).Ok);
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollRefresh && j.Payload == poll.ID).ExecuteSingleAsync(token);
|
|
||||||
Assert.True(job.RunAt > DateTime.UtcNow);
|
|
||||||
Assert.Empty(await Updates(mallory));
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, (await new PollRefreshJob(_harness.Db, _harness.Local, _harness.Outbox).Handle(job, token)).Result);
|
|
||||||
|
|
||||||
var question = Assert.Single(await Updates(mallory))["object"]!;
|
|
||||||
Assert.Equal("Question", question["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { 0, 1 }, Counts(question));
|
|
||||||
Assert.Null(question["closed"]);
|
|
||||||
Assert.Null((await DB.Default.Find<Post>().OneAsync(poll.ID, token)).Poll.ClosedAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Closing_a_local_poll_tells_its_voters_and_sends_the_closed_question()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (alice, mallory, poll) = await LocalPoll();
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
Assert.True((await _harness.Polls.Vote(bob, poll, new[] { 0 }, token)).Ok);
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollClose && j.Payload == poll.ID).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, (await new PollCloseJob(_harness.Db, _harness.Local, _harness.Outbox).Handle(job, token)).Result);
|
|
||||||
|
|
||||||
var closed = (await DB.Default.Find<Post>().OneAsync(poll.ID, token)).Poll.ClosedAt;
|
|
||||||
Assert.NotNull(closed);
|
|
||||||
var question = Assert.Single(await Updates(mallory))["object"]!;
|
|
||||||
Assert.NotNull(question["closed"]);
|
|
||||||
Assert.Equal(new[] { 1, 0 }, Counts(question));
|
|
||||||
var told = await DB.Default.Find<Notification>().Match(n => n.Type == NotificationType.Poll && n.PostId == poll.ID).ExecuteAsync(token);
|
|
||||||
Assert.Equal(new[] { alice.Id, bob.Id }.Order(), told.Select(n => n.AvatarId).Order());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Closing_a_remote_poll_tells_the_local_voters_and_sends_nothing()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var question = PublicNote(mallory, "<p>pick</p>", alice.Uri);
|
|
||||||
question["type"] = "Question";
|
|
||||||
question["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" });
|
|
||||||
question["endTime"] = DateTime.UtcNow.AddMinutes(10).ToString("O");
|
|
||||||
question["oneOf"] = new JsonArray(
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "red", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = 0 } },
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "blue", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = 0 } });
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", Create(mallory, question));
|
|
||||||
var poll = await DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(question)).ExecuteSingleAsync(token);
|
|
||||||
Assert.True((await _harness.Polls.Vote(alice, poll, new[] { 1 }, token)).Ok);
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollClose && j.Payload == poll.ID).ExecuteSingleAsync(token);
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, (await new PollCloseJob(_harness.Db, _harness.Local, _harness.Outbox).Handle(job, token)).Result);
|
|
||||||
|
|
||||||
var told = Assert.Single(await DB.Default.Find<Notification>().Match(n => n.Type == NotificationType.Poll && n.PostId == poll.ID).ExecuteAsync(token));
|
|
||||||
Assert.Equal(alice.Id, told.AvatarId);
|
|
||||||
Assert.Equal(poll.AuthorAccountId, told.FromAccountId);
|
|
||||||
Assert.Empty(await Updates(mallory));
|
|
||||||
Assert.Null((await DB.Default.Find<Post>().OneAsync(poll.ID, token)).Poll.ClosedAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_server_is_described_from_its_nodeinfo_and_at_most_once_a_week()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var host = $"describe{Guid.NewGuid():N}.example";
|
|
||||||
var peer = _harness.Peer;
|
|
||||||
peer.ServeText("/.well-known/nodeinfo", new JsonObject
|
|
||||||
{
|
|
||||||
["links"] = new JsonArray(
|
|
||||||
new JsonObject { ["rel"] = "http://nodeinfo.diaspora.software/ns/schema/2.0", ["href"] = $"https://{host}/nodeinfo/2.0" },
|
|
||||||
new JsonObject { ["rel"] = "http://nodeinfo.diaspora.software/ns/schema/2.1", ["href"] = $"https://{host}/nodeinfo/2.1" })
|
|
||||||
}.ToJsonString(), "application/json");
|
|
||||||
peer.ServeText("/nodeinfo/2.1", new JsonObject
|
|
||||||
{
|
|
||||||
["version"] = "2.1",
|
|
||||||
["software"] = new JsonObject { ["name"] = "gotosocial", ["version"] = "0.20.1" },
|
|
||||||
["protocols"] = new JsonArray("activitypub", 42),
|
|
||||||
["openRegistrations"] = false,
|
|
||||||
["usage"] = new JsonObject { ["users"] = new JsonObject { ["total"] = 3 } },
|
|
||||||
["metadata"] = new JsonObject { ["nodeName"] = "A small place" }
|
|
||||||
}.ToJsonString(), "application/json");
|
|
||||||
var describer = new PeerDescriber(Peer.Http(), peer.A);
|
|
||||||
|
|
||||||
async Task Record()
|
|
||||||
{
|
|
||||||
var note = NoteParser.Parse(new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"https://{host}/notes/{Guid.NewGuid():N}", ["type"] = "Note", ["attributedTo"] = $"https://{host}/users/x",
|
|
||||||
["content"] = "<p>hi</p>", ["to"] = new JsonArray(Addressing.Public)
|
|
||||||
});
|
|
||||||
var post = new Post { ObjectURI = note.Id, IsFederatedCopy = true };
|
|
||||||
await DB.Default.SaveAsync(post, token);
|
|
||||||
await _harness.Records.Record(note, post, ObjectPath.Fetched, refetched: false, token);
|
|
||||||
}
|
|
||||||
Task<List<Job>> Jobs() => DB.Default.Find<Job>().Match(j => j.Kind == JobKind.DescribeInstance && j.Payload == host).ExecuteAsync(token);
|
|
||||||
|
|
||||||
await Record();
|
|
||||||
await Record();
|
|
||||||
var job = Assert.Single(await Jobs());
|
|
||||||
Assert.StartsWith($"describe|{host}|", job.DedupeKey);
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, (await describer.Handle(job, token)).Result);
|
|
||||||
|
|
||||||
var instance = await DB.Default.Find<RemoteInstance>().Match(i => i.Host == host).ExecuteSingleAsync(token);
|
|
||||||
Assert.Equal(("gotosocial", "0.20.1", "A small place"), (instance.Software, instance.SoftwareVersion, instance.NodeName));
|
|
||||||
Assert.Equal(new[] { "activitypub" }, instance.Protocols);
|
|
||||||
Assert.False(instance.OpenRegistrations);
|
|
||||||
Assert.Equal(3, JsonNode.Parse(instance.NodeInfo)!["usage"]!["users"]!["total"]!.GetValue<int>());
|
|
||||||
Assert.Null(instance.DescriptionError);
|
|
||||||
Assert.InRange(instance.DescribedAt!.Value, DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow.AddSeconds(1));
|
|
||||||
Assert.DoesNotContain(peer.Requests, r => r.Path == "/nodeinfo/2.0");
|
|
||||||
|
|
||||||
await DB.Default.DeleteAsync<Job>(job.ID);
|
|
||||||
await Record();
|
|
||||||
Assert.Empty(await Jobs());
|
|
||||||
|
|
||||||
await DB.Default.Update<RemoteInstance>().MatchID(instance.ID).Modify(i => i.DescribedAt, DateTime.UtcNow.AddDays(-8)).ExecuteAsync(token);
|
|
||||||
await Record();
|
|
||||||
Assert.Single(await Jobs());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_server_without_usable_nodeinfo_is_described_as_such()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var plain = $"plain{Guid.NewGuid():N}.example";
|
|
||||||
var describer = new PeerDescriber(Peer.Http(), _harness.Peer.A + "/" + plain);
|
|
||||||
_harness.Peer.ServeText($"/{plain}/.well-known/nodeinfo", new JsonObject
|
|
||||||
{
|
|
||||||
["links"] = new JsonArray(new JsonObject { ["rel"] = "http://nodeinfo.diaspora.software/ns/schema/2.1", ["href"] = $"http://{plain}/nodeinfo/2.1" })
|
|
||||||
}.ToJsonString(), "application/json");
|
|
||||||
var silent = $"silent{Guid.NewGuid():N}.example";
|
|
||||||
|
|
||||||
await describer.Handle(new Job { Kind = JobKind.DescribeInstance, Payload = plain }, token);
|
|
||||||
await new PeerDescriber(Peer.Http(), _harness.Peer.A + "/" + silent).Handle(new Job { Kind = JobKind.DescribeInstance, Payload = silent }, token);
|
|
||||||
|
|
||||||
Assert.Equal("no NodeInfo", (await DB.Default.Find<RemoteInstance>().Match(i => i.Host == plain).ExecuteSingleAsync(token)).DescriptionError);
|
|
||||||
Assert.Equal("no NodeInfo", (await DB.Default.Find<RemoteInstance>().Match(i => i.Host == silent).ExecuteSingleAsync(token)).DescriptionError);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkPreviews Previews() => new(_harness.Db, _harness.Local, Peer.Http(), _harness.Queue,
|
|
||||||
new StaticOptions<FederationOptions>(new FederationOptions { AllowPrivateNetworks = true, AllowPlainHttp = true }));
|
|
||||||
|
|
||||||
async Task<Post> Linking(PostVisibility visibility, string path)
|
|
||||||
{
|
|
||||||
var post = new Post
|
|
||||||
{
|
|
||||||
ObjectURI = $"https://elsewhere.example/notes/{Guid.NewGuid():N}", IsFederatedCopy = true, Visibility = visibility,
|
|
||||||
ContentHtml = $"<p>read <a href=\"{_harness.Peer.A}{path}\">this</a></p>"
|
|
||||||
};
|
|
||||||
await DB.Default.SaveAsync(post, TestContext.Current.CancellationToken);
|
|
||||||
_harness.Peer.ServeText(path, """
|
|
||||||
<html><head><title>Fallback</title>
|
|
||||||
<meta property="og:title" content="A headline">
|
|
||||||
<meta property="og:description" content="What it says">
|
|
||||||
<meta property="og:image" content="/cover.jpg">
|
|
||||||
</head><body></body></html>
|
|
||||||
""", "text/html; charset=utf-8");
|
|
||||||
return post;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_link_preview_is_built_from_open_graph_for_a_public_post_only()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var publicPath = $"/articles/{Guid.NewGuid():N}";
|
|
||||||
var privatePath = $"/articles/{Guid.NewGuid():N}";
|
|
||||||
var open = await Linking(PostVisibility.Public, publicPath);
|
|
||||||
var followersOnly = await Linking(PostVisibility.FollowersOnly, privatePath);
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, (await Previews().Handle(new Job { Kind = JobKind.FetchPreview, Payload = open.ID }, token)).Result);
|
|
||||||
Assert.Equal(JobResult.Done, (await Previews().Handle(new Job { Kind = JobKind.FetchPreview, Payload = followersOnly.ID }, token)).Result);
|
|
||||||
|
|
||||||
var card = (await DB.Default.Find<Post>().OneAsync(open.ID, token)).Link;
|
|
||||||
Assert.Equal(_harness.Peer.A + publicPath, card.Href);
|
|
||||||
Assert.Equal(("A headline", "What it says", _harness.Peer.A + "/cover.jpg"), (card.Title, card.Description, card.ImageURL));
|
|
||||||
Assert.True(await DB.Default.Find<LinkPreview>().Match(p => p.Url == _harness.Peer.A + publicPath).ExecuteAnyAsync(token));
|
|
||||||
Assert.Null((await DB.Default.Find<Post>().OneAsync(followersOnly.ID, token)).Link);
|
|
||||||
Assert.DoesNotContain(_harness.Peer.Requests, r => r.Path == privatePath);
|
|
||||||
Assert.False(await DB.Default.Find<LinkPreview>().Match(p => p.Url == _harness.Peer.A + privatePath).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_janitor_removes_stale_unattached_uploads_and_trims_the_proxy_cache_oldest_first()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var root = Path.Combine(Path.GetTempPath(), $"privapub-janitor-{Guid.NewGuid():N}");
|
|
||||||
var options = new StaticOptions<MediaOptions>(new MediaOptions { Root = root, ProxyCacheBytes = 800 });
|
|
||||||
var media = new MediaService(options, _harness.Local, default, NullLogger<MediaService>.Instance);
|
|
||||||
var seeded = new List<string>();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MediaAttachment Upload(string name, DateTime created, string postId = default)
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(Path.Combine(root, "files"));
|
|
||||||
File.WriteAllBytes(Path.Combine(root, "files", name), new byte[] { 1, 2, 3 });
|
|
||||||
File.WriteAllBytes(Path.Combine(root, "files", "small-" + name), new byte[] { 1 });
|
|
||||||
return new MediaAttachment { FilePath = Path.Combine("files", name), PreviewPath = Path.Combine("files", "small-" + name), CreatedAt = created, PostId = postId };
|
|
||||||
}
|
|
||||||
var stale = Upload("stale.webp", DateTime.UtcNow.AddDays(-2));
|
|
||||||
var fresh = Upload("fresh.webp", DateTime.UtcNow.AddHours(-1));
|
|
||||||
var attached = Upload("attached.webp", DateTime.UtcNow.AddDays(-3), "000000000000000000000001");
|
|
||||||
await DB.Default.SaveAsync(new[] { stale, fresh, attached }, token);
|
|
||||||
seeded.AddRange(new[] { stale.ID, fresh.ID, attached.ID });
|
|
||||||
Directory.CreateDirectory(media.ProxyRoot);
|
|
||||||
FileInfo Cached(string name, int bytes, int minutesAgo)
|
|
||||||
{
|
|
||||||
var path = Path.Combine(media.ProxyRoot, name);
|
|
||||||
File.WriteAllBytes(path, new byte[bytes]);
|
|
||||||
File.WriteAllText(path + ".type", "image/png");
|
|
||||||
File.SetLastWriteTimeUtc(path, DateTime.UtcNow.AddMinutes(-minutesAgo));
|
|
||||||
return new FileInfo(path);
|
|
||||||
}
|
|
||||||
var oldest = Cached("a", 600, 30);
|
|
||||||
var older = Cached("b", 400, 20);
|
|
||||||
var newest = Cached("c", 300, 10);
|
|
||||||
|
|
||||||
await new MediaJanitor(media, options, NullLogger<MediaJanitor>.Instance).Sweep(token);
|
|
||||||
|
|
||||||
Assert.False(await DB.Default.Find<MediaAttachment>().Match(m => m.ID == stale.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.False(File.Exists(Path.Combine(root, stale.FilePath)));
|
|
||||||
Assert.False(File.Exists(Path.Combine(root, stale.PreviewPath)));
|
|
||||||
Assert.True(await DB.Default.Find<MediaAttachment>().Match(m => m.ID == fresh.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(await DB.Default.Find<MediaAttachment>().Match(m => m.ID == attached.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(File.Exists(Path.Combine(root, fresh.FilePath)));
|
|
||||||
Assert.False(File.Exists(oldest.FullName));
|
|
||||||
Assert.False(File.Exists(oldest.FullName + ".type"));
|
|
||||||
Assert.True(File.Exists(older.FullName));
|
|
||||||
Assert.True(File.Exists(older.FullName + ".type"));
|
|
||||||
Assert.True(File.Exists(newest.FullName));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await DB.Default.DeleteAsync<MediaAttachment>(m => seeded.Contains(m.ID));
|
|
||||||
foreach (var directory in new[] { root, media.ProxyRoot }.Where(Directory.Exists))
|
|
||||||
Directory.Delete(directory, recursive: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class OAuthPrunerTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public async Task Old_tokens_and_authorizations_that_are_no_longer_valid_are_pruned_and_the_rest_kept()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var host = await PrivaPubHost.Shared();
|
|
||||||
var now = DateTimeOffset.UtcNow;
|
|
||||||
using var scope = host.Services.CreateScope();
|
|
||||||
var tokens = scope.ServiceProvider.GetRequiredService<IOpenIddictTokenManager>();
|
|
||||||
var authorizations = scope.ServiceProvider.GetRequiredService<IOpenIddictAuthorizationManager>();
|
|
||||||
var subject = $"pruned{Guid.NewGuid():N}";
|
|
||||||
async Task<string> Token(DateTimeOffset created, DateTimeOffset expires, string status) =>
|
|
||||||
await tokens.GetIdAsync(await tokens.CreateAsync(new OpenIddictTokenDescriptor
|
|
||||||
{
|
|
||||||
CreationDate = created, ExpirationDate = expires, Status = status, Subject = subject, Type = OpenIddictConstants.TokenTypeHints.AccessToken
|
|
||||||
}, token), token);
|
|
||||||
async Task<string> Authorization(DateTimeOffset created, string status) =>
|
|
||||||
await authorizations.GetIdAsync(await authorizations.CreateAsync(new OpenIddictAuthorizationDescriptor
|
|
||||||
{
|
|
||||||
CreationDate = created, Status = status, Subject = subject, Type = OpenIddictConstants.AuthorizationTypes.Permanent
|
|
||||||
}, token), token);
|
|
||||||
var expired = await Token(now.AddDays(-30), now.AddDays(-29), OpenIddictConstants.Statuses.Valid);
|
|
||||||
var revoked = await Token(now.AddDays(-30), now.AddDays(1), OpenIddictConstants.Statuses.Revoked);
|
|
||||||
var current = await Token(now.AddMinutes(-5), now.AddHours(1), OpenIddictConstants.Statuses.Valid);
|
|
||||||
var recentlyRevoked = await Token(now.AddDays(-1), now.AddDays(-1).AddMinutes(1), OpenIddictConstants.Statuses.Revoked);
|
|
||||||
var oldRevoked = await Authorization(now.AddDays(-30), OpenIddictConstants.Statuses.Revoked);
|
|
||||||
var oldValid = await Authorization(now.AddDays(-30), OpenIddictConstants.Statuses.Valid);
|
|
||||||
|
|
||||||
var (prunedTokens, prunedAuthorizations) = await new OAuthPruner(host.Services, NullLogger<OAuthPruner>.Instance).Prune(now.AddDays(-14), token);
|
|
||||||
|
|
||||||
Assert.True(prunedTokens >= 2, $"{prunedTokens} tokens pruned");
|
|
||||||
Assert.True(prunedAuthorizations >= 1, $"{prunedAuthorizations} authorizations pruned");
|
|
||||||
//a fresh scope: the managers cache what they created
|
|
||||||
using var after = host.Services.CreateScope();
|
|
||||||
tokens = after.ServiceProvider.GetRequiredService<IOpenIddictTokenManager>();
|
|
||||||
authorizations = after.ServiceProvider.GetRequiredService<IOpenIddictAuthorizationManager>();
|
|
||||||
Assert.Null(await tokens.FindByIdAsync(expired, token));
|
|
||||||
Assert.Null(await tokens.FindByIdAsync(revoked, token));
|
|
||||||
Assert.NotNull(await tokens.FindByIdAsync(current, token));
|
|
||||||
Assert.NotNull(await tokens.FindByIdAsync(recentlyRevoked, token));
|
|
||||||
Assert.Null(await authorizations.FindByIdAsync(oldRevoked, token));
|
|
||||||
Assert.NotNull(await authorizations.FindByIdAsync(oldValid, token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Xunit.Collection(nameof(Exclusive))]
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class DeliveryOutcomeTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
static readonly string[] PeerHosts = { "localhost", "127.0.0.1" };
|
|
||||||
|
|
||||||
Harness _harness;
|
|
||||||
WebApplication _hinting;
|
|
||||||
string _hintingBase;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
await DB.Default.DeleteAsync<RemoteInstance>(i => PeerHosts.Contains(i.Host));
|
|
||||||
var builder = WebApplication.CreateSlimBuilder();
|
|
||||||
builder.WebHost.UseUrls("http://127.0.0.1:0");
|
|
||||||
_hinting = builder.Build();
|
|
||||||
//answers /{status}/{retry-after}: the peer cannot send a Retry-After
|
|
||||||
_hinting.Run(context =>
|
|
||||||
{
|
|
||||||
var parts = context.Request.Path.Value!.Trim('/').Split('/');
|
|
||||||
context.Response.StatusCode = int.Parse(parts[0]);
|
|
||||||
if (parts.Length > 1)
|
|
||||||
context.Response.Headers.RetryAfter = parts[1] == "date"
|
|
||||||
? DateTimeOffset.UtcNow.AddMinutes(10).ToString("r")
|
|
||||||
: parts[1];
|
|
||||||
return Task.CompletedTask;
|
|
||||||
});
|
|
||||||
await _hinting.StartAsync();
|
|
||||||
_hintingBase = _hinting.Urls.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_hinting != default)
|
|
||||||
await _hinting.DisposeAsync();
|
|
||||||
if (_harness == default)
|
|
||||||
return;
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
await DB.Default.DeleteAsync<RemoteInstance>(i => PeerHosts.Contains(i.Host));
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<JobOutcome> Attempt(LocalActor signer, string inbox)
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var id = $"{Harness.Base}/a/{Guid.NewGuid():N}";
|
|
||||||
await _harness.Delivery.Enqueue(signer, new[] { inbox }, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = id, ["type"] = "Create", ["actor"] = signer.Uri, ["to"] = new JsonArray(Addressing.Public),
|
|
||||||
["object"] = new JsonObject { ["type"] = "Note", ["content"] = "hi" }
|
|
||||||
}, token);
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.DedupeKey == $"{id}|{inbox}").ExecuteSingleAsync(token);
|
|
||||||
job.Attempts = 1;
|
|
||||||
var handler = new DeliveryJobHandler(_harness.Local, Peer.Http(), new HostCircuitBreaker(new MemoryCache(new MemoryCacheOptions())),
|
|
||||||
NullLogger<DeliveryJobHandler>.Instance);
|
|
||||||
return await handler.Handle(job, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_delivery_carries_a_valid_digest_and_a_signature_by_the_signer()
|
|
||||||
{
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
_harness.Peer.Answer("/ok/inbox", 202);
|
|
||||||
|
|
||||||
var outcome = await Attempt(alice, _harness.Peer.A + "/ok/inbox");
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Done, outcome.Result);
|
|
||||||
var received = Assert.Single(_harness.Peer.Requests, r => r.Path == "/ok/inbox");
|
|
||||||
Assert.Equal("POST", received.Method);
|
|
||||||
Assert.Equal(alice.Uri, JsonNode.Parse(received.Body)!["actor"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpSignatures.Digest(Encoding.UTF8.GetBytes(received.Body)), received.Headers["Digest"]);
|
|
||||||
var signature = HttpSignatures.Parse(received.Signature);
|
|
||||||
Assert.Equal(alice.KeyId, signature.KeyId);
|
|
||||||
Assert.Equal(new[] { "(request-target)", "host", "date", "digest" }, signature.Headers);
|
|
||||||
var signingString = $"(request-target): post /ok/inbox\nhost: {received.Headers["Host"]}\ndate: {received.Headers["Date"]}\ndigest: {received.Headers["Digest"]}";
|
|
||||||
using var key = RSA.Create();
|
|
||||||
key.ImportFromPem(alice.PublicKeyPem);
|
|
||||||
Assert.True(key.VerifyData(Encoding.UTF8.GetBytes(signingString), signature.Signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Refusals_are_dead_hints_defer_and_failures_retry()
|
|
||||||
{
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
_harness.Peer.Answer("/gone/inbox", 410);
|
|
||||||
_harness.Peer.Answer("/missing/inbox", 404);
|
|
||||||
_harness.Peer.Answer("/broken/inbox", 500);
|
|
||||||
|
|
||||||
var gone = await Attempt(alice, _harness.Peer.A + "/gone/inbox");
|
|
||||||
var missing = await Attempt(alice, _harness.Peer.A + "/missing/inbox");
|
|
||||||
var busy = await Attempt(alice, _hintingBase + "/429/120");
|
|
||||||
var down = await Attempt(alice, _hintingBase + "/503/date");
|
|
||||||
var unhinted = await Attempt(alice, _hintingBase + "/503");
|
|
||||||
var broken = await Attempt(alice, _harness.Peer.A + "/broken/inbox");
|
|
||||||
|
|
||||||
Assert.Equal(JobResult.Dead, gone.Result);
|
|
||||||
Assert.StartsWith("410", gone.Error);
|
|
||||||
Assert.Equal(JobResult.Dead, missing.Result);
|
|
||||||
Assert.Equal(JobResult.Defer, busy.Result);
|
|
||||||
Assert.InRange(busy.RetryAt!.Value, DateTime.UtcNow.AddSeconds(100), DateTime.UtcNow.AddSeconds(125));
|
|
||||||
Assert.Equal(JobResult.Defer, down.Result);
|
|
||||||
Assert.InRange(down.RetryAt!.Value, DateTime.UtcNow.AddMinutes(9), DateTime.UtcNow.AddMinutes(11));
|
|
||||||
Assert.Equal(JobResult.Retry, unhinted.Result);
|
|
||||||
Assert.Equal(JobResult.Retry, broken.Result);
|
|
||||||
Assert.StartsWith("500", broken.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class NoteParserTests
|
|
||||||
{
|
|
||||||
const string MastodonNote = """
|
|
||||||
{
|
|
||||||
"id": "https://m.example/users/alice/statuses/1",
|
|
||||||
"type": "Note",
|
|
||||||
"summary": "spoilers",
|
|
||||||
"inReplyTo": "https://privapub.test/peasants/bob/posts/abc",
|
|
||||||
"published": "2026-09-30T10:00:00Z",
|
|
||||||
"url": "https://m.example/@alice/1",
|
|
||||||
"attributedTo": "https://m.example/users/alice",
|
|
||||||
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
|
||||||
"cc": ["https://m.example/users/alice/followers", "https://privapub.test/peasants/bob"],
|
|
||||||
"sensitive": true,
|
|
||||||
"conversation": "tag:m.example,2026-09-30:objectId=1:objectType=Conversation",
|
|
||||||
"context": "https://m.example/contexts/1",
|
|
||||||
"content": "<p><span class=\"h-card\"><a href=\"https://privapub.test/peasants/bob\" class=\"u-url mention\">@<span>bob</span></a></span> hi <a href=\"https://m.example/tags/Fedi\" class=\"mention hashtag\" rel=\"tag\">#<span>Fedi</span></a><script>x</script></p>",
|
|
||||||
"contentMap": { "en": "<p>hi</p>" },
|
|
||||||
"attachment": [{
|
|
||||||
"type": "Document", "mediaType": "image/png", "url": "https://files.m.example/a.png",
|
|
||||||
"name": "a cat", "blurhash": "UBL_:rOpGG-oBUNG,qRj2so|=eE1w^n4S5NH", "focalPoint": [0.5, -2.0], "width": 640, "height": 480
|
|
||||||
}],
|
|
||||||
"tag": [
|
|
||||||
{ "type": "Mention", "href": "https://privapub.test/peasants/bob", "name": "@bob@privapub.test" },
|
|
||||||
{ "type": "Hashtag", "href": "https://m.example/tags/fedi", "name": "#Fedi" },
|
|
||||||
{ "type": "Emoji", "name": ":blob:", "icon": { "type": "Image", "url": "https://files.m.example/blob.png" } }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""";
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Reads_a_mastodon_note()
|
|
||||||
{
|
|
||||||
var note = NoteParser.Parse(JsonNode.Parse(MastodonNote));
|
|
||||||
|
|
||||||
Assert.Equal("https://m.example/users/alice", note.AttributedTo);
|
|
||||||
Assert.Equal("spoilers", note.SpoilerText);
|
|
||||||
Assert.True(note.Sensitive);
|
|
||||||
Assert.Equal("en", note.Language);
|
|
||||||
Assert.Equal("https://m.example/@alice/1", note.Url);
|
|
||||||
Assert.Equal("https://m.example/contexts/1", note.Context);
|
|
||||||
Assert.DoesNotContain("<script>", note.ContentHtml);
|
|
||||||
Assert.Contains("u-url mention", note.ContentHtml);
|
|
||||||
Assert.Equal("https://privapub.test/peasants/bob", Assert.Single(note.Mentions).ActorURI);
|
|
||||||
Assert.Equal("fedi", Assert.Single(note.Tags));
|
|
||||||
var media = Assert.Single(note.Attachments);
|
|
||||||
Assert.Equal("a cat", media.Description);
|
|
||||||
Assert.Equal(new[] { 0.5f, -1f }, media.Focus);
|
|
||||||
Assert.Equal(new DateTime(2026, 9, 30, 10, 0, 0, DateTimeKind.Utc), note.Published);
|
|
||||||
Assert.Null(note.Updated);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Reads_a_lemmy_page_with_a_title()
|
|
||||||
{
|
|
||||||
var note = NoteParser.Parse(JsonNode.Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://l.example/post/7", "type": "Page", "name": "A title",
|
|
||||||
"attributedTo": "https://l.example/u/carol", "audience": "https://l.example/c/cats",
|
|
||||||
"content": "<p>body</p>", "to": ["https://l.example/c/cats", "https://www.w3.org/ns/activitystreams#Public"],
|
|
||||||
"published": "2026-09-30T10:00:00.123456+00:00"
|
|
||||||
}
|
|
||||||
"""));
|
|
||||||
|
|
||||||
Assert.Equal("A title", note.Title);
|
|
||||||
Assert.Equal("https://l.example/c/cats", note.Audience);
|
|
||||||
Assert.False(note.Sensitive);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Falls_back_to_misskey_content_and_takes_the_person_from_a_peertube_attribution()
|
|
||||||
{
|
|
||||||
var note = NoteParser.Parse(JsonNode.Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://k.example/notes/9", "type": "Note",
|
|
||||||
"attributedTo": [{ "type": "Group", "id": "https://k.example/c/chan" }, { "type": "Person", "id": "https://k.example/users/9" }],
|
|
||||||
"_misskey_content": "hello <b>there</b>\nnext", "_misskey_quote": "https://k.example/notes/8"
|
|
||||||
}
|
|
||||||
"""));
|
|
||||||
|
|
||||||
Assert.Equal("https://k.example/users/9", note.AttributedTo);
|
|
||||||
Assert.Equal("hello <b>there</b><br>next", note.ContentHtml);
|
|
||||||
Assert.Equal("https://k.example/notes/8", note.QuoteUri);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("Article", false, false)]
|
|
||||||
[InlineData("Event", false, false)]
|
|
||||||
[InlineData("Video", false, false)]
|
|
||||||
[InlineData("Page", false, false)]
|
|
||||||
[InlineData("Note", false, true)]
|
|
||||||
[InlineData("Question", false, true)]
|
|
||||||
[InlineData("Article", true, true)]
|
|
||||||
public void A_summary_warns_only_on_notes_or_when_marked_sensitive(string type, bool sensitive, bool warns)
|
|
||||||
{
|
|
||||||
var note = NoteParser.Parse(JsonNode.Parse($$"""
|
|
||||||
{
|
|
||||||
"id": "https://w.example/?p=12", "type": "{{type}}", "name": "Twelve", "summary": "Saturday, 10:00 at the library",
|
|
||||||
"sensitive": {{(sensitive ? "true" : "false")}}, "attributedTo": "https://w.example/author", "content": "<p>body</p>"
|
|
||||||
}
|
|
||||||
"""));
|
|
||||||
|
|
||||||
Assert.Equal(warns, note.Sensitive);
|
|
||||||
Assert.Equal(warns ? "Saturday, 10:00 at the library" : null, note.SpoilerText);
|
|
||||||
Assert.Equal(warns ? null : "Saturday, 10:00 at the library", note.Excerpt);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("""{ "id": "https://x.example/1", "type": "Person" }""")]
|
|
||||||
[InlineData("""{ "id": "not a uri", "type": "Note" }""")]
|
|
||||||
[InlineData("""[1, 2]""")]
|
|
||||||
public void Refuses_what_is_not_a_note(string json) =>
|
|
||||||
Assert.Null(NoteParser.Parse(JsonNode.Parse(json)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AddressingTests
|
|
||||||
{
|
|
||||||
const string Followers = "https://m.example/users/alice/followers";
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(new[] { Addressing.Public }, new[] { Followers }, PostVisibility.Public)]
|
|
||||||
[InlineData(new[] { "as:Public" }, new string[0], PostVisibility.Public)]
|
|
||||||
[InlineData(new[] { Followers }, new[] { Addressing.Public }, PostVisibility.Unlisted)]
|
|
||||||
[InlineData(new[] { Followers }, new[] { "https://privapub.test/peasants/bob" }, PostVisibility.FollowersOnly)]
|
|
||||||
[InlineData(new[] { "https://privapub.test/peasants/bob" }, new string[0], PostVisibility.Direct)]
|
|
||||||
[InlineData(new[] { "https://m.example/users/mallory/followers" }, new string[0], PostVisibility.Direct)]
|
|
||||||
public void Classifies_like_mastodon(string[] to, string[] cc, PostVisibility expected) =>
|
|
||||||
Assert.Equal(expected, Addressing.Classify(to, cc, Followers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using PrivaPub.Federation.Objects;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ObjectRecordsTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void An_object_larger_than_the_cap_keeps_only_its_hash()
|
|
||||||
{
|
|
||||||
var big = new JsonObject { ["content"] = new string('x', ObjectRecords.MaxRawBytes + 1) };
|
|
||||||
|
|
||||||
var (text, hash, bytes, truncated) = ObjectRecords.Capture(big);
|
|
||||||
|
|
||||||
Assert.Null(text);
|
|
||||||
Assert.True(truncated);
|
|
||||||
Assert.True(bytes > ObjectRecords.MaxRawBytes);
|
|
||||||
Assert.Equal(64, hash.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_small_object_is_kept_whole_with_its_hash()
|
|
||||||
{
|
|
||||||
var small = new JsonObject { ["type"] = "Note", ["content"] = "hi" };
|
|
||||||
|
|
||||||
var (text, hash, bytes, truncated) = ObjectRecords.Capture(small);
|
|
||||||
|
|
||||||
Assert.Equal(small.ToJsonString(), text);
|
|
||||||
Assert.False(truncated);
|
|
||||||
Assert.Equal(text.Length, bytes);
|
|
||||||
Assert.Equal(64, hash.Length);
|
|
||||||
Assert.Equal(default, ObjectRecords.Capture(default));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
using PrivaPub.Api.Mastodon.Mappers;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ObjectShapesTests
|
|
||||||
{
|
|
||||||
static NoteDocument Parse(string json) => NoteParser.Parse(JsonNode.Parse(json));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_a_peertube_video_with_its_files_poster_captions_and_markdown_description()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://tube.example/videos/watch/1", "type": "Video", "name": "A *talk*", "duration": "PT6299S",
|
|
||||||
"mediaType": "text/markdown", "content": "**Bold** words", "sensitive": false, "views": 14771, "state": 1,
|
|
||||||
"isLiveBroadcast": false, "commentsPolicy": 2, "downloadEnabled": true,
|
|
||||||
"licence": { "identifier": "5", "name": "Attribution - Share Alike" }, "category": { "identifier": "2", "name": "Films" },
|
|
||||||
"attributedTo": [{ "type": "Person", "id": "https://tube.example/accounts/ann" }, { "type": "Group", "id": "https://tube.example/video-channels/films" }],
|
|
||||||
"icon": [
|
|
||||||
{ "type": "Image", "url": "https://tube.example/thumb-280.jpg", "mediaType": "image/jpeg", "width": 280, "height": 157 },
|
|
||||||
{ "type": "Image", "url": "https://tube.example/thumb-1920.jpg", "mediaType": "image/jpeg", "width": 1920, "height": 1080 },
|
|
||||||
{ "type": "Image", "url": "https://tube.example/thumb-850.jpg", "mediaType": "image/jpeg", "width": 850, "height": 480 }
|
|
||||||
],
|
|
||||||
"subtitleLanguage": [{ "identifier": "en", "url": [{ "mediaType": "text/vtt", "href": "https://tube.example/en.vtt" }] }],
|
|
||||||
"url": [
|
|
||||||
{ "type": "Link", "mediaType": "text/html", "href": "https://tube.example/w/abc" },
|
|
||||||
{ "type": "Link", "mediaType": "video/mp4", "href": "https://tube.example/720.mp4", "height": 720, "width": 1280, "fps": 24, "size": 942586378,
|
|
||||||
"attachment": [{ "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "audio" }, { "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "video" }] },
|
|
||||||
{ "type": "Link", "mediaType": "application/x-mpegURL", "href": "https://tube.example/master.m3u8" },
|
|
||||||
{ "type": "Link", "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", "href": "magnet:?xt=urn:btih:abc" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("https://tube.example/w/abc", note.Url);
|
|
||||||
Assert.Equal("A *talk*", note.Title);
|
|
||||||
Assert.Contains("<strong>Bold</strong>", note.ContentHtml);
|
|
||||||
Assert.Equal("https://tube.example/thumb-850.jpg", note.CoverURL);
|
|
||||||
Assert.Equal(6299, note.Video.DurationSeconds);
|
|
||||||
var file = Assert.Single(note.Video.Variants);
|
|
||||||
Assert.Equal(new[] { "audio", "video" }, file.Streams);
|
|
||||||
Assert.Equal(942586378, file.Size);
|
|
||||||
Assert.Equal("https://tube.example/master.m3u8", note.Video.PlaylistURL);
|
|
||||||
Assert.Equal(2, note.Video.CommentsPolicy);
|
|
||||||
Assert.Equal("Attribution - Share Alike", note.Video.Licence);
|
|
||||||
Assert.Equal("https://tube.example/video-channels/films", note.Video.ChannelURI);
|
|
||||||
Assert.Equal("https://tube.example/en.vtt", Assert.Single(note.Video.Captions).Url);
|
|
||||||
Assert.Equal("https://tube.example/accounts/ann", note.AttributedTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_a_mobilizon_event_with_its_time_place_and_online_link()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://events.example/events/9", "type": "Event", "name": "Repair café",
|
|
||||||
"summary": "<p>Saturday at the library</p>", "content": "<p>Bring broken things.</p>",
|
|
||||||
"startTime": "2026-10-03T10:00:00+02:00", "endTime": "2026-10-03T13:00:00+02:00", "timezone": "Europe/Rome",
|
|
||||||
"joinMode": "free", "participantCount": 12, "maximumAttendeeCapacity": 40, "ical:status": "CONFIRMED",
|
|
||||||
"location": { "type": "Place", "name": "Biblioteca", "latitude": 45.07, "longitude": 7.68,
|
|
||||||
"address": { "type": "PostalAddress", "streetAddress": "Via Roma 1", "addressLocality": "Torino", "addressCountry": "IT" } },
|
|
||||||
"attachment": [{ "type": "Link", "name": "Website", "href": "https://meet.example/repair" }],
|
|
||||||
"attributedTo": "https://events.example/@club"
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Null(note.SpoilerText);
|
|
||||||
Assert.False(note.Sensitive);
|
|
||||||
Assert.Equal("Saturday at the library", note.Excerpt);
|
|
||||||
Assert.Equal(new DateTime(2026, 10, 3, 8, 0, 0, DateTimeKind.Utc), note.Event.Start);
|
|
||||||
Assert.Equal("Via Roma 1, Torino, IT", Assert.Single(note.Event.Places).Address);
|
|
||||||
Assert.Equal("https://meet.example/repair", note.Event.OnlineURL);
|
|
||||||
Assert.Equal(40, note.Event.Capacity);
|
|
||||||
Assert.Equal("CONFIRMED", note.Event.Status);
|
|
||||||
Assert.Equal("2026-10-03 10:00 – 13:00 (Europe/Rome) · Biblioteca", MastodonMapper.EventLine(note.Event));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_a_lemmy_link_post_as_a_link_with_its_thumbnail()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://lemmy.example/post/5", "type": "Page", "name": "A good read", "attributedTo": "https://lemmy.example/u/bo",
|
|
||||||
"attachment": [{ "type": "Link", "href": "https://news.example/story", "mediaType": "text/html" }],
|
|
||||||
"image": { "type": "Image", "url": "https://lemmy.example/pictrs/thumb.jpg" },
|
|
||||||
"language": { "identifier": "en", "name": "English" }
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("https://news.example/story", note.Link.Href);
|
|
||||||
Assert.Equal("https://lemmy.example/pictrs/thumb.jpg", note.Link.ImageURL);
|
|
||||||
Assert.False(note.Link.FromPublisher);
|
|
||||||
Assert.Empty(note.Attachments);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Takes_a_publisher_supplied_preview_from_a_link_attachment()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://m.example/statuses/1", "type": "Note", "attributedTo": "https://m.example/users/a", "content": "<p>look</p>",
|
|
||||||
"attachment": [{ "type": "Link", "href": "https://news.example/a",
|
|
||||||
"preview": { "type": "Article", "name": "Headline & more", "summary": "<p>What happened</p>", "image": { "type": "Image", "url": "https://news.example/a.jpg" } } }]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("Headline & more", note.Link.Title);
|
|
||||||
Assert.Equal("What happened", note.Link.Description);
|
|
||||||
Assert.Equal("https://news.example/a.jpg", note.Link.ImageURL);
|
|
||||||
Assert.True(note.Link.FromPublisher);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Reads_media_in_every_shape_and_infers_what_is_missing()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://bsky.brid.gy/convert/ap/at://did:plc:x/post/1", "type": "Note", "attributedTo": "https://bsky.brid.gy/ap/did:plc:x",
|
|
||||||
"content": "<p>pics</p>",
|
|
||||||
"@context": ["https://www.w3.org/ns/activitystreams", { "@language": "de" }],
|
|
||||||
"attachment": [
|
|
||||||
{ "type": "Image", "url": "https://cdn.example/a.jpeg", "summary": "alt from summary" },
|
|
||||||
{ "type": "Document", "url": [{ "type": "Link", "href": "https://cdn.example/clip", "mediaType": "video/mp4" }],
|
|
||||||
"icon": { "type": "Image", "url": "https://cdn.example/clip.jpg" }, "duration": "PT12.4S", "sensitive": true },
|
|
||||||
{ "type": "Image", "url": "https://cdn.example/nameless" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("de", note.Language);
|
|
||||||
Assert.Equal("image/jpeg", note.Attachments[0].ContentType);
|
|
||||||
Assert.Equal("alt from summary", note.Attachments[0].Description);
|
|
||||||
Assert.Equal("https://cdn.example/clip", note.Attachments[1].RemoteURL);
|
|
||||||
Assert.Equal("video/mp4", note.Attachments[1].ContentType);
|
|
||||||
Assert.Equal("https://cdn.example/clip.jpg", note.Attachments[1].RemotePreviewURL);
|
|
||||||
Assert.Equal(12.4, note.Attachments[1].DurationSeconds);
|
|
||||||
Assert.True(note.Attachments[1].Sensitive);
|
|
||||||
Assert.Equal("image/*", note.Attachments[2].ContentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_a_funkwhale_track_and_a_loops_poster()
|
|
||||||
{
|
|
||||||
var track = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://music.example/federation/music/uploads/1", "type": "Audio", "name": "Song", "attributedTo": "https://music.example/@band",
|
|
||||||
"summary": "#rock #live", "duration": 241, "position": 3, "album": "https://music.example/albums/2", "license": "https://creativecommons.org/licenses/by/4.0/",
|
|
||||||
"url": [{ "type": "Link", "mediaType": "text/html", "href": "https://music.example/library/tracks/1" },
|
|
||||||
{ "type": "Link", "mediaType": "audio/mpeg", "href": "https://music.example/listen/1.mp3", "bitrate": 320000, "size": 9640000 }]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
var loop = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://loops.example/v/1", "type": "Note", "attributedTo": "https://loops.example/@dancer", "content": "",
|
|
||||||
"preview": { "type": "Image", "url": { "href": "https://loops.example/poster.jpg", "mediaType": "image/jpeg" } },
|
|
||||||
"attachment": [{ "type": "Document", "mediaType": "video/mp4", "url": "https://loops.example/v/1.mp4", "width": 720, "height": 1280 }]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal("#rock #live", track.Excerpt);
|
|
||||||
Assert.Null(track.SpoilerText);
|
|
||||||
Assert.Equal(241, track.Audio.DurationSeconds);
|
|
||||||
Assert.Equal(3, track.Audio.Position);
|
|
||||||
Assert.Equal("https://music.example/listen/1.mp3", Assert.Single(track.Audio.Variants).Url);
|
|
||||||
Assert.Equal("https://loops.example/poster.jpg", loop.CoverURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_custom_emoji_and_drops_ones_that_could_not_render()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://k.example/notes/1", "type": "Note", "attributedTo": "https://k.example/users/1", "content": ":blobcat: hi :bad:",
|
|
||||||
"tag": [
|
|
||||||
{ "type": "Emoji", "name": ":blobcat:", "updated": "2026-01-01T00:00:00Z", "icon": { "type": "Image", "mediaType": "image/png", "url": "https://k.example/emoji/blobcat.png" } },
|
|
||||||
{ "type": "Emoji", "name": ":blobcat:", "icon": { "type": "Image", "url": "https://k.example/emoji/duplicate.png" } },
|
|
||||||
{ "type": "Emoji", "name": ":bad name:", "icon": { "type": "Image", "url": "https://k.example/emoji/x.png" } },
|
|
||||||
{ "type": "Emoji", "name": ":nourl:", "icon": { "type": "Image", "url": "data:image/png;base64,AAAA" } }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
var emoji = Assert.Single(note.Emojis);
|
|
||||||
Assert.Equal("blobcat", emoji.Shortcode);
|
|
||||||
Assert.Equal("https://k.example/emoji/blobcat.png", emoji.URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Reads_polls_from_mastodon_misskey_and_closed_ones()
|
|
||||||
{
|
|
||||||
var mastodon = Parse("""
|
|
||||||
{ "id": "https://m.example/q/1", "type": "Question", "attributedTo": "https://m.example/u", "content": "?", "endTime": "2026-10-02T00:00:00Z", "votersCount": 7,
|
|
||||||
"oneOf": [{ "type": "Note", "name": "a", "replies": { "type": "Collection", "totalItems": 4 } }, { "type": "Note", "name": "b", "replies": { "type": "Collection", "totalItems": 3 } }] }
|
|
||||||
""");
|
|
||||||
var misskey = Parse("""
|
|
||||||
{ "id": "https://k.example/q/1", "type": "Question", "attributedTo": "https://k.example/u", "_misskey_content": "?",
|
|
||||||
"anyOf": [{ "type": "Note", "name": "x", "_misskey_votes": 2 }, { "type": "Note", "name": "y", "_misskey_votes": 5 }] }
|
|
||||||
""");
|
|
||||||
var closed = Parse("""
|
|
||||||
{ "id": "https://g.example/q/1", "type": "Question", "attributedTo": "https://g.example/u", "content": "?", "closed": "2026-09-30T12:00:00Z",
|
|
||||||
"oneOf": [{ "type": "Note", "name": "p" }, { "type": "Note", "name": "q" }] }
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.False(mastodon.Poll.Multiple);
|
|
||||||
Assert.Equal(new[] { 4, 3 }, mastodon.Poll.Options.Select(o => o.Votes));
|
|
||||||
Assert.Equal(7, mastodon.Poll.VotersCount);
|
|
||||||
Assert.True(misskey.Poll.Multiple);
|
|
||||||
Assert.Equal(new[] { 2, 5 }, misskey.Poll.Options.Select(o => o.Votes));
|
|
||||||
Assert.Null(misskey.Poll.VotersCount);
|
|
||||||
Assert.Equal(new DateTime(2026, 9, 30, 12, 0, 0, DateTimeKind.Utc), closed.Poll.ClosedAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Finds_playable_files_inside_an_hls_only_peertube_video_and_picks_one_with_sound()
|
|
||||||
{
|
|
||||||
var note = Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://tube.example/videos/watch/2", "type": "Video", "name": "HLS only", "attributedTo": "https://tube.example/accounts/ann",
|
|
||||||
"url": [
|
|
||||||
{ "type": "Link", "mediaType": "text/html", "href": "https://tube.example/w/def" },
|
|
||||||
{ "type": "Link", "mediaType": "application/x-mpegURL", "href": "https://tube.example/master.m3u8", "tag": [
|
|
||||||
{ "type": "Link", "mediaType": "video/mp4", "href": "https://tube.example/1080-fragmented.mp4", "height": 1080,
|
|
||||||
"attachment": [{ "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "video" }, { "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "audio" }] },
|
|
||||||
{ "type": "Link", "mediaType": "video/mp4", "href": "https://tube.example/720-fragmented.mp4", "height": 720,
|
|
||||||
"attachment": [{ "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "video" }] },
|
|
||||||
{ "type": "Link", "mediaType": "video/mp4", "href": "https://tube.example/480-fragmented.mp4", "height": 480,
|
|
||||||
"attachment": [{ "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "video" }, { "type": "PropertyValue", "name": "ffprobe_codec_type", "value": "audio" }] }
|
|
||||||
] }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
Assert.Equal(3, note.Video.Variants.Count);
|
|
||||||
Assert.Equal("https://tube.example/480-fragmented.mp4", MastodonMapper.BestVideo(note.Video.Variants).Url);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Normalises_hashtags_like_mastodon() =>
|
|
||||||
Assert.Equal("fedi".Normalize(System.Text.NormalizationForm.FormKC).ToLowerInvariant(), Assert.Single(Parse("""
|
|
||||||
{ "id": "https://x.example/1", "type": "Note", "attributedTo": "https://x.example/u", "content": "",
|
|
||||||
"tag": [{ "type": "Hashtag", "name": "#FEDI" }] }
|
|
||||||
""").Tags));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class PollTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
static string NewId(RemoteActor actor, string kind) => $"{Origin(actor)}/{kind}/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
async Task Follows(RemoteActor follower, string target) =>
|
|
||||||
await _harness.Deliver(follower, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(follower, "follows"), ["type"] = "Follow", ["actor"] = follower.Id, ["object"] = target
|
|
||||||
});
|
|
||||||
|
|
||||||
JsonObject Vote(RemoteActor voter, string question, string owner, string choice) => new()
|
|
||||||
{
|
|
||||||
["id"] = NewId(voter, "activities"), ["type"] = "Create", ["actor"] = voter.Id, ["to"] = new JsonArray(owner),
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(voter, "votes"), ["type"] = "Note", ["name"] = choice, ["attributedTo"] = voter.Id,
|
|
||||||
["inReplyTo"] = question, ["to"] = new JsonArray(owner)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_local_poll_goes_out_as_a_question_and_counts_each_remote_voter_once()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await Follows(mallory, alice.Uri);
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "which?", Poll = new PollDraft(new[] { "tea", "coffee" }, 3600, false, false) }, token);
|
|
||||||
Assert.True(outcome.Ok);
|
|
||||||
var question = (await _harness.Outgoing(mallory.Id + "/inbox")).Single(a => a["type"]!.GetValue<string>() == "Create")["object"]!;
|
|
||||||
Assert.Equal("Question", question["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { "tea", "coffee" }, question["oneOf"]!.AsArray().Select(o => o!["name"]!.GetValue<string>()));
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", Vote(mallory, outcome.Post.ObjectURI, alice.Uri, "coffee"));
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", Vote(mallory, outcome.Post.ObjectURI, alice.Uri, "tea"));
|
|
||||||
|
|
||||||
var poll = (await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token)).Poll;
|
|
||||||
Assert.Equal(new[] { 0, 1 }, poll.Options.Select(o => o.Votes));
|
|
||||||
Assert.Equal(1, poll.VotersCount);
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.InReplyToURI == outcome.Post.ObjectURI).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollRefresh && j.Payload == outcome.Post.ID).ExecuteAnyAsync(token));
|
|
||||||
Assert.True(await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollClose && j.Payload == outcome.Post.ID).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_persona_votes_on_a_remote_poll_and_a_count_refresh_is_not_an_edit()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var questionId = NewId(mallory, "questions");
|
|
||||||
JsonObject Question(int first, int second) => new()
|
|
||||||
{
|
|
||||||
["id"] = questionId, ["type"] = "Question", ["attributedTo"] = mallory.Id, ["content"] = "<p>pick</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["cc"] = new JsonArray(alice.Uri),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" }),
|
|
||||||
["endTime"] = DateTime.UtcNow.AddDays(1).ToString("O"),
|
|
||||||
["anyOf"] = new JsonArray(
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "red", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = first } },
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "blue", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = second } })
|
|
||||||
};
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "activities"), ["type"] = "Create", ["actor"] = mallory.Id, ["object"] = Question(3, 1)
|
|
||||||
});
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == questionId).ExecuteFirstAsync(token);
|
|
||||||
Assert.True(post.Poll.Multiple);
|
|
||||||
|
|
||||||
Assert.True((await _harness.Polls.Vote(alice, post, new[] { 0, 1 }, token)).Ok);
|
|
||||||
Assert.False((await _harness.Polls.Vote(alice, post, new[] { 0 }, token)).Ok);
|
|
||||||
|
|
||||||
var votes = (await _harness.Outgoing(mallory.Id + "/inbox")).Where(a => a["type"]!.GetValue<string>() == "Create").Select(a => a["object"]!).ToList();
|
|
||||||
Assert.Equal(new[] { "red", "blue" }, votes.Select(v => v["name"]!.GetValue<string>()).Order().Reverse());
|
|
||||||
Assert.All(votes, v => Assert.Equal(questionId, v["inReplyTo"]!.GetValue<string>()));
|
|
||||||
Assert.All(votes, v => Assert.Null(v["published"]));
|
|
||||||
Assert.Equal(new[] { 0, 1 }, (await _harness.Polls.OwnVotes(post.ID, alice.Id, token)).Order());
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "activities"), ["type"] = "Update", ["actor"] = mallory.Id, ["object"] = Question(9, 5)
|
|
||||||
});
|
|
||||||
var refreshed = await DB.Default.Find<Post>().OneAsync(post.ID, token);
|
|
||||||
Assert.Equal(new[] { 9, 5 }, refreshed.Poll.Options.Select(o => o.Votes));
|
|
||||||
Assert.Empty(refreshed.Revisions);
|
|
||||||
Assert.Null(refreshed.EditedAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Closing_a_poll_tells_its_voters_and_its_author()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "quick", Poll = new PollDraft(new[] { "yes", "no" }, 300, false, false) }, token);
|
|
||||||
Assert.True((await _harness.Polls.Vote(bob, outcome.Post, new[] { 0 }, token)).Ok);
|
|
||||||
Assert.False((await _harness.Polls.Vote(alice, outcome.Post, new[] { 0 }, token)).Ok);
|
|
||||||
|
|
||||||
var job = await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.PollClose && j.Payload == outcome.Post.ID).ExecuteFirstAsync(token);
|
|
||||||
await new PollCloseJob(_harness.Db, _harness.Local, _harness.Outbox).Handle(job, token);
|
|
||||||
|
|
||||||
Assert.NotNull((await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token)).Poll.ClosedAt);
|
|
||||||
var told = await DB.Default.Find<Notification>().Match(n => n.Type == NotificationType.Poll && n.PostId == outcome.Post.ID).ExecuteAsync(token);
|
|
||||||
Assert.Equal(new[] { alice.Id, bob.Id }.Order(), told.Select(n => n.AvatarId).Order());
|
|
||||||
Assert.False((await _harness.Polls.Vote(bob, await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token), new[] { 1 }, token)).Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ProvenanceTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_delivered_post_keeps_its_raw_object_how_it_came_and_every_edit()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var origin = new Uri(mallory.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{origin}/notes/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = mallory.Id,
|
|
||||||
["content"] = "<p>hi</p>",
|
|
||||||
["_misskey_quote"] = $"{origin}/notes/elsewhere",
|
|
||||||
["to"] = new JsonArray(Addressing.Public),
|
|
||||||
["cc"] = new JsonArray(alice.Uri),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" })
|
|
||||||
};
|
|
||||||
var create = new JsonObject { ["id"] = $"{origin}/activities/{Guid.NewGuid():N}", ["type"] = "Create", ["actor"] = mallory.Id, ["object"] = note.DeepClone() };
|
|
||||||
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", create);
|
|
||||||
var edited = note.DeepClone().AsObject();
|
|
||||||
edited["content"] = "<p>hi again</p>";
|
|
||||||
edited["updated"] = DateTime.UtcNow.ToString("O");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{origin}/activities/{Guid.NewGuid():N}", ["type"] = "Update", ["actor"] = mallory.Id, ["object"] = edited
|
|
||||||
});
|
|
||||||
|
|
||||||
var record = await DB.Default.Find<ObjectRecord>().Match(r => r.ObjectURI == note["id"]!.GetValue<string>()).ExecuteFirstAsync(token);
|
|
||||||
Assert.NotNull(record);
|
|
||||||
Assert.Equal(ObjectPath.Delivered, record.Path);
|
|
||||||
Assert.False(record.Refetched);
|
|
||||||
Assert.Equal("shared", record.Inbox);
|
|
||||||
Assert.Equal(mallory.KeyId, record.KeyId);
|
|
||||||
Assert.Equal(create["id"]!.GetValue<string>(), record.ActivityId);
|
|
||||||
Assert.Contains("digest", record.SignedHeaders);
|
|
||||||
Assert.Equal("<p>hi</p>", JsonNode.Parse(record.Raw)!["content"]!.GetValue<string>());
|
|
||||||
Assert.Contains("legacy-quote", ObjectFeatures.Detect(JsonNode.Parse(record.Raw)!.AsObject()));
|
|
||||||
Assert.Equal("<p>hi again</p>", JsonNode.Parse(Assert.Single(record.Revisions).Raw)!["content"]!.GetValue<string>());
|
|
||||||
Assert.True(await DB.Default.Find<Job>().Match(j => j.Kind == JobKind.DescribeInstance && j.Payload == record.Host).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class QuoteTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
static string NewId(RemoteActor actor, string kind) => $"{Origin(actor)}/{kind}/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
async Task<Post> Delivered(RemoteActor author, string mentioned, Action<JsonObject> shape = default)
|
|
||||||
{
|
|
||||||
var note = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(author, "notes"), ["type"] = "Note", ["attributedTo"] = author.Id, ["content"] = "<p>hello</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["cc"] = new JsonArray(mentioned),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = mentioned, ["name"] = "@someone" })
|
|
||||||
};
|
|
||||||
shape?.Invoke(note);
|
|
||||||
await _harness.Deliver(author, "/human-centipede", new JsonObject { ["id"] = NewId(author, "activities"), ["type"] = "Create", ["actor"] = author.Id, ["object"] = note });
|
|
||||||
return await DB.Default.Find<Post>().Match(p => p.ObjectURI == note["id"]!.GetValue<string>()).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
string Stamp(RemoteActor quotedAuthor, string quoting, string quoted)
|
|
||||||
{
|
|
||||||
var path = $"/stamps/{Guid.NewGuid():N}";
|
|
||||||
var id = Origin(quotedAuthor) + path;
|
|
||||||
_harness.Peer.Serve(path, new JsonObject
|
|
||||||
{
|
|
||||||
["@context"] = "https://www.w3.org/ns/activitystreams", ["id"] = id, ["type"] = "QuoteAuthorization",
|
|
||||||
["attributedTo"] = quotedAuthor.Id, ["interactingObject"] = quoting, ["interactionTarget"] = quoted
|
|
||||||
}.ToJsonString());
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_misskey_quote_of_a_public_post_is_shown_and_counted()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var ann = new RemoteActor(_harness.Peer, "ann");
|
|
||||||
var kitty = new RemoteActor(_harness.Peer, "kitty");
|
|
||||||
var original = await Delivered(ann, alice.Uri);
|
|
||||||
|
|
||||||
var quoting = await Delivered(kitty, alice.Uri, n =>
|
|
||||||
{
|
|
||||||
n["_misskey_quote"] = original.ObjectURI;
|
|
||||||
n["content"] = $"<p>look<span class=\"quote-inline\"><br>RE: <a href=\"{original.ObjectURI}\">{original.ObjectURI}</a></span></p>";
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Equal(QuoteState.Accepted, quoting.QuoteState);
|
|
||||||
Assert.Equal(original.ID, quoting.QuotedPostId);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(original.ID, token)).QuotesCount);
|
|
||||||
var status = await new PrivaPub.Api.Mastodon.Mappers.MastodonMapper(_harness.Db, _harness.Local).Status(quoting, alice.Id, token);
|
|
||||||
Assert.Equal("accepted", status.Quote.State);
|
|
||||||
Assert.Equal(original.ID, status.Quote.QuotedStatus.Id);
|
|
||||||
Assert.DoesNotContain("RE:", status.Content);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_stamped_quote_is_accepted_a_forged_one_is_not_and_revoking_takes_it_back()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var ann = new RemoteActor(_harness.Peer, "ann");
|
|
||||||
var bob = new RemoteActor(_harness.Peer, "bob");
|
|
||||||
var original = await Delivered(ann, alice.Uri);
|
|
||||||
var quotingId = NewId(bob, "notes");
|
|
||||||
var stamp = Stamp(ann, quotingId, original.ObjectURI);
|
|
||||||
var forged = Stamp(ann, NewId(bob, "notes"), original.ObjectURI);
|
|
||||||
|
|
||||||
var quoting = await Delivered(bob, alice.Uri, n => { n["id"] = quotingId; n["quote"] = original.ObjectURI; n["quoteAuthorization"] = stamp; });
|
|
||||||
var cheat = await Delivered(bob, alice.Uri, n => { n["quote"] = original.ObjectURI; n["quoteAuthorization"] = forged; });
|
|
||||||
var waiting = await Delivered(bob, alice.Uri, n => n["quote"] = original.ObjectURI);
|
|
||||||
|
|
||||||
Assert.Equal(QuoteState.Accepted, quoting.QuoteState);
|
|
||||||
Assert.Equal(QuoteState.Unauthorized, cheat.QuoteState);
|
|
||||||
Assert.Equal(QuoteState.Pending, waiting.QuoteState);
|
|
||||||
|
|
||||||
await _harness.Deliver(ann, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(ann, "activities"), ["type"] = "Delete", ["actor"] = ann.Id, ["object"] = stamp
|
|
||||||
});
|
|
||||||
Assert.Equal(QuoteState.Revoked, (await DB.Default.Find<Post>().OneAsync(quoting.ID, token)).QuoteState);
|
|
||||||
Assert.Equal(0, (await DB.Default.Find<Post>().OneAsync(original.ID, token)).QuotesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_persona_asks_before_quoting_and_is_stamped_when_accepted()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var ann = new RemoteActor(_harness.Peer, "ann");
|
|
||||||
var original = await Delivered(ann, alice.Uri, n => n["interactionPolicy"] = new JsonObject
|
|
||||||
{
|
|
||||||
["canQuote"] = new JsonObject { ["automaticApproval"] = new JsonArray(Addressing.Public) }
|
|
||||||
});
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "this", QuotedStatusId = original.ID }, token);
|
|
||||||
Assert.Equal(QuoteState.Pending, outcome.Post.QuoteState);
|
|
||||||
var request = Assert.Single(await _harness.Outgoing(ann.Id + "/inbox"), a => a["type"]!.GetValue<string>() == "QuoteRequest");
|
|
||||||
Assert.Equal(original.ObjectURI, request["object"]!.GetValue<string>());
|
|
||||||
Assert.Equal(original.ObjectURI, request["instrument"]!["quote"]!.GetValue<string>());
|
|
||||||
|
|
||||||
await _harness.Deliver(ann, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(ann, "activities"), ["type"] = "Accept", ["actor"] = ann.Id,
|
|
||||||
["object"] = request["id"]!.GetValue<string>(), ["result"] = Stamp(ann, outcome.Post.ObjectURI, original.ObjectURI)
|
|
||||||
});
|
|
||||||
|
|
||||||
var quoting = await DB.Default.Find<Post>().OneAsync(outcome.Post.ID, token);
|
|
||||||
Assert.Equal(QuoteState.Accepted, quoting.QuoteState);
|
|
||||||
Assert.NotNull(quoting.QuoteAuthorizationURI);
|
|
||||||
Assert.Contains(await _harness.Outgoing(ann.Id + "/inbox"), a => a["type"]!.GetValue<string>() == "Update"
|
|
||||||
&& a["object"]!["quoteAuthorization"]?.GetValue<string>() == quoting.QuoteAuthorizationURI);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_legacy_post_is_quoted_without_asking_and_a_persona_that_allows_nobody_cannot_be_quoted()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (aliceRoot, alice) = await _harness.Persona("alice");
|
|
||||||
var (bobRoot, bob) = await _harness.Persona("bob");
|
|
||||||
var kitty = new RemoteActor(_harness.Peer, "kitty");
|
|
||||||
var legacy = await Delivered(kitty, alice.Uri);
|
|
||||||
bob.Settings.QuotePolicy = PrivaPub.Models.User.QuotePolicies.Nobody;
|
|
||||||
var bobs = (await _harness.Statuses.Publish(bob, new StatusDraft { Text = "mine" }, token)).Post;
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(alice, new StatusDraft { Text = "nice", QuotedStatusId = legacy.ID }, token);
|
|
||||||
Assert.Equal(QuoteState.Accepted, outcome.Post.QuoteState);
|
|
||||||
Assert.False(outcome.Post.QuoteByConsent);
|
|
||||||
Assert.False((await _harness.Statuses.Publish(alice, new StatusDraft { Text = "and this", QuotedStatusId = bobs.ID }, token)).Ok);
|
|
||||||
Assert.True((await _harness.Statuses.Publish(bob, new StatusDraft { Text = "me again", QuotedStatusId = bobs.ID }, token)).Ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject Request(RemoteActor quoter, string quotedUri, string quotingId) => new()
|
|
||||||
{
|
|
||||||
["id"] = NewId(quoter, "activities"), ["type"] = "QuoteRequest", ["actor"] = quoter.Id, ["object"] = quotedUri,
|
|
||||||
["instrument"] = new JsonObject { ["id"] = quotingId, ["type"] = "Note", ["attributedTo"] = quoter.Id, ["quote"] = quotedUri, ["content"] = "<p>so true</p>" }
|
|
||||||
};
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Anyone_may_quote_a_persona_by_default_and_the_licence_can_be_revoked()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject { ["id"] = NewId(mallory, "follows"), ["type"] = "Follow", ["actor"] = mallory.Id, ["object"] = alice.Uri });
|
|
||||||
var original = (await _harness.Statuses.Publish(alice, new StatusDraft { Text = "quote me" }, token)).Post;
|
|
||||||
var created = (await _harness.Outgoing(mallory.Id + "/inbox")).Single(a => a["type"]!.GetValue<string>() == "Create")["object"]!;
|
|
||||||
Assert.Equal(Addressing.Public, created["interactionPolicy"]!["canQuote"]!["automaticApproval"]![0]!.GetValue<string>());
|
|
||||||
|
|
||||||
var quotingId = NewId(mallory, "notes");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", Request(mallory, original.ObjectURI, quotingId));
|
|
||||||
var accept = Assert.Single(await _harness.Outgoing(mallory.Id + "/inbox"), a => a["type"]!.GetValue<string>() == "Accept" && a["result"] != null);
|
|
||||||
var licence = accept["result"]!.GetValue<string>();
|
|
||||||
Assert.StartsWith(alice.Uri + "/parrot-licences/", licence);
|
|
||||||
|
|
||||||
var quoting = await Delivered(mallory, alice.Uri, n => { n["id"] = quotingId; n["quote"] = original.ObjectURI; n["quoteAuthorization"] = licence; });
|
|
||||||
Assert.Equal(QuoteState.Accepted, quoting.QuoteState);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(original.ID, token)).QuotesCount);
|
|
||||||
|
|
||||||
Assert.True(await _harness.Quotes.RevokeLicence(original, quoting, token));
|
|
||||||
Assert.Equal(QuoteState.Revoked, (await DB.Default.Find<Post>().OneAsync(quoting.ID, token)).QuoteState);
|
|
||||||
Assert.Contains(await _harness.Outgoing(mallory.Id + "/inbox"), a => a["type"]!.GetValue<string>() == "Delete" && a["object"]!.GetValue<string>() == licence);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_followers_only_persona_turns_a_stranger_down()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
alice.Settings.QuotePolicy = PrivaPub.Models.User.QuotePolicies.Followers;
|
|
||||||
var original = (await _harness.Statuses.Publish(alice, new StatusDraft { Text = "friends only quoting" }, token)).Post;
|
|
||||||
var stranger = new RemoteActor(_harness.Peer, "stranger");
|
|
||||||
|
|
||||||
await _harness.Deliver(stranger, "/human-centipede", Request(stranger, original.ObjectURI, NewId(stranger, "notes")));
|
|
||||||
|
|
||||||
Assert.Equal("Reject", Assert.Single(await _harness.Outgoing(stranger.Id + "/inbox"))["type"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task One_persona_quotes_another_with_a_licence()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var (_, bob) = await _harness.Persona("bob");
|
|
||||||
var original = (await _harness.Statuses.Publish(alice, new StatusDraft { Text = "public thought" }, token)).Post;
|
|
||||||
|
|
||||||
var outcome = await _harness.Statuses.Publish(bob, new StatusDraft { Text = "agreed", QuotedStatusId = original.ID }, token);
|
|
||||||
|
|
||||||
Assert.True(outcome.Ok);
|
|
||||||
Assert.Equal(QuoteState.Accepted, outcome.Post.QuoteState);
|
|
||||||
Assert.StartsWith(alice.Uri + "/parrot-licences/", outcome.Post.QuoteAuthorizationURI);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(original.ID, token)).QuotesCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Post;
|
|
||||||
using PrivaPub.Domain.Social;
|
|
||||||
using PrivaPub.Federation.Objects;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class ReactionNamesTests
|
|
||||||
{
|
|
||||||
[Theory]
|
|
||||||
[InlineData(":blobcat@k.example:", "blobcat")]
|
|
||||||
[InlineData("👍🏽", "👍🏽")]
|
|
||||||
[InlineData("❤️", "❤️")]
|
|
||||||
[InlineData("nope", null)]
|
|
||||||
[InlineData("👍👍", null)]
|
|
||||||
[InlineData(":unknown:", null)]
|
|
||||||
public void Normalises_what_peers_send(string content, string expected) =>
|
|
||||||
Assert.Equal(expected, Reactions.Normalise(content, new List<CustomEmoji> { new() { Shortcode = "blobcat", URL = "https://k.example/e.png" } })?.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ReactionTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Harness _harness;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_harness = await Harness.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_harness != default)
|
|
||||||
await _harness.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Origin(RemoteActor actor) => new Uri(actor.Id).GetLeftPart(UriPartial.Authority);
|
|
||||||
|
|
||||||
static string NewId(RemoteActor actor, string kind) => $"{Origin(actor)}/{kind}/{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
async Task<Post> LocalPost()
|
|
||||||
{
|
|
||||||
var (root, alice) = await _harness.Persona("alice");
|
|
||||||
await _harness.Posts.InsertPost(root, new InsertPostForm { AvatarId = alice.Id, Text = "react to me" }, TestContext.Current.CancellationToken);
|
|
||||||
return await DB.Default.Find<Post>().Match(p => p.GroupUserId == alice.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Misskey_and_pleroma_reactions_are_kept_apart_from_favourites()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var post = await LocalPost();
|
|
||||||
var misskey = new RemoteActor(_harness.Peer, "kitty");
|
|
||||||
var pleroma = new RemoteActor(_harness.Peer, "pleroma");
|
|
||||||
|
|
||||||
await _harness.Deliver(misskey, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(misskey, "likes"), ["type"] = "Like", ["actor"] = misskey.Id, ["object"] = post.ObjectURI, ["content"] = ":blobcat:",
|
|
||||||
["_misskey_reaction"] = ":blobcat:",
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Emoji", ["name"] = ":blobcat:", ["icon"] = new JsonObject { ["type"] = "Image", ["url"] = $"{Origin(misskey)}/emoji/blobcat.png" } })
|
|
||||||
});
|
|
||||||
await _harness.Deliver(misskey, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(misskey, "likes"), ["type"] = "Like", ["actor"] = misskey.Id, ["object"] = post.ObjectURI, ["content"] = "❤"
|
|
||||||
});
|
|
||||||
var fire = new JsonObject { ["id"] = NewId(pleroma, "activities"), ["type"] = "EmojiReact", ["actor"] = pleroma.Id, ["object"] = post.ObjectURI, ["content"] = "🔥" };
|
|
||||||
await _harness.Deliver(pleroma, "/human-centipede", fire);
|
|
||||||
|
|
||||||
var kept = await DB.Default.Find<Reaction>().Match(r => r.PostId == post.ID).ExecuteAsync(token);
|
|
||||||
Assert.Equal(new HashSet<string> { "blobcat", "🔥" }, kept.Select(r => r.Emoji).ToHashSet());
|
|
||||||
Assert.Equal($"{Origin(misskey)}/emoji/blobcat.png", kept.Single(r => r.Emoji == "blobcat").EmojiURL);
|
|
||||||
Assert.Equal(1, (await DB.Default.Find<Post>().OneAsync(post.ID, token)).FavouritesCount);
|
|
||||||
Assert.True(await DB.Default.Find<Notification>().Match(n => n.Type == NotificationType.Reaction && n.Emoji == "🔥").ExecuteAnyAsync(token));
|
|
||||||
|
|
||||||
await _harness.Deliver(pleroma, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(pleroma, "activities"), ["type"] = "Undo", ["actor"] = pleroma.Id, ["object"] = fire.DeepClone()
|
|
||||||
});
|
|
||||||
Assert.Equal("blobcat", Assert.Single(await DB.Default.Find<Reaction>().Match(r => r.PostId == post.ID).ExecuteAsync(token)).Emoji);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_persona_reacts_to_a_remote_post_and_takes_it_back()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var (_, alice) = await _harness.Persona("alice");
|
|
||||||
var mallory = new RemoteActor(_harness.Peer, "mallory");
|
|
||||||
var noteId = NewId(mallory, "notes");
|
|
||||||
await _harness.Deliver(mallory, "/human-centipede", new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = NewId(mallory, "activities"), ["type"] = "Create", ["actor"] = mallory.Id,
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId, ["type"] = "Note", ["attributedTo"] = mallory.Id, ["content"] = "<p>hi</p>",
|
|
||||||
["to"] = new JsonArray(Addressing.Public), ["cc"] = new JsonArray(alice.Uri),
|
|
||||||
["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@alice" })
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteFirstAsync(token);
|
|
||||||
|
|
||||||
Assert.True(await _harness.Reactions.React(alice, post, "🎉", token));
|
|
||||||
Assert.False(await _harness.Reactions.React(alice, post, "not an emoji", token));
|
|
||||||
Assert.True(await _harness.Reactions.Unreact(alice, post, "🎉", token));
|
|
||||||
|
|
||||||
var sent = await _harness.Outgoing(mallory.Id + "/inbox");
|
|
||||||
var react = Assert.Single(sent, a => a["type"]!.GetValue<string>() == "EmojiReact");
|
|
||||||
Assert.Equal("🎉", react["content"]!.GetValue<string>());
|
|
||||||
Assert.Equal(noteId, react["object"]!.GetValue<string>());
|
|
||||||
Assert.Equal(react["id"]!.GetValue<string>(), Assert.Single(sent, a => a["type"]!.GetValue<string>() == "Undo")["object"]!["id"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Models;
|
|
||||||
using PrivaPub.StaticServices;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class RemoteActorServiceTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
Peer _peer;
|
|
||||||
RemoteActorService _service;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
var cache = new MemoryCache(new MemoryCacheOptions());
|
|
||||||
var local = new LocalActorService(new DbEntities(),
|
|
||||||
new StaticOptions<AppConfiguration>(new AppConfiguration { BackendBaseAddress = "https://privapub.test" }));
|
|
||||||
_service = new RemoteActorService(Peer.Http(cache), local, cache, new DbEntities());
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_stored_actor_remembers_the_extensions_its_document_uses()
|
|
||||||
{
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
|
|
||||||
var stored = await _service.GetActor(bob.Id, refresh: true, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Contains("key:rsa-2048", stored.Features);
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Actor(string id, string keyId = default, string owner = default, string pem = default, string type = "Person") =>
|
|
||||||
new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = id,
|
|
||||||
["type"] = type,
|
|
||||||
["preferredUsername"] = id[(id.LastIndexOf('/') + 1)..],
|
|
||||||
["inbox"] = id + "/inbox",
|
|
||||||
["publicKey"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = keyId ?? id + "#main-key",
|
|
||||||
["owner"] = owner ?? id,
|
|
||||||
["publicKeyPem"] = pem ?? Keys.NewKeyPair().PublicKeyPem
|
|
||||||
}
|
|
||||||
}.ToJsonString();
|
|
||||||
|
|
||||||
string Unique(string name) => $"/users/{name}{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Accepts_an_actor_whose_document_names_its_own_address()
|
|
||||||
{
|
|
||||||
var path = Unique("alice");
|
|
||||||
_peer.Serve(path, Actor("{A}" + path));
|
|
||||||
|
|
||||||
var actor = await _service.GetActorByKeyId($"{_peer.A}{path}#main-key", refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.NotNull(actor);
|
|
||||||
Assert.Equal(_peer.A + path, actor.ActorURI);
|
|
||||||
Assert.Equal($"{_peer.A}{path}#main-key", actor.PublicKeyId);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Refuses_a_document_that_claims_another_origin()
|
|
||||||
{
|
|
||||||
var victim = Unique("bob");
|
|
||||||
var mallory = Unique("mallory");
|
|
||||||
_peer.Serve(mallory, Actor("{B}" + victim));
|
|
||||||
|
|
||||||
var actor = await _service.GetActor(_peer.A + mallory, refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
var byKey = await _service.GetActorByKeyId($"{_peer.B}{victim}#main-key", refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Null(actor);
|
|
||||||
Assert.Null(byKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Refuses_a_key_owned_by_someone_else()
|
|
||||||
{
|
|
||||||
var eve = Unique("eve");
|
|
||||||
_peer.Serve(eve, Actor("{A}" + eve, owner: "{A}/users/alice"));
|
|
||||||
|
|
||||||
Assert.Null(await _service.GetActorByKeyId($"{_peer.A}{eve}#main-key", refresh: false, TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Refuses_a_key_document_whose_owner_is_on_another_origin()
|
|
||||||
{
|
|
||||||
var alice = Unique("alice");
|
|
||||||
var key = $"/keys/{Guid.NewGuid():N}";
|
|
||||||
_peer.Serve(alice, Actor("{B}" + alice));
|
|
||||||
_peer.Serve(key, new JsonObject { ["id"] = "{A}" + key, ["owner"] = "{B}" + alice, ["publicKeyPem"] = Keys.NewKeyPair().PublicKeyPem }.ToJsonString());
|
|
||||||
|
|
||||||
Assert.Null(await _service.GetActorByKeyId(_peer.A + key, refresh: false, TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Refuses_a_key_the_actor_does_not_list()
|
|
||||||
{
|
|
||||||
var alice = Unique("alice");
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice));
|
|
||||||
|
|
||||||
Assert.Null(await _service.GetActorByKeyId($"{_peer.A}{alice}#other-key", refresh: false, TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Follows_a_same_origin_alias_to_the_actor_it_names()
|
|
||||||
{
|
|
||||||
var alice = Unique("alice");
|
|
||||||
var alias = $"/@alias{Guid.NewGuid():N}";
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice));
|
|
||||||
_peer.Serve(alias, Actor("{A}" + alice));
|
|
||||||
|
|
||||||
var actor = await _service.GetActor(_peer.A + alias, refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.NotNull(actor);
|
|
||||||
Assert.Equal(_peer.A + alice, actor.ActorURI);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Resolves_a_gotosocial_style_key_address()
|
|
||||||
{
|
|
||||||
var gts = Unique("gts");
|
|
||||||
var keyPath = gts + "/main-key";
|
|
||||||
var pem = Keys.NewKeyPair().PublicKeyPem;
|
|
||||||
_peer.Serve(gts, Actor("{A}" + gts, keyId: "{A}" + keyPath, pem: pem));
|
|
||||||
_peer.Serve(keyPath, Actor("{A}" + gts, keyId: "{A}" + keyPath, pem: pem));
|
|
||||||
|
|
||||||
var actor = await _service.GetActorByKeyId(_peer.A + keyPath, refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.NotNull(actor);
|
|
||||||
Assert.Equal(_peer.A + gts, actor.ActorURI);
|
|
||||||
Assert.Equal(pem, actor.PublicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_rotated_key_replaces_the_stored_one_but_only_once_per_interval()
|
|
||||||
{
|
|
||||||
var alice = Unique("alice");
|
|
||||||
var keyId = $"{_peer.A}{alice}#main-key";
|
|
||||||
var first = Keys.NewKeyPair().PublicKeyPem;
|
|
||||||
var second = Keys.NewKeyPair().PublicKeyPem;
|
|
||||||
var third = Keys.NewKeyPair().PublicKeyPem;
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice, pem: first));
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
|
|
||||||
Assert.Equal(first, (await _service.GetActorByKeyId(keyId, refresh: false, token)).PublicKey);
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice, pem: second));
|
|
||||||
Assert.Equal(first, (await _service.GetActorByKeyId(keyId, refresh: true, token)).PublicKey);
|
|
||||||
|
|
||||||
var fresh = new RemoteActorService(Peer.Http(), new LocalActorService(new DbEntities(),
|
|
||||||
new StaticOptions<AppConfiguration>(new AppConfiguration { BackendBaseAddress = "https://privapub.test" })),
|
|
||||||
new MemoryCache(new MemoryCacheOptions()), new DbEntities());
|
|
||||||
Assert.Equal(second, (await fresh.GetActorByKeyId(keyId, refresh: true, token)).PublicKey);
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice, pem: third));
|
|
||||||
Assert.Equal(second, (await fresh.GetActorByKeyId(keyId, refresh: true, token)).PublicKey);
|
|
||||||
Assert.Single(await new DbEntities().ForeignAvatars.Match(a => a.ActorURI == _peer.A + alice).ExecuteAsync(token));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Signs_every_fetch()
|
|
||||||
{
|
|
||||||
var alice = Unique("alice");
|
|
||||||
_peer.Serve(alice, Actor("{A}" + alice));
|
|
||||||
|
|
||||||
await _service.GetActor(_peer.A + alice, refresh: false, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
var request = Assert.Single(_peer.Requests, r => r.Path == alice);
|
|
||||||
Assert.Contains("keyId=\"https://privapub.test/peasants/privapub#main-key\"", request.Signature);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ActorDocumentTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Reads_a_mastodon_actor()
|
|
||||||
{
|
|
||||||
var document = ActorDocument.Parse(JsonDocument.Parse("""
|
|
||||||
{
|
|
||||||
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
||||||
"id": "https://mastodon.example/users/alice",
|
|
||||||
"type": "Person",
|
|
||||||
"preferredUsername": "alice",
|
|
||||||
"name": "Alice",
|
|
||||||
"inbox": "https://mastodon.example/users/alice/inbox",
|
|
||||||
"outbox": "https://mastodon.example/users/alice/outbox",
|
|
||||||
"url": "https://mastodon.example/@alice",
|
|
||||||
"discoverable": false,
|
|
||||||
"endpoints": { "sharedInbox": "https://mastodon.example/inbox" },
|
|
||||||
"icon": { "type": "Image", "url": "https://files.mastodon.example/a.png" },
|
|
||||||
"publicKey": {
|
|
||||||
"id": "https://mastodon.example/users/alice#main-key",
|
|
||||||
"owner": "https://mastodon.example/users/alice",
|
|
||||||
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIB\n-----END PUBLIC KEY-----\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
""").RootElement);
|
|
||||||
|
|
||||||
Assert.Equal("alice", document.PreferredUsername);
|
|
||||||
Assert.Equal("https://mastodon.example/inbox", document.SharedInbox);
|
|
||||||
Assert.Equal("https://files.mastodon.example/a.png", document.Icon);
|
|
||||||
Assert.False(document.Discoverable);
|
|
||||||
Assert.NotNull(document.Key("https://mastodon.example/users/alice#main-key"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Keeps_only_keys_owned_by_the_actor_on_its_origin()
|
|
||||||
{
|
|
||||||
var document = ActorDocument.Parse(JsonDocument.Parse("""
|
|
||||||
{
|
|
||||||
"id": "https://a.example/users/alice",
|
|
||||||
"type": "Person",
|
|
||||||
"publicKey": [
|
|
||||||
{ "id": "https://a.example/users/alice#main-key", "owner": "https://a.example/users/alice", "publicKeyPem": "x" },
|
|
||||||
{ "id": "https://b.example/keys/1", "owner": "https://a.example/users/alice", "publicKeyPem": "y" },
|
|
||||||
{ "id": "https://a.example/users/alice#other", "owner": "https://a.example/users/bob", "publicKeyPem": "z" },
|
|
||||||
{ "id": "https://a.example/users/alice#unowned", "publicKeyPem": "w" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
""").RootElement);
|
|
||||||
|
|
||||||
Assert.Equal("https://a.example/users/alice#main-key", Assert.Single(document.Keys).Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Refuses_an_inbox_on_another_origin()
|
|
||||||
{
|
|
||||||
var document = ActorDocument.Parse(JsonDocument.Parse("""
|
|
||||||
{ "id": "https://a.example/users/alice", "type": "Person", "inbox": "https://b.example/inbox" }
|
|
||||||
""").RootElement);
|
|
||||||
|
|
||||||
Assert.Null(document.Inbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("Note")]
|
|
||||||
[InlineData("Tombstone")]
|
|
||||||
[InlineData("Collection")]
|
|
||||||
public void Refuses_non_actor_types(string type) =>
|
|
||||||
Assert.Null(ActorDocument.Parse(JsonDocument.Parse($$"""{ "id": "https://a.example/x", "type": "{{type}}" }""").RootElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
using PrivaPub.Federation.Actors;
|
|
||||||
using PrivaPub.Federation.Rendering;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Federation
|
|
||||||
{
|
|
||||||
public class RendererTests
|
|
||||||
{
|
|
||||||
static readonly LocalActor Alice = new()
|
|
||||||
{
|
|
||||||
Id = "a1",
|
|
||||||
Kind = LocalActorKind.Person,
|
|
||||||
UserName = "alice",
|
|
||||||
Name = "Alice",
|
|
||||||
Summary = "I **like** <b>cats</b>",
|
|
||||||
PublicKeyPem = Keys.NewKeyPair().PublicKeyPem,
|
|
||||||
Published = new DateTime(2026, 9, 30, 17, 45, 12, DateTimeKind.Utc),
|
|
||||||
Fields = new Dictionary<string, string> { ["site"] = "https://alice.example", ["mood"] = "<i>ok</i>" },
|
|
||||||
BaseAddress = "https://privapub.test"
|
|
||||||
};
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void An_actor_looks_like_a_mastodon_actor_with_our_route_names()
|
|
||||||
{
|
|
||||||
var actor = ActivityPubRenderer.Actor(Alice);
|
|
||||||
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice", actor["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/@alice", actor["url"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/mouth", actor["inbox"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/anus", actor["outbox"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/groupies", actor["followers"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/stalking", actor["following"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/human-centipede", actor["endpoints"]!["sharedInbox"]!.GetValue<string>());
|
|
||||||
Assert.Equal("2026-09-30T00:00:00Z", actor["published"]!.GetValue<string>());
|
|
||||||
Assert.Equal("alice@privapub.test", actor["webfinger"]!.GetValue<string>());
|
|
||||||
Assert.False(actor["indexable"]!.GetValue<bool>());
|
|
||||||
Assert.Equal("<p>I <strong>like</strong> <b>cats</b></p>", actor["summary"]!.GetValue<string>());
|
|
||||||
var fields = actor["attachment"]!.AsArray();
|
|
||||||
Assert.Contains("rel=\"nofollow noopener noreferrer me\"", fields[0]!["value"]!.GetValue<string>());
|
|
||||||
Assert.Equal("<i>ok</i>", fields[1]!["value"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice#main-key", actor["publicKey"]!["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(actor["id"]!.GetValue<string>(), actor["publicKey"]!["owner"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_titled_post_with_a_warning_keeps_the_title_visible_on_mastodon()
|
|
||||||
{
|
|
||||||
var post = new Post
|
|
||||||
{
|
|
||||||
ID = "p1",
|
|
||||||
Title = "On <cats>",
|
|
||||||
ContentHtml = "<p>body</p>",
|
|
||||||
HasContentWarning = true,
|
|
||||||
Language = "en",
|
|
||||||
Mentions = new() { new PostMention { ActorURI = "https://m.example/users/bob", Handle = "@bob@m.example" } },
|
|
||||||
Tags = new() { "cats" },
|
|
||||||
CreationDate = new DateTime(2026, 9, 30, 17, 45, 12, 345, DateTimeKind.Utc)
|
|
||||||
};
|
|
||||||
|
|
||||||
var note = ActivityPubRenderer.Note(post, Alice, default, "https://m.example/users/bob/statuses/1");
|
|
||||||
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/scribbles/p1", note["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/@alice/p1", note["url"]!.GetValue<string>());
|
|
||||||
Assert.Equal("<p><strong>On <cats></strong></p><p>body</p>", note["content"]!.GetValue<string>());
|
|
||||||
Assert.Equal("On <cats>", note["summary"]!.GetValue<string>());
|
|
||||||
Assert.True(note["sensitive"]!.GetValue<bool>());
|
|
||||||
Assert.Equal("2026-09-30T17:45:12.345Z", note["published"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { ActivityPubRenderer.Public }, note["to"]!.AsArray().Select(n => n!.GetValue<string>()));
|
|
||||||
Assert.Equal(new[] { Alice.Followers, "https://m.example/users/bob" }, note["cc"]!.AsArray().Select(n => n!.GetValue<string>()));
|
|
||||||
var tags = note["tag"]!.AsArray();
|
|
||||||
Assert.Equal("@bob@m.example", tags[0]!["name"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://privapub.test/tags/cats", tags[1]!["href"]!.GetValue<string>());
|
|
||||||
Assert.Equal("https://m.example/users/bob/statuses/1", note["inReplyTo"]!.GetValue<string>());
|
|
||||||
Assert.NotNull(note["contentMap"]!["en"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_warning_without_a_title_or_spoiler_gets_a_generic_summary()
|
|
||||||
{
|
|
||||||
var note = ActivityPubRenderer.Note(new Post { ID = "p2", ContentHtml = "<p>x</p>", HasContentWarning = true }, Alice, default, default);
|
|
||||||
|
|
||||||
Assert.Equal(ActivityPubRenderer.ContentWarning, note["summary"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void A_direct_note_is_addressed_to_its_recipients_only()
|
|
||||||
{
|
|
||||||
var post = new Post { ID = "p3", ContentHtml = "<p>psst</p>", Visibility = PostVisibility.Direct };
|
|
||||||
|
|
||||||
var note = ActivityPubRenderer.DirectNote(post, Alice, new[] { ("https://m.example/users/bob", "bob@m.example") },
|
|
||||||
Alice.ConversationUri("c1"));
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "https://m.example/users/bob" }, note["to"]!.AsArray().Select(n => n!.GetValue<string>()));
|
|
||||||
Assert.Empty(note["cc"]!.AsArray());
|
|
||||||
Assert.Equal("https://privapub.test/peasants/alice/whispers/c1", note["context"]!.GetValue<string>());
|
|
||||||
Assert.StartsWith("<p><span class=\"h-card\"", note["content"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Mention", note["tag"]![0]!["type"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,445 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using System.Net;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ClientApiAccountsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string NewPassword = "Other-Pass-2!";
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
static string Name(string prefix) => $"{prefix}{Guid.NewGuid():N}"[..20];
|
|
||||||
|
|
||||||
async Task<HttpResponseMessage> LogIn(string userName, string password)
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
return await client.PostJson("/clientapi/user/login", new { userName, password });
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<HttpStatusCode> Settings(string jwt)
|
|
||||||
{
|
|
||||||
using var client = _host.As(jwt);
|
|
||||||
return (await client.GetAsync("/clientapi/user/settings", TestContext.Current.CancellationToken)).StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<string> Message(HttpResponseMessage response)
|
|
||||||
{
|
|
||||||
var body = await response.JsonBody();
|
|
||||||
return body["errorMessage"]?.GetValue<string>() ?? body["title"]?.GetValue<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
string Jwt(string rootId, string userName, DateTime expires, string key = default)
|
|
||||||
{
|
|
||||||
var configuration = _host.Get<IConfiguration>();
|
|
||||||
var signing = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key ?? configuration["AppConfiguration:Jwt:Key"]!));
|
|
||||||
var token = new JwtSecurityToken(configuration["AppConfiguration:Jwt:Issuer"], configuration["AppConfiguration:Jwt:Audience"],
|
|
||||||
new[] { new Claim(ClaimTypes.UserData, rootId), new Claim(ClaimTypes.Name, userName), new Claim(Policies.IsUser, "true") },
|
|
||||||
notBefore: expires.AddHours(-1), expires: expires, signingCredentials: new SigningCredentials(signing, SecurityAlgorithms.HmacSha512));
|
|
||||||
return new JwtSecurityTokenHandler().WriteToken(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Signing_up_answers_a_token_for_the_new_root()
|
|
||||||
{
|
|
||||||
var userName = Name("Signup");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/user/signup", new { userName, password = Accounts.Password });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var jwt = await response.JsonBody();
|
|
||||||
Assert.Equal(userName.ToLowerInvariant(), jwt["username"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { Policies.IsUser }, jwt["policies"]!.AsArray().Select(p => p!.GetValue<string>()));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(jwt["token"]!.GetValue<string>()));
|
|
||||||
var stored = await DB.Default.Find<RootUser>().MatchID(jwt["userId"]!.GetValue<string>()).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.NotEqual(Accounts.Password, stored.HashedPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_taken_username_is_refused_whatever_its_case()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("taken");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var again = await client.PostJson("/clientapi/user/signup", new { userName = root.UserName, password = Accounts.Password });
|
|
||||||
var shouted = await client.PostJson("/clientapi/user/signup", new { userName = root.UserName.ToUpperInvariant(), password = Accounts.Password });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, again.StatusCode);
|
|
||||||
Assert.Contains("already taken", await Message(again));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, shouted.StatusCode);
|
|
||||||
Assert.Equal(1, await DB.Default.CountAsync<RootUser>(u => u.UserName == root.UserName, TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TheoryData<string> InvalidSignUps() => new()
|
|
||||||
{
|
|
||||||
"{}",
|
|
||||||
"{\"userName\":\"ab\",\"password\":\"Test-Pass-1!\"}",
|
|
||||||
"{\"userName\":\"has space\",\"password\":\"Test-Pass-1!\"}",
|
|
||||||
"{\"userName\":\"validname\",\"password\":\"short\"}",
|
|
||||||
"{\"userName\":\"validname\",\"password\":\"nouppercase1\"}",
|
|
||||||
"{\"userName\":\"validname\",\"password\":\"Has Space1\"}",
|
|
||||||
"{\"userName\":\"validname\",\"password\":\"Test-Pass-1!\",\"lightThemeIndexColour\":400}",
|
|
||||||
"{\"userName\":\"" + new string('a', 40) + "\",\"password\":\"Test-Pass-1!\"}",
|
|
||||||
"not json"
|
|
||||||
};
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(InvalidSignUps))]
|
|
||||||
public async Task An_invalid_sign_up_answers_400_with_a_message(string body)
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var response = await client.PostAsync("/clientapi/user/signup", new StringContent(body, Encoding.UTF8, "application/json"), TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.False(string.IsNullOrEmpty(await Message(response)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Logging_in_and_out()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("login");
|
|
||||||
|
|
||||||
var ok = await LogIn(root.UserName, root.Password);
|
|
||||||
var wrong = await LogIn(root.UserName, "Wrong-Pass-1!");
|
|
||||||
var unknown = await LogIn(Name("nobody"), root.Password);
|
|
||||||
using var signedIn = _host.As((await ok.JsonBody())["token"]!.GetValue<string>());
|
|
||||||
var logout = await signedIn.GetAsync("/clientapi/user/logout", TestContext.Current.CancellationToken);
|
|
||||||
using var anonymous = _host.Client();
|
|
||||||
var anonymousLogout = await anonymous.GetAsync("/clientapi/user/logout", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, ok.StatusCode);
|
|
||||||
Assert.Equal(root.Id, (await ok.JsonBody())["userId"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, wrong.StatusCode);
|
|
||||||
Assert.Equal("Wrong password.", await Message(wrong));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, unknown.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, logout.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, anonymousLogout.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Update_sets_the_recovery_email_and_refuses_one_in_use()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("email");
|
|
||||||
var other = await _host.SignUp("email");
|
|
||||||
var email = $"{Guid.NewGuid():N}@example.test";
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
using var otherClient = _host.As(other.Jwt);
|
|
||||||
|
|
||||||
var set = await client.PostJson("/clientapi/user/update", new { email });
|
|
||||||
var taken = await otherClient.PostJson("/clientapi/user/update", new { email });
|
|
||||||
var invalid = await otherClient.PostJson("/clientapi/user/update", new { email = "not an email" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, set.StatusCode);
|
|
||||||
Assert.Equal(email, (await DB.Default.Find<RootUser>().MatchID(root.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken)).Email);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, taken.StatusCode);
|
|
||||||
Assert.Contains("already taken", await Message(taken));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, invalid.StatusCode);
|
|
||||||
Assert.Null((await DB.Default.Find<RootUser>().MatchID(other.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken)).Email);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Settings_round_trip()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("settings");
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
|
|
||||||
var updated = await client.PostJson("/clientapi/user/update/settings", new
|
|
||||||
{
|
|
||||||
languageCode = "it",
|
|
||||||
lightThemeIndexColour = 100,
|
|
||||||
darkThemeIndexColour = 200,
|
|
||||||
iconsThemeIndexColour = 50,
|
|
||||||
themeIsDarkMode = true,
|
|
||||||
themeIsDarkGray = true
|
|
||||||
});
|
|
||||||
var settings = await (await client.GetAsync("/clientapi/user/settings", TestContext.Current.CancellationToken)).JsonBody();
|
|
||||||
var unsupported = await client.PostJson("/clientapi/user/update/settings", new { languageCode = "xx" });
|
|
||||||
var outOfRange = await client.PostJson("/clientapi/user/update/settings", new { languageCode = "en", lightThemeIndexColour = 360 });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, updated.StatusCode);
|
|
||||||
Assert.Equal("it", settings["languageCode"]!.GetValue<string>());
|
|
||||||
Assert.Equal(100, settings["lightThemeIndexColour"]!.GetValue<int>());
|
|
||||||
Assert.Equal(200, settings["darkThemeIndexColour"]!.GetValue<int>());
|
|
||||||
Assert.Equal(50, settings["iconsThemeIndexColour"]!.GetValue<int>());
|
|
||||||
Assert.True(settings["themeIsDarkMode"]!.GetValue<bool>());
|
|
||||||
Assert.True(settings["themeIsDarkGray"]!.GetValue<bool>());
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, unsupported.StatusCode);
|
|
||||||
Assert.Contains("unsupported", await Message(unsupported));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, outOfRange.StatusCode);
|
|
||||||
Assert.Equal("it", (await DB.Default.Find<RootUser>().MatchID(root.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken)).Settings.LanguageCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Changing_the_password_needs_the_old_one()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("password");
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
|
|
||||||
var wrongOld = await client.PostJson("/clientapi/user/update/password", new { oldPassword = "Wrong-Pass-1!", newPassword = NewPassword, repeatedPassword = NewPassword });
|
|
||||||
var mismatch = await client.PostJson("/clientapi/user/update/password", new { oldPassword = root.Password, newPassword = NewPassword, repeatedPassword = "Something-3!" });
|
|
||||||
var weak = await client.PostJson("/clientapi/user/update/password", new { oldPassword = root.Password, newPassword = "weak", repeatedPassword = "weak" });
|
|
||||||
var changed = await client.PostJson("/clientapi/user/update/password", new { oldPassword = root.Password, newPassword = NewPassword, repeatedPassword = NewPassword });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, wrongOld.StatusCode);
|
|
||||||
Assert.Equal("Wrong password.", await Message(wrongOld));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, mismatch.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, weak.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, changed.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await LogIn(root.UserName, root.Password)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await LogIn(root.UserName, NewPassword)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_invitation_signs_up_a_root_with_a_persona_in_the_group()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp("owner"), "owner");
|
|
||||||
var group = await _host.Group(owner, community: false, password: "door-Pass-1");
|
|
||||||
var invitationCode = group["invitationCode"]!.GetValue<string>();
|
|
||||||
var userName = Name("invited");
|
|
||||||
var avatarUserName = Name("guest");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var wrongPassword = await client.PostJson("/clientapi/user/invitation/signup", new { userName, password = Accounts.Password, invitationCode, invitationPassword = "nope", avatarUserName });
|
|
||||||
var wrongCode = await client.PostJson("/clientapi/user/invitation/signup", new { userName, password = Accounts.Password, invitationCode = $"{Guid.NewGuid():N}{Guid.NewGuid():N}", invitationPassword = "door-Pass-1", avatarUserName });
|
|
||||||
var response = await client.PostJson("/clientapi/user/invitation/signup", new { userName, password = Accounts.Password, invitationCode, invitationPassword = "door-Pass-1", avatarUserName, avatarName = "Guest" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotAcceptable, wrongPassword.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, wrongCode.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var jwt = await response.JsonBody();
|
|
||||||
using var invited = _host.As(jwt["token"]!.GetValue<string>());
|
|
||||||
var avatars = await (await invited.GetAsync("/clientapi/avatar/private/list", TestContext.Current.CancellationToken)).JsonItems();
|
|
||||||
var avatar = Assert.Single(avatars)!;
|
|
||||||
Assert.Equal(avatarUserName, avatar["userName"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Guest", avatar["name"]!.GetValue<string>());
|
|
||||||
var stored = await DB.Default.Find<GroupEntity>().MatchID(group["id"]!.GetValue<string>()).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.Contains(stored.Members, m => !m.IsForeign && m.AvatarId == avatar["id"]!.GetValue<string>() && m.Role == GroupRole.Member);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_invitation_never_names_the_persona_after_the_login()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp("owner"), "owner");
|
|
||||||
var invitationCode = (await _host.Group(owner, community: true))["invitationCode"]!.GetValue<string>();
|
|
||||||
var userName = Name("same");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var same = await client.PostJson("/clientapi/user/invitation/signup", new { userName, password = Accounts.Password, invitationCode, avatarUserName = userName });
|
|
||||||
var shouted = await client.PostJson("/clientapi/user/invitation/signup", new { userName = userName.ToUpperInvariant(), password = Accounts.Password, invitationCode, avatarUserName = userName });
|
|
||||||
var missing = await client.PostJson("/clientapi/user/invitation/signup", new { userName, password = Accounts.Password, invitationCode });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, same.StatusCode);
|
|
||||||
Assert.Equal("Your persona's username must differ from your login.", await Message(same));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, shouted.StatusCode);
|
|
||||||
Assert.Equal("Your persona's username must differ from your login.", await Message(shouted));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, missing.StatusCode);
|
|
||||||
Assert.False(await DB.Default.Find<RootUser>().Match(u => u.UserName == userName).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
Assert.False(await DB.Default.Find<Avatar>().Match(a => a.UserName == userName).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_existing_root_joins_through_an_invitation_with_a_new_persona()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp("owner"), "owner");
|
|
||||||
var group = await _host.Group(owner, community: true);
|
|
||||||
var root = await _host.SignUp("joiner");
|
|
||||||
var avatarUserName = Name("joined");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/user/invitation/login", new
|
|
||||||
{
|
|
||||||
userName = root.UserName,
|
|
||||||
password = root.Password,
|
|
||||||
invitationCode = group["invitationCode"]!.GetValue<string>(),
|
|
||||||
avatarUserName
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
using var joined = _host.As(root.Jwt);
|
|
||||||
var avatar = Assert.Single(await (await joined.GetAsync("/clientapi/avatar/private/list", TestContext.Current.CancellationToken)).JsonItems())!;
|
|
||||||
Assert.Equal(avatarUserName, avatar["userName"]!.GetValue<string>());
|
|
||||||
var groups = await (await joined.GetAsync("/clientapi/group/list?avatarId=" + avatar["id"]!.GetValue<string>(), TestContext.Current.CancellationToken)).JsonItems();
|
|
||||||
Assert.Equal(group["id"]!.GetValue<string>(), Assert.Single(groups)!["id"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Recovery_without_an_email_is_refused()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("noemail");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/user/recover/password", new { userName = root.UserName });
|
|
||||||
var unknown = await client.PostJson("/clientapi/user/recover/password", new { userName = Name("nobody") });
|
|
||||||
var neither = await client.PostJson("/clientapi/user/recover/password", new { });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Locked, response.StatusCode);
|
|
||||||
Assert.Contains("doesn't have an email", await Message(response));
|
|
||||||
Assert.False(await DB.Default.Find<EmailRecovery>().Match(r => r.RootUserId == root.Id).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, unknown.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, neither.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Recovery_through_an_unreachable_mail_server_says_so_and_nothing_more()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("smtp");
|
|
||||||
var email = $"{Guid.NewGuid():N}@example.test";
|
|
||||||
using (var signedIn = _host.As(root.Jwt))
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await signedIn.PostJson("/clientapi/user/update", new { email })).StatusCode);
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var byName = await client.PostJson("/clientapi/user/recover/password", new { userName = root.UserName });
|
|
||||||
var byEmail = await client.PostJson("/clientapi/user/recover/password", new { email });
|
|
||||||
|
|
||||||
foreach (var response in new[] { byName, byEmail })
|
|
||||||
{
|
|
||||||
var body = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);
|
|
||||||
Assert.Equal("Failed to send email.", JsonNode.Parse(body)!["errorMessage"]!.GetValue<string>());
|
|
||||||
foreach (var leak in new[] { "xception", "efused", "ocket", "127.0.0.1", "smtp", "SMTP", " at " })
|
|
||||||
Assert.DoesNotContain(leak, body);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_wrong_recovery_code_changes_nothing()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
var code = Guid.NewGuid().ToString("N");
|
|
||||||
|
|
||||||
var valid = await client.PostAsync("/clientapi/user/recover/valid", new StringContent($"\"{code}\"", Encoding.UTF8, "application/json"), TestContext.Current.CancellationToken);
|
|
||||||
var change = await client.PostJson("/clientapi/user/recover/update/password", new { newPassword = NewPassword, repeatedPassword = NewPassword, recoveryCode = code });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, valid.StatusCode);
|
|
||||||
Assert.Equal("false", await valid.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, change.StatusCode);
|
|
||||||
Assert.Equal("Invalid recovery code.", await Message(change));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_valid_recovery_code_resets_the_password_once()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("recover");
|
|
||||||
var code = Guid.NewGuid().ToString("N") + Guid.NewGuid().ToString("N");
|
|
||||||
await DB.Default.SaveAsync(new EmailRecovery { RootUserId = root.Id, RecoveryCode = code }, TestContext.Current.CancellationToken);
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var valid = await client.PostAsync("/clientapi/user/recover/valid", new StringContent($"\"{code}\"", Encoding.UTF8, "application/json"), TestContext.Current.CancellationToken);
|
|
||||||
var change = await client.PostJson("/clientapi/user/recover/update/password", new { newPassword = NewPassword, repeatedPassword = NewPassword, recoveryCode = code });
|
|
||||||
var again = await client.PostJson("/clientapi/user/recover/update/password", new { newPassword = "Third-Pass-3!", repeatedPassword = "Third-Pass-3!", recoveryCode = code });
|
|
||||||
|
|
||||||
Assert.Equal("true", await valid.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
Assert.True(change.IsSuccessStatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, again.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await LogIn(root.UserName, root.Password)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await LogIn(root.UserName, NewPassword)).StatusCode);
|
|
||||||
Assert.False(await DB.Default.Find<EmailRecovery>().Match(r => r.RootUserId == root.Id).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Sniffing_again_answers_a_fresh_token()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("sniff");
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
|
|
||||||
var response = await client.GetAsync("/clientapi/user/sniff/again", TestContext.Current.CancellationToken);
|
|
||||||
using var anonymous = _host.Client();
|
|
||||||
var refused = await anonymous.GetAsync("/clientapi/user/sniff/again", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var jwt = await response.JsonBody();
|
|
||||||
Assert.Equal(root.Id, jwt["userId"]!.GetValue<string>());
|
|
||||||
Assert.Equal(root.UserName, jwt["username"]!.GetValue<string>());
|
|
||||||
Assert.True(jwt["expiration"]!.GetValue<long>() > DateTime.UtcNow.Ticks);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(jwt["token"]!.GetValue<string>()));
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, refused.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_eleventh_sign_up_from_one_address_in_a_minute_is_refused()
|
|
||||||
{
|
|
||||||
using var client = _host.ClientAt("198.51.100.21");
|
|
||||||
for (var attempt = 1; attempt <= 10; attempt++)
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await client.PostJson("/clientapi/user/signup", new { })).StatusCode);
|
|
||||||
|
|
||||||
var eleventh = await client.PostJson("/clientapi/user/signup", new { userName = Name("limited"), password = Accounts.Password });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.TooManyRequests, eleventh.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_bad_token_answers_401_with_a_json_body()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("badjwt");
|
|
||||||
var tokens = new[]
|
|
||||||
{
|
|
||||||
"not-a-jwt",
|
|
||||||
Jwt(root.Id, root.UserName, DateTime.UtcNow.AddHours(-1)),
|
|
||||||
Jwt(root.Id, root.UserName, DateTime.UtcNow.AddHours(1), key: "another-key-entirely-0123456789abcdef0123456789abcdef0123456789abcdef")
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var token in tokens)
|
|
||||||
{
|
|
||||||
using var client = _host.As(token);
|
|
||||||
var response = await client.GetAsync("/clientapi/user/settings", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
|
||||||
Assert.Equal("application/json", response.Content.Headers.ContentType!.MediaType);
|
|
||||||
var body = await response.JsonBody();
|
|
||||||
Assert.Equal(401, body["statusCode"]!.GetValue<int>());
|
|
||||||
Assert.False(body["isValid"]!.GetValue<bool>());
|
|
||||||
Assert.Contains("invalid_token", response.Headers.WwwAuthenticate.ToString());
|
|
||||||
}
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(Jwt(root.Id, root.UserName, DateTime.UtcNow.AddHours(1))));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_banned_or_removed_root_loses_the_client_api_at_once()
|
|
||||||
{
|
|
||||||
var banned = await _host.SignUp("banned");
|
|
||||||
var removed = await _host.SignUp("removed");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(banned.Jwt));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(removed.Jwt));
|
|
||||||
|
|
||||||
await ClientApi.Ban(banned.Id);
|
|
||||||
await DB.Default.Update<RootUser>().MatchID(removed.Id).Modify(u => u.DeletedAt, DateTime.UtcNow).ExecuteAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Settings(banned.Jwt));
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Settings(removed.Jwt));
|
|
||||||
using (var client = _host.As(banned.Jwt))
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await client.GetAsync("/clientapi/user/sniff/again", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await client.PostJson("/clientapi/avatar/private/insert", new { userName = Name("late"), name = "late", biography = "testing" })).StatusCode);
|
|
||||||
}
|
|
||||||
await ClientApi.Ban(banned.Id, banned: false);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(banned.Jwt));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,257 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Group;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ClientApiGroupsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string DoorPassword = "door-Pass-1";
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<Persona> NewPersona(string name) => await _host.Persona(await _host.SignUp(name), name);
|
|
||||||
|
|
||||||
static Task<GroupEntity> Stored(JsonObject group) =>
|
|
||||||
DB.Default.Find<GroupEntity>().MatchID(group["id"]!.GetValue<string>()).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
async Task<List<string>> Groups(Persona persona)
|
|
||||||
{
|
|
||||||
using var client = _host.As(persona.Root.Jwt);
|
|
||||||
var response = await client.GetAsync("/clientapi/group/list?avatarId=" + persona.Id, TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
return (await response.JsonItems()).Select(g => g!["id"]!.GetValue<string>()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<HttpResponseMessage> Approve(Persona manager, JsonObject group, string actorUri)
|
|
||||||
{
|
|
||||||
using var client = _host.As(manager.Root.Jwt);
|
|
||||||
return await client.PostJson("/clientapi/group/approve", new { avatarId = manager.Id, groupId = group["id"]!.GetValue<string>(), memberActorURI = actorUri });
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<(Persona Owner, JsonObject Circle, RemoteActor Member)> CircleWithRemoteMember()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("circleowner");
|
|
||||||
var circle = await _host.Group(owner, community: false, name: "circle");
|
|
||||||
var member = new RemoteActor(_peer, "member");
|
|
||||||
await _host.Follow(member, _peer.A, circle["userName"]!.GetValue<string>());
|
|
||||||
Assert.True((await Approve(owner, circle, member.Id)).IsSuccessStatusCode);
|
|
||||||
return (owner, circle, member);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<HttpStatusCode> Get(string path, RemoteActor signer = default)
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
using var request = signer == default ? new HttpRequestMessage(HttpMethod.Get, path) : signer.SignedGet(path);
|
|
||||||
request.Headers.Accept.ParseAdd("application/activity+json");
|
|
||||||
return (await client.SendAsync(request, TestContext.Current.CancellationToken)).StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_community_and_a_circle_are_created()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("founder");
|
|
||||||
|
|
||||||
var community = await _host.Group(owner, community: true, name: "community");
|
|
||||||
var circle = await _host.Group(owner, community: false, password: DoorPassword, name: "circle");
|
|
||||||
|
|
||||||
Assert.True(community["isCommunity"]!.GetValue<bool>());
|
|
||||||
Assert.False(circle["isCommunity"]!.GetValue<bool>());
|
|
||||||
foreach (var group in new[] { community, circle })
|
|
||||||
{
|
|
||||||
Assert.True(group["isOwner"]!.GetValue<bool>());
|
|
||||||
Assert.Equal(64, group["invitationCode"]!.GetValue<string>().Length);
|
|
||||||
Assert.Equal($"{PrivaPubHost.Base}/peasants/{group["userName"]!.GetValue<string>()}", group["url"]!.GetValue<string>());
|
|
||||||
Assert.Equal(1, group["membersCount"]!.GetValue<int>());
|
|
||||||
}
|
|
||||||
Assert.True(circle["isPasswordRequired"]!.GetValue<bool>());
|
|
||||||
Assert.False(community["isPasswordRequired"]!.GetValue<bool>());
|
|
||||||
Assert.Equal(GroupKind.Community, (await Stored(community)).Kind);
|
|
||||||
var storedCircle = await Stored(circle);
|
|
||||||
Assert.Equal(GroupKind.Circle, storedCircle.Kind);
|
|
||||||
Assert.NotEqual(DoorPassword, storedCircle.HashedInvitationPassword);
|
|
||||||
Assert.Contains(storedCircle.Members, m => m.AvatarId == owner.Id && m.Role == GroupRole.Owner);
|
|
||||||
Assert.Equal(new[] { community["id"]!.GetValue<string>(), circle["id"]!.GetValue<string>() }.Order(), (await Groups(owner)).Order());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_group_needs_a_persona_of_ones_own()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("founder");
|
|
||||||
var stranger = await _host.SignUp("stranger");
|
|
||||||
using var client = _host.As(stranger.Jwt);
|
|
||||||
|
|
||||||
var insert = await client.PostJson("/clientapi/group/insert", new { avatarId = owner.Id, userName = $"stolen{Guid.NewGuid():N}"[..20], name = "stolen", isCommunity = true });
|
|
||||||
var list = await client.GetAsync("/clientapi/group/list?avatarId=" + owner.Id, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, insert.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, list.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Joining_takes_the_code_and_the_password()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("host");
|
|
||||||
var circle = await _host.Group(owner, community: false, password: DoorPassword);
|
|
||||||
var joiner = await NewPersona("guest");
|
|
||||||
var invitationCode = circle["invitationCode"]!.GetValue<string>();
|
|
||||||
using var client = _host.As(joiner.Root.Jwt);
|
|
||||||
|
|
||||||
var noPassword = await client.PostJson("/clientapi/group/join", new { avatarId = joiner.Id, invitationCode });
|
|
||||||
var wrongPassword = await client.PostJson("/clientapi/group/join", new { avatarId = joiner.Id, invitationCode, invitationPassword = "wrong" });
|
|
||||||
var wrongCode = await client.PostJson("/clientapi/group/join", new { avatarId = joiner.Id, invitationCode = $"{Guid.NewGuid():N}{Guid.NewGuid():N}", invitationPassword = DoorPassword });
|
|
||||||
var joined = await client.PostJson("/clientapi/group/join", new { avatarId = joiner.Id, invitationCode, invitationPassword = DoorPassword });
|
|
||||||
var twice = await client.PostJson("/clientapi/group/join", new { avatarId = joiner.Id, invitationCode, invitationPassword = DoorPassword });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotAcceptable, noPassword.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotAcceptable, wrongPassword.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, wrongCode.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, joined.StatusCode);
|
|
||||||
var view = await joined.JsonBody();
|
|
||||||
Assert.Equal(2, view["membersCount"]!.GetValue<int>());
|
|
||||||
Assert.False(view["isOwner"]!.GetValue<bool>());
|
|
||||||
Assert.Null(view["invitationCode"]);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, twice.StatusCode);
|
|
||||||
Assert.Equal(2, (await Stored(circle)).Members.Count);
|
|
||||||
Assert.Equal(new[] { circle["id"]!.GetValue<string>() }, await Groups(joiner));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Joining_needs_a_persona_of_ones_own()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("host");
|
|
||||||
var community = await _host.Group(owner, community: true);
|
|
||||||
var victim = await NewPersona("victim");
|
|
||||||
var stranger = await _host.SignUp("stranger");
|
|
||||||
using var client = _host.As(stranger.Jwt);
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/group/join", new { avatarId = victim.Id, invitationCode = community["invitationCode"]!.GetValue<string>() });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
|
||||||
Assert.DoesNotContain((await Stored(community)).Members, m => m.AvatarId == victim.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Members_leave_and_owners_cannot()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("host");
|
|
||||||
var community = await _host.Group(owner, community: true);
|
|
||||||
var member = await NewPersona("leaver");
|
|
||||||
var groupId = community["id"]!.GetValue<string>();
|
|
||||||
using (var joining = _host.As(member.Root.Jwt))
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await joining.PostJson("/clientapi/group/join", new { avatarId = member.Id, invitationCode = community["invitationCode"]!.GetValue<string>() })).StatusCode);
|
|
||||||
using var memberClient = _host.As(member.Root.Jwt);
|
|
||||||
using var ownerClient = _host.As(owner.Root.Jwt);
|
|
||||||
|
|
||||||
var left = await memberClient.PostJson("/clientapi/group/leave", new { avatarId = member.Id, groupId });
|
|
||||||
var ownerLeft = await ownerClient.PostJson("/clientapi/group/leave", new { avatarId = owner.Id, groupId });
|
|
||||||
|
|
||||||
Assert.True(left.IsSuccessStatusCode);
|
|
||||||
Assert.Empty(await Groups(member));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, ownerLeft.StatusCode);
|
|
||||||
Assert.Equal(new[] { owner.Id }, (await Stored(community)).Members.Select(m => m.AvatarId));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circle_takes_a_remote_member_only_once_the_owner_approves()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("approver");
|
|
||||||
var circle = await _host.Group(owner, community: false);
|
|
||||||
var member = new RemoteActor(_peer, "asker");
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
|
|
||||||
await _host.Follow(member, _peer.A, circle["userName"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var request = await DB.Default.Find<Follower>().Match(f => f.LocalActorId == circle["id"]!.GetValue<string>() && f.ActorURI == member.Id).ExecuteSingleAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.False(request.IsAccepted);
|
|
||||||
Assert.DoesNotContain((await Stored(circle)).Members, m => m.AvatarId == member.Id);
|
|
||||||
Assert.Empty(await Jobs.Deliveries(member.Id + "/inbox", since, TestContext.Current.CancellationToken));
|
|
||||||
|
|
||||||
var outsider = await NewPersona("outsider");
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await Approve(outsider, circle, member.Id)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await Approve(owner, circle, $"{_peer.A}/users/nobody")).StatusCode);
|
|
||||||
Assert.True((await Approve(owner, circle, member.Id)).IsSuccessStatusCode);
|
|
||||||
|
|
||||||
Assert.Contains((await Stored(circle)).Members, m => m.IsForeign && m.AvatarId == member.Id);
|
|
||||||
Assert.True((await DB.Default.Find<Follower>().MatchID(request.ID).ExecuteFirstAsync(TestContext.Current.CancellationToken)).IsAccepted);
|
|
||||||
var accept = Assert.Single(await Jobs.Deliveries(member.Id + "/inbox", since, TestContext.Current.CancellationToken));
|
|
||||||
Assert.Equal("Accept", accept["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(circle["url"]!.GetValue<string>(), accept["actor"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circle_is_never_found()
|
|
||||||
{
|
|
||||||
var owner = await NewPersona("hidden");
|
|
||||||
var circle = await _host.Group(owner, community: false, name: "circle");
|
|
||||||
var community = await _host.Group(owner, community: true, name: "community");
|
|
||||||
var circleName = circle["userName"]!.GetValue<string>();
|
|
||||||
var communityName = community["userName"]!.GetValue<string>();
|
|
||||||
using var anonymous = _host.Client();
|
|
||||||
using var searcher = _host.As(await _host.MastodonToken(await NewPersona("searcher")));
|
|
||||||
|
|
||||||
foreach (var acct in new[] { circleName, $"{circleName}@{PrivaPubHost.Host}", $"@{circleName}@{PrivaPubHost.Host}" })
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.GetAsync("/api/v1/accounts/lookup?acct=" + Uri.EscapeDataString(acct), TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await searcher.GetAsync("/api/v1/accounts/lookup?acct=" + Uri.EscapeDataString(acct), TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
}
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await anonymous.GetAsync("/api/v1/accounts/lookup?acct=" + communityName, TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await searcher.GetAsync("/api/v1/accounts/" + circle["id"]!.GetValue<string>(), TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await searcher.GetAsync("/api/v1/accounts/" + community["id"]!.GetValue<string>(), TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
|
|
||||||
foreach (var q in new[] { circleName, $"@{circleName}@{PrivaPubHost.Host}", circle["url"]!.GetValue<string>() })
|
|
||||||
{
|
|
||||||
var found = await searcher.GetStringAsync($"/api/v2/search?resolve=true&q={Uri.EscapeDataString(q)}", TestContext.Current.CancellationToken);
|
|
||||||
Assert.Empty(JsonNode.Parse(found)!["accounts"]!.AsArray());
|
|
||||||
Assert.Empty(JsonNode.Parse(found)!["statuses"]!.AsArray());
|
|
||||||
}
|
|
||||||
var communityFound = await searcher.GetStringAsync($"/api/v2/search?resolve=true&q={Uri.EscapeDataString(community["url"]!.GetValue<string>())}", TestContext.Current.CancellationToken);
|
|
||||||
Assert.Single(JsonNode.Parse(communityFound)!["accounts"]!.AsArray());
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.GetAsync($"/@{circleName}", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await anonymous.GetAsync($"/@{communityName}", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circles_members_and_wardens_are_shown_only_to_members()
|
|
||||||
{
|
|
||||||
var (_, circle, member) = await CircleWithRemoteMember();
|
|
||||||
var outsider = new RemoteActor(_peer, "outsider");
|
|
||||||
var community = await _host.Group(await NewPersona("open"), community: true);
|
|
||||||
var circleName = circle["userName"]!.GetValue<string>();
|
|
||||||
var communityName = community["userName"]!.GetValue<string>();
|
|
||||||
|
|
||||||
foreach (var collection in new[] { "flock", "wardens" })
|
|
||||||
{
|
|
||||||
var path = $"/peasants/{circleName}/{collection}";
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, await Get(path));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, await Get(path, outsider));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Get(path, member));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Get($"/peasants/{communityName}/{collection}"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,308 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Moderation;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
[Xunit.Collection(nameof(Exclusive))]
|
|
||||||
public sealed class ClientApiModerationTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
async Task<HttpStatusCode> Settings(string jwt)
|
|
||||||
{
|
|
||||||
using var client = _host.As(jwt);
|
|
||||||
return (await client.GetAsync("/clientapi/user/settings", TestContext.Current.CancellationToken)).StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<HttpStatusCode> Credentials(string token)
|
|
||||||
{
|
|
||||||
using var client = _host.As(token);
|
|
||||||
return (await client.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken)).StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<HttpResponseMessage> LogIn(Root root)
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
return await client.PostJson("/clientapi/user/login", new { userName = root.UserName, password = root.Password });
|
|
||||||
}
|
|
||||||
|
|
||||||
static Task<HttpResponseMessage> Remove(HttpClient client, params string[] ids) =>
|
|
||||||
client.SendAsync(new HttpRequestMessage(HttpMethod.Delete, "/clientapi/admin/remove/users") { Content = JsonContent.Create(new { userIdList = ids }) });
|
|
||||||
|
|
||||||
static Task<RootUser> Stored(string id) => DB.Default.Find<RootUser>().MatchID(id).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
static JsonObject DirectNote(RemoteActor sender, string origin, Persona persona)
|
|
||||||
{
|
|
||||||
var noteId = $"{origin}/notes/{Guid.NewGuid():N}";
|
|
||||||
var to = new JsonArray($"{PrivaPubHost.Base}/peasants/{persona.UserName}");
|
|
||||||
return new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId + "/activity",
|
|
||||||
["type"] = "Create",
|
|
||||||
["actor"] = sender.Id,
|
|
||||||
["to"] = to.DeepClone(),
|
|
||||||
["object"] = new JsonObject { ["id"] = noteId, ["type"] = "Note", ["attributedTo"] = sender.Id, ["to"] = to.DeepClone(), ["content"] = "<p>hello</p>" }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_admin_bans_and_unbans_a_root()
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var victim = await _host.Persona(await _host.SignUp("victim"), "victim");
|
|
||||||
var token = await _host.MastodonToken(victim);
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
|
|
||||||
var banned = await client.PostJson("/clientapi/admin/ban/users", new { userIdList = new[] { victim.Root.Id } });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, banned.StatusCode);
|
|
||||||
Assert.True((await Stored(victim.Root.Id)).IsBanned);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Settings(victim.Root.Jwt));
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Credentials(token));
|
|
||||||
var login = await LogIn(victim.Root);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, login.StatusCode);
|
|
||||||
Assert.Contains("banned", (await login.JsonBody())["errorMessage"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var unbanned = await client.PostJson("/clientapi/admin/unban/users", new { userIdList = new[] { victim.Root.Id } });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, unbanned.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(victim.Root.Jwt));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Credentials(token));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await LogIn(victim.Root)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_admin_cannot_ban_or_remove_itself()
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var victim = await _host.SignUp("victim");
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await client.PostJson("/clientapi/admin/ban/users", new { userIdList = new[] { admin.Id, victim.Id } })).StatusCode);
|
|
||||||
var removed = await Remove(client, admin.Id);
|
|
||||||
|
|
||||||
Assert.False((await Stored(admin.Id)).IsBanned);
|
|
||||||
Assert.True((await Stored(victim.Id)).IsBanned);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, removed.StatusCode);
|
|
||||||
Assert.Null((await Stored(admin.Id)).DeletedAt);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await Settings(admin.Jwt));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_admin_removes_a_root()
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var victim = await _host.Persona(await _host.SignUp("removed"), "removed");
|
|
||||||
var token = await _host.MastodonToken(victim);
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
|
|
||||||
var removed = await Remove(client, victim.Root.Id);
|
|
||||||
var again = await Remove(client, victim.Root.Id);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, removed.StatusCode);
|
|
||||||
var stored = await Stored(victim.Root.Id);
|
|
||||||
Assert.NotNull(stored.DeletedAt);
|
|
||||||
Assert.Null(stored.HashedPassword);
|
|
||||||
Assert.NotEqual(victim.Root.UserName, stored.UserName);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, again.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Settings(victim.Root.Jwt));
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, await Credentials(token));
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await LogIn(victim.Root)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Only_admins_moderate()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("plain");
|
|
||||||
var target = await _host.SignUp("target");
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
using var anonymous = _host.Client();
|
|
||||||
var forbidden = new List<HttpResponseMessage>
|
|
||||||
{
|
|
||||||
await client.PostJson("/clientapi/admin/ban/users", new { userIdList = new[] { target.Id } }),
|
|
||||||
await client.PostJson("/clientapi/admin/unban/users", new { userIdList = new[] { target.Id } }),
|
|
||||||
await Remove(client, target.Id),
|
|
||||||
await client.GetAsync("/clientapi/admin/domainblocks/list", TestContext.Current.CancellationToken),
|
|
||||||
await client.PostJson("/clientapi/admin/domainblocks/insert", new { domain = "forbidden.example" }),
|
|
||||||
await client.PostAsync("/clientapi/admin/domainblocks/delete?domain=forbidden.example", default, TestContext.Current.CancellationToken),
|
|
||||||
await client.GetAsync("/clientapi/moderator/reports", TestContext.Current.CancellationToken),
|
|
||||||
await client.PostAsync($"/clientapi/moderator/reports/{target.Id}/resolve", default, TestContext.Current.CancellationToken)
|
|
||||||
};
|
|
||||||
var unauthorized = await anonymous.PostJson("/clientapi/admin/ban/users", new { userIdList = new[] { target.Id } });
|
|
||||||
|
|
||||||
foreach (var response in forbidden)
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
|
||||||
var body = await response.JsonBody();
|
|
||||||
Assert.Equal(403, body["statusCode"]!.GetValue<int>());
|
|
||||||
Assert.Equal("Forbidden.", body["errorMessage"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, unauthorized.StatusCode);
|
|
||||||
var stored = await Stored(target.Id);
|
|
||||||
Assert.False(stored.IsBanned);
|
|
||||||
Assert.Null(stored.DeletedAt);
|
|
||||||
Assert.False(await DB.Default.Find<DomainBlock>().Match(b => b.Domain == "forbidden.example").ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_moderator_lists_and_resolves_reports()
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var reporter = await _host.Persona(await _host.SignUp("reporter"), "reporter");
|
|
||||||
var target = await _host.Persona(await _host.SignUp("reported"), "reported");
|
|
||||||
var comment = $"spam {Guid.NewGuid():N}";
|
|
||||||
using (var api = _host.As(await _host.MastodonToken(reporter)))
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.Form("/api/v1/reports", ("account_id", target.Id), ("comment", comment), ("category", "spam"))).StatusCode);
|
|
||||||
var reportId = (await DB.Default.Find<Models.Social.Report>().Match(r => r.Comment == comment).ExecuteSingleAsync(TestContext.Current.CancellationToken)).ID;
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
|
|
||||||
var open = await client.GetStringAsync("/clientapi/moderator/reports?resolved=false", TestContext.Current.CancellationToken);
|
|
||||||
var resolved = await client.PostAsync($"/clientapi/moderator/reports/{reportId}/resolve", default, TestContext.Current.CancellationToken);
|
|
||||||
var stillOpen = await client.GetStringAsync("/clientapi/moderator/reports?resolved=false", TestContext.Current.CancellationToken);
|
|
||||||
var closed = await client.GetStringAsync("/clientapi/moderator/reports?resolved=true", TestContext.Current.CancellationToken);
|
|
||||||
var unknown = await client.PostAsync($"/clientapi/moderator/reports/{MongoDB.Bson.ObjectId.GenerateNewId()}/resolve", default, TestContext.Current.CancellationToken);
|
|
||||||
var junk = await client.PostAsync("/clientapi/moderator/reports/x/resolve", default, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
var listed = JsonNode.Parse(open)!.AsArray().Single(r => r!["id"]!.GetValue<string>() == reportId)!;
|
|
||||||
Assert.Equal("local", listed["reporter"]!.GetValue<string>());
|
|
||||||
Assert.Equal(target.Id, listed["targetAccountId"]!.GetValue<string>());
|
|
||||||
Assert.Equal("spam", listed["category"]!.GetValue<string>());
|
|
||||||
Assert.DoesNotContain(reporter.Id, open);
|
|
||||||
Assert.DoesNotContain(reporter.UserName, open);
|
|
||||||
Assert.DoesNotContain(reporter.Root.Id, open);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, resolved.StatusCode);
|
|
||||||
Assert.DoesNotContain(reportId, stillOpen);
|
|
||||||
Assert.Contains(reportId, closed);
|
|
||||||
var stored = await DB.Default.Find<Models.Social.Report>().MatchID(reportId).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(admin.Id, stored.ResolvedBy);
|
|
||||||
Assert.NotNull(stored.ResolvedAt);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, unknown.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, junk.StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Domain_blocks_are_inserted_listed_and_deleted()
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var domain = $"blocked-{Guid.NewGuid():N}.example";
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var inserted = await client.PostJson("/clientapi/admin/domainblocks/insert", new { domain = $" {domain.ToUpperInvariant()}. ", suspend = false, rejectMedia = true, publicComment = "noisy" });
|
|
||||||
var listed = await (await client.GetAsync("/clientapi/admin/domainblocks/list", TestContext.Current.CancellationToken)).JsonItems();
|
|
||||||
var suspended = await client.PostJson("/clientapi/admin/domainblocks/insert", new { domain, suspend = true });
|
|
||||||
var deleted = await client.PostAsync($"/clientapi/admin/domainblocks/delete?domain={domain}", default, TestContext.Current.CancellationToken);
|
|
||||||
var after = await (await client.GetAsync("/clientapi/admin/domainblocks/list", TestContext.Current.CancellationToken)).JsonItems();
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, inserted.StatusCode);
|
|
||||||
var view = await inserted.JsonBody();
|
|
||||||
Assert.Equal(domain, view["domain"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Silence", view["severity"]!.GetValue<string>());
|
|
||||||
Assert.True(view["rejectMedia"]!.GetValue<bool>());
|
|
||||||
Assert.Contains(listed, b => b!["domain"]!.GetValue<string>() == domain);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, suspended.StatusCode);
|
|
||||||
Assert.Equal("Suspend", (await suspended.JsonBody())["severity"]!.GetValue<string>());
|
|
||||||
Assert.Equal(view["id"]!.GetValue<string>(), (await suspended.JsonBody())["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpStatusCode.OK, deleted.StatusCode);
|
|
||||||
Assert.DoesNotContain(after, b => b!["domain"]!.GetValue<string>() == domain);
|
|
||||||
Assert.Null(_host.Get<IDomainBlocks>().Find(domain));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await DB.Default.DeleteAsync<DomainBlock>(b => b.Domain == domain);
|
|
||||||
await _host.Get<IDomainBlocks>().Reload(CancellationToken.None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("")]
|
|
||||||
[InlineData("ab")]
|
|
||||||
[InlineData("not a domain")]
|
|
||||||
[InlineData("127.0.0.1")]
|
|
||||||
[InlineData("https://bad.example/")]
|
|
||||||
[InlineData("bad..example")]
|
|
||||||
public async Task A_bad_domain_is_refused(string domain)
|
|
||||||
{
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
using var client = _host.As(admin.Jwt);
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/admin/domainblocks/insert", new { domain });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
var normalised = DomainBlocks.Normalise(domain);
|
|
||||||
Assert.False(await DB.Default.Find<DomainBlock>().Match(b => b.Domain == normalised).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_suspended_server_is_answered_202_and_nothing_is_kept()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var admin = await _host.Admin();
|
|
||||||
var persona = await _host.Persona(await _host.SignUp("suspend"), "suspend");
|
|
||||||
await using var peer = await Peer.Start();
|
|
||||||
var sender = new RemoteActor(peer, "suspended", origin: peer.B);
|
|
||||||
var blocked = DirectNote(sender, peer.B, persona);
|
|
||||||
var welcome = DirectNote(sender, peer.B, persona);
|
|
||||||
using var adminClient = _host.As(admin.Jwt);
|
|
||||||
using var client = _host.Client();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await adminClient.PostJson("/clientapi/admin/domainblocks/insert", new { domain = "localhost", suspend = true })).StatusCode);
|
|
||||||
var answer = await client.SendAsync(sender.SignedPost($"/peasants/{persona.UserName}/mouth", blocked), token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, answer.StatusCode);
|
|
||||||
Assert.False(await DB.Default.Find<Job>().Match(j => j.DedupeKey == "inbox|" + blocked["id"]!.GetValue<string>()).ExecuteAnyAsync(token));
|
|
||||||
Assert.Equal(0, await _host.RunInbox(blocked["id"]!.GetValue<string>(), token));
|
|
||||||
Assert.False(await DB.Default.Find<Post>().Match(p => p.ObjectURI == blocked["object"]!["id"]!.GetValue<string>()).ExecuteAnyAsync(token));
|
|
||||||
Assert.Empty(peer.Requests);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await adminClient.PostAsync("/clientapi/admin/domainblocks/delete?domain=localhost", default, token)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, (await client.SendAsync(sender.SignedPost($"/peasants/{persona.UserName}/mouth", welcome), token)).StatusCode);
|
|
||||||
Assert.Equal(1, await _host.RunInbox(welcome["id"]!.GetValue<string>(), token));
|
|
||||||
Assert.True(await DB.Default.Find<Post>().Match(p => p.ObjectURI == welcome["object"]!["id"]!.GetValue<string>()).ExecuteAnyAsync(token));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await DB.Default.DeleteAsync<DomainBlock>(b => b.Domain == "localhost");
|
|
||||||
await _host.Get<IDomainBlocks>().Reload(CancellationToken.None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_data_endpoints_answer_anyone()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var ping = await client.GetAsync("/clientapi/data/ping", TestContext.Current.CancellationToken);
|
|
||||||
var version = await client.GetAsync("/clientapi/data/current-version", TestContext.Current.CancellationToken);
|
|
||||||
var languages = await client.GetAsync("/clientapi/data/languages", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NoContent, ping.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, version.StatusCode);
|
|
||||||
Assert.False(string.IsNullOrWhiteSpace(await version.Content.ReadAsStringAsync(TestContext.Current.CancellationToken)));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, languages.StatusCode);
|
|
||||||
var codes = (await languages.JsonItems()).Select(l => l!["international2Code"]!.GetValue<string>()).Order().ToList();
|
|
||||||
Assert.Equal(new[] { "en", "it" }, codes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
using MongoDB.Bson;
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using GroupEntity = PrivaPub.Models.Group.Group;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ClientApiPersonasTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
static string Name(string prefix) => $"{prefix}{Guid.NewGuid():N}"[..20];
|
|
||||||
|
|
||||||
async Task<HttpResponseMessage> Insert(Root root, object body)
|
|
||||||
{
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
return await client.PostJson("/clientapi/avatar/private/insert", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<List<string>> Listed(Root root)
|
|
||||||
{
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
return (await (await client.GetAsync("/clientapi/avatar/private/list", TestContext.Current.CancellationToken)).JsonItems())
|
|
||||||
.Select(a => a!["id"]!.GetValue<string>()).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static DateTime IdDay(string id) => ObjectId.Parse(id).CreationTime;
|
|
||||||
|
|
||||||
static void WithinTwoWeeksBefore(DateTime created, DateTime published, string id)
|
|
||||||
{
|
|
||||||
Assert.Equal(published.Date, published);
|
|
||||||
Assert.InRange(published, created.Date.AddDays(-13), DateTime.UtcNow.Date);
|
|
||||||
Assert.Equal(published, IdDay(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_root_id_in_the_body_is_ignored()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("owner");
|
|
||||||
var other = await _host.SignUp("victim");
|
|
||||||
var userName = Name("planted");
|
|
||||||
|
|
||||||
var response = await Insert(root, new { userName, name = "planted", biography = "testing", rootId = other.Id });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var id = (await response.JsonBody())["id"]!.GetValue<string>();
|
|
||||||
var link = await DB.Default.Find<RootToAvatar>().Match(r => r.AvatarId == id).ExecuteSingleAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(root.Id, link.RootId);
|
|
||||||
Assert.Contains(id, await Listed(root));
|
|
||||||
Assert.DoesNotContain(id, await Listed(other));
|
|
||||||
Assert.DoesNotContain(root.Id, await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("Upper")]
|
|
||||||
[InlineData("has-dash")]
|
|
||||||
[InlineData("dot.ted")]
|
|
||||||
[InlineData("spa ce")]
|
|
||||||
[InlineData("ünïcode")]
|
|
||||||
[InlineData("at@sign")]
|
|
||||||
[InlineData("")]
|
|
||||||
public async Task Usernames_outside_the_regex_are_refused(string userName)
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("regex");
|
|
||||||
|
|
||||||
var response = await Insert(root, new { userName, name = "regex", biography = "testing" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.Contains((await response.JsonBody())["errors"]!.AsObject(), e => e.Key.Equals("userName", StringComparison.OrdinalIgnoreCase));
|
|
||||||
Assert.Empty(await Listed(root));
|
|
||||||
if (userName.Length > 0)
|
|
||||||
Assert.False(await DB.Default.Find<ReservedName>().Match(r => r.Name == userName || r.Name == userName.ToLowerInvariant()).ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("admin")]
|
|
||||||
[InlineData("privapub")]
|
|
||||||
[InlineData("root")]
|
|
||||||
[InlineData("moderator")]
|
|
||||||
[InlineData("abuse")]
|
|
||||||
public async Task Reserved_names_are_refused(string userName)
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("reserved");
|
|
||||||
|
|
||||||
var response = await Insert(root, new { userName, name = userName, biography = "testing" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.Contains("already take", (await response.JsonBody())["errorMessage"]!.GetValue<string>());
|
|
||||||
Assert.Empty(await Listed(root));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Personas_and_groups_share_one_name_space()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("names");
|
|
||||||
var persona = await _host.Persona(root, "names");
|
|
||||||
var group = await _host.Group(persona, community: true);
|
|
||||||
var groupName = group["userName"]!.GetValue<string>();
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
|
|
||||||
var personaOverGroup = await Insert(root, new { userName = groupName, name = "copy", biography = "testing" });
|
|
||||||
var groupOverPersona = await client.PostJson("/clientapi/group/insert", new { avatarId = persona.Id, userName = persona.UserName, name = "copy", isCommunity = true });
|
|
||||||
var personaOverPersona = await Insert(await _host.SignUp("names"), new { userName = persona.UserName, name = "copy", biography = "testing" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, personaOverGroup.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, groupOverPersona.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, personaOverPersona.StatusCode);
|
|
||||||
var reserved = await DB.Default.Find<ReservedName>().Match(r => r.Name == groupName || r.Name == persona.UserName).ExecuteAsync(TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(2, reserved.Count);
|
|
||||||
Assert.Contains(reserved, r => r.Name == persona.UserName && r.OwnerKind == LocalActorKind.Person && r.OwnerId == persona.Id);
|
|
||||||
Assert.Contains(reserved, r => r.Name == groupName && r.OwnerKind == LocalActorKind.Group && r.OwnerId == group["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(1, await DB.Default.CountAsync<Avatar>(a => a.UserName == persona.UserName, TestContext.Current.CancellationToken));
|
|
||||||
Assert.Equal(1, await DB.Default.CountAsync<GroupEntity>(g => g.UserName == groupName, TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_update_is_delivered_to_followers()
|
|
||||||
{
|
|
||||||
await using var peer = await Peer.Start();
|
|
||||||
var persona = await _host.Persona(await _host.SignUp("update"), "update");
|
|
||||||
var follower = new RemoteActor(peer, "fan");
|
|
||||||
await _host.Follow(follower, peer.A, persona.UserName);
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
using var client = _host.As(persona.Root.Jwt);
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/avatar/private/update", new { avatarId = persona.Id, name = "Renamed", biography = "new biography" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var update = Assert.Single(await Jobs.Deliveries(follower.Id + "/inbox", since, TestContext.Current.CancellationToken), d => d["type"]!.GetValue<string>() == "Update");
|
|
||||||
Assert.Equal($"{PrivaPubHost.Base}/peasants/{persona.UserName}", update["actor"]!.GetValue<string>());
|
|
||||||
var person = update["object"]!.AsObject();
|
|
||||||
Assert.Equal("Person", person["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{PrivaPubHost.Base}/peasants/{persona.UserName}", person["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Renamed", person["name"]!.GetValue<string>());
|
|
||||||
Assert.DoesNotContain(persona.Root.Id, update.ToJsonString());
|
|
||||||
Assert.DoesNotContain(persona.Root.UserName, update.ToJsonString());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Updating_another_roots_persona_is_refused()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp("mine"), "mine");
|
|
||||||
var intruder = await _host.SignUp("intruder");
|
|
||||||
using var client = _host.As(intruder.Jwt);
|
|
||||||
|
|
||||||
var response = await client.PostJson("/clientapi/avatar/private/update", new { avatarId = persona.Id, name = "Hijacked", biography = "testing" });
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
|
||||||
Assert.NotEqual("Hijacked", (await DB.Default.Find<Avatar>().MatchID(persona.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken)).Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Published_days_and_ids_fall_within_two_weeks_before_creation()
|
|
||||||
{
|
|
||||||
var created = DateTime.UtcNow;
|
|
||||||
var persona = await _host.Persona(await _host.SignUp("published"), "published");
|
|
||||||
var group = await _host.Group(persona, community: true);
|
|
||||||
using var client = _host.Client();
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Get, $"/peasants/{persona.UserName}");
|
|
||||||
request.Headers.Accept.ParseAdd("application/activity+json");
|
|
||||||
|
|
||||||
var avatar = await DB.Default.Find<Avatar>().MatchID(persona.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
var stored = await DB.Default.Find<GroupEntity>().MatchID(group["id"]!.GetValue<string>()).ExecuteFirstAsync(TestContext.Current.CancellationToken);
|
|
||||||
var actor = JsonNode.Parse(await (await client.SendAsync(request, TestContext.Current.CancellationToken)).Content.ReadAsStringAsync(TestContext.Current.CancellationToken))!;
|
|
||||||
|
|
||||||
WithinTwoWeeksBefore(created, avatar.PublishedOn, avatar.ID);
|
|
||||||
WithinTwoWeeksBefore(created, stored.PublishedOn, stored.ID);
|
|
||||||
var published = DateTime.Parse(actor["published"]!.GetValue<string>(), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
|
|
||||||
Assert.Equal(avatar.PublishedOn, published);
|
|
||||||
Assert.DoesNotContain(avatar.CreatedAt.ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture), actor.ToJsonString());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_list_holds_only_the_roots_own_personas()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("list");
|
|
||||||
var other = await _host.SignUp("list");
|
|
||||||
var first = await _host.Persona(root, "first");
|
|
||||||
var second = await _host.Persona(root, "second");
|
|
||||||
var theirs = await _host.Persona(other, "theirs");
|
|
||||||
|
|
||||||
Assert.Equal(new[] { first.Id, second.Id }.Order(), (await Listed(root)).Order());
|
|
||||||
Assert.Equal(new[] { theirs.Id }, await Listed(other));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,468 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Federation.Rendering;
|
|
||||||
using PrivaPub.Models.Federation;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.Host.FederationHelpers;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class FederationGetTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string Base = PrivaPubHost.Base;
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
HttpClient _client;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_client = _host.Client();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
_client?.Dispose();
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_actor_document_is_activity_json_with_an_spki_key_on_the_actor()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "actor");
|
|
||||||
var avatar = await DB.Default.Find<Avatar>().MatchID(persona.Id).ExecuteSingleAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
var fetched = await _client.Fetch($"/peasants/{persona.UserName}");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, fetched.Status);
|
|
||||||
Assert.Equal(ActivityJson, fetched.MediaType);
|
|
||||||
Assert.Contains("Accept", fetched.Response.Headers.Vary);
|
|
||||||
var actor = fetched.Json;
|
|
||||||
var id = persona.ActorUri();
|
|
||||||
Assert.Equal(id, actor["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Person", actor["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.UserName, actor["preferredUsername"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/mouth", actor["inbox"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/anus", actor["outbox"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/groupies", actor["followers"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/stalking", actor["following"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/trophies", actor["featured"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id + "/tattoos", actor["featuredTags"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{Base}/@{persona.UserName}", actor["url"]!.GetValue<string>());
|
|
||||||
Assert.Equal(Base + "/human-centipede", actor["endpoints"]!["sharedInbox"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var key = actor["publicKey"]!;
|
|
||||||
Assert.Equal(id + "#main-key", key["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(id, key["owner"]!.GetValue<string>());
|
|
||||||
var pem = key["publicKeyPem"]!.GetValue<string>();
|
|
||||||
Assert.StartsWith("-----BEGIN PUBLIC KEY-----", pem);
|
|
||||||
using var rsa = RSA.Create();
|
|
||||||
rsa.ImportFromPem(pem);
|
|
||||||
Assert.True(rsa.KeySize >= 2048);
|
|
||||||
|
|
||||||
Assert.Equal(ActivityPubRenderer.Day(avatar.PublishedOn), actor["published"]!.GetValue<string>());
|
|
||||||
Assert.EndsWith("T00:00:00Z", actor["published"]!.GetValue<string>());
|
|
||||||
Assert.DoesNotContain(Keys(actor), k => k.Contains("created", StringComparison.OrdinalIgnoreCase));
|
|
||||||
Assert.DoesNotContain(ActivityPubRenderer.Timestamp(avatar.CreatedAt)[..16], fetched.Text);
|
|
||||||
Assert.DoesNotContain(persona.Root.Id, fetched.Text);
|
|
||||||
Assert.DoesNotContain(persona.Root.UserName, fetched.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_actor_answers_ld_json_and_sends_browsers_to_the_profile_page()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "browser");
|
|
||||||
|
|
||||||
var ld = await _client.Fetch($"/peasants/{persona.UserName}", LdJson);
|
|
||||||
var browser = await _client.Fetch($"/peasants/{persona.UserName}", Browser);
|
|
||||||
var instance = await _client.Fetch("/peasants/privapub", Browser);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, ld.Status);
|
|
||||||
Assert.Equal(persona.ActorUri(), ld.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, browser.Status);
|
|
||||||
Assert.Equal($"{Base}/@{persona.UserName}", browser.Location);
|
|
||||||
Assert.Contains("Accept", browser.Response.Headers.Vary);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, instance.Status);
|
|
||||||
Assert.Equal("Application", instance.Json["type"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Users_moves_permanently_to_peasants_and_unknown_actors_are_404()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "users");
|
|
||||||
|
|
||||||
var moved = await _client.Fetch($"/users/{persona.UserName}");
|
|
||||||
var unknown = await _client.Fetch($"/peasants/nobody{Guid.NewGuid():N}"[..28]);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.MovedPermanently, moved.Status);
|
|
||||||
Assert.Equal($"/peasants/{persona.UserName}", moved.Location);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, unknown.Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_outbox_pages_public_posts_and_boosts_and_nothing_else()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "outbox");
|
|
||||||
var friend = await _host.Persona(await _host.SignUp(), "friend");
|
|
||||||
var boosted = await _host.Publish(friend, "worth a boost");
|
|
||||||
var shown = new List<Post>();
|
|
||||||
for (var i = 0; i < 20; i++)
|
|
||||||
shown.Add(await _host.Publish(persona, $"public number {i}"));
|
|
||||||
shown.Add(await _host.Publish(persona, "quietly public", PostVisibility.Unlisted));
|
|
||||||
var hidden = new List<Post>
|
|
||||||
{
|
|
||||||
await _host.Publish(persona, "for followers", PostVisibility.FollowersOnly),
|
|
||||||
await _host.Publish(persona, $"@{friend.UserName} just you", PostVisibility.Direct),
|
|
||||||
await _host.PublishLocated(persona, "only around here"),
|
|
||||||
await _host.FederatedCopy(persona)
|
|
||||||
};
|
|
||||||
var deleted = await _host.Publish(persona, "regretted");
|
|
||||||
await _host.Remove(persona, deleted);
|
|
||||||
hidden.Add(deleted);
|
|
||||||
var reblog = await _host.Reblog(persona, boosted);
|
|
||||||
Assert.Equal(PostVisibility.LocalGeo, hidden[2].Visibility);
|
|
||||||
|
|
||||||
var outbox = await _client.Fetch($"/peasants/{persona.UserName}/anus");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, outbox.Status);
|
|
||||||
Assert.Equal(ActivityJson, outbox.MediaType);
|
|
||||||
Assert.Equal("OrderedCollection", outbox.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri() + "/anus", outbox.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(22, outbox.Json["totalItems"]!.GetValue<int>());
|
|
||||||
Assert.Null(outbox.Json["orderedItems"]);
|
|
||||||
var first = outbox.Json["first"]!.GetValue<string>();
|
|
||||||
Assert.Equal(persona.ActorUri() + "/anus?page=true", first);
|
|
||||||
|
|
||||||
var page1 = await _client.Fetch(PathOf(first));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, page1.Status);
|
|
||||||
Assert.Equal("OrderedCollectionPage", page1.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri() + "/anus", page1.Json["partOf"]!.GetValue<string>());
|
|
||||||
var items1 = page1.Json["orderedItems"]!.AsArray().Select(i => i!.AsObject()).ToList();
|
|
||||||
Assert.Equal(20, items1.Count);
|
|
||||||
var next = page1.Json["next"]!.GetValue<string>();
|
|
||||||
Assert.StartsWith(persona.ActorUri() + "/anus?page=true&max_id=", next);
|
|
||||||
|
|
||||||
var page2 = await _client.Fetch(PathOf(next));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, page2.Status);
|
|
||||||
Assert.Equal(next, page2.Json["id"]!.GetValue<string>());
|
|
||||||
var items2 = page2.Json["orderedItems"]!.AsArray().Select(i => i!.AsObject()).ToList();
|
|
||||||
Assert.Equal(2, items2.Count);
|
|
||||||
Assert.Null(page2.Json["next"]);
|
|
||||||
|
|
||||||
var items = items1.Concat(items2).ToList();
|
|
||||||
Assert.Equal(22, items.Select(i => i["id"]!.GetValue<string>()).Distinct().Count());
|
|
||||||
var announce = items[0];
|
|
||||||
Assert.Equal("Announce", announce["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(reblog.ObjectURI, announce["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{persona.ActorUri()}/grunts/announce-{boosted.ID}", announce["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(boosted.ObjectURI, announce["object"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri(), announce["actor"]!.GetValue<string>());
|
|
||||||
|
|
||||||
var creates = items.Skip(1).ToList();
|
|
||||||
Assert.All(creates, c =>
|
|
||||||
{
|
|
||||||
Assert.Equal("Create", c["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri(), c["actor"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri(), c["object"]!["attributedTo"]!.GetValue<string>());
|
|
||||||
});
|
|
||||||
Assert.Equal(shown.Select(p => p.ObjectURI).Reverse(), creates.Select(c => c["object"]!["id"]!.GetValue<string>()));
|
|
||||||
var everything = page1.Text + page2.Text;
|
|
||||||
foreach (var post in hidden)
|
|
||||||
Assert.DoesNotContain(post.ID, everything);
|
|
||||||
|
|
||||||
var junk = await _client.Fetch($"/peasants/{persona.UserName}/anus?page=true&max_id=not-an-id");
|
|
||||||
Assert.True((int)junk.Status < 500, $"a junk max_id answered {(int)junk.Status}");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Followers_and_following_give_no_names_away()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "groupies");
|
|
||||||
var friend = await _host.Persona(await _host.SignUp(), "stalked");
|
|
||||||
var accepted = $"https://remote.example/users/fan{Guid.NewGuid():N}";
|
|
||||||
var pending = $"https://remote.example/users/hopeful{Guid.NewGuid():N}";
|
|
||||||
await DB.Default.SaveAsync(new[]
|
|
||||||
{
|
|
||||||
new Follower { LocalActorId = persona.Id, LocalActorKind = LocalActorKind.Person, ActorURI = accepted, InboxURL = accepted + "/inbox" },
|
|
||||||
new Follower { LocalActorId = persona.Id, LocalActorKind = LocalActorKind.Person, ActorURI = pending, InboxURL = pending + "/inbox", IsAccepted = false }
|
|
||||||
}, token);
|
|
||||||
await DB.Default.SaveAsync(new Following
|
|
||||||
{
|
|
||||||
AvatarId = persona.Id,
|
|
||||||
TargetAccountId = friend.Id,
|
|
||||||
TargetActorURI = friend.ActorUri(),
|
|
||||||
TargetIsLocal = true,
|
|
||||||
State = FollowState.Accepted
|
|
||||||
}, token);
|
|
||||||
|
|
||||||
var followers = await _client.Fetch($"/peasants/{persona.UserName}/groupies");
|
|
||||||
var following = await _client.Fetch($"/peasants/{persona.UserName}/stalking");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, followers.Status);
|
|
||||||
Assert.Equal("OrderedCollection", followers.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri() + "/groupies", followers.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(1, followers.Json["totalItems"]!.GetValue<int>());
|
|
||||||
Assert.DoesNotContain(accepted, followers.Text);
|
|
||||||
Assert.DoesNotContain(pending, followers.Text);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, following.Status);
|
|
||||||
Assert.Equal(persona.ActorUri() + "/stalking", following.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(0, following.Json["totalItems"]!.GetValue<int>());
|
|
||||||
Assert.DoesNotContain(friend.UserName, following.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Trophies_are_the_public_pins_newest_first_and_tattoos_is_empty()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "trophies");
|
|
||||||
var older = await _host.Publish(persona, "pinned first");
|
|
||||||
var newer = await _host.Publish(persona, "pinned second");
|
|
||||||
var followersOnly = await _host.Publish(persona, "pinned but private", PostVisibility.FollowersOnly);
|
|
||||||
var removed = await _host.Publish(persona, "pinned then deleted");
|
|
||||||
foreach (var post in new[] { older, followersOnly, removed, newer })
|
|
||||||
await DB.Default.SaveAsync(new Pin { AvatarId = persona.Id, PostId = post.ID }, token);
|
|
||||||
await _host.Remove(persona, removed);
|
|
||||||
|
|
||||||
var featured = await _client.Fetch($"/peasants/{persona.UserName}/trophies");
|
|
||||||
var tags = await _client.Fetch($"/peasants/{persona.UserName}/tattoos");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, featured.Status);
|
|
||||||
Assert.Equal(persona.ActorUri() + "/trophies", featured.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(2, featured.Json["totalItems"]!.GetValue<int>());
|
|
||||||
var notes = featured.Json["orderedItems"]!.AsArray();
|
|
||||||
Assert.Equal(new[] { newer.ObjectURI, older.ObjectURI }, notes.Select(n => n!["id"]!.GetValue<string>()));
|
|
||||||
Assert.All(notes, n => Assert.Equal("Note", n!["type"]!.GetValue<string>()));
|
|
||||||
Assert.DoesNotContain(followersOnly.ID, featured.Text);
|
|
||||||
Assert.DoesNotContain(removed.ID, featured.Text);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, tags.Status);
|
|
||||||
Assert.Equal(persona.ActorUri() + "/tattoos", tags.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(0, tags.Json["totalItems"]!.GetValue<int>());
|
|
||||||
Assert.Empty(tags.Json["orderedItems"]!.AsArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_scribble_is_served_while_public_and_a_tombstone_once_deleted()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "scribble");
|
|
||||||
var other = await _host.Persona(await _host.SignUp(), "other");
|
|
||||||
var shown = await _host.Publish(persona, "hello fediverse");
|
|
||||||
var unlisted = await _host.Publish(persona, "hello quietly", PostVisibility.Unlisted);
|
|
||||||
var followersOnly = await _host.Publish(persona, "hello followers", PostVisibility.FollowersOnly);
|
|
||||||
var direct = await _host.Publish(persona, $"@{other.UserName} hello you", PostVisibility.Direct);
|
|
||||||
var located = await _host.PublishLocated(persona, "hello neighbours");
|
|
||||||
var deleted = await _host.Publish(persona, "goodbye");
|
|
||||||
await _host.Remove(persona, deleted);
|
|
||||||
string Path(Post post) => $"/peasants/{persona.UserName}/scribbles/{post.ID}";
|
|
||||||
|
|
||||||
var note = await _client.Fetch(Path(shown));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, note.Status);
|
|
||||||
Assert.Equal(ActivityJson, note.MediaType);
|
|
||||||
Assert.Equal(shown.ObjectURI, note.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Note", note.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(persona.ActorUri(), note.Json["attributedTo"]!.GetValue<string>());
|
|
||||||
Assert.NotNull(note.Json["@context"]);
|
|
||||||
Assert.Contains(ActivityPubRenderer.Public, Strings(note.Json["to"]));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await _client.Fetch(Path(unlisted))).Status);
|
|
||||||
|
|
||||||
var browser = await _client.Fetch(Path(shown), Browser);
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, browser.Status);
|
|
||||||
Assert.Equal($"{Base}/@{persona.UserName}/{shown.ID}", browser.Location);
|
|
||||||
|
|
||||||
foreach (var post in new[] { followersOnly, direct, located })
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch(Path(post))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch($"/peasants/{other.UserName}/scribbles/{shown.ID}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch($"/peasants/{persona.UserName}/scribbles/{Guid.NewGuid():N}"[..48])).Status);
|
|
||||||
|
|
||||||
var tombstone = await _client.Fetch(Path(deleted));
|
|
||||||
Assert.Equal(HttpStatusCode.Gone, tombstone.Status);
|
|
||||||
Assert.Equal(ActivityJson, tombstone.MediaType);
|
|
||||||
Assert.Equal("Tombstone", tombstone.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(deleted.ObjectURI, tombstone.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal("Note", tombstone.Json["formerType"]!.GetValue<string>());
|
|
||||||
Assert.NotNull(tombstone.Json["deleted"]);
|
|
||||||
Assert.DoesNotContain("goodbye", tombstone.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circle_post_is_served_only_to_a_member_or_its_instance_actor()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp(), "circleowner");
|
|
||||||
var circle = await _host.FederatedGroup(owner, community: false);
|
|
||||||
var member = new RemoteActor(_peer, "member");
|
|
||||||
var memberServer = new RemoteActor(_peer, "instance", type: "Application");
|
|
||||||
var neighbour = new RemoteActor(_peer, "neighbour");
|
|
||||||
var stranger = new RemoteActor(_peer, "stranger", _peer.B);
|
|
||||||
var strangerServer = new RemoteActor(_peer, "instance", _peer.B, "Application");
|
|
||||||
await circle.AddForeignMember(member.Id);
|
|
||||||
var post = await _host.Publish(owner, new StatusDraft { Text = "just us", PlainText = true, GroupId = circle.Id });
|
|
||||||
Assert.Equal(PostVisibility.Circle, post.Visibility);
|
|
||||||
var path = $"/peasants/{owner.UserName}/scribbles/{post.ID}";
|
|
||||||
|
|
||||||
var asMember = await _client.Fetch(member.SignedGet(path));
|
|
||||||
var asMemberServer = await _client.Fetch(memberServer.SignedGet(path));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, asMember.Status);
|
|
||||||
Assert.Equal(post.ObjectURI, asMember.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { circle.Uri, circle.Uri + "/flock" }, Strings(asMember.Json["to"]));
|
|
||||||
Assert.DoesNotContain(ActivityPubRenderer.Public, asMember.Text);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, asMemberServer.Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch(path)).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch(path, Browser)).Status);
|
|
||||||
foreach (var outsider in new[] { neighbour, stranger, strangerServer })
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch(outsider.SignedGet(path))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch($"/peasants/{owner.UserName}/grunts/create-{post.ID}")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_circles_followers_members_and_wardens_are_shown_only_to_its_members()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var owner = await _host.Persona(await _host.SignUp(), "circlelists");
|
|
||||||
var circle = await _host.FederatedGroup(owner, community: false);
|
|
||||||
var community = await _host.FederatedGroup(owner, community: true);
|
|
||||||
var member = new RemoteActor(_peer, "member");
|
|
||||||
var stranger = new RemoteActor(_peer, "stranger", _peer.B);
|
|
||||||
await circle.AddForeignMember(member.Id);
|
|
||||||
foreach (var group in new[] { circle, community })
|
|
||||||
await DB.Default.SaveAsync(new Follower
|
|
||||||
{
|
|
||||||
LocalActorId = group.Id,
|
|
||||||
LocalActorKind = LocalActorKind.Group,
|
|
||||||
ActorURI = member.Id,
|
|
||||||
InboxURL = member.Id + "/inbox"
|
|
||||||
}, token);
|
|
||||||
|
|
||||||
foreach (var collection in new[] { "groupies", "flock", "wardens" })
|
|
||||||
{
|
|
||||||
var path = $"/peasants/{circle.UserName}/{collection}";
|
|
||||||
Assert.True((await _client.Fetch(path)).Status == HttpStatusCode.NotFound, $"the circle's {collection} answered an unsigned GET");
|
|
||||||
Assert.True((await _client.Fetch(stranger.SignedGet(path))).Status == HttpStatusCode.NotFound, $"the circle's {collection} answered a stranger");
|
|
||||||
var asMember = await _client.Fetch(member.SignedGet(path));
|
|
||||||
Assert.True(asMember.Status == HttpStatusCode.OK, $"the circle's {collection} refused a member");
|
|
||||||
Assert.Equal(circle.Uri + "/" + collection, asMember.Json["id"]!.GetValue<string>());
|
|
||||||
var open = await _client.Fetch($"/peasants/{community.UserName}/{collection}");
|
|
||||||
Assert.True(open.Status == HttpStatusCode.OK, $"the community's {collection} answered {(int)open.Status}");
|
|
||||||
}
|
|
||||||
Assert.Equal(1, (await _client.Fetch(member.SignedGet($"/peasants/{circle.UserName}/groupies"))).Json["totalItems"]!.GetValue<int>());
|
|
||||||
Assert.Equal(2, (await _client.Fetch(member.SignedGet($"/peasants/{circle.UserName}/flock"))).Json["totalItems"]!.GetValue<int>());
|
|
||||||
var wardens = await _client.Fetch($"/peasants/{community.UserName}/wardens");
|
|
||||||
Assert.Equal(new[] { owner.ActorUri() }, Strings(wardens.Json["orderedItems"]));
|
|
||||||
Assert.Equal(community.Uri + "/wardens", (await _client.Fetch($"/peasants/{community.UserName}")).Json["attributedTo"]!.GetValue<string>());
|
|
||||||
Assert.Null((await _client.Fetch($"/peasants/{circle.UserName}")).Json["attributedTo"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Grunts_resolve_creates_and_boosts()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "grunts");
|
|
||||||
var friend = await _host.Persona(await _host.SignUp(), "boosted");
|
|
||||||
var post = await _host.Publish(persona, "a grunt");
|
|
||||||
var followersOnly = await _host.Publish(persona, "a private grunt", PostVisibility.FollowersOnly);
|
|
||||||
var original = await _host.Publish(friend, "boost me");
|
|
||||||
var reblog = await _host.Reblog(persona, original);
|
|
||||||
string Path(string id) => $"/peasants/{persona.UserName}/grunts/{id}";
|
|
||||||
|
|
||||||
var create = await _client.Fetch(Path($"create-{post.ID}"));
|
|
||||||
var announce = await _client.Fetch(Path($"announce-{original.ID}"));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, create.Status);
|
|
||||||
Assert.Equal(ActivityJson, create.MediaType);
|
|
||||||
Assert.Equal("Create", create.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(Base + Path($"create-{post.ID}"), create.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(post.ObjectURI, create.Json["object"]!["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(post.ActivityURI, create.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpStatusCode.OK, announce.Status);
|
|
||||||
Assert.Equal("Announce", announce.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(reblog.ObjectURI, announce.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(original.ObjectURI, announce.Json["object"]!.GetValue<string>());
|
|
||||||
|
|
||||||
foreach (var unknown in new[] { $"create-{followersOnly.ID}", $"create-{Guid.NewGuid():N}"[..31], $"announce-{post.ID}", $"like-{post.ID}", "x" })
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch(Path(unknown))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _client.Fetch($"/peasants/{friend.UserName}/grunts/announce-{original.ID}")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_parrot_licence_is_served_by_its_author_until_revoked()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var quoted = await _host.Persona(await _host.SignUp(), "quoted");
|
|
||||||
var quoter = await _host.Persona(await _host.SignUp(), "quoter");
|
|
||||||
var original = await _host.Publish(quoted, "quote me");
|
|
||||||
var quoting = await _host.Publish(quoter, new StatusDraft { Text = "well said", PlainText = true, QuotedStatusId = original.ID });
|
|
||||||
Assert.Equal(QuoteState.Accepted, quoting.QuoteState);
|
|
||||||
var licenceUri = quoting.QuoteAuthorizationURI;
|
|
||||||
Assert.StartsWith(quoted.ActorUri() + "/parrot-licences/", licenceUri);
|
|
||||||
var licenceId = licenceUri.Split('/')[^1];
|
|
||||||
|
|
||||||
var licence = await _client.Fetch(PathOf(licenceUri));
|
|
||||||
var wrongAuthor = await _client.Fetch($"/peasants/{quoter.UserName}/parrot-licences/{licenceId}");
|
|
||||||
var unknown = await _client.Fetch($"/peasants/{quoted.UserName}/parrot-licences/{Guid.NewGuid():N}"[..48]);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, licence.Status);
|
|
||||||
Assert.Equal(ActivityJson, licence.MediaType);
|
|
||||||
Assert.Equal("QuoteAuthorization", licence.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal(licenceUri, licence.Json["id"]!.GetValue<string>());
|
|
||||||
Assert.Equal(quoted.ActorUri(), licence.Json["attributedTo"]!.GetValue<string>());
|
|
||||||
Assert.Equal(quoting.ObjectURI, licence.Json["interactingObject"]!.GetValue<string>());
|
|
||||||
Assert.Equal(original.ObjectURI, licence.Json["interactionTarget"]!.GetValue<string>());
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, wrongAuthor.Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, unknown.Status);
|
|
||||||
|
|
||||||
Assert.True(await _host.Get<IQuoteService>().RevokeLicence(original, quoting, token));
|
|
||||||
var revoked = await _client.Fetch(PathOf(licenceUri));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Gone, revoked.Status);
|
|
||||||
Assert.Equal(ActivityJson, revoked.MediaType);
|
|
||||||
Assert.Equal("Tombstone", revoked.Json["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal("QuoteAuthorization", revoked.Json["formerType"]!.GetValue<string>());
|
|
||||||
Assert.Equal(licenceUri, revoked.Json["id"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Secure_mode_refuses_unsigned_gets_except_for_the_instance_actor()
|
|
||||||
{
|
|
||||||
var secure = await SecureModeHost.Shared();
|
|
||||||
using var client = secure.Client();
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "secure");
|
|
||||||
var post = await _host.Publish(persona, "only for the signed");
|
|
||||||
var reader = new RemoteActor(_peer, "reader");
|
|
||||||
var paths = new[]
|
|
||||||
{
|
|
||||||
$"/peasants/{persona.UserName}",
|
|
||||||
$"/peasants/{persona.UserName}/anus",
|
|
||||||
$"/peasants/{persona.UserName}/anus?page=true",
|
|
||||||
$"/peasants/{persona.UserName}/groupies",
|
|
||||||
$"/peasants/{persona.UserName}/stalking",
|
|
||||||
$"/peasants/{persona.UserName}/trophies",
|
|
||||||
$"/peasants/{persona.UserName}/tattoos",
|
|
||||||
$"/peasants/{persona.UserName}/scribbles/{post.ID}",
|
|
||||||
$"/peasants/{persona.UserName}/grunts/create-{post.ID}",
|
|
||||||
$"/peasants/nobody{Guid.NewGuid():N}"[..28]
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var path in paths)
|
|
||||||
Assert.True((await client.Fetch(path)).Status == HttpStatusCode.Unauthorized, $"{path} answered an unsigned GET");
|
|
||||||
var instance = await client.Fetch("/peasants/privapub");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, instance.Status);
|
|
||||||
Assert.Equal("Application", instance.Json["type"]!.GetValue<string>());
|
|
||||||
foreach (var path in paths[..^1])
|
|
||||||
Assert.True((await client.Fetch(reader.SignedGet(path))).Status == HttpStatusCode.OK, $"{path} refused a signed GET");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Federation.Inbox;
|
|
||||||
using PrivaPub.Infrastructure.Jobs;
|
|
||||||
using PrivaPub.Models;
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class HostBootTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_host_shares_the_fixture_database()
|
|
||||||
{
|
|
||||||
Assert.True(await DB.Default.Find<AppConfiguration>().ExecuteAnyAsync(TestContext.Current.CancellationToken));
|
|
||||||
using var client = _host.Client();
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await client.GetAsync("/build.json", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_harness_handles_the_same_activities_as_the_server()
|
|
||||||
{
|
|
||||||
await using var harness = await Harness.Start();
|
|
||||||
var registered = _host.Services.GetServices<IActivityHandler>().Select(h => h.GetType()).OrderBy(t => t.Name);
|
|
||||||
var harnessed = harness.Handlers.Select(h => h.GetType()).OrderBy(t => t.Name);
|
|
||||||
|
|
||||||
Assert.Equal(registered, harnessed);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Every_job_kind_has_exactly_one_handler()
|
|
||||||
{
|
|
||||||
var handlers = _host.Services.GetServices<IJobHandler>().GroupBy(h => h.Kind).ToDictionary(g => g.Key, g => g.Count());
|
|
||||||
|
|
||||||
foreach (var kind in Enum.GetValues<JobKind>())
|
|
||||||
Assert.True(handlers.GetValueOrDefault(kind) == 1, $"{kind} has {handlers.GetValueOrDefault(kind)} handlers");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Every_controller_and_page_model_can_be_made()
|
|
||||||
{
|
|
||||||
using var scope = _host.Services.CreateScope();
|
|
||||||
var controllers = _host.Get<IActionDescriptorCollectionProvider>().ActionDescriptors.Items
|
|
||||||
.OfType<ControllerActionDescriptor>()
|
|
||||||
.Select(d => d.ControllerTypeInfo.AsType())
|
|
||||||
.Distinct()
|
|
||||||
.ToList();
|
|
||||||
var pages = typeof(Program).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(PageModel)) && !t.IsAbstract).ToList();
|
|
||||||
|
|
||||||
Assert.NotEmpty(controllers);
|
|
||||||
Assert.NotEmpty(pages);
|
|
||||||
foreach (var type in controllers.Concat(pages))
|
|
||||||
Assert.NotNull(ActivatorUtilities.CreateInstance(scope.ServiceProvider, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void The_service_graph_is_valid()
|
|
||||||
{
|
|
||||||
var services = new ServiceCollection();
|
|
||||||
foreach (var descriptor in _host.Registered)
|
|
||||||
((ICollection<ServiceDescriptor>)services).Add(descriptor);
|
|
||||||
|
|
||||||
using var provider = services.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true });
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Swagger_is_not_served_outside_development()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.GetAsync("/swagger/index.html", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_persona_gets_a_mastodon_token_through_the_real_code_flow()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp();
|
|
||||||
var persona = await _host.Persona(root, "boot");
|
|
||||||
|
|
||||||
var token = await _host.MastodonToken(persona);
|
|
||||||
|
|
||||||
using var client = _host.As(token);
|
|
||||||
var account = await client.GetStringAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken);
|
|
||||||
Assert.Contains($"\"id\":\"{persona.Id}\"", account);
|
|
||||||
Assert.DoesNotContain(root.Id, account);
|
|
||||||
Assert.DoesNotContain(root.UserName, account);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_signed_delivery_through_the_real_route_is_queued_and_stored()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
await using var peer = await Peer.Start();
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "mouth");
|
|
||||||
var bob = new RemoteActor(peer, "bob");
|
|
||||||
var noteId = $"{peer.A}/notes/{Guid.NewGuid():N}";
|
|
||||||
var activity = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId + "/activity",
|
|
||||||
["type"] = "Create",
|
|
||||||
["actor"] = bob.Id,
|
|
||||||
["to"] = new JsonArray($"{PrivaPubHost.Base}/peasants/{persona.UserName}"),
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId,
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = bob.Id,
|
|
||||||
["to"] = new JsonArray($"{PrivaPubHost.Base}/peasants/{persona.UserName}"),
|
|
||||||
["content"] = "<p>hello through the front door</p>",
|
|
||||||
["published"] = DateTime.UtcNow.ToString("O")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
var response = await client.SendAsync(bob.SignedPost($"/peasants/{persona.UserName}/mouth", activity), token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
|
|
||||||
Assert.Equal(1, await _host.RunInbox(noteId + "/activity", token));
|
|
||||||
var stored = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteFirstAsync(token);
|
|
||||||
Assert.Equal(PostVisibility.Direct, stored.Visibility);
|
|
||||||
Assert.Contains("front door", stored.ContentHtml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class InboxRouteTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
HttpClient _client;
|
|
||||||
Peer _peer;
|
|
||||||
Persona _persona;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_client = _host.Client();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
_persona = await _host.Persona(await _host.SignUp(), "inbox");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
_client?.Dispose();
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TheoryData<string> Inboxes() => new() { "personal", "personal-shared", "shared" };
|
|
||||||
|
|
||||||
string Route(string inbox) => inbox switch
|
|
||||||
{
|
|
||||||
"personal" => $"/peasants/{_persona.UserName}/mouth",
|
|
||||||
"personal-shared" => $"/peasants/{_persona.UserName}/human-centipede",
|
|
||||||
_ => "/human-centipede"
|
|
||||||
};
|
|
||||||
|
|
||||||
JsonObject Direct(RemoteActor sender)
|
|
||||||
{
|
|
||||||
var noteId = $"{new Uri(sender.Id).GetLeftPart(UriPartial.Authority)}/notes/{Guid.NewGuid():N}";
|
|
||||||
var to = new JsonArray($"{PrivaPubHost.Base}/peasants/{_persona.UserName}");
|
|
||||||
return new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId + "/activity",
|
|
||||||
["type"] = "Create",
|
|
||||||
["actor"] = sender.Id,
|
|
||||||
["to"] = to.DeepClone(),
|
|
||||||
["object"] = new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = noteId,
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = sender.Id,
|
|
||||||
["to"] = to.DeepClone(),
|
|
||||||
["content"] = "<p>knock knock</p>",
|
|
||||||
["published"] = DateTime.UtcNow.ToString("O")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Id(JsonObject activity) => activity["id"]!.GetValue<string>();
|
|
||||||
|
|
||||||
async Task<bool> Queued(JsonObject activity) =>
|
|
||||||
await DB.Default.Find<Job>().Match(j => j.DedupeKey == "inbox|" + Id(activity)).ExecuteAnyAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
async Task<HttpResponseMessage> Send(HttpRequestMessage request) => await _client.SendAsync(request, TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Inboxes))]
|
|
||||||
public async Task A_signed_delivery_is_accepted_and_queued(string inbox)
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "sender");
|
|
||||||
var activity = Direct(sender);
|
|
||||||
|
|
||||||
var response = await Send(sender.SignedPost(Route(inbox), activity));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
|
|
||||||
Assert.Equal(1, await _host.RunInbox(Id(activity), TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Inboxes))]
|
|
||||||
public async Task Junk_is_400_and_an_unsigned_activity_401(string inbox)
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "unsigned");
|
|
||||||
foreach (var junk in new[] { "not json", "[1,2,3]", "\"Create\"", "{}", "{\"type\":\"Create\"}" })
|
|
||||||
{
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Post, Route(inbox)) { Content = new StringContent(junk, Encoding.UTF8, "application/activity+json") };
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await Send(request)).StatusCode);
|
|
||||||
}
|
|
||||||
var activity = Direct(sender);
|
|
||||||
using var unsigned = new HttpRequestMessage(HttpMethod.Post, Route(inbox))
|
|
||||||
{
|
|
||||||
Content = new StringContent(activity.ToJsonString(), Encoding.UTF8, "application/activity+json")
|
|
||||||
};
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await Send(unsigned)).StatusCode);
|
|
||||||
Assert.False(await Queued(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_unknown_persona_has_no_mouth()
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "lost");
|
|
||||||
var activity = Direct(sender);
|
|
||||||
|
|
||||||
var response = await Send(sender.SignedPost($"/peasants/nobody{Guid.NewGuid():N}"[..28] + "/mouth", activity));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
|
||||||
Assert.False(await Queued(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Inboxes))]
|
|
||||||
public async Task A_tampered_stale_or_misdirected_signature_is_401(string inbox)
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "forger");
|
|
||||||
var path = Route(inbox);
|
|
||||||
|
|
||||||
var tampered = Direct(sender);
|
|
||||||
var badDigest = sender.SignedPost(path, tampered);
|
|
||||||
badDigest.Headers.Remove("Digest");
|
|
||||||
badDigest.Headers.TryAddWithoutValidation("Digest", "SHA-256=" + Convert.ToBase64String(new byte[32]));
|
|
||||||
var stale = Direct(sender);
|
|
||||||
var twoHoursAgo = DateTimeOffset.UtcNow.AddHours(-2).ToString("r", CultureInfo.InvariantCulture);
|
|
||||||
var elsewhere = Direct(sender);
|
|
||||||
var otherBody = Direct(sender);
|
|
||||||
var swapped = sender.SignedPost(path, Direct(sender));
|
|
||||||
swapped.Content = new StringContent(otherBody.ToJsonString(), Encoding.UTF8, "application/activity+json");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await Send(badDigest)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await Send(sender.SignedPost(path, stale, date: twoHoursAgo))).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await Send(sender.SignedPost(path, elsewhere, host: "elsewhere.example"))).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await Send(swapped)).StatusCode);
|
|
||||||
foreach (var activity in new[] { tampered, stale, elsewhere, otherBody })
|
|
||||||
Assert.False(await Queued(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Ld_json_with_the_activitystreams_profile_is_accepted()
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "ldjson");
|
|
||||||
var activity = Direct(sender);
|
|
||||||
var request = sender.SignedPost($"/peasants/{_persona.UserName}/mouth", activity);
|
|
||||||
request.Content!.Headers.Remove("Content-Type");
|
|
||||||
request.Content.Headers.TryAddWithoutValidation("Content-Type", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"");
|
|
||||||
|
|
||||||
var response = await Send(request);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
|
|
||||||
Assert.True(await Queued(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_unreachable_signing_key_asks_the_sender_to_retry()
|
|
||||||
{
|
|
||||||
var sender = new RemoteActor(_peer, "flaky");
|
|
||||||
_peer.Answer(new Uri(sender.Id).AbsolutePath, 503);
|
|
||||||
var activity = Direct(sender);
|
|
||||||
|
|
||||||
var response = await Send(sender.SignedPost($"/peasants/{_persona.UserName}/mouth", activity));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);
|
|
||||||
Assert.True(response.Headers.RetryAfter?.Delta is { TotalSeconds: > 0 }, "no Retry-After");
|
|
||||||
Assert.False(await Queued(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Unsigned_posts_from_one_address_are_limited()
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
using var client = _host.Client();
|
|
||||||
client.DefaultRequestHeaders.Remove(PrivaPubHost.ClientHeader);
|
|
||||||
client.DefaultRequestHeaders.Add(PrivaPubHost.ClientHeader, $"fd7e:{Random.Shared.Next(0x10000):x}:{Random.Shared.Next(0x10000):x}::1");
|
|
||||||
var body = Direct(new RemoteActor(_peer, "flood")).ToJsonString();
|
|
||||||
async Task<HttpStatusCode> Post()
|
|
||||||
{
|
|
||||||
using var content = new StringContent(body, Encoding.UTF8, "application/activity+json");
|
|
||||||
using var response = await client.PostAsync("/human-centipede", content, token);
|
|
||||||
return response.StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The bucket holds 300 and refills 50 every ten seconds on its own timer, so a refill can land at any moment:
|
|
||||||
// the first refusal comes after at least 300 posts and within a few refills.
|
|
||||||
var answers = new List<HttpStatusCode>();
|
|
||||||
while (answers.Count < 600 && (answers.Count == 0 || answers[^1] != HttpStatusCode.TooManyRequests))
|
|
||||||
answers.Add(await Post());
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.TooManyRequests, answers[^1]);
|
|
||||||
Assert.True(answers.Count > 300, $"limited after only {answers.Count - 1} posts");
|
|
||||||
Assert.All(answers.SkipLast(1), status => Assert.Equal(HttpStatusCode.Unauthorized, status));
|
|
||||||
var polite = new RemoteActor(_peer, "polite");
|
|
||||||
using var signed = await client.SendAsync(polite.SignedPost("/human-centipede", Direct(polite)), token);
|
|
||||||
Assert.Equal(HttpStatusCode.Accepted, signed.StatusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,628 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MastodonAccountsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CancellationToken Token => TestContext.Current.CancellationToken;
|
|
||||||
|
|
||||||
async Task<(RemoteActor Actor, string Id)> Remote(string name = "bob")
|
|
||||||
{
|
|
||||||
var actor = new RemoteActor(_peer, name);
|
|
||||||
var known = await _host.Known(actor);
|
|
||||||
return (actor, known.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Verify_credentials_shows_the_persona_and_its_source_and_nothing_of_the_login()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var me = (await alice.Client.Get("/api/v1/accounts/verify_credentials")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(alice.Id, me.Body.Text("id"));
|
|
||||||
Assert.Equal(alice.UserName, me.Body.Text("username"));
|
|
||||||
Assert.Equal(alice.UserName, me.Body.Text("acct"));
|
|
||||||
Assert.Equal(alice.Uri, me.Body.Text("uri"));
|
|
||||||
Assert.Equal("public", me.Body["source"].Text("privacy"));
|
|
||||||
Assert.Equal("public", me.Body["source"].Text("quote_policy"));
|
|
||||||
Assert.Equal(0, me.Body["source"].Number("follow_requests_count"));
|
|
||||||
Assert.DoesNotContain(alice.Persona.Root.Id, me.Text);
|
|
||||||
Assert.DoesNotContain(alice.Persona.Root.UserName, me.Text);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get("/api/v1/accounts/verify_credentials")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Update_credentials_takes_fields_in_both_shapes_the_source_and_the_quote_policy()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var updated = (await alice.Client.Patch("/api/v1/accounts/update_credentials",
|
|
||||||
("display_name", " Alice Liddell "), ("note", "down the hole"), ("locked", "true"), ("bot", "true"),
|
|
||||||
("fields_attributes[0][name]", "Site"), ("fields_attributes[0][value]", "https://example.com"),
|
|
||||||
("fields_attributes[1][name]", "Pronouns"), ("fields_attributes[1][value]", "she/her"),
|
|
||||||
("source[privacy]", "private"), ("source[sensitive]", "true"), ("source[language]", "it"), ("source[quote_policy]", "followers"))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("Alice Liddell", updated.Body.Text("display_name"));
|
|
||||||
Assert.True(updated.Body.Flag("locked"));
|
|
||||||
Assert.True(updated.Body.Flag("bot"));
|
|
||||||
Assert.Equal(new[] { "Site", "Pronouns" }, updated.Body["fields"]!.AsArray().Select(f => f.Text("name")));
|
|
||||||
Assert.Equal("down the hole", updated.Body["source"].Text("note"));
|
|
||||||
Assert.Equal("private", updated.Body["source"].Text("privacy"));
|
|
||||||
Assert.True(updated.Body["source"].Flag("sensitive"));
|
|
||||||
Assert.Equal("it", updated.Body["source"].Text("language"));
|
|
||||||
Assert.Equal("followers", updated.Body["source"].Text("quote_policy"));
|
|
||||||
|
|
||||||
var arrayShape = (await alice.Client.Json(HttpMethod.Patch, "/api/v1/accounts/update_credentials", new JsonObject
|
|
||||||
{
|
|
||||||
["fields_attributes"] = new JsonArray(new JsonObject { ["name"] = "Garden", ["value"] = "roses" }, new JsonObject { ["name"] = "Cat", ["value"] = "Dinah" }),
|
|
||||||
["source"] = new JsonObject { ["quote_policy"] = "everyone" }
|
|
||||||
})).Ok();
|
|
||||||
Assert.Equal(new[] { ("Garden", "roses"), ("Cat", "Dinah") },
|
|
||||||
arrayShape.Body["source"]!["fields"]!.AsArray().Select(f => (f.Text("name"), f.Text("value"))));
|
|
||||||
Assert.Equal("followers", arrayShape.Body["source"].Text("quote_policy"));
|
|
||||||
|
|
||||||
var formArray = (await alice.Client.Patch("/api/v1/accounts/update_credentials",
|
|
||||||
("fields_attributes[][name]", "One"), ("fields_attributes[][value]", "1"), ("fields_attributes[][name]", "Two"), ("fields_attributes[][value]", "2"))).Ok();
|
|
||||||
Assert.Equal(new[] { ("One", "1"), ("Two", "2") }, formArray.Body["source"]!["fields"]!.AsArray().Select(f => (f.Text("name"), f.Text("value"))));
|
|
||||||
|
|
||||||
var again = (await alice.Client.Get("/api/v1/accounts/verify_credentials")).Ok();
|
|
||||||
Assert.Equal(2, again.Body["fields"]!.AsArray().Count);
|
|
||||||
Assert.Equal("private", again.Body["source"].Text("privacy"));
|
|
||||||
var status = await alice.Status("with the default visibility");
|
|
||||||
Assert.Equal("private", status.Text("visibility"));
|
|
||||||
Assert.True(status.Flag("sensitive"));
|
|
||||||
Assert.Equal("it", status.Text("language"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Avatar_and_header_uploads_are_resized_and_lose_their_metadata()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var picture = MastodonHelpers.JpegWithMetadata(900, 700);
|
|
||||||
using (var original = NetVips.Image.NewFromBuffer(picture))
|
|
||||||
Assert.Contains("exif-data", original.GetFields());
|
|
||||||
var form = MastodonHelpers.Multipart(("avatar", picture, "image/jpeg", "me.jpg"), ("header", MastodonHelpers.JpegWithMetadata(2000, 900), "image/jpeg", "header.jpg"));
|
|
||||||
form.Add(new StringContent("Alice"), "display_name");
|
|
||||||
|
|
||||||
var updated = (await alice.Client.Exchange(new HttpRequestMessage(HttpMethod.Patch, "/api/v1/accounts/update_credentials") { Content = form })).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("Alice", updated.Body.Text("display_name"));
|
|
||||||
foreach (var (field, maxWidth, maxHeight) in new[] { ("avatar", 400, 400), ("header", 1500, 500) })
|
|
||||||
{
|
|
||||||
var url = updated.Body.Text(field);
|
|
||||||
Assert.StartsWith($"{PrivaPubHost.Base}/media/files/", url);
|
|
||||||
var bytes = await _host.Client().GetByteArrayAsync(url, Token);
|
|
||||||
MastodonHelpers.AssertNoMetadata(bytes);
|
|
||||||
using var stored = NetVips.Image.NewFromBuffer(bytes);
|
|
||||||
Assert.True(stored.Width <= maxWidth && stored.Height <= maxHeight, $"{field} is {stored.Width}x{stored.Height}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Lookup_finds_local_and_remote_accounts_but_never_a_circle_or_the_instance_actor()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var (bob, bobId) = await Remote();
|
|
||||||
var circleName = $"circle{Guid.NewGuid():N}"[..20];
|
|
||||||
string circleId;
|
|
||||||
using (var clientApi = _host.As(alice.Persona.Root.Jwt))
|
|
||||||
{
|
|
||||||
var circle = await clientApi.PostAsJsonAsync("/clientapi/group/insert", new { avatarId = alice.Id, userName = circleName, name = "inner", isCommunity = false }, Token);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, circle.StatusCode);
|
|
||||||
circleId = (await circle.Content.ReadFromJsonAsync<JsonObject>(Token))!["id"]!.GetValue<string>();
|
|
||||||
}
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
Assert.Equal(alice.Id, (await anonymous.Get($"/api/v1/accounts/lookup?acct={alice.UserName}")).Ok().Body.Text("id"));
|
|
||||||
Assert.Equal(alice.Id, (await anonymous.Get($"/api/v1/accounts/lookup?acct=@{alice.UserName}@{PrivaPubHost.Host}")).Ok().Body.Text("id"));
|
|
||||||
var remote = (await anonymous.Get($"/api/v1/accounts/lookup?acct={Uri.EscapeDataString(bob.Handle())}")).Ok();
|
|
||||||
Assert.Equal(bobId, remote.Body.Text("id"));
|
|
||||||
Assert.Equal(bob.Handle(), remote.Body.Text("acct"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get($"/api/v1/accounts/lookup?acct={circleName}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/accounts/lookup?acct={circleName}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get("/api/v1/accounts/lookup?acct=privapub")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get($"/api/v1/accounts/lookup?acct=nobody{Guid.NewGuid():N}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get("/api/v1/accounts/lookup?acct=a@b@c")).Status);
|
|
||||||
|
|
||||||
Assert.Equal(alice.UserName, (await anonymous.Get($"/api/v1/accounts/{alice.Id}")).Ok().Body.Text("username"));
|
|
||||||
Assert.Equal(bob.Handle(), (await anonymous.Get($"/api/v1/accounts/{bobId}")).Ok().Body.Text("acct"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get("/api/v1/accounts/000000000000000000000000")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/accounts/{circleId}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/accounts/{circleId}/statuses")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post($"/api/v1/accounts/{circleId}/follow")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Search_resolves_a_remote_handle_only_when_asked_by_a_signed_in_persona()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
_peer.WebFinger(bob);
|
|
||||||
var handle = Uri.EscapeDataString(bob.Handle());
|
|
||||||
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/search?q={handle}")).Ok().Array);
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v2/search?q={handle}")).Ok().Body["accounts"]!.AsArray());
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get($"/api/v1/accounts/search?q={handle}&resolve=true")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get($"/api/v2/search?q={handle}&resolve=true")).Status);
|
|
||||||
Assert.Empty(_peer.Requests);
|
|
||||||
|
|
||||||
var resolved = (await alice.Client.Get($"/api/v1/accounts/search?q={handle}&resolve=true")).Ok();
|
|
||||||
|
|
||||||
var found = Assert.Single(resolved.Array);
|
|
||||||
Assert.Equal(bob.Handle(), found.Text("acct"));
|
|
||||||
Assert.Contains(_peer.Requests, r => r.Path == "/.well-known/webfinger");
|
|
||||||
Assert.Equal(found.Text("id"), Assert.Single((await alice.Client.Get($"/api/v2/search?q={handle}&type=accounts")).Ok().Body["accounts"]!.AsArray()).Text("id"));
|
|
||||||
Assert.Contains(alice.Id, (await alice.Client.Get($"/api/v1/accounts/search?q={alice.UserName}")).Ok().Ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Account_statuses_filter_pins_replies_reblogs_media_and_tags_and_page_both_ways()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var tag = $"tag{Guid.NewGuid():N}"[..16];
|
|
||||||
var tagged = await alice.Status($"first #{tag}");
|
|
||||||
var thread = await alice.Status("and a thread", ("in_reply_to_id", tagged.Text("id")));
|
|
||||||
var upload = (await alice.Client.Exchange(new HttpRequestMessage(HttpMethod.Post, "/api/v2/media")
|
|
||||||
{
|
|
||||||
Content = MastodonHelpers.Multipart(("file", MastodonHelpers.JpegWithMetadata(64, 48), "image/jpeg", "a.jpg"))
|
|
||||||
})).Ok();
|
|
||||||
var withMedia = await alice.Status("a picture", ("media_ids[]", upload.Body.Text("id")));
|
|
||||||
var carolPost = await carol.Status("boost me");
|
|
||||||
var answer = await alice.Status("an answer", ("in_reply_to_id", carolPost.Text("id")));
|
|
||||||
var reblog = (await alice.Client.Post($"/api/v1/statuses/{carolPost.Text("id")}/reblog")).Ok().Body;
|
|
||||||
var pinned = await alice.Status("pinned");
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{pinned.Text("id")}/pin")).Ok();
|
|
||||||
var path = $"/api/v1/accounts/{alice.Id}/statuses";
|
|
||||||
string[] Ids(params JsonObject[] statuses) => statuses.Select(s => s.Text("id")).ToArray();
|
|
||||||
|
|
||||||
Assert.Equal(Ids(pinned), (await carol.Client.Get(path + "?pinned=true")).Ok().Ids);
|
|
||||||
Assert.True((await carol.Client.Get(path + "?pinned=true")).Ok().Array[0].Flag("pinned"));
|
|
||||||
Assert.Equal(Ids(pinned, reblog.AsObject(), answer, withMedia, thread, tagged), (await carol.Client.Get(path)).Ok().Ids);
|
|
||||||
Assert.Equal(Ids(pinned, reblog.AsObject(), withMedia, thread, tagged), (await carol.Client.Get(path + "?exclude_replies=true")).Ok().Ids);
|
|
||||||
Assert.DoesNotContain(reblog.Text("id"), (await carol.Client.Get(path + "?exclude_reblogs=true")).Ok().Ids);
|
|
||||||
Assert.Equal(Ids(withMedia), (await carol.Client.Get(path + "?only_media=true")).Ok().Ids);
|
|
||||||
Assert.Equal(Ids(tagged), (await _host.Client().Get(path + $"?tagged={tag.ToUpperInvariant()}")).Ok().Ids);
|
|
||||||
|
|
||||||
var first = (await carol.Client.Get(path + "?limit=2")).Ok();
|
|
||||||
Assert.Equal(Ids(pinned, reblog.AsObject()), first.Ids);
|
|
||||||
var next = (await carol.Client.Get(first.Link("next"))).Ok();
|
|
||||||
Assert.Equal(Ids(answer, withMedia), next.Ids);
|
|
||||||
Assert.Contains("limit=2", next.Link("prev"));
|
|
||||||
Assert.Equal(first.Ids, (await carol.Client.Get(next.Link("prev"))).Ok().Ids);
|
|
||||||
var last = (await carol.Client.Get(next.Link("next"))).Ok();
|
|
||||||
Assert.Equal(Ids(thread, tagged), last.Ids);
|
|
||||||
Assert.Empty((await carol.Client.Get(last.Link("next"))).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_community_account_lists_the_posts_addressed_to_it()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var reader = await _host.Mastodon("reader");
|
|
||||||
var name = $"community{Guid.NewGuid():N}"[..20];
|
|
||||||
string communityId;
|
|
||||||
using (var clientApi = _host.As(alice.Persona.Root.Jwt))
|
|
||||||
{
|
|
||||||
var created = await clientApi.PostAsJsonAsync("/clientapi/group/insert", new { avatarId = alice.Id, userName = name, name = "Gardeners", isCommunity = true }, Token);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, created.StatusCode);
|
|
||||||
communityId = (await created.Content.ReadFromJsonAsync<JsonObject>(Token))!["id"]!.GetValue<string>();
|
|
||||||
}
|
|
||||||
var addressed = await alice.Status($"@{name} first meeting on Sunday");
|
|
||||||
await alice.Status("not for the garden");
|
|
||||||
|
|
||||||
var community = (await reader.Client.Get($"/api/v1/accounts/lookup?acct={name}")).Ok();
|
|
||||||
Assert.Equal(communityId, community.Body.Text("id"));
|
|
||||||
Assert.True(community.Body.Flag("group"));
|
|
||||||
Assert.Equal(new[] { addressed.Text("id") }, (await reader.Client.Get($"/api/v1/accounts/{communityId}/statuses")).Ok().Ids);
|
|
||||||
Assert.Equal(1, (await _host.Client().Get($"/api/v1/accounts/{communityId}")).Ok().Body.Number("statuses_count"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_follower_sees_followers_only_posts_and_a_stranger_does_not()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var follower = await _host.Mastodon("follower");
|
|
||||||
var stranger = await _host.Mastodon("stranger");
|
|
||||||
(await follower.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
var open = await alice.Status("for everyone");
|
|
||||||
var quiet = await alice.Status("for followers", ("visibility", "private"));
|
|
||||||
var direct = await alice.Status($"@{follower.UserName} for you", ("visibility", "direct"));
|
|
||||||
var path = $"/api/v1/accounts/{alice.Id}/statuses";
|
|
||||||
|
|
||||||
Assert.Equal(new[] { quiet.Text("id"), open.Text("id") }, (await follower.Client.Get(path)).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { open.Text("id") }, (await stranger.Client.Get(path)).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { open.Text("id") }, (await _host.Client().Get(path)).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { direct.Text("id"), quiet.Text("id"), open.Text("id") }, (await alice.Client.Get(path)).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Get($"/api/v1/statuses/{quiet.Text("id")}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await follower.Client.Get($"/api/v1/statuses/{quiet.Text("id")}")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Followers_and_following_are_listed_only_to_their_owner()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = await _host.Mastodon("bob");
|
|
||||||
(await bob.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { bob.Id }, (await alice.Client.Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Ids);
|
|
||||||
Assert.Empty((await bob.Client.Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Array);
|
|
||||||
Assert.Empty((await _host.Client().Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Array);
|
|
||||||
Assert.Equal(new[] { alice.Id }, (await bob.Client.Get($"/api/v1/accounts/{bob.Id}/following")).Ok().Ids);
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/{bob.Id}/following")).Ok().Array);
|
|
||||||
var account = (await bob.Client.Get($"/api/v1/accounts/{alice.Id}")).Ok();
|
|
||||||
Assert.Equal(1, account.Body.Number("followers_count"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Following_is_immediate_for_an_open_persona_requested_for_a_locked_one_and_queued_for_a_remote_one()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var locked = await _host.Mastodon("locked");
|
|
||||||
var follower = await _host.Mastodon("follower");
|
|
||||||
(await locked.Client.Patch("/api/v1/accounts/update_credentials", ("locked", "true"))).Ok();
|
|
||||||
var (bob, bobId) = await Remote();
|
|
||||||
|
|
||||||
var open = (await follower.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
Assert.True(open.Body.Flag("following"));
|
|
||||||
Assert.False(open.Body.Flag("requested"));
|
|
||||||
Assert.True(open.Body.Flag("showing_reblogs"));
|
|
||||||
var notified = (await alice.Client.Get("/api/v1/notifications?types[]=follow")).Ok();
|
|
||||||
Assert.Equal(follower.Id, Assert.Single(notified.Array)!["account"].Text("id"));
|
|
||||||
|
|
||||||
var asked = (await follower.Client.Post($"/api/v1/accounts/{locked.Id}/follow", ("reblogs", "false"))).Ok();
|
|
||||||
Assert.False(asked.Body.Flag("following"));
|
|
||||||
Assert.True(asked.Body.Flag("requested"));
|
|
||||||
Assert.Equal(new[] { follower.Id }, (await locked.Client.Get("/api/v1/follow_requests")).Ok().Ids);
|
|
||||||
Assert.Equal(1, (await locked.Client.Get("/api/v1/accounts/verify_credentials")).Ok().Body["source"].Number("follow_requests_count"));
|
|
||||||
Assert.True((await locked.Client.Post($"/api/v1/follow_requests/{follower.Id}/authorize")).Ok().Body.Flag("followed_by"));
|
|
||||||
var accepted = Assert.Single((await follower.Client.Get($"/api/v1/accounts/relationships?id[]={locked.Id}")).Ok().Array);
|
|
||||||
Assert.True(accepted.Flag("following"));
|
|
||||||
Assert.False(accepted.Flag("showing_reblogs"));
|
|
||||||
Assert.Empty((await locked.Client.Get("/api/v1/follow_requests")).Ok().Array);
|
|
||||||
|
|
||||||
var remote = (await follower.Client.Post($"/api/v1/accounts/{bobId}/follow")).Ok();
|
|
||||||
Assert.True(remote.Body.Flag("requested"));
|
|
||||||
var follow = Assert.Single(await bob.Delivered(since), d => d.Type() == "Follow");
|
|
||||||
Assert.Equal(follower.Uri, follow.Text("actor"));
|
|
||||||
Assert.Equal(bob.Id, follow.Text("object"));
|
|
||||||
|
|
||||||
Assert.False((await follower.Client.Post($"/api/v1/accounts/{alice.Id}/unfollow")).Ok().Body.Flag("following"));
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Array);
|
|
||||||
Assert.False((await follower.Client.Post($"/api/v1/accounts/{bobId}/unfollow")).Ok().Body.Flag("requested"));
|
|
||||||
var undo = Assert.Single(await bob.Delivered(since), d => d.Type() == "Undo");
|
|
||||||
Assert.Equal(follow.Text("id"), undo["object"].Text("id"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await follower.Client.Post("/api/v1/accounts/000000000000000000000000/follow")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, (await follower.Client.Post($"/api/v1/accounts/{follower.Id}/follow")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Remote_follow_requests_are_answered_with_the_original_follow()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var locked = await _host.Mastodon("locked");
|
|
||||||
(await locked.Client.Patch("/api/v1/accounts/update_credentials", ("locked", "true"))).Ok();
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var carol = new RemoteActor(_peer, "carol");
|
|
||||||
var bobFollow = await _host.FollowedBy(locked, bob);
|
|
||||||
var carolFollow = await _host.FollowedBy(locked, carol);
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
var carolId = (await _host.Known(carol)).ID;
|
|
||||||
|
|
||||||
var requests = (await locked.Client.Get("/api/v1/follow_requests")).Ok();
|
|
||||||
Assert.Equal(new[] { carolId, bobId }, requests.Ids);
|
|
||||||
Assert.True(Assert.Single((await locked.Client.Get($"/api/v1/accounts/relationships?id[]={bobId}")).Ok().Array).Flag("requested_by"));
|
|
||||||
Assert.Empty(await bob.Delivered(since));
|
|
||||||
|
|
||||||
Assert.True((await locked.Client.Post($"/api/v1/follow_requests/{bobId}/authorize")).Ok().Body.Flag("followed_by"));
|
|
||||||
Assert.False((await locked.Client.Post($"/api/v1/follow_requests/{carolId}/reject")).Ok().Body.Flag("requested_by"));
|
|
||||||
|
|
||||||
var accept = Assert.Single(await bob.Delivered(since));
|
|
||||||
Assert.Equal("Accept", accept.Type());
|
|
||||||
Assert.Equal(locked.Uri, accept.Text("actor"));
|
|
||||||
Assert.Equal(bobFollow, accept["object"].Text("id"));
|
|
||||||
var reject = Assert.Single(await carol.Delivered(since));
|
|
||||||
Assert.Equal("Reject", reject.Type());
|
|
||||||
Assert.Equal(carolFollow, reject["object"].Text("id"));
|
|
||||||
Assert.Equal(carol.Id, reject["object"].Text("actor"));
|
|
||||||
Assert.Empty((await locked.Client.Get("/api/v1/follow_requests")).Ok().Array);
|
|
||||||
Assert.Equal(new[] { bobId }, (await locked.Client.Get($"/api/v1/accounts/{locked.Id}/followers")).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await locked.Client.Post($"/api/v1/follow_requests/{carolId}/authorize")).Status);
|
|
||||||
|
|
||||||
var local = await _host.Mastodon("local");
|
|
||||||
(await local.Client.Post($"/api/v1/accounts/{locked.Id}/follow")).Ok();
|
|
||||||
(await locked.Client.Post($"/api/v1/follow_requests/{local.Id}/reject")).Ok();
|
|
||||||
var refused = Assert.Single((await local.Client.Get($"/api/v1/accounts/relationships?id[]={locked.Id}")).Ok().Array);
|
|
||||||
Assert.False(refused.Flag("requested"));
|
|
||||||
Assert.False(refused.Flag("following"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Removing_a_follower_ends_the_follow_on_both_sides_and_tells_a_remote_follower()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var local = await _host.Mastodon("local");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var follow = await _host.FollowedBy(alice, bob);
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
(await local.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
Assert.True(Assert.Single((await alice.Client.Get($"/api/v1/accounts/relationships?id[]={bobId}")).Ok().Array).Flag("followed_by"));
|
|
||||||
|
|
||||||
var removed = (await alice.Client.Post($"/api/v1/accounts/{bobId}/remove_from_followers")).Ok();
|
|
||||||
|
|
||||||
Assert.False(removed.Body.Flag("followed_by"));
|
|
||||||
var reject = Assert.Single(await bob.Delivered(since), d => d.Type() == "Reject");
|
|
||||||
Assert.Equal(alice.Uri, reject.Text("actor"));
|
|
||||||
Assert.Equal(follow, reject["object"].Text("id"));
|
|
||||||
Assert.Equal("Follow", reject["object"].Text("type"));
|
|
||||||
Assert.Equal(bob.Id, reject["object"].Text("actor"));
|
|
||||||
Assert.Equal(alice.Uri, reject["object"].Text("object"));
|
|
||||||
|
|
||||||
Assert.False((await alice.Client.Post($"/api/v1/accounts/{local.Id}/remove_from_followers")).Ok().Body.Flag("followed_by"));
|
|
||||||
Assert.False(Assert.Single((await local.Client.Get($"/api/v1/accounts/relationships?id[]={alice.Id}")).Ok().Array).Flag("following"));
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Array);
|
|
||||||
Assert.Empty((await local.Client.Get($"/api/v1/accounts/{local.Id}/following")).Ok().Array);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post("/api/v1/accounts/000000000000000000000000/remove_from_followers")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Blocks_federate_and_reject_a_remote_follower()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var local = await _host.Mastodon("local");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var follow = await _host.FollowedBy(alice, bob);
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
(await local.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
|
|
||||||
var blocked = (await alice.Client.Post($"/api/v1/accounts/{bobId}/block")).Ok();
|
|
||||||
|
|
||||||
Assert.True(blocked.Body.Flag("blocking"));
|
|
||||||
Assert.False(blocked.Body.Flag("followed_by"));
|
|
||||||
var sent = await bob.Delivered(since);
|
|
||||||
var reject = Assert.Single(sent, d => d.Type() == "Reject");
|
|
||||||
Assert.Equal((follow, "Follow", bob.Id), (reject["object"].Text("id"), reject["object"].Text("type"), reject["object"].Text("actor")));
|
|
||||||
var block = Assert.Single(sent, d => d.Type() == "Block");
|
|
||||||
Assert.Equal((alice.Uri, bob.Id), (block.Text("actor"), block.Text("object")));
|
|
||||||
Assert.True((await alice.Client.Post($"/api/v1/accounts/{local.Id}/block")).Ok().Body.Flag("blocking"));
|
|
||||||
Assert.Equal(new[] { local.Id, bobId }, (await alice.Client.Get("/api/v1/blocks")).Ok().Ids);
|
|
||||||
var blockedBy = Assert.Single((await local.Client.Get($"/api/v1/accounts/relationships?id[]={alice.Id}")).Ok().Array);
|
|
||||||
Assert.True(blockedBy.Flag("blocked_by"));
|
|
||||||
Assert.False(blockedBy.Flag("following"));
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/{alice.Id}/followers")).Ok().Array);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post($"/api/v1/accounts/{alice.Id}/block")).Status);
|
|
||||||
|
|
||||||
Assert.False((await alice.Client.Post($"/api/v1/accounts/{bobId}/unblock")).Ok().Body.Flag("blocking"));
|
|
||||||
var undo = Assert.Single(await bob.Delivered(since), d => d.Type() == "Undo");
|
|
||||||
Assert.Equal(block.Text("id"), undo["object"].Text("id"));
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{local.Id}/unblock")).Ok();
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/blocks")).Ok().Array);
|
|
||||||
Assert.Equal(new[] { "Accept", "Block", "Reject", "Undo" }, (await bob.Delivered(since)).Select(d => d.Type()).Order());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Mutes_keep_their_duration_and_notification_choice_and_never_federate()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var chatty = await _host.Mastodon("chatty");
|
|
||||||
var muffled = await _host.Mastodon("muffled");
|
|
||||||
var (bob, bobId) = await Remote();
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{chatty.Id}/follow")).Ok();
|
|
||||||
var post = (await alice.Status("like me")).Text("id");
|
|
||||||
|
|
||||||
var muted = (await alice.Client.Post($"/api/v1/accounts/{chatty.Id}/mute", ("duration", "3600"), ("notifications", "false"))).Ok();
|
|
||||||
Assert.True(muted.Body.Flag("muting"));
|
|
||||||
Assert.False(muted.Body.Flag("muting_notifications"));
|
|
||||||
var mute = await DB.Default.Find<Mute>().Match(m => m.AvatarId == alice.Id && m.TargetAccountId == chatty.Id).ExecuteFirstAsync(Token);
|
|
||||||
Assert.InRange(mute.ExpiresAt!.Value, DateTime.UtcNow.AddMinutes(59), DateTime.UtcNow.AddMinutes(61));
|
|
||||||
var forever = (await alice.Client.Post($"/api/v1/accounts/{muffled.Id}/mute")).Ok();
|
|
||||||
Assert.True(forever.Body.Flag("muting_notifications"));
|
|
||||||
Assert.Null((await DB.Default.Find<Mute>().Match(m => m.AvatarId == alice.Id && m.TargetAccountId == muffled.Id).ExecuteFirstAsync(Token)).ExpiresAt);
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{bobId}/mute")).Ok();
|
|
||||||
Assert.Equal(new[] { bobId, muffled.Id, chatty.Id }, (await alice.Client.Get("/api/v1/mutes")).Ok().Ids);
|
|
||||||
|
|
||||||
var hidden = (await chatty.Status("you will not see this")).Text("id");
|
|
||||||
(await chatty.Client.Post($"/api/v1/statuses/{post}/favourite")).Ok();
|
|
||||||
(await muffled.Client.Post($"/api/v1/statuses/{post}/favourite")).Ok();
|
|
||||||
Assert.DoesNotContain(hidden, (await alice.Client.Get("/api/v1/timelines/home")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { chatty.Id }, (await alice.Client.Get("/api/v1/notifications?types[]=favourite")).Ok().Array.Select(n => n!["account"].Text("id")));
|
|
||||||
Assert.Empty(await bob.Delivered(since));
|
|
||||||
|
|
||||||
Assert.False((await alice.Client.Post($"/api/v1/accounts/{chatty.Id}/unmute")).Ok().Body.Flag("muting"));
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{muffled.Id}/unmute")).Ok();
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{bobId}/unmute")).Ok();
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/mutes")).Ok().Array);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post($"/api/v1/accounts/{alice.Id}/mute")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Domain_blocks_are_listed_added_and_removed()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var domain = $"blocked{Guid.NewGuid():N}.example";
|
|
||||||
|
|
||||||
Assert.Equal("{}", (await alice.Client.Post("/api/v1/domain_blocks", ("domain", domain.ToUpperInvariant()))).Ok().Text);
|
|
||||||
(await alice.Client.Post("/api/v1/domain_blocks", ("domain", "not a domain"))).Ok();
|
|
||||||
Assert.Equal(new[] { domain }, (await alice.Client.Get("/api/v1/domain_blocks")).Ok().Array.Select(d => d!.GetValue<string>()));
|
|
||||||
|
|
||||||
(await alice.Client.Delete("/api/v1/domain_blocks", ("domain", domain))).Ok();
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/domain_blocks")).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Relationships_answer_every_asked_id_even_a_junk_one()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = await _host.Mastodon("bob");
|
|
||||||
|
|
||||||
var answer = (await alice.Client.Get($"/api/v1/accounts/relationships?id[]=junk&id[]={bob.Id}&id[]=junk")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "junk", bob.Id }, answer.Ids);
|
|
||||||
Assert.All(answer.Array, r => Assert.False(r.Flag("following") || r.Flag("blocking") || r.Flag("muting") || r.Flag("followed_by")));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_remote_authors_followers_only_posts_show_only_to_the_personas_that_follow_them()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var (bob, bobId) = await Remote();
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{bobId}/follow")).Ok();
|
|
||||||
var follow = Assert.Single(await bob.Delivered(since), d => d.Type() == "Follow");
|
|
||||||
await _host.Deliver(bob, alice.Mouth, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = $"{bob.Origin()}/accepts/{Guid.NewGuid():N}",
|
|
||||||
["type"] = "Accept",
|
|
||||||
["actor"] = bob.Id,
|
|
||||||
["object"] = follow.DeepClone()
|
|
||||||
});
|
|
||||||
Assert.True(Assert.Single((await alice.Client.Get($"/api/v1/accounts/relationships?id[]={bobId}")).Ok().Array).Flag("following"));
|
|
||||||
var create = bob.Create("<p>for my followers</p>", new[] { bob.Id + "/followers" });
|
|
||||||
await _host.Deliver(bob, alice.Mouth, create);
|
|
||||||
var noteId = create["object"].Text("id");
|
|
||||||
var stored = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteFirstAsync(Token);
|
|
||||||
Assert.Equal(PostVisibility.FollowersOnly, stored.Visibility);
|
|
||||||
var path = $"/api/v1/accounts/{bobId}/statuses";
|
|
||||||
|
|
||||||
Assert.Equal(new[] { stored.ID }, (await alice.Client.Get(path)).Ok().Ids);
|
|
||||||
Assert.Empty((await carol.Client.Get(path)).Ok().Array);
|
|
||||||
Assert.Empty((await _host.Client().Get(path)).Ok().Array);
|
|
||||||
Assert.Equal("private", (await alice.Client.Get($"/api/v1/statuses/{stored.ID}")).Ok().Body.Text("visibility"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await carol.Client.Get($"/api/v1/statuses/{stored.ID}")).Status);
|
|
||||||
Assert.Contains(stored.ID, (await alice.Client.Get("/api/v1/timelines/home")).Ok().Ids);
|
|
||||||
Assert.True((await alice.Client.Post($"/api/v1/statuses/{stored.ID}/favourite")).Ok().Body.Flag("favourited"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Search_by_address_finds_local_posts_and_personas_but_never_a_circle_or_a_hidden_post()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var stranger = await _host.Mastodon("stranger");
|
|
||||||
var open = await alice.Status("findable");
|
|
||||||
var quiet = await alice.Status("not for strangers", ("visibility", "private"));
|
|
||||||
var circleName = $"circle{Guid.NewGuid():N}"[..20];
|
|
||||||
using (var clientApi = _host.As(alice.Persona.Root.Jwt))
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await clientApi.PostAsJsonAsync("/clientapi/group/insert",
|
|
||||||
new { avatarId = alice.Id, userName = circleName, name = "inner", isCommunity = false }, Token)).StatusCode);
|
|
||||||
|
|
||||||
var byPost = (await stranger.Client.Get($"/api/v2/search?q={Uri.EscapeDataString(open.Text("uri"))}")).Ok();
|
|
||||||
Assert.Equal(open.Text("id"), Assert.Single(byPost.Body["statuses"]!.AsArray()).Text("id"));
|
|
||||||
Assert.Equal(open.Text("id"), Assert.Single((await stranger.Client.Get($"/api/v2/search?q={Uri.EscapeDataString(open.Text("url"))}")).Ok().Body["statuses"]!.AsArray()).Text("id"));
|
|
||||||
var hidden = (await stranger.Client.Get($"/api/v2/search?q={Uri.EscapeDataString(quiet.Text("uri"))}&resolve=true")).Ok();
|
|
||||||
Assert.Empty(hidden.Body["statuses"]!.AsArray());
|
|
||||||
Assert.Equal(alice.Id, Assert.Single((await stranger.Client.Get($"/api/v2/search?q={Uri.EscapeDataString(alice.Uri)}")).Ok().Body["accounts"]!.AsArray()).Text("id"));
|
|
||||||
Assert.Empty((await stranger.Client.Get($"/api/v2/search?q={Uri.EscapeDataString($"{PrivaPubHost.Base}/peasants/{circleName}")}&resolve=true")).Ok().Body["accounts"]!.AsArray());
|
|
||||||
Assert.Empty((await stranger.Client.Get($"/api/v1/accounts/search?q={circleName}")).Ok().Array);
|
|
||||||
var tag = (await stranger.Client.Get("/api/v2/search?q=%23Cats&type=hashtags")).Ok();
|
|
||||||
Assert.Equal("cats", Assert.Single(tag.Body["hashtags"]!.AsArray()).Text("name"));
|
|
||||||
Assert.Empty(tag.Body["accounts"]!.AsArray());
|
|
||||||
|
|
||||||
(await alice.Client.Patch("/api/v1/accounts/update_credentials", ("discoverable", "false"))).Ok();
|
|
||||||
Assert.Empty((await stranger.Client.Get($"/api/v1/accounts/search?q={alice.UserName}")).Ok().Array);
|
|
||||||
Assert.Equal(alice.Id, (await stranger.Client.Get($"/api/v1/accounts/lookup?acct={alice.UserName}")).Ok().Body.Text("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_banned_login_loses_every_persona_token()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await alice.Client.Get("/api/v1/accounts/verify_credentials")).Status);
|
|
||||||
|
|
||||||
await DB.Default.Update<RootUser>().MatchID(alice.Persona.Root.Id).Modify(r => r.IsBanned, true).ExecuteAsync(Token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await alice.Client.Get("/api/v1/accounts/verify_credentials")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await alice.Client.Post("/api/v1/statuses", ("status", "still here?"))).Status);
|
|
||||||
Assert.Equal(alice.Id, (await _host.Client().Get($"/api/v1/accounts/{alice.Id}")).Ok().Body.Text("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_forwarded_report_leaves_as_a_flag_from_the_instance_actor_never_from_the_reporter()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var local = await _host.Mastodon("local");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var post = await _host.PublicPostFrom(bob, alice, "<p>something nasty</p>");
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
var unrelated = await alice.Status("mine");
|
|
||||||
|
|
||||||
var report = (await alice.Client.Post("/api/v1/reports", ("account_id", bobId), ("status_ids[]", post.ID), ("status_ids[]", unrelated.Text("id")),
|
|
||||||
("comment", "please look"), ("category", "spam"), ("forward", "true"))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(bobId, report.Body["target_account"].Text("id"));
|
|
||||||
Assert.Equal(new[] { post.ID }, report.Body["status_ids"]!.AsArray().Select(i => i!.GetValue<string>()));
|
|
||||||
Assert.True(report.Body.Flag("forwarded"));
|
|
||||||
Assert.Equal("spam", report.Body.Text("category"));
|
|
||||||
var flag = Assert.Single(await bob.Delivered(since));
|
|
||||||
Assert.Equal("Flag", flag.Type());
|
|
||||||
Assert.Equal($"{PrivaPubHost.Base}/peasants/privapub", flag.Text("actor"));
|
|
||||||
Assert.Equal(new[] { bob.Id, post.ObjectURI }, flag["object"]!.AsArray().Select(o => o!.GetValue<string>()));
|
|
||||||
Assert.DoesNotContain(alice.UserName, flag.ToJsonString());
|
|
||||||
Assert.DoesNotContain(alice.Id, flag.ToJsonString());
|
|
||||||
|
|
||||||
var quiet = (await alice.Client.Post("/api/v1/reports", ("account_id", bobId), ("comment", "just noting"))).Ok();
|
|
||||||
Assert.False(quiet.Body.Flag("forwarded"));
|
|
||||||
Assert.False((await alice.Client.Post("/api/v1/reports", ("account_id", local.Id), ("forward", "true"))).Ok().Body.Flag("forwarded"));
|
|
||||||
Assert.Single(await bob.Delivered(since));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post("/api/v1/reports", ("account_id", "000000000000000000000000"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Statuses_count_still_counts_located_posts_pending_an_owner_decision()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
await alice.Status("visible");
|
|
||||||
await _host.Located(alice, "by the river");
|
|
||||||
|
|
||||||
var account = (await _host.Client().Get($"/api/v1/accounts/{alice.Id}")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(2, account.Body.Number("statuses_count"));
|
|
||||||
Assert.Single((await _host.Client().Get($"/api/v1/accounts/{alice.Id}/statuses")).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Account_stub_routes_answer_empty_lists()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
Assert.Empty((await _host.Client().Get($"/api/v1/accounts/{alice.Id}/featured_tags")).Ok().Array);
|
|
||||||
Assert.Empty((await alice.Client.Get($"/api/v1/accounts/{alice.Id}/lists")).Ok().Array);
|
|
||||||
var familiar = (await alice.Client.Get($"/api/v1/accounts/familiar_followers?id[]={alice.Id}")).Ok();
|
|
||||||
Assert.Equal(alice.Id, Assert.Single(familiar.Array).Text("id"));
|
|
||||||
Assert.Empty(familiar.Array[0]!["accounts"]!.AsArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
using PrivaPub.Api.Mastodon.Controllers;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MastodonInstanceTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Both_instance_documents_advertise_mastodon_4_2_and_the_domain()
|
|
||||||
{
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
var v1 = (await anonymous.Get("/api/v1/instance")).Ok();
|
|
||||||
Assert.Equal("4.2.0 (compatible; PrivaPub)", v1.Body.Text("version"));
|
|
||||||
Assert.Equal(InstanceController.Version, v1.Body.Text("version"));
|
|
||||||
Assert.Equal(PrivaPubHost.Host, v1.Body.Text("uri"));
|
|
||||||
Assert.False(v1.Body.Flag("registrations"));
|
|
||||||
Assert.True(v1.Body["stats"].Number("user_count") >= 0);
|
|
||||||
Assert.Equal(5000, v1.Body["configuration"]!["statuses"].Number("max_characters"));
|
|
||||||
Assert.Equal(4, v1.Body["configuration"]!["polls"].Number("max_options"));
|
|
||||||
Assert.Contains("image/jpeg", v1.Body["configuration"]!["media_attachments"]!["supported_mime_types"]!.AsArray().Select(t => t!.GetValue<string>()));
|
|
||||||
Assert.Empty(v1.Body["rules"]!.AsArray());
|
|
||||||
Assert.Null(v1.Body["contact_account"]);
|
|
||||||
Assert.True(v1.Body.AsObject().ContainsKey("contact_account"));
|
|
||||||
|
|
||||||
var v2 = (await anonymous.Get("/api/v2/instance")).Ok();
|
|
||||||
Assert.Equal(InstanceController.Version, v2.Body.Text("version"));
|
|
||||||
Assert.Equal(PrivaPubHost.Host, v2.Body.Text("domain"));
|
|
||||||
Assert.Equal($"wss://{PrivaPubHost.Host}", v2.Body["configuration"]!["urls"].Text("streaming"));
|
|
||||||
Assert.False(v2.Body["registrations"].Flag("enabled"));
|
|
||||||
Assert.False(v2.Body["configuration"]!["translation"].Flag("enabled"));
|
|
||||||
Assert.Equal(7, v2.Body["api_versions"].Number("mastodon"));
|
|
||||||
|
|
||||||
var signedIn = await _host.Mastodon("reader");
|
|
||||||
Assert.Equal(InstanceController.Version, (await signedIn.Client.Get("/api/v1/instance")).Ok().Body.Text("version"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_instance_side_routes_answer_without_a_login()
|
|
||||||
{
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
Assert.Empty((await anonymous.Get("/api/v1/instance/peers")).Ok().Array);
|
|
||||||
Assert.Empty((await anonymous.Get("/api/v1/instance/activity")).Ok().Array);
|
|
||||||
Assert.Empty((await anonymous.Get("/api/v1/instance/rules")).Ok().Array);
|
|
||||||
var extended = (await anonymous.Get("/api/v1/instance/extended_description")).Ok();
|
|
||||||
Assert.StartsWith("<p>", extended.Body.Text("content"));
|
|
||||||
Assert.EndsWith("T00:00:00.000Z", extended.Body.Text("updated_at"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("/api/v1/custom_emojis")]
|
|
||||||
[InlineData("/api/v1/announcements")]
|
|
||||||
[InlineData("/api/v1/trends")]
|
|
||||||
[InlineData("/api/v1/trends/tags")]
|
|
||||||
[InlineData("/api/v1/trends/statuses")]
|
|
||||||
[InlineData("/api/v1/trends/links")]
|
|
||||||
public async Task Public_stub_routes_answer_empty_lists_to_anyone(string path)
|
|
||||||
{
|
|
||||||
Assert.Empty((await _host.Client().Get(path)).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("/api/v1/filters")]
|
|
||||||
[InlineData("/api/v2/filters")]
|
|
||||||
[InlineData("/api/v1/lists")]
|
|
||||||
[InlineData("/api/v1/suggestions")]
|
|
||||||
[InlineData("/api/v2/suggestions")]
|
|
||||||
[InlineData("/api/v1/followed_tags")]
|
|
||||||
[InlineData("/api/v1/endorsements")]
|
|
||||||
[InlineData("/api/v1/featured_tags")]
|
|
||||||
[InlineData("/api/v1/scheduled_statuses")]
|
|
||||||
public async Task Signed_in_stub_routes_answer_empty_lists(string path)
|
|
||||||
{
|
|
||||||
var reader = await _host.Mastodon("reader");
|
|
||||||
|
|
||||||
Assert.Empty((await reader.Client.Get(path)).Ok().Array);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get(path)).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Apps_are_registered_validated_and_verified()
|
|
||||||
{
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
var app = (await anonymous.Post("/api/v1/apps", ("client_name", "tusky-ish"), ("redirect_uris", "urn:ietf:wg:oauth:2.0:oob"), ("scopes", "read write"),
|
|
||||||
("website", "https://example.com"))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("tusky-ish", app.Body.Text("name"));
|
|
||||||
Assert.Equal(new[] { "read", "write" }, app.Body["scopes"]!.AsArray().Select(s => s!.GetValue<string>()));
|
|
||||||
Assert.False(string.IsNullOrEmpty(app.Body.Text("client_id")));
|
|
||||||
Assert.False(string.IsNullOrEmpty(app.Body.Text("client_secret")));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await anonymous.Post("/api/v1/apps", ("redirect_uris", "urn:ietf:wg:oauth:2.0:oob"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await anonymous.Post("/api/v1/apps", ("client_name", "x"), ("redirect_uris", "javascript:alert(1)"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await anonymous.Post("/api/v1/apps", ("client_name", "x"))).Status);
|
|
||||||
|
|
||||||
var reader = await _host.Mastodon("reader");
|
|
||||||
var verified = (await reader.Client.Get("/api/v1/apps/verify_credentials")).Ok();
|
|
||||||
Assert.Equal("privapub-tests", verified.Body.Text("name"));
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await anonymous.Get("/api/v1/apps/verify_credentials")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Preferences_follow_the_persona_and_push_has_no_subscription()
|
|
||||||
{
|
|
||||||
var reader = await _host.Mastodon("reader", scopes: "read write follow push");
|
|
||||||
(await reader.Client.Patch("/api/v1/accounts/update_credentials", ("source[privacy]", "unlisted"), ("source[sensitive]", "true"))).Ok();
|
|
||||||
|
|
||||||
var preferences = (await reader.Client.Get("/api/v1/preferences")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("unlisted", preferences.Body.Text("posting:default:visibility"));
|
|
||||||
Assert.True(preferences.Body.Flag("posting:default:sensitive"));
|
|
||||||
Assert.False(preferences.Body.Flag("reading:expand:spoilers"));
|
|
||||||
var push = await reader.Client.Get("/api/v1/push/subscription");
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, push.Status);
|
|
||||||
Assert.Equal("Record not found", push.Body.Text("error"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,369 +0,0 @@
|
|||||||
using PrivaPub.Domain.Media;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MastodonMediaTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CancellationToken Token => TestContext.Current.CancellationToken;
|
|
||||||
|
|
||||||
static Task<ApiAnswer> Upload(Mastodon account, string path, byte[] bytes, string contentType, string fileName, params (string Key, string Value)[] fields)
|
|
||||||
{
|
|
||||||
var form = MastodonHelpers.Multipart(("file", bytes, contentType, fileName));
|
|
||||||
foreach (var (key, value) in fields)
|
|
||||||
form.Add(new StringContent(value), key);
|
|
||||||
return account.Client.Exchange(new HttpRequestMessage(HttpMethod.Post, path) { Content = form });
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<(int ExitCode, string Output)> Run(string program, params string[] arguments)
|
|
||||||
{
|
|
||||||
var start = new ProcessStartInfo(program) { RedirectStandardOutput = true, RedirectStandardError = true };
|
|
||||||
foreach (var argument in arguments)
|
|
||||||
start.ArgumentList.Add(argument);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var process = Process.Start(start)!;
|
|
||||||
var output = process.StandardOutput.ReadToEndAsync(Token);
|
|
||||||
var errors = process.StandardError.ReadToEndAsync(Token);
|
|
||||||
await process.WaitForExitAsync(Token);
|
|
||||||
return (process.ExitCode, await output + await errors);
|
|
||||||
}
|
|
||||||
catch (System.ComponentModel.Win32Exception)
|
|
||||||
{
|
|
||||||
return (-1, $"{program} is not installed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<byte[]> Made(string extension, params string[] arguments)
|
|
||||||
{
|
|
||||||
if ((await Run("ffmpeg", "-version")).ExitCode != 0 || (await Run("ffprobe", "-version")).ExitCode != 0)
|
|
||||||
Assert.Skip("ffmpeg and ffprobe are needed to make and inspect audio and video");
|
|
||||||
var path = Path.Combine(Path.GetTempPath(), $"privapub-av-{Guid.NewGuid():N}.{extension}");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var (exitCode, output) = await Run("ffmpeg", arguments.Append(path).Prepend("-nostdin").Prepend("-y").ToArray());
|
|
||||||
Assert.True(exitCode == 0, output);
|
|
||||||
return await File.ReadAllBytesAsync(path, Token);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
File.Delete(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<string> Probe(string url)
|
|
||||||
{
|
|
||||||
var path = Path.Combine(Path.GetTempPath(), $"privapub-probe-{Guid.NewGuid():N}");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await File.WriteAllBytesAsync(path, await _host.Client().GetByteArrayAsync(url, Token), Token);
|
|
||||||
var (exitCode, output) = await Run("ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", path);
|
|
||||||
Assert.Equal(0, exitCode);
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
File.Delete(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("/api/v1/media")]
|
|
||||||
[InlineData("/api/v2/media")]
|
|
||||||
public async Task Images_upload_with_their_description_and_focus_and_without_their_metadata(string route)
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var uploaded = (await Upload(alice, route, MastodonHelpers.JpegWithMetadata(640, 480), "image/jpeg", "holiday.jpg",
|
|
||||||
("description", "a blue square"), ("focus", "0.5,-0.25"))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("image", uploaded.Body.Text("type"));
|
|
||||||
Assert.Equal("a blue square", uploaded.Body.Text("description"));
|
|
||||||
Assert.Equal(640, uploaded.Body["meta"]!["original"].Number("width"));
|
|
||||||
Assert.Equal(480, uploaded.Body["meta"]!["original"].Number("height"));
|
|
||||||
Assert.Equal(0.5, uploaded.Body["meta"]!["focus"]!["x"]!.GetValue<double>());
|
|
||||||
Assert.Equal(-0.25, uploaded.Body["meta"]!["focus"]!["y"]!.GetValue<double>());
|
|
||||||
Assert.False(string.IsNullOrEmpty(uploaded.Body.Text("blurhash")));
|
|
||||||
Assert.Null(uploaded.Body.Text("remote_url"));
|
|
||||||
foreach (var field in new[] { "url", "preview_url" })
|
|
||||||
{
|
|
||||||
Assert.StartsWith($"{PrivaPubHost.Base}/media/files/", uploaded.Body.Text(field));
|
|
||||||
MastodonHelpers.AssertNoMetadata(await _host.Client().GetByteArrayAsync(uploaded.Body.Text(field), Token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Media_is_read_and_described_only_by_its_owner()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var mallory = await _host.Mastodon("mallory");
|
|
||||||
var id = (await Upload(alice, "/api/v2/media", MastodonHelpers.JpegWithMetadata(32, 32), "image/jpeg", "a.jpg")).Ok().Body.Text("id");
|
|
||||||
|
|
||||||
Assert.Equal(id, (await alice.Client.Get($"/api/v1/media/{id}")).Ok().Body.Text("id"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await mallory.Client.Get($"/api/v1/media/{id}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await mallory.Client.Put($"/api/v1/media/{id}", ("description", "mine now"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get($"/api/v1/media/{id}")).Status);
|
|
||||||
|
|
||||||
var described = (await alice.Client.Put($"/api/v1/media/{id}", ("description", " a tiny square "), ("focus", "2,-3"))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("a tiny square", described.Body.Text("description"));
|
|
||||||
Assert.Equal((1.0, -1.0), (described.Body["meta"]!["focus"]!["x"]!.GetValue<double>(), described.Body["meta"]!["focus"]!["y"]!.GetValue<double>()));
|
|
||||||
Assert.Equal("a tiny square", (await alice.Client.Get($"/api/v1/media/{id}")).Ok().Body.Text("description"));
|
|
||||||
Assert.Null((await alice.Client.Put($"/api/v1/media/{id}", ("description", ""))).Ok().Body.Text("description"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Unsupported_unreadable_and_missing_files_are_refused_with_422()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var text = await Upload(alice, "/api/v2/media", Encoding.UTF8.GetBytes("hello"), "text/plain", "a.txt");
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, text.Status);
|
|
||||||
Assert.Contains("not supported", text.Body.Text("error"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await Upload(alice, "/api/v2/media", Encoding.UTF8.GetBytes("not a jpeg"), "image/jpeg", "a.jpg")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await Upload(alice, "/api/v2/media", Encoding.UTF8.GetBytes("not a video"), "video/mp4", "a.mp4")).Status);
|
|
||||||
var empty = new MultipartFormDataContent { { new StringContent("no file"), "description" } };
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Exchange(new HttpRequestMessage(HttpMethod.Post, "/api/v2/media") { Content = empty })).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post("/api/v1/media")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Video_is_remuxed_without_its_metadata()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var video = await Made("mp4", "-f", "lavfi", "-i", "testsrc=duration=1:size=320x240:rate=10", "-f", "lavfi", "-i", "sine=frequency=440:duration=1",
|
|
||||||
"-metadata", "title=secret title", "-metadata", "comment=filmed at home", "-metadata:s:v:0", "handler_name=hidden handler",
|
|
||||||
"-c:v", "mpeg4", "-c:a", "aac", "-shortest");
|
|
||||||
Assert.Contains("secret title", Encoding.Latin1.GetString(video));
|
|
||||||
|
|
||||||
var uploaded = (await Upload(alice, "/api/v2/media", video, "video/mp4", "clip.mp4")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("video", uploaded.Body.Text("type"));
|
|
||||||
Assert.Equal(320, uploaded.Body["meta"]!["original"].Number("width"));
|
|
||||||
Assert.EndsWith(".mp4", uploaded.Body.Text("url"));
|
|
||||||
Assert.EndsWith(".jpg", uploaded.Body.Text("preview_url"));
|
|
||||||
var probe = await Probe(uploaded.Body.Text("url"));
|
|
||||||
Assert.Contains("\"codec_type\": \"video\"", probe);
|
|
||||||
Assert.DoesNotContain("secret title", probe);
|
|
||||||
Assert.DoesNotContain("filmed at home", probe);
|
|
||||||
Assert.DoesNotContain("hidden handler", probe);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Audio_is_remuxed_without_its_metadata()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var audio = await Made("m4a", "-f", "lavfi", "-i", "sine=frequency=330:duration=1", "-metadata", "title=secret song", "-metadata", "artist=Alice Smith",
|
|
||||||
"-c:a", "aac");
|
|
||||||
|
|
||||||
var uploaded = (await Upload(alice, "/api/v2/media", audio, "audio/mp4", "song.m4a")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("audio", uploaded.Body.Text("type"));
|
|
||||||
var probe = await Probe(uploaded.Body.Text("url"));
|
|
||||||
Assert.Contains("\"codec_type\": \"audio\"", probe);
|
|
||||||
Assert.DoesNotContain("secret song", probe);
|
|
||||||
Assert.DoesNotContain("Alice Smith", probe);
|
|
||||||
}
|
|
||||||
|
|
||||||
static byte[] Bytes(int length)
|
|
||||||
{
|
|
||||||
var bytes = new byte[length];
|
|
||||||
Random.Shared.NextBytes(bytes);
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
string Served(byte[] bytes, string contentType = "video/mp4")
|
|
||||||
{
|
|
||||||
var path = $"/media/{Guid.NewGuid():N}.bin";
|
|
||||||
_peer.ServeFile(path, bytes, contentType);
|
|
||||||
return _peer.A + path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HttpRequestMessage Ranged(string url, long from, long to)
|
|
||||||
{
|
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
|
||||||
request.Headers.Range = new RangeHeaderValue(from, to);
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Every_remote_media_address_the_api_returns_goes_through_the_proxy()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var document = bob.Document();
|
|
||||||
document["icon"] = new JsonObject { ["type"] = "Image", ["url"] = _peer.A + "/avatar.png" };
|
|
||||||
document["image"] = new JsonObject { ["type"] = "Image", ["url"] = _peer.A + "/header.png" };
|
|
||||||
_peer.Serve($"/users/{bob.Name}", document.ToJsonString());
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
var post = await _host.PublicPostFrom(bob, alice, "<p>look :blob:</p>", note =>
|
|
||||||
{
|
|
||||||
note["attachment"] = new JsonArray(new JsonObject
|
|
||||||
{
|
|
||||||
["type"] = "Document", ["mediaType"] = "image/png", ["url"] = _peer.A + "/picture.png", ["name"] = "a picture"
|
|
||||||
});
|
|
||||||
note["tag"]!.AsArray().Add(new JsonObject
|
|
||||||
{
|
|
||||||
["type"] = "Emoji", ["name"] = ":blob:", ["icon"] = new JsonObject { ["type"] = "Image", ["url"] = _peer.A + "/blob.png" }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
var proxied = $"{PrivaPubHost.Base}/media/proxy/";
|
|
||||||
|
|
||||||
var account = (await alice.Client.Get($"/api/v1/accounts/{bobId}")).Ok().Body;
|
|
||||||
var status = (await alice.Client.Get($"/api/v1/statuses/{post.ID}")).Ok().Body;
|
|
||||||
|
|
||||||
foreach (var field in new[] { "avatar", "avatar_static", "header", "header_static" })
|
|
||||||
Assert.StartsWith(proxied, account.Text(field));
|
|
||||||
Assert.StartsWith(proxied, status["account"].Text("avatar"));
|
|
||||||
var attachment = Assert.Single(status["media_attachments"]!.AsArray());
|
|
||||||
Assert.StartsWith(proxied, attachment.Text("url"));
|
|
||||||
Assert.StartsWith(proxied, attachment.Text("preview_url"));
|
|
||||||
Assert.Equal(_peer.A + "/picture.png", attachment.Text("remote_url"));
|
|
||||||
Assert.Equal("a picture", attachment.Text("description"));
|
|
||||||
Assert.StartsWith(proxied, Assert.Single(status["emojis"]!.AsArray()).Text("url"));
|
|
||||||
var everything = account.ToJsonString() + status.ToJsonString();
|
|
||||||
foreach (var file in new[] { "/avatar.png", "/header.png", "/blob.png" })
|
|
||||||
Assert.DoesNotContain(_peer.A + file, everything);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_proxy_refuses_a_url_it_did_not_sign()
|
|
||||||
{
|
|
||||||
var proxy = _host.Get<IMediaProxy>();
|
|
||||||
var remote = Served(Bytes(100));
|
|
||||||
var wrapped = proxy.Wrap(remote);
|
|
||||||
var parts = new Uri(wrapped).AbsolutePath.Split('/');
|
|
||||||
var other = new Uri(proxy.Wrap(Served(Bytes(100)))).AbsolutePath.Split('/');
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
Assert.StartsWith($"{PrivaPubHost.Base}/media/proxy/", wrapped);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.GetAsync($"/media/proxy/AAAAAAAAAAAAAAAAAAAAAA/{parts[^1]}", Token)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.GetAsync($"/media/proxy/{parts[^2]}/{other[^1]}", Token)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.GetAsync($"/media/proxy/{parts[^2]}/!!!", Token)).StatusCode);
|
|
||||||
Assert.Empty(_peer.Requests);
|
|
||||||
Assert.Equal($"{PrivaPubHost.Base}/media/files/a.jpg", proxy.Wrap($"{PrivaPubHost.Base}/media/files/a.jpg"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_ranged_request_is_streamed_as_206_and_never_cached()
|
|
||||||
{
|
|
||||||
var proxy = _host.Get<IMediaProxy>();
|
|
||||||
var bytes = Bytes(10_000);
|
|
||||||
var remote = Served(bytes);
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
using var response = await client.SendAsync(Ranged(proxy.Wrap(remote), 100, 199), Token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.PartialContent, response.StatusCode);
|
|
||||||
Assert.Equal("bytes 100-199/10000", response.Content.Headers.ContentRange!.ToString());
|
|
||||||
Assert.Equal(bytes[100..200], await response.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.Equal("nosniff", response.Headers.GetValues("X-Content-Type-Options").Single());
|
|
||||||
Assert.Equal(default, proxy.Cached(remote));
|
|
||||||
using var again = await client.SendAsync(Ranged(proxy.Wrap(remote), 0, 9), Token);
|
|
||||||
Assert.Equal(bytes[..10], await again.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.Equal(2, _peer.Requests.Count);
|
|
||||||
Assert.All(_peer.Requests, r => Assert.StartsWith("bytes=", r.Headers["Range"]));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_whole_download_is_cached_and_then_served_with_ranges()
|
|
||||||
{
|
|
||||||
var proxy = _host.Get<IMediaProxy>();
|
|
||||||
var bytes = Bytes(5_000);
|
|
||||||
var remote = Served(bytes, "image/png");
|
|
||||||
using var client = _host.Client();
|
|
||||||
|
|
||||||
using var whole = await client.GetAsync(proxy.Wrap(remote), Token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, whole.StatusCode);
|
|
||||||
Assert.Equal("image/png", whole.Content.Headers.ContentType!.MediaType);
|
|
||||||
Assert.Equal(bytes, await whole.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.NotNull(proxy.Cached(remote).Path);
|
|
||||||
using var part = await client.SendAsync(Ranged(proxy.Wrap(remote), 10, 19), Token);
|
|
||||||
Assert.Equal(HttpStatusCode.PartialContent, part.StatusCode);
|
|
||||||
Assert.Equal(bytes[10..20], await part.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
using var cached = await client.GetAsync(proxy.Wrap(remote), Token);
|
|
||||||
Assert.Equal(bytes, await cached.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.Single(_peer.Requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Anything_over_the_proxy_limit_is_streamed_and_never_cached()
|
|
||||||
{
|
|
||||||
var host = await SmallProxyHost.Shared();
|
|
||||||
var proxy = host.Get<IMediaProxy>();
|
|
||||||
var bytes = Bytes(SmallProxyHost.Limit * 4);
|
|
||||||
var remote = Served(bytes);
|
|
||||||
using var client = host.Client();
|
|
||||||
|
|
||||||
using var response = await client.GetAsync(proxy.Wrap(remote), Token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
Assert.Equal(bytes.Length, response.Content.Headers.ContentLength);
|
|
||||||
Assert.Equal(bytes, await response.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.Equal(default, proxy.Cached(remote));
|
|
||||||
using var again = await client.GetAsync(proxy.Wrap(remote), Token);
|
|
||||||
Assert.Equal(bytes, await again.Content.ReadAsByteArrayAsync(Token));
|
|
||||||
Assert.Equal(4, _peer.Requests.Count);
|
|
||||||
var small = Served(Bytes(SmallProxyHost.Limit / 2));
|
|
||||||
using (var fits = await client.GetAsync(proxy.Wrap(small), Token))
|
|
||||||
Assert.Equal(HttpStatusCode.OK, fits.StatusCode);
|
|
||||||
Assert.NotNull(proxy.Cached(small).Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class SmallProxyHost : PrivaPubHost
|
|
||||||
{
|
|
||||||
public const int Limit = 16 * 1024;
|
|
||||||
|
|
||||||
static readonly SemaphoreSlim Boot = new(1, 1);
|
|
||||||
static SmallProxyHost _shared;
|
|
||||||
|
|
||||||
public static new async Task<SmallProxyHost> Shared()
|
|
||||||
{
|
|
||||||
await PrivaPubHost.Shared();
|
|
||||||
await Boot.WaitAsync();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_shared == default)
|
|
||||||
{
|
|
||||||
var host = new SmallProxyHost();
|
|
||||||
_ = host.Services;
|
|
||||||
_shared = host;
|
|
||||||
}
|
|
||||||
return _shared;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Boot.Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<KeyValuePair<string, string>> Settings() =>
|
|
||||||
base.Settings().Append(new KeyValuePair<string, string>("Media:MaxProxiedBytes", Limit.ToString(System.Globalization.CultureInfo.InvariantCulture)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,548 +0,0 @@
|
|||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MastodonStatusesTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<string> Strings(JsonNode node) => node!.AsArray().Select(n => n!.GetValue<string>());
|
|
||||||
|
|
||||||
static async Task<JsonObject> Image(Mastodon account) =>
|
|
||||||
(await account.Client.Exchange(new HttpRequestMessage(HttpMethod.Post, "/api/v1/media")
|
|
||||||
{
|
|
||||||
Content = MastodonHelpers.Multipart(("file", MastodonHelpers.JpegWithMetadata(80, 60), "image/jpeg", "a.jpg"))
|
|
||||||
})).Ok().Object;
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Each_visibility_is_addressed_the_way_mastodon_addresses_it()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var carol = new RemoteActor(_peer, "carol");
|
|
||||||
await _host.FollowedBy(alice, bob);
|
|
||||||
_peer.WebFinger(carol);
|
|
||||||
var followers = alice.Uri + "/groupies";
|
|
||||||
|
|
||||||
var open = await alice.Status("for everyone");
|
|
||||||
var unlisted = await alice.Status("quietly public", ("visibility", "unlisted"));
|
|
||||||
var quiet = await alice.Status("for followers", ("visibility", "private"));
|
|
||||||
var direct = await alice.Status($"@{carol.Handle()} just you", ("visibility", "direct"));
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "public", "unlisted", "private", "direct" }, new[] { open, unlisted, quiet, direct }.Select(s => s.Text("visibility")));
|
|
||||||
var creates = (await bob.Delivered(since)).Where(d => d.Type() == "Create").ToDictionary(d => d["object"].Text("id"));
|
|
||||||
Assert.Equal(3, creates.Count);
|
|
||||||
var publicNote = creates[open.Text("uri")]["object"];
|
|
||||||
Assert.Equal(new[] { MastodonHelpers.Public }, Strings(publicNote["to"]));
|
|
||||||
Assert.Equal(new[] { followers }, Strings(publicNote["cc"]));
|
|
||||||
var unlistedNote = creates[unlisted.Text("uri")]["object"];
|
|
||||||
Assert.Equal(new[] { followers }, Strings(unlistedNote["to"]));
|
|
||||||
Assert.Equal(new[] { MastodonHelpers.Public }, Strings(unlistedNote["cc"]));
|
|
||||||
var quietNote = creates[quiet.Text("uri")]["object"];
|
|
||||||
Assert.Equal(new[] { followers }, Strings(quietNote["to"]));
|
|
||||||
Assert.Empty(quietNote["cc"]!.AsArray());
|
|
||||||
var whisper = Assert.Single(await carol.Delivered(since));
|
|
||||||
Assert.Equal(direct.Text("uri"), whisper["object"].Text("id"));
|
|
||||||
Assert.Equal(new[] { carol.Id }, Strings(whisper["object"]!["to"]));
|
|
||||||
Assert.Empty(whisper["object"]!["cc"]!.AsArray());
|
|
||||||
Assert.Equal(carol.Handle(), Assert.Single(direct["mentions"]!.AsArray()).Text("acct"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_content_warning_is_kept_as_spoiler_text_and_federates_as_a_summary()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var warned = await alice.Status("the butler did it", ("spoiler_text", "spoilers"));
|
|
||||||
|
|
||||||
Assert.True(warned.Flag("sensitive"));
|
|
||||||
Assert.Equal("spoilers", warned.Text("spoiler_text"));
|
|
||||||
var note = (await _host.ActivityPub($"/peasants/{alice.UserName}/scribbles/{warned.Text("id")}")).Ok().Body;
|
|
||||||
Assert.Equal("spoilers", note.Text("summary"));
|
|
||||||
Assert.True(note.Flag("sensitive"));
|
|
||||||
Assert.Contains("the butler did it", note.Text("content"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post("/api/v1/statuses", ("status", " "))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_reply_to_a_local_post_threads_counts_and_shows_in_the_context()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = await _host.Mastodon("bob");
|
|
||||||
var root = await alice.Status("what do you think?");
|
|
||||||
|
|
||||||
var reply = await bob.Status("I agree", ("in_reply_to_id", root.Text("id")));
|
|
||||||
var nested = await alice.Status("thanks", ("in_reply_to_id", reply.Text("id")));
|
|
||||||
|
|
||||||
Assert.Equal(root.Text("id"), reply.Text("in_reply_to_id"));
|
|
||||||
Assert.Equal(alice.Id, reply.Text("in_reply_to_account_id"));
|
|
||||||
Assert.Equal(1, (await bob.Client.Get($"/api/v1/statuses/{root.Text("id")}")).Ok().Body.Number("replies_count"));
|
|
||||||
var context = (await _host.Client().Get($"/api/v1/statuses/{reply.Text("id")}/context")).Ok();
|
|
||||||
Assert.Equal(new[] { root.Text("id") }, context.Body["ancestors"]!.AsArray().Select(s => s.Text("id")));
|
|
||||||
Assert.Equal(new[] { nested.Text("id") }, context.Body["descendants"]!.AsArray().Select(s => s.Text("id")));
|
|
||||||
var whole = (await alice.Client.Get($"/api/v1/statuses/{root.Text("id")}/context")).Ok();
|
|
||||||
Assert.Equal(new[] { reply.Text("id"), nested.Text("id") }, whole.Body["descendants"]!.AsArray().Select(s => s.Text("id")));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await bob.Client.Post("/api/v1/statuses", ("status", "lost"), ("in_reply_to_id", "000000000000000000000000"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_reply_to_a_remote_post_mentions_its_author_and_reaches_its_inbox()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
_peer.WebFinger(bob);
|
|
||||||
var parent = await _host.PublicPostFrom(bob, alice);
|
|
||||||
var bobId = (await _host.Known(bob)).ID;
|
|
||||||
|
|
||||||
var reply = await alice.Status($"@{bob.Handle()} well said", ("in_reply_to_id", parent.ID));
|
|
||||||
|
|
||||||
Assert.Equal(parent.ID, reply.Text("in_reply_to_id"));
|
|
||||||
Assert.Equal(bobId, reply.Text("in_reply_to_account_id"));
|
|
||||||
var mention = Assert.Single(reply["mentions"]!.AsArray());
|
|
||||||
Assert.Equal((bobId, bob.Handle()), (mention.Text("id"), mention.Text("acct")));
|
|
||||||
var create = Assert.Single(await bob.Delivered(since), d => d.Type() == "Create");
|
|
||||||
var note = create["object"]!;
|
|
||||||
Assert.Equal(parent.ObjectURI, note.Text("inReplyTo"));
|
|
||||||
Assert.Contains(bob.Id, Strings(note["cc"]));
|
|
||||||
Assert.Contains(note["tag"]!.AsArray(), t => t.Text("type") == "Mention" && t.Text("href") == bob.Id);
|
|
||||||
Assert.Equal(1, (await alice.Client.Get($"/api/v1/statuses/{parent.ID}")).Ok().Body.Number("replies_count"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_poll_is_created_validated_and_federated_as_a_question()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var status = await alice.Status("tea or coffee?", ("poll[options][]", "tea"), ("poll[options][]", "coffee"), ("poll[expires_in]", "600"),
|
|
||||||
("poll[multiple]", "true"));
|
|
||||||
|
|
||||||
var poll = status["poll"]!;
|
|
||||||
Assert.Equal(new[] { "tea", "coffee" }, poll["options"]!.AsArray().Select(o => o.Text("title")));
|
|
||||||
Assert.True(poll.Flag("multiple"));
|
|
||||||
Assert.False(poll.Flag("expired"));
|
|
||||||
Assert.NotNull(poll.Text("expires_at"));
|
|
||||||
Assert.Equal(status.Text("id"), (await _host.Client().Get($"/api/v1/polls/{status.Text("id")}")).Ok().Body.Text("id"));
|
|
||||||
var question = (await _host.ActivityPub($"/peasants/{alice.UserName}/scribbles/{status.Text("id")}")).Ok().Body;
|
|
||||||
Assert.Equal("Question", question.Text("type"));
|
|
||||||
Assert.Equal(2, question["anyOf"]!.AsArray().Count);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post("/api/v1/statuses", ("status", "one?"), ("poll[options][]", "only"),
|
|
||||||
("poll[expires_in]", "600"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Media_is_attached_only_by_its_owner()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var mallory = await _host.Mastodon("mallory");
|
|
||||||
var upload = await Image(alice);
|
|
||||||
|
|
||||||
var status = await alice.Status("look", ("media_ids[]", upload.Text("id")));
|
|
||||||
|
|
||||||
var attachment = Assert.Single(status["media_attachments"]!.AsArray());
|
|
||||||
Assert.Equal(upload.Text("id"), attachment.Text("id"));
|
|
||||||
Assert.Equal("image", attachment.Text("type"));
|
|
||||||
var note = (await _host.ActivityPub($"/peasants/{alice.UserName}/scribbles/{status.Text("id")}")).Ok().Body;
|
|
||||||
Assert.Equal(upload.Text("url"), Assert.Single(note["attachment"]!.AsArray()).Text("url"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await mallory.Client.Post("/api/v1/statuses", ("status", "mine"), ("media_ids[]", (await Image(alice)).Text("id")))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post("/api/v1/statuses", ("status", "again"), ("media_ids[]", upload.Text("id")))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_quote_of_a_local_post_is_accepted_listed_and_revocable()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var original = await carol.Status("quote me");
|
|
||||||
var closed = await carol.Status("do not quote me", ("quote_approval_policy", "nobody"));
|
|
||||||
|
|
||||||
var quote = await alice.Status("so true", ("quoted_status_id", original.Text("id")));
|
|
||||||
|
|
||||||
Assert.Equal("accepted", quote["quote"].Text("state"));
|
|
||||||
Assert.Equal(original.Text("id"), quote["quote"]!["quoted_status"].Text("id"));
|
|
||||||
Assert.Equal(1, (await carol.Client.Get($"/api/v1/statuses/{original.Text("id")}")).Ok().Body.Number("quotes_count"));
|
|
||||||
Assert.Equal(new[] { quote.Text("id") }, (await _host.Client().Get($"/api/v1/statuses/{original.Text("id")}/quotes")).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post("/api/v1/statuses", ("status", "anyway"), ("quoted_status_id", closed.Text("id")))).Status);
|
|
||||||
Assert.Empty(closed["quote_approval"]!["automatic"]!.AsArray());
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post($"/api/v1/statuses/{original.Text("id")}/quotes/{quote.Text("id")}/revoke")).Status);
|
|
||||||
var revoked = (await carol.Client.Post($"/api/v1/statuses/{original.Text("id")}/quotes/{quote.Text("id")}/revoke")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(quote.Text("id"), revoked.Body.Text("id"));
|
|
||||||
Assert.Equal("revoked", revoked.Body["quote"].Text("state"));
|
|
||||||
Assert.Empty((await carol.Client.Get($"/api/v1/statuses/{original.Text("id")}/quotes")).Ok().Array);
|
|
||||||
Assert.Equal(0, (await carol.Client.Get($"/api/v1/statuses/{original.Text("id")}")).Ok().Body.Number("quotes_count"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_edit_keeps_its_history_shows_its_source_and_federates_an_update()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var other = await _host.Mastodon("other");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
await _host.FollowedBy(alice, bob);
|
|
||||||
var status = await alice.Status("first version", ("spoiler_text", "cw"));
|
|
||||||
var id = status.Text("id");
|
|
||||||
|
|
||||||
var edited = (await alice.Client.Put($"/api/v1/statuses/{id}", ("status", "second version"))).Ok();
|
|
||||||
|
|
||||||
Assert.NotNull(edited.Body.Text("edited_at"));
|
|
||||||
Assert.Contains("second version", edited.Body.Text("content"));
|
|
||||||
Assert.Contains("second version", (await other.Client.Get($"/api/v1/statuses/{id}")).Ok().Body.Text("content"));
|
|
||||||
var history = (await _host.Client().Get($"/api/v1/statuses/{id}/history")).Ok().Array;
|
|
||||||
Assert.Equal(2, history.Count);
|
|
||||||
Assert.Contains("first version", history[0].Text("content"));
|
|
||||||
Assert.Equal("cw", history[0].Text("spoiler_text"));
|
|
||||||
Assert.Contains("second version", history[1].Text("content"));
|
|
||||||
Assert.Equal(alice.Id, history[1]!["account"].Text("id"));
|
|
||||||
var source = (await alice.Client.Get($"/api/v1/statuses/{id}/source")).Ok();
|
|
||||||
Assert.Equal(("second version", ""), (source.Body.Text("text"), source.Body.Text("spoiler_text")));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Get($"/api/v1/statuses/{id}/source")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Put($"/api/v1/statuses/{id}", ("status", "hijacked"))).Status);
|
|
||||||
var update = Assert.Single(await bob.Delivered(since), d => d.Type() == "Update");
|
|
||||||
Assert.Equal(status.Text("uri"), update["object"].Text("id"));
|
|
||||||
Assert.Contains("second version", update["object"].Text("content"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Delete_returns_the_text_for_a_redraft_and_leaves_a_tombstone()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var other = await _host.Mastodon("other");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
await _host.FollowedBy(alice, bob);
|
|
||||||
var status = await alice.Status("regrettable", ("spoiler_text", "hot take"));
|
|
||||||
var id = status.Text("id");
|
|
||||||
var scribble = $"/peasants/{alice.UserName}/scribbles/{id}";
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await _host.ActivityPub(scribble)).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Delete($"/api/v1/statuses/{id}")).Status);
|
|
||||||
|
|
||||||
var deleted = (await alice.Client.Delete($"/api/v1/statuses/{id}")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(id, deleted.Body.Text("id"));
|
|
||||||
Assert.Equal("regrettable", deleted.Body.Text("text"));
|
|
||||||
Assert.Equal("hot take", deleted.Body.Text("spoiler_text"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/statuses/{id}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Delete($"/api/v1/statuses/{id}")).Status);
|
|
||||||
var tombstone = await _host.ActivityPub(scribble);
|
|
||||||
Assert.Equal(HttpStatusCode.Gone, tombstone.Status);
|
|
||||||
Assert.Equal("Tombstone", tombstone.Body.Text("type"));
|
|
||||||
Assert.Equal(status.Text("uri"), tombstone.Body.Text("id"));
|
|
||||||
var delete = Assert.Single(await bob.Delivered(since), d => d.Type() == "Delete");
|
|
||||||
Assert.Equal(status.Text("uri"), delete["object"].Text("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Favourites_and_reblogs_count_and_federate_with_their_undos()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var remote = await _host.PublicPostFrom(bob, alice);
|
|
||||||
var path = $"/api/v1/statuses/{remote.ID}";
|
|
||||||
|
|
||||||
var liked = (await alice.Client.Post(path + "/favourite")).Ok();
|
|
||||||
Assert.True(liked.Body.Flag("favourited"));
|
|
||||||
Assert.Equal(1, liked.Body.Number("favourites_count"));
|
|
||||||
Assert.Equal(new[] { alice.Id }, (await _host.Client().Get(path + "/favourited_by")).Ok().Ids);
|
|
||||||
Assert.Equal(1, (await alice.Client.Post(path + "/favourite")).Ok().Body.Number("favourites_count"));
|
|
||||||
var unliked = (await alice.Client.Post(path + "/unfavourite")).Ok();
|
|
||||||
Assert.False(unliked.Body.Flag("favourited"));
|
|
||||||
Assert.Equal(0, unliked.Body.Number("favourites_count"));
|
|
||||||
|
|
||||||
var reblog = (await alice.Client.Post(path + "/reblog")).Ok();
|
|
||||||
Assert.Equal(remote.ID, reblog.Body["reblog"].Text("id"));
|
|
||||||
Assert.True(reblog.Body["reblog"].Flag("reblogged"));
|
|
||||||
Assert.Equal(1, reblog.Body["reblog"].Number("reblogs_count"));
|
|
||||||
Assert.Equal(new[] { alice.Id }, (await carol.Client.Get(path + "/reblogged_by")).Ok().Ids);
|
|
||||||
var unreblogged = (await alice.Client.Post(path + "/unreblog")).Ok();
|
|
||||||
Assert.False(unreblogged.Body.Flag("reblogged"));
|
|
||||||
Assert.Equal(0, unreblogged.Body.Number("reblogs_count"));
|
|
||||||
Assert.Empty((await carol.Client.Get(path + "/reblogged_by")).Ok().Array);
|
|
||||||
|
|
||||||
var sent = await bob.Delivered(since);
|
|
||||||
var like = Assert.Single(sent, d => d.Type() == "Like");
|
|
||||||
Assert.Equal((alice.Uri, remote.ObjectURI), (like.Text("actor"), like.Text("object")));
|
|
||||||
var announce = Assert.Single(sent, d => d.Type() == "Announce");
|
|
||||||
Assert.Equal(remote.ObjectURI, announce.Text("object"));
|
|
||||||
var undos = sent.Where(d => d.Type() == "Undo").ToList();
|
|
||||||
Assert.Equal(new[] { "Announce", "Like" }, undos.Select(u => u["object"].Text("type")).Order());
|
|
||||||
Assert.Equal(like.Text("id"), undos.Single(u => u["object"].Text("type") == "Like")["object"].Text("id"));
|
|
||||||
|
|
||||||
var local = await carol.Status("a local one");
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{local.Text("id")}/favourite")).Ok();
|
|
||||||
var notification = Assert.Single((await carol.Client.Get("/api/v1/notifications?types[]=favourite")).Ok().Array);
|
|
||||||
Assert.Equal((alice.Id, local.Text("id")), (notification["account"].Text("id"), notification["status"].Text("id")));
|
|
||||||
var quiet = await carol.Status("followers only", ("visibility", "private"));
|
|
||||||
(await alice.Client.Post($"/api/v1/accounts/{carol.Id}/follow")).Ok();
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post($"/api/v1/statuses/{quiet.Text("id")}/reblog")).Status);
|
|
||||||
Assert.True((await alice.Client.Post($"/api/v1/statuses/{quiet.Text("id")}/favourite")).Ok().Body.Flag("favourited"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Bookmarks_are_kept_listed_and_removed()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var first = await carol.Status("worth keeping");
|
|
||||||
var second = await carol.Status("this too");
|
|
||||||
|
|
||||||
Assert.True((await alice.Client.Post($"/api/v1/statuses/{first.Text("id")}/bookmark")).Ok().Body.Flag("bookmarked"));
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{second.Text("id")}/bookmark")).Ok();
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{second.Text("id")}/bookmark")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { second.Text("id"), first.Text("id") }, (await alice.Client.Get("/api/v1/bookmarks")).Ok().Ids);
|
|
||||||
Assert.Empty((await carol.Client.Get("/api/v1/bookmarks")).Ok().Array);
|
|
||||||
var page = (await alice.Client.Get("/api/v1/bookmarks?limit=1")).Ok();
|
|
||||||
Assert.Equal(new[] { second.Text("id") }, page.Ids);
|
|
||||||
Assert.Equal(new[] { first.Text("id") }, (await alice.Client.Get(page.Link("next"))).Ok().Ids);
|
|
||||||
Assert.False((await alice.Client.Post($"/api/v1/statuses/{first.Text("id")}/unbookmark")).Ok().Body.Flag("bookmarked"));
|
|
||||||
Assert.Equal(new[] { second.Text("id") }, (await alice.Client.Get("/api/v1/bookmarks")).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Post("/api/v1/statuses/000000000000000000000000/bookmark")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Pins_take_only_the_owners_public_posts()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var mine = await alice.Status("pin me");
|
|
||||||
var quiet = await alice.Status("not this", ("visibility", "private"));
|
|
||||||
var theirs = await carol.Status("not yours");
|
|
||||||
|
|
||||||
Assert.True((await alice.Client.Post($"/api/v1/statuses/{mine.Text("id")}/pin")).Ok().Body.Flag("pinned"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post($"/api/v1/statuses/{theirs.Text("id")}/pin")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post($"/api/v1/statuses/{quiet.Text("id")}/pin")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await carol.Client.Post($"/api/v1/statuses/{quiet.Text("id")}/pin")).Status);
|
|
||||||
var featured = (await _host.ActivityPub($"/peasants/{alice.UserName}/trophies")).Ok().Body;
|
|
||||||
Assert.Equal(mine.Text("uri"), Assert.Single(featured["orderedItems"]!.AsArray()).Text("id"));
|
|
||||||
|
|
||||||
for (var i = 0; i < 4; i++)
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{(await alice.Status($"more {i}")).Text("id")}/pin")).Ok();
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post($"/api/v1/statuses/{(await alice.Status("one too many")).Text("id")}/pin")).Status);
|
|
||||||
|
|
||||||
Assert.False((await alice.Client.Post($"/api/v1/statuses/{mine.Text("id")}/unpin")).Ok().Body.Flag("pinned"));
|
|
||||||
Assert.Equal(4, (await alice.Client.Get($"/api/v1/accounts/{alice.Id}/statuses?pinned=true")).Ok().Array.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_interaction_policy_sets_who_may_quote_and_matches_the_activitypub_note()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
await _host.FollowedBy(alice, bob);
|
|
||||||
var open = await alice.Status("quotable");
|
|
||||||
var quiet = await alice.Status("followers only", ("visibility", "private"));
|
|
||||||
var scribble = $"/peasants/{alice.UserName}/scribbles/{open.Text("id")}";
|
|
||||||
string CanQuote(JsonNode note) => Assert.Single(note["interactionPolicy"]!["canQuote"]!["automaticApproval"]!.AsArray())!.GetValue<string>();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { "public" }, Strings(open["quote_approval"]!["automatic"]));
|
|
||||||
Assert.Equal(MastodonHelpers.Public, CanQuote((await _host.ActivityPub(scribble)).Ok().Body));
|
|
||||||
|
|
||||||
var followers = (await alice.Client.Put($"/api/v1/statuses/{open.Text("id")}/interaction_policy", ("quote_approval_policy", "followers"))).Ok();
|
|
||||||
Assert.Equal(new[] { "followers" }, Strings(followers.Body["quote_approval"]!["automatic"]));
|
|
||||||
Assert.Equal(alice.Uri + "/groupies", CanQuote((await _host.ActivityPub(scribble)).Ok().Body));
|
|
||||||
|
|
||||||
var nobody = (await alice.Client.Put($"/api/v1/statuses/{open.Text("id")}/interaction_policy", ("quote_approval_policy", "nobody"))).Ok();
|
|
||||||
Assert.Empty(nobody.Body["quote_approval"]!["automatic"]!.AsArray());
|
|
||||||
Assert.Equal(alice.Uri, CanQuote((await _host.ActivityPub(scribble)).Ok().Body));
|
|
||||||
|
|
||||||
var forced = (await alice.Client.Put($"/api/v1/statuses/{quiet.Text("id")}/interaction_policy", ("quote_approval_policy", "public"))).Ok();
|
|
||||||
Assert.Empty(forced.Body["quote_approval"]!["automatic"]!.AsArray());
|
|
||||||
var updates = (await bob.Delivered(since)).Where(d => d.Type() == "Update").ToList();
|
|
||||||
Assert.Equal(3, updates.Count);
|
|
||||||
Assert.Equal(alice.Uri, CanQuote(updates.Single(u => u["object"].Text("id") == quiet.Text("uri"))["object"]));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity,
|
|
||||||
(await alice.Client.Put($"/api/v1/statuses/{open.Text("id")}/interaction_policy", ("quote_approval_policy", "everyone"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound,
|
|
||||||
(await (await _host.Mastodon("other")).Client.Put($"/api/v1/statuses/{open.Text("id")}/interaction_policy", ("quote_approval_policy", "public"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_stranger_gets_404_for_followers_only_and_direct_posts()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var follower = await _host.Mastodon("follower");
|
|
||||||
var friend = await _host.Mastodon("friend");
|
|
||||||
var stranger = await _host.Mastodon("stranger");
|
|
||||||
(await follower.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
var quiet = await alice.Status("followers only", ("visibility", "private"));
|
|
||||||
var direct = await alice.Status($"@{friend.UserName} only you", ("visibility", "direct"));
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
foreach (var id in new[] { quiet.Text("id"), direct.Text("id") })
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Get($"/api/v1/statuses/{id}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Get($"/api/v1/statuses/{id}/context")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Post($"/api/v1/statuses/{id}/favourite")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Post($"/api/v1/statuses/{id}/bookmark")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Post("/api/v1/statuses", ("status", "re"), ("in_reply_to_id", id))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get($"/api/v1/statuses/{id}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await anonymous.Get($"/api/v1/statuses/{id}/favourited_by")).Status);
|
|
||||||
}
|
|
||||||
Assert.Empty((await stranger.Client.Get($"/api/v1/statuses?id[]={quiet.Text("id")}&id[]={direct.Text("id")}")).Ok().Array);
|
|
||||||
Assert.Equal(new[] { quiet.Text("id") }, (await follower.Client.Get($"/api/v1/statuses?id[]={quiet.Text("id")}&id[]={direct.Text("id")}")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { direct.Text("id") }, (await friend.Client.Get($"/api/v1/statuses?id[]={quiet.Text("id")}&id[]={direct.Text("id")}")).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await follower.Client.Get($"/api/v1/statuses/{quiet.Text("id")}/context")).Status);
|
|
||||||
Assert.Equal(quiet.Text("id"), (await follower.Client.Post("/api/v1/statuses", ("status", "re"), ("in_reply_to_id", quiet.Text("id")))).Ok().Body.Text("in_reply_to_id"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _host.ActivityPub($"/peasants/{alice.UserName}/scribbles/{quiet.Text("id")}")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_located_post_is_never_reachable_by_id_by_anyone_else()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var other = await _host.Mastodon("other");
|
|
||||||
var id = await _host.Located(alice, "the bench by the river");
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
foreach (var client in new[] { other.Client, anonymous })
|
|
||||||
{
|
|
||||||
foreach (var path in new[] { "", "/context", "/history", "/favourited_by", "/reblogged_by", "/quotes" })
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.Get($"/api/v1/statuses/{id}{path}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.Get($"/api/privapub/v1/statuses/{id}/provenance")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.Get($"/api/v1/pleroma/statuses/{id}/reactions")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await client.Get($"/api/v1/polls/{id}")).Status);
|
|
||||||
Assert.Empty((await client.Get($"/api/v1/statuses?id[]={id}")).Ok().Array);
|
|
||||||
Assert.DoesNotContain(id, (await client.Get($"/api/v1/accounts/{alice.Id}/statuses")).Ok().Ids);
|
|
||||||
}
|
|
||||||
foreach (var action in new[] { "favourite", "reblog", "bookmark", "pin" })
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Post($"/api/v1/statuses/{id}/{action}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Put($"/api/v1/pleroma/statuses/{id}/reactions/%F0%9F%91%8D")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Post("/api/v1/statuses", ("status", "re"), ("in_reply_to_id", id))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Post("/api/v1/statuses", ("status", "qt"), ("quoted_status_id", id))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _host.ActivityPub($"/peasants/{alice.UserName}/scribbles/{id}")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Creating_honours_the_idempotency_key_the_scopes_and_needs_a_recipient_for_a_direct_message()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var reader = await _host.Mastodon("reader", scopes: "read");
|
|
||||||
var key = Guid.NewGuid().ToString("N");
|
|
||||||
Task<ApiAnswer> Keyed(string text)
|
|
||||||
{
|
|
||||||
var request = new HttpRequestMessage(HttpMethod.Post, "/api/v1/statuses") { Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["status"] = text }) };
|
|
||||||
request.Headers.Add("Idempotency-Key", key);
|
|
||||||
return alice.Client.Exchange(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
var first = (await Keyed("once")).Ok();
|
|
||||||
var second = (await Keyed("once again")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(first.Body.Text("id"), second.Body.Text("id"));
|
|
||||||
Assert.Single((await alice.Client.Get($"/api/v1/accounts/{alice.Id}/statuses")).Ok().Array);
|
|
||||||
var noRecipient = await alice.Client.Post("/api/v1/statuses", ("status", "to nobody"), ("visibility", "direct"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, noRecipient.Status);
|
|
||||||
Assert.Contains("recipient", noRecipient.Body.Text("error"));
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, (await reader.Client.Post("/api/v1/statuses", ("status", "read only"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, (await reader.Client.Post($"/api/v1/statuses/{first.Body.Text("id")}/favourite")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await reader.Client.Get($"/api/v1/statuses/{first.Body.Text("id")}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Post("/api/v1/statuses", ("status", "anonymous"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Local_polls_take_one_vote_per_persona_and_never_from_their_author()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var poll = await alice.Status("pick one", ("poll[options][]", "red"), ("poll[options][]", "blue"), ("poll[expires_in]", "3600"));
|
|
||||||
var path = $"/api/v1/polls/{poll.Text("id")}";
|
|
||||||
|
|
||||||
var voted = (await carol.Client.Post(path + "/votes", ("choices[]", "1"))).Ok();
|
|
||||||
|
|
||||||
Assert.True(voted.Body.Flag("voted"));
|
|
||||||
Assert.Equal(new[] { 1 }, voted.Body["own_votes"]!.AsArray().Select(v => v!.GetValue<int>()));
|
|
||||||
Assert.Equal(1, voted.Body.Number("votes_count"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await carol.Client.Post(path + "/votes", ("choices[]", "0"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Post(path + "/votes", ("choices[]", "0"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await (await _host.Mastodon("dave")).Client.Post(path + "/votes", ("choices[]", "0"), ("choices[]", "1"))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await (await _host.Mastodon("erin")).Client.Post(path + "/votes", ("choices[]", "7"))).Status);
|
|
||||||
var anonymous = (await _host.Client().Get(path)).Ok();
|
|
||||||
Assert.Null(anonymous.Body["voted"]);
|
|
||||||
Assert.Equal(new[] { 0, 1 }, anonymous.Body["options"]!.AsArray().Select(o => o.Number("votes_count")));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_vote_on_a_remote_poll_goes_only_to_its_author_without_a_published_date()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var carol = new RemoteActor(_peer, "carol");
|
|
||||||
await _host.FollowedBy(alice, carol);
|
|
||||||
var question = await _host.PublicPostFrom(bob, alice, "<p>which?</p>", note =>
|
|
||||||
{
|
|
||||||
note["type"] = "Question";
|
|
||||||
note["oneOf"] = new JsonArray(
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "this", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = 0 } },
|
|
||||||
new JsonObject { ["type"] = "Note", ["name"] = "that", ["replies"] = new JsonObject { ["type"] = "Collection", ["totalItems"] = 0 } });
|
|
||||||
note["endTime"] = DateTime.UtcNow.AddDays(1).ToString("O");
|
|
||||||
});
|
|
||||||
|
|
||||||
var voted = (await alice.Client.Post($"/api/v1/polls/{question.ID}/votes", ("choices[]", "1"))).Ok();
|
|
||||||
|
|
||||||
Assert.True(voted.Body.Flag("voted"));
|
|
||||||
var vote = Assert.Single(await bob.Delivered(since), d => d.Type() == "Create");
|
|
||||||
Assert.Equal("that", vote["object"].Text("name"));
|
|
||||||
Assert.Equal(question.ObjectURI, vote["object"].Text("inReplyTo"));
|
|
||||||
Assert.Null(vote["object"]!["published"]);
|
|
||||||
Assert.Equal(new[] { bob.Id }, Strings(vote["object"]!["to"]));
|
|
||||||
Assert.DoesNotContain(await carol.Delivered(since), d => d.Type() == "Create");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Deleting_a_reblog_undoes_it()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var remote = await _host.PublicPostFrom(bob, alice);
|
|
||||||
var reblog = (await alice.Client.Post($"/api/v1/statuses/{remote.ID}/reblog")).Ok().Body;
|
|
||||||
|
|
||||||
(await alice.Client.Delete($"/api/v1/statuses/{reblog.Text("id")}")).Ok();
|
|
||||||
|
|
||||||
Assert.False((await alice.Client.Get($"/api/v1/statuses/{remote.ID}")).Ok().Body.Flag("reblogged"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/statuses/{reblog.Text("id")}")).Status);
|
|
||||||
var undo = Assert.Single(await bob.Delivered(since), d => d.Type() == "Undo");
|
|
||||||
Assert.Equal("Announce", undo["object"].Text("type"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Many_statuses_are_fetched_by_id_in_one_call()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var first = await alice.Status("one");
|
|
||||||
var second = await alice.Status("two");
|
|
||||||
|
|
||||||
var answer = (await _host.Client().Get($"/api/v1/statuses?id[]={first.Text("id")}&id[]={second.Text("id")}&id[]=junk")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { first.Text("id"), second.Text("id") }, answer.Ids.Order());
|
|
||||||
Assert.Empty((await _host.Client().Get("/api/v1/statuses")).Ok().Array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class MastodonTimelinesTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_home_timeline_pages_with_max_since_and_min_id()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = await _host.Mastodon("bob");
|
|
||||||
var posts = new List<string>();
|
|
||||||
for (var i = 1; i <= 4; i++)
|
|
||||||
posts.Add((await alice.Status($"post {i}")).Text("id"));
|
|
||||||
(await bob.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
var afterFollow = (await alice.Status("post 5")).Text("id");
|
|
||||||
var (p1, p2, p3, p4) = (posts[0], posts[1], posts[2], posts[3]);
|
|
||||||
|
|
||||||
var first = (await alice.Client.Get("/api/v1/timelines/home?limit=2")).Ok();
|
|
||||||
Assert.Equal(new[] { afterFollow, p4 }, first.Ids);
|
|
||||||
Assert.Equal(new[] { p3, p2 }, (await alice.Client.Get(first.Link("next"))).Ok().Ids);
|
|
||||||
Assert.Empty((await alice.Client.Get(first.Link("prev"))).Ok().Array);
|
|
||||||
Assert.Equal(new[] { p2, p1 }, (await alice.Client.Get($"/api/v1/timelines/home?max_id={p3}&limit=2")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { afterFollow, p4 }, (await alice.Client.Get($"/api/v1/timelines/home?since_id={p1}&limit=2")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { p3, p2 }, (await alice.Client.Get($"/api/v1/timelines/home?min_id={p1}&limit=2")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { p3 }, (await alice.Client.Get($"/api/v1/timelines/home?min_id={p2}&max_id={p4}")).Ok().Ids);
|
|
||||||
|
|
||||||
Assert.Equal(new[] { afterFollow }, (await bob.Client.Get("/api/v1/timelines/home")).Ok().Ids);
|
|
||||||
Assert.Equal(HttpStatusCode.Unauthorized, (await _host.Client().Get("/api/v1/timelines/home")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<List<string>> Window(HttpClient client, string filter, string since, string until)
|
|
||||||
{
|
|
||||||
var ids = new List<string>();
|
|
||||||
for (var page = 0; page < 50; page++)
|
|
||||||
{
|
|
||||||
var batch = (await client.Get($"/api/v1/timelines/public?{filter}&since_id={since}&max_id={until}&limit=40")).Ok().Ids.ToList();
|
|
||||||
if (batch.Count == 0)
|
|
||||||
break;
|
|
||||||
ids.AddRange(batch);
|
|
||||||
until = batch[^1];
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_public_timeline_splits_local_from_remote_and_leaves_out_unlisted_posts()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var since = MastodonHelpers.IdBefore(DateTime.UtcNow);
|
|
||||||
var remote = await _host.PublicPostFrom(bob, alice);
|
|
||||||
var open = (await alice.Status("hello world")).Text("id");
|
|
||||||
var unlisted = (await alice.Status("hello quietly", ("visibility", "unlisted"))).Text("id");
|
|
||||||
var until = MastodonHelpers.IdBefore(DateTime.UtcNow.AddSeconds(1));
|
|
||||||
var anonymous = _host.Client();
|
|
||||||
|
|
||||||
var everything = await Window(anonymous, "local=false", since, until);
|
|
||||||
Assert.Contains(open, everything);
|
|
||||||
Assert.Contains(remote.ID, everything);
|
|
||||||
Assert.DoesNotContain(unlisted, everything);
|
|
||||||
var local = await Window(anonymous, "local=true", since, until);
|
|
||||||
Assert.Contains(open, local);
|
|
||||||
Assert.DoesNotContain(remote.ID, local);
|
|
||||||
var federated = await Window(alice.Client, "remote=true", since, until);
|
|
||||||
Assert.Contains(remote.ID, federated);
|
|
||||||
Assert.DoesNotContain(open, federated);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_tag_timeline_is_open_to_anonymous_readers_and_shows_only_public_posts()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var tag = $"t{Guid.NewGuid():N}"[..16];
|
|
||||||
var open = (await alice.Status($"about #{tag}")).Text("id");
|
|
||||||
await alice.Status($"quietly about #{tag}", ("visibility", "unlisted"));
|
|
||||||
await alice.Status($"privately about #{tag}", ("visibility", "private"));
|
|
||||||
var later = (await alice.Status($"more about #{tag.ToUpperInvariant()}")).Text("id");
|
|
||||||
|
|
||||||
var tagged = (await _host.Client().Get($"/api/v1/timelines/tag/{tag}")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { later, open }, tagged.Ids);
|
|
||||||
Assert.Equal(new[] { later }, (await _host.Client().Get($"/api/v1/timelines/tag/{tag}?local=true&limit=1")).Ok().Ids);
|
|
||||||
Assert.Equal(new[] { later, open }, (await alice.Client.Get($"/api/v1/timelines/tag/%23{tag}")).Ok().Ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_list_timeline_is_an_empty_stub()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/timelines/list/anything")).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Favourites_list_what_the_persona_liked_newest_first()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var first = (await carol.Status("one")).Text("id");
|
|
||||||
var second = (await carol.Status("two")).Text("id");
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{first}/favourite")).Ok();
|
|
||||||
(await alice.Client.Post($"/api/v1/statuses/{second}/favourite")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(new[] { second, first }, (await alice.Client.Get("/api/v1/favourites")).Ok().Ids);
|
|
||||||
var page = (await alice.Client.Get("/api/v1/favourites?limit=1")).Ok();
|
|
||||||
Assert.Equal(new[] { second }, page.Ids);
|
|
||||||
Assert.Equal(new[] { first }, (await alice.Client.Get(page.Link("next"))).Ok().Ids);
|
|
||||||
Assert.Empty((await carol.Client.Get("/api/v1/favourites")).Ok().Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Conversations_list_direct_messages_to_their_participants_only()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = await _host.Mastodon("bob");
|
|
||||||
var stranger = await _host.Mastodon("stranger");
|
|
||||||
(await alice.Status($"@{bob.UserName} psst", ("visibility", "direct"))).Text("id");
|
|
||||||
var answer = (await bob.Status($"@{alice.UserName} what?", ("visibility", "direct"))).Text("id");
|
|
||||||
|
|
||||||
var mine = Assert.Single((await alice.Client.Get("/api/v1/conversations")).Ok().Array);
|
|
||||||
Assert.Equal(new[] { bob.Id }, mine!["accounts"]!.AsArray().Select(a => a.Text("id")));
|
|
||||||
Assert.Equal(answer, mine["last_status"].Text("id"));
|
|
||||||
var theirs = Assert.Single((await bob.Client.Get("/api/v1/conversations")).Ok().Array);
|
|
||||||
Assert.Equal(mine.Text("id"), theirs.Text("id"));
|
|
||||||
Assert.Equal(new[] { alice.Id }, theirs!["accounts"]!.AsArray().Select(a => a.Text("id")));
|
|
||||||
Assert.Empty((await stranger.Client.Get("/api/v1/conversations")).Ok().Array);
|
|
||||||
|
|
||||||
var read = (await bob.Client.Post($"/api/v1/conversations/{mine.Text("id")}/read")).Ok();
|
|
||||||
Assert.Equal(mine.Text("id"), read.Body.Text("id"));
|
|
||||||
Assert.Equal(answer, read.Body["last_status"].Text("id"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await stranger.Client.Post($"/api/v1/conversations/{mine.Text("id")}/read")).Status);
|
|
||||||
Assert.DoesNotContain(answer, (await stranger.Client.Get($"/api/v1/accounts/{bob.Id}/statuses")).Ok().Ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Markers_are_saved_versioned_and_read_back_per_timeline()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var saved = (await alice.Client.Post("/api/v1/markers", ("home[last_read_id]", "100"))).Ok();
|
|
||||||
Assert.Equal("100", saved.Body["home"].Text("last_read_id"));
|
|
||||||
Assert.Equal(1, saved.Body["home"].Number("version"));
|
|
||||||
Assert.Null(saved.Body["notifications"]);
|
|
||||||
|
|
||||||
var again = (await alice.Client.Json(HttpMethod.Post, "/api/v1/markers", new JsonObject
|
|
||||||
{
|
|
||||||
["home"] = new JsonObject { ["last_read_id"] = "200" },
|
|
||||||
["notifications"] = new JsonObject { ["last_read_id"] = "7" }
|
|
||||||
})).Ok();
|
|
||||||
Assert.Equal(("200", 2), (again.Body["home"].Text("last_read_id"), again.Body["home"].Number("version")));
|
|
||||||
Assert.Equal(("7", 1), (again.Body["notifications"].Text("last_read_id"), again.Body["notifications"].Number("version")));
|
|
||||||
|
|
||||||
var home = (await alice.Client.Get("/api/v1/markers?timeline[]=home")).Ok().Object;
|
|
||||||
Assert.Equal(new[] { "home" }, home.Select(p => p.Key));
|
|
||||||
Assert.Equal("200", home["home"].Text("last_read_id"));
|
|
||||||
Assert.Equal(new[] { "home", "notifications" }, (await alice.Client.Get("/api/v1/markers")).Ok().Object.Select(p => p.Key).Order());
|
|
||||||
Assert.Empty((await (await _host.Mastodon("other")).Client.Get("/api/v1/markers")).Ok().Object);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_notification_about_a_deleted_post_is_gone_not_null()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var post = (await alice.Status("short lived")).Text("id");
|
|
||||||
(await carol.Client.Post($"/api/v1/statuses/{post}/favourite")).Ok();
|
|
||||||
var id = Assert.Single((await alice.Client.Get("/api/v1/notifications")).Ok().Array).Text("id");
|
|
||||||
|
|
||||||
(await alice.Client.Delete($"/api/v1/statuses/{post}")).Ok();
|
|
||||||
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/notifications")).Ok().Array);
|
|
||||||
var gone = await alice.Client.Get($"/api/v1/notifications/{id}");
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, gone.Status);
|
|
||||||
Assert.Equal("Record not found", gone.Body.Text("error"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Notifications_filter_page_dismiss_and_clear()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var post = (await alice.Status("notice me")).Text("id");
|
|
||||||
(await carol.Client.Post($"/api/v1/accounts/{alice.Id}/follow")).Ok();
|
|
||||||
(await carol.Client.Post($"/api/v1/statuses/{post}/favourite")).Ok();
|
|
||||||
var mention = (await carol.Status($"hey @{alice.UserName}")).Text("id");
|
|
||||||
(await carol.Client.Post($"/api/v1/statuses/{post}/reblog")).Ok();
|
|
||||||
|
|
||||||
var all = (await alice.Client.Get("/api/v1/notifications")).Ok();
|
|
||||||
Assert.Equal(new[] { "reblog", "mention", "favourite", "follow" }, all.Array.Select(n => n.Text("type")));
|
|
||||||
Assert.All(all.Array, n => Assert.Equal(carol.Id, n!["account"].Text("id")));
|
|
||||||
Assert.Equal(mention, all.Array[1]!["status"].Text("id"));
|
|
||||||
Assert.Equal(new[] { "mention" }, (await alice.Client.Get("/api/v1/notifications?types[]=mention")).Ok().Array.Select(n => n.Text("type")));
|
|
||||||
Assert.Equal(new[] { "mention", "favourite" },
|
|
||||||
(await alice.Client.Get("/api/v1/notifications?exclude_types[]=follow&exclude_types[]=reblog")).Ok().Array.Select(n => n.Text("type")));
|
|
||||||
Assert.Equal(4, (await alice.Client.Get($"/api/v1/notifications?account_id={carol.Id}")).Ok().Array.Count);
|
|
||||||
var page = (await alice.Client.Get("/api/v1/notifications?limit=3")).Ok();
|
|
||||||
Assert.Equal(new[] { "follow" }, (await alice.Client.Get(page.Link("next"))).Ok().Array.Select(n => n.Text("type")));
|
|
||||||
Assert.Equal(4, (await alice.Client.Get("/api/v1/notifications/unread_count")).Ok().Body.Number("count"));
|
|
||||||
|
|
||||||
var followId = all.Array[3].Text("id");
|
|
||||||
Assert.Equal("follow", (await alice.Client.Get($"/api/v1/notifications/{followId}")).Ok().Body.Text("type"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await carol.Client.Get($"/api/v1/notifications/{followId}")).Status);
|
|
||||||
(await carol.Client.Post($"/api/v1/notifications/{followId}/dismiss")).Ok();
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await alice.Client.Get($"/api/v1/notifications/{followId}")).Status);
|
|
||||||
(await alice.Client.Post($"/api/v1/notifications/{followId}/dismiss")).Ok();
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Get($"/api/v1/notifications/{followId}")).Status);
|
|
||||||
Assert.Equal(3, (await alice.Client.Get("/api/v1/notifications")).Ok().Array.Count);
|
|
||||||
|
|
||||||
(await alice.Client.Post("/api/v1/notifications/clear")).Ok();
|
|
||||||
Assert.Empty((await alice.Client.Get("/api/v1/notifications")).Ok().Array);
|
|
||||||
Assert.Equal(0, (await alice.Client.Get("/api/v1/notifications/unread_count")).Ok().Body.Number("count"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Routing;
|
|
||||||
using Microsoft.AspNetCore.Routing.Patterns;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class NeverFiveHundredTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
static readonly string[] Junk = { "x", "000000000000000000000000", "%2e%2e", new string('a', 5000), "5f0c1a2b3c4d5e6f70819203" };
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
public static TheoryData<string> Credentials() => new() { "anonymous", "persona", "junk" };
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Credentials))]
|
|
||||||
public async Task No_route_answers_500_to_junk(string credentials)
|
|
||||||
{
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
var bearer = credentials switch
|
|
||||||
{
|
|
||||||
"persona" => await _host.MastodonToken(await _host.Persona(await _host.SignUp(), "junk")),
|
|
||||||
"junk" => "not-a-token",
|
|
||||||
_ => default
|
|
||||||
};
|
|
||||||
var jwt = credentials == "persona" ? (await _host.SignUp()).Jwt : bearer;
|
|
||||||
var failures = new List<string>();
|
|
||||||
|
|
||||||
foreach (var (method, template) in Routes())
|
|
||||||
foreach (var value in Junk)
|
|
||||||
{
|
|
||||||
var path = Fill(template, value);
|
|
||||||
using var request = new HttpRequestMessage(new HttpMethod(method), path);
|
|
||||||
request.Headers.Add(PrivaPubHost.ClientHeader, $"10.9.{Random.Shared.Next(256)}.{Random.Shared.Next(1, 255)}");
|
|
||||||
var auth = path.StartsWith("/api/", StringComparison.Ordinal) || path.StartsWith("/oauth/", StringComparison.Ordinal) ? bearer : jwt;
|
|
||||||
if (auth != default)
|
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", auth);
|
|
||||||
if (method is "POST" or "PUT" or "PATCH")
|
|
||||||
request.Content = new StringContent("{}", Encoding.UTF8, "application/json");
|
|
||||||
using var client = _host.Client();
|
|
||||||
HttpResponseMessage response;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
response = await client.SendAsync(request, token);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
failures.Add($"{method} {Short(path)} threw {ex.GetType().Name}: {ex.Message}");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
using (response)
|
|
||||||
{
|
|
||||||
if ((int)response.StatusCode >= 500)
|
|
||||||
failures.Add($"{method} {Short(path)} answered {(int)response.StatusCode}");
|
|
||||||
else if (path.StartsWith("/api/", StringComparison.Ordinal) && (int)response.StatusCode >= 400 && !await IsMastodonError(response))
|
|
||||||
failures.Add($"{method} {Short(path)} answered {(int)response.StatusCode} without a Mastodon error body");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.True(failures.Count == 0, $"{failures.Count} problems as {credentials}:\n" + string.Join("\n", failures.Distinct().Take(80)));
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<(string Method, string Template)> Routes()
|
|
||||||
{
|
|
||||||
var endpoints = _host.Services.GetRequiredService<EndpointDataSource>().Endpoints.OfType<RouteEndpoint>();
|
|
||||||
foreach (var endpoint in endpoints)
|
|
||||||
{
|
|
||||||
var methods = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods;
|
|
||||||
var template = "/" + endpoint.RoutePattern.RawText?.TrimStart('/');
|
|
||||||
foreach (var method in methods is { Count: > 0 } ? methods : new[] { "GET", "POST" })
|
|
||||||
yield return (method, template);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Fill(string template, string value)
|
|
||||||
{
|
|
||||||
var pattern = RoutePatternFactory.Parse(template);
|
|
||||||
var builder = new StringBuilder();
|
|
||||||
foreach (var segment in pattern.PathSegments)
|
|
||||||
{
|
|
||||||
builder.Append('/');
|
|
||||||
foreach (var part in segment.Parts)
|
|
||||||
builder.Append(part switch
|
|
||||||
{
|
|
||||||
RoutePatternLiteralPart literal => literal.Content,
|
|
||||||
RoutePatternParameterPart => value,
|
|
||||||
RoutePatternSeparatorPart separator => separator.Content,
|
|
||||||
_ => string.Empty
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return builder.Length == 0 ? "/" : builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task<bool> IsMastodonError(HttpResponseMessage response)
|
|
||||||
{
|
|
||||||
var body = await response.Content.ReadAsStringAsync();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return JsonNode.Parse(body) is JsonObject error && error["error"] is JsonValue;
|
|
||||||
}
|
|
||||||
catch (System.Text.Json.JsonException)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static string Short(string path) => path.Length > 120 ? path[..120] + "…" : path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,346 +0,0 @@
|
|||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class OAuthTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
async Task<Persona> NewPersona(string name = "oauth") => await _host.Persona(await _host.SignUp(), name);
|
|
||||||
|
|
||||||
static async Task<bool> SignedIn(HttpClient client, OAuthApp app)
|
|
||||||
{
|
|
||||||
var response = await client.GetAsync(app.ReturnUrl(), TestContext.Current.CancellationToken);
|
|
||||||
return response.StatusCode == HttpStatusCode.OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async Task AssertMastodonError(HttpResponseMessage response, HttpStatusCode status)
|
|
||||||
{
|
|
||||||
Assert.Equal(status, response.StatusCode);
|
|
||||||
Assert.False(string.IsNullOrEmpty((await response.JsonBody())["error"]?.GetValue<string>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_token_names_the_persona_and_never_the_root()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
var root = persona.Root;
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
|
|
||||||
var exchanged = await client.Exchange(app, await client.Code(app, persona));
|
|
||||||
var body = await exchanged.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, exchanged.StatusCode);
|
|
||||||
Assert.DoesNotContain(root.Id, body);
|
|
||||||
Assert.DoesNotContain(root.UserName, body);
|
|
||||||
var token = JsonNode.Parse(body)!["access_token"]!.GetValue<string>();
|
|
||||||
using var api = _host.As(token);
|
|
||||||
var account = await api.GetStringAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken);
|
|
||||||
Assert.Contains($"\"id\":\"{persona.Id}\"", account);
|
|
||||||
Assert.DoesNotContain(root.Id, account);
|
|
||||||
Assert.DoesNotContain(root.UserName, account);
|
|
||||||
|
|
||||||
var stored = await ClientApi.StoredTokens(app.ClientId);
|
|
||||||
Assert.NotEmpty(stored);
|
|
||||||
foreach (var entry in stored)
|
|
||||||
{
|
|
||||||
Assert.Equal(persona.Id, entry["subject"].AsString);
|
|
||||||
var raw = entry.ToString();
|
|
||||||
var payload = entry.Contains("payload") && entry["payload"].IsString ? ClientApi.JwtPayload(entry["payload"].AsString) : string.Empty;
|
|
||||||
Assert.DoesNotContain(root.Id, raw + payload);
|
|
||||||
Assert.DoesNotContain(root.UserName, raw + payload);
|
|
||||||
}
|
|
||||||
var access = stored.Single(t => ClientApi.IsAccessToken(t));
|
|
||||||
Assert.Equal(persona.Id, JsonNode.Parse(ClientApi.JwtPayload(access["payload"].AsString))!["sub"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_wrong_password_shows_an_error_and_signs_nobody_in()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
|
|
||||||
var response = await client.SignIn(persona.Root, app.ReturnUrl(), password: "Wrong-Pass-1!");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
Assert.Contains("That username and password do not match.", await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
Assert.DoesNotContain(response.Headers.TryGetValues("Set-Cookie", out var cookies) ? cookies : Enumerable.Empty<string>(),
|
|
||||||
c => c.StartsWith("privapub.oauth=", StringComparison.Ordinal));
|
|
||||||
var authorize = await client.GetAsync(app.ReturnUrl(), TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, authorize.StatusCode);
|
|
||||||
Assert.StartsWith("/oauth/login?", authorize.Headers.Location!.OriginalString);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_login_without_the_antiforgery_token_is_refused()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
await client.GetStringAsync("/oauth/login", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
var response = await client.Form("/oauth/login", ("returnUrl", "/oauth/authorize?x=1"), ("userName", persona.Root.UserName), ("password", persona.Root.Password));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.False(response.Headers.TryGetValues("Set-Cookie", out var cookies) && cookies.Any(c => c.StartsWith("privapub.oauth=", StringComparison.Ordinal)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("https://evil.example/oauth/authorize?client_id=x")]
|
|
||||||
[InlineData("//evil.example/oauth/authorize?client_id=x")]
|
|
||||||
[InlineData("/\\evil.example/oauth/authorize?client_id=x")]
|
|
||||||
[InlineData("/somewhere/else")]
|
|
||||||
public async Task The_return_address_never_leaves_the_site(string returnUrl)
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
|
|
||||||
var response = await client.SignIn(persona.Root, returnUrl);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
|
||||||
Assert.Equal("/oauth/authorize?signed_in=1", response.Headers.Location!.OriginalString);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Denying_answers_access_denied_and_no_code()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, (await client.SignIn(persona.Root, app.ReturnUrl())).StatusCode);
|
|
||||||
|
|
||||||
var response = await client.Choose(app, persona.Id, decision: "deny");
|
|
||||||
var page = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Null(ClientApi.CodeIn(page));
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
|
||||||
var location = response.Headers.Location!.OriginalString;
|
|
||||||
Assert.StartsWith(ClientApi.OutOfBand + "?error=access_denied", location);
|
|
||||||
Assert.DoesNotContain("code=", location);
|
|
||||||
Assert.DoesNotContain(await ClientApi.StoredTokens(app.ClientId), ClientApi.IsAccessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Choosing_another_roots_persona_shows_the_choice_again_without_a_code()
|
|
||||||
{
|
|
||||||
var mine = await NewPersona();
|
|
||||||
var theirs = await NewPersona("theirs");
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, (await client.SignIn(mine.Root, app.ReturnUrl())).StatusCode);
|
|
||||||
|
|
||||||
var response = await client.Choose(app, theirs.Id);
|
|
||||||
var page = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
Assert.Null(ClientApi.CodeIn(page));
|
|
||||||
Assert.Contains(mine.Id, page);
|
|
||||||
Assert.DoesNotContain(theirs.Id, page);
|
|
||||||
Assert.DoesNotContain(theirs.UserName, page);
|
|
||||||
Assert.DoesNotContain(await ClientApi.StoredTokens(app.ClientId), ClientApi.IsAccessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_banned_root_is_sent_back_to_the_login()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, (await client.SignIn(persona.Root, app.ReturnUrl())).StatusCode);
|
|
||||||
var choice = await client.Choice(app);
|
|
||||||
|
|
||||||
await ClientApi.Ban(persona.Root.Id);
|
|
||||||
var authorize = await client.GetAsync(app.ReturnUrl(), TestContext.Current.CancellationToken);
|
|
||||||
var chosen = await client.Decide(choice, persona.Id);
|
|
||||||
var again = await client.SignIn(persona.Root, app.ReturnUrl());
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, authorize.StatusCode);
|
|
||||||
Assert.StartsWith("/oauth/login?returnUrl=", authorize.Headers.Location!.OriginalString);
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, chosen.StatusCode);
|
|
||||||
Assert.StartsWith("/oauth/login?returnUrl=", chosen.Headers.Location!.OriginalString);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, again.StatusCode);
|
|
||||||
Assert.Contains("That username and password do not match.", await again.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_code_issued_before_a_ban_buys_no_token()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
var code = await client.Code(app, persona);
|
|
||||||
|
|
||||||
await ClientApi.Ban(persona.Root.Id);
|
|
||||||
var response = await client.Exchange(app, code);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.Equal("invalid_grant", (await response.JsonBody())["error"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Force_login_asks_for_the_password_again()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, (await client.SignIn(persona.Root, app.ReturnUrl())).StatusCode);
|
|
||||||
Assert.True(await SignedIn(client, app));
|
|
||||||
|
|
||||||
var forced = await client.GetAsync(app.ReturnUrl("force_login=true"), TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, forced.StatusCode);
|
|
||||||
var location = forced.Headers.Location!.OriginalString;
|
|
||||||
Assert.StartsWith("/oauth/login?returnUrl=", location);
|
|
||||||
var returnUrl = Uri.UnescapeDataString(location["/oauth/login?returnUrl=".Length..]);
|
|
||||||
Assert.Contains("force_login=true", returnUrl);
|
|
||||||
Assert.DoesNotContain("signed_in", returnUrl);
|
|
||||||
var signedIn = await client.SignIn(persona.Root, returnUrl);
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, signedIn.StatusCode);
|
|
||||||
Assert.EndsWith("&signed_in=1", signedIn.Headers.Location!.OriginalString);
|
|
||||||
var page = await client.GetAsync(signedIn.Headers.Location!.OriginalString, TestContext.Current.CancellationToken);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, page.StatusCode);
|
|
||||||
Assert.Contains(persona.Id, await page.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_authorization_code_works_once()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
var code = await client.Code(app, persona);
|
|
||||||
|
|
||||||
var first = await client.Exchange(app, code);
|
|
||||||
var second = await client.Exchange(app, code);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, first.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, second.StatusCode);
|
|
||||||
Assert.Equal("invalid_grant", (await second.JsonBody())["error"]!.GetValue<string>());
|
|
||||||
using var api = _host.As((await first.JsonBody())["access_token"]!.GetValue<string>());
|
|
||||||
await AssertMastodonError(await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken), HttpStatusCode.Unauthorized);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("password")]
|
|
||||||
[InlineData("refresh_token")]
|
|
||||||
public async Task Grants_other_than_code_and_client_credentials_are_refused(string grant)
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client();
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
|
|
||||||
var response = await client.Form("/oauth/token", ("grant_type", grant), ("client_id", app.ClientId), ("client_secret", app.ClientSecret),
|
|
||||||
("username", persona.Root.UserName), ("password", persona.Root.Password), ("refresh_token", "anything"), ("scope", "read"));
|
|
||||||
var body = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
|
||||||
Assert.DoesNotContain("access_token", body);
|
|
||||||
Assert.Equal("unsupported_grant_type", JsonNode.Parse(body)!["error"]!.GetValue<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_client_credentials_token_is_no_persona()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
var app = await client.RegisterApp("read write");
|
|
||||||
var response = await client.Form("/oauth/token", ("grant_type", "client_credentials"), ("client_id", app.ClientId), ("client_secret", app.ClientSecret), ("scope", "read"));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var token = (await response.JsonBody())["access_token"]!.GetValue<string>();
|
|
||||||
using var api = _host.As(token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.GetAsync("/api/v1/apps/verify_credentials", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
await AssertMastodonError(await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken), HttpStatusCode.Unauthorized);
|
|
||||||
await AssertMastodonError(await api.GetAsync("/api/v1/notifications", TestContext.Current.CancellationToken), HttpStatusCode.Unauthorized);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_read_only_token_cannot_post()
|
|
||||||
{
|
|
||||||
var token = await _host.MastodonToken(await NewPersona(), "read");
|
|
||||||
using var api = _host.As(token);
|
|
||||||
|
|
||||||
var response = await api.Form("/api/v1/statuses", ("status", "nope"));
|
|
||||||
|
|
||||||
await AssertMastodonError(response, HttpStatusCode.Forbidden);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_follow_scope_covers_reading_follows()
|
|
||||||
{
|
|
||||||
var token = await _host.MastodonToken(await NewPersona(), "follow");
|
|
||||||
using var api = _host.As(token);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.GetAsync("/api/v1/follow_requests", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.GetAsync("/api/v1/blocks", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
await AssertMastodonError(await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken), HttpStatusCode.Forbidden);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_revoked_token_stops_working()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
var token = await client.Token(app, persona);
|
|
||||||
using var api = _host.As(token);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
|
|
||||||
var revoked = await client.Form("/oauth/revoke", ("token", token), ("client_id", app.ClientId), ("client_secret", app.ClientSecret));
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, revoked.StatusCode);
|
|
||||||
await AssertMastodonError(await api.GetAsync("/api/v1/accounts/verify_credentials", TestContext.Current.CancellationToken), HttpStatusCode.Unauthorized);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_login_and_authorize_pages_are_hardened()
|
|
||||||
{
|
|
||||||
var persona = await NewPersona();
|
|
||||||
using var client = _host.Client(cookies: true);
|
|
||||||
var app = await client.RegisterApp();
|
|
||||||
|
|
||||||
var login = await client.GetAsync("/oauth/login?returnUrl=" + Uri.EscapeDataString(app.ReturnUrl()), TestContext.Current.CancellationToken);
|
|
||||||
var failed = await client.SignIn(persona.Root, app.ReturnUrl(), password: "Wrong-Pass-1!");
|
|
||||||
Assert.Equal(HttpStatusCode.Redirect, (await client.SignIn(persona.Root, app.ReturnUrl())).StatusCode);
|
|
||||||
var authorize = await client.GetAsync(app.ReturnUrl(), TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
foreach (var response in new[] { login, failed, authorize })
|
|
||||||
{
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
var csp = string.Join(";", response.Headers.GetValues("Content-Security-Policy"));
|
|
||||||
Assert.Contains("default-src 'none'", csp);
|
|
||||||
Assert.Contains("frame-ancestors 'none'", csp);
|
|
||||||
Assert.Contains("no-store", response.Headers.CacheControl!.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task The_eleventh_login_from_one_address_in_a_minute_is_refused()
|
|
||||||
{
|
|
||||||
using var client = _host.ClientAt("198.51.100.12");
|
|
||||||
for (var attempt = 1; attempt <= 10; attempt++)
|
|
||||||
Assert.Equal(HttpStatusCode.OK, (await client.GetAsync("/oauth/login", TestContext.Current.CancellationToken)).StatusCode);
|
|
||||||
|
|
||||||
var eleventh = await client.GetAsync("/oauth/login", TestContext.Current.CancellationToken);
|
|
||||||
using var elsewhere = _host.ClientAt("198.51.100.13");
|
|
||||||
var other = await elsewhere.GetAsync("/oauth/login", TestContext.Current.CancellationToken);
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.TooManyRequests, eleventh.StatusCode);
|
|
||||||
Assert.Equal(HttpStatusCode.OK, other.StatusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,261 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Routing;
|
|
||||||
using Microsoft.AspNetCore.Routing.Patterns;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels.Social;
|
|
||||||
using PrivaPub.Domain.Social;
|
|
||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Models.Social;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.Host.FederationHelpers;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed partial class PersonaSeparationHttpTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string Base = PrivaPubHost.Base;
|
|
||||||
const int MaxDocuments = 300;
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Root _root;
|
|
||||||
Persona _alpha;
|
|
||||||
Persona _bravo;
|
|
||||||
Persona _charlie;
|
|
||||||
LocalGroup _community;
|
|
||||||
string _tag;
|
|
||||||
Post _shown;
|
|
||||||
Post _poll;
|
|
||||||
List<Post> _alphaPosts;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
var token = TestContext.Current.CancellationToken;
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_root = await _host.SignUp("sep");
|
|
||||||
_alpha = await _host.Persona(_root, "sepalpha");
|
|
||||||
_bravo = await _host.Persona(_root, "sepbravo");
|
|
||||||
_charlie = await _host.Persona(await _host.SignUp(), "sepcharlie");
|
|
||||||
_community = await _host.FederatedGroup(_bravo, community: true, "sepcommunity");
|
|
||||||
_tag = $"septag{Guid.NewGuid():N}"[..14];
|
|
||||||
|
|
||||||
await _host.Publish(_bravo, "the sibling's own words", PostVisibility.FollowersOnly);
|
|
||||||
var follows = _host.Get<IFollowService>();
|
|
||||||
Assert.True((await follows.Follow(_root.Id, new FollowForm { AvatarId = _bravo.Id, Target = _charlie.UserName }, token)).IsValid);
|
|
||||||
|
|
||||||
_shown = await _host.Publish(_alpha, $"hello from alpha #{_tag}");
|
|
||||||
_poll = await _host.Publish(_alpha, new StatusDraft
|
|
||||||
{
|
|
||||||
Text = "which one?",
|
|
||||||
PlainText = true,
|
|
||||||
Poll = new PollDraft(new[] { "this", "that" }, 3600, false, false)
|
|
||||||
});
|
|
||||||
var charlieSays = await _host.Publish(_charlie, "worth sharing");
|
|
||||||
_alphaPosts = new List<Post>
|
|
||||||
{
|
|
||||||
_shown,
|
|
||||||
_poll,
|
|
||||||
await _host.Publish(_alpha, "quietly", PostVisibility.Unlisted),
|
|
||||||
await _host.Publish(_alpha, "for my followers", PostVisibility.FollowersOnly),
|
|
||||||
await _host.Publish(_alpha, $"@{_charlie.UserName} between us", PostVisibility.Direct),
|
|
||||||
await _host.PublishLocated(_alpha, "around here"),
|
|
||||||
await _host.Publish(_alpha, new StatusDraft { Text = "quoting charlie", PlainText = true, QuotedStatusId = charlieSays.ID }),
|
|
||||||
await _host.Reblog(_alpha, charlieSays)
|
|
||||||
};
|
|
||||||
await DB.Default.SaveAsync(new Pin { AvatarId = _alpha.Id, PostId = _shown.ID }, token);
|
|
||||||
Assert.True((await follows.Follow(_root.Id, new FollowForm { AvatarId = _alpha.Id, Target = _charlie.UserName }, token)).IsValid);
|
|
||||||
Assert.True((await follows.Follow(_charlie.Root.Id, new FollowForm { AvatarId = _charlie.Id, Target = _alpha.UserName }, token)).IsValid);
|
|
||||||
Assert.True((await _host.Get<IStatusService>().Favourite(await _host.Actor(_charlie), _shown.ID, true, token)).Ok);
|
|
||||||
await _host.Publish(_charlie, new StatusDraft { Text = $"@{_alpha.UserName} nice", PlainText = true, InReplyTo = _shown.ID });
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
string[] Forbidden() => new[] { _bravo.Id, _bravo.UserName, _root.Id, _root.UserName, _community.Id, _community.UserName };
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Nothing_the_api_tells_a_persona_names_its_sibling_or_its_login()
|
|
||||||
{
|
|
||||||
var bearer = await _host.MastodonToken(_alpha);
|
|
||||||
using var client = _host.As(bearer);
|
|
||||||
var notifications = await client.Fetch("/api/v1/notifications", "application/json");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, notifications.Status);
|
|
||||||
var notificationIds = JsonNode.Parse(notifications.Text)!.AsArray().Select(n => n!["id"]!.GetValue<string>()).ToList();
|
|
||||||
Assert.NotEmpty(notificationIds);
|
|
||||||
|
|
||||||
var paths = Routes().Select(Fill).Concat(new[]
|
|
||||||
{
|
|
||||||
$"/api/v2/search?q={_alpha.UserName}",
|
|
||||||
$"/api/v2/search?q={Uri.EscapeDataString($"@{_alpha.UserName}@{PrivaPubHost.Host}")}",
|
|
||||||
$"/api/v2/search?q={Uri.EscapeDataString(_alpha.ActorUri())}",
|
|
||||||
$"/api/v2/search?q={Uri.EscapeDataString(_shown.ObjectURI)}",
|
|
||||||
$"/api/v2/search?q=%23{_tag}",
|
|
||||||
$"/api/v1/accounts/search?q={_alpha.UserName}",
|
|
||||||
$"/api/v1/accounts/lookup?acct={_alpha.UserName}",
|
|
||||||
$"/api/v1/accounts/relationships?id[]={_alpha.Id}&id[]={_charlie.Id}",
|
|
||||||
$"/api/v1/accounts/familiar_followers?id[]={_charlie.Id}",
|
|
||||||
$"/api/v1/accounts/{_alpha.Id}/statuses?pinned=true",
|
|
||||||
$"/api/v1/accounts/{_alpha.Id}/statuses?exclude_replies=true&limit=40",
|
|
||||||
$"/api/v1/statuses?{string.Join("&", _alphaPosts.Select(p => "id[]=" + p.ID))}",
|
|
||||||
$"/api/v1/statuses/{_poll.ID}",
|
|
||||||
$"/api/v1/polls/{_poll.ID}",
|
|
||||||
$"/api/v1/notifications/{notificationIds[0]}",
|
|
||||||
"/api/v1/timelines/home?limit=40",
|
|
||||||
"/api/v1/timelines/public?local=true&limit=40"
|
|
||||||
}).Concat(_alphaPosts.Select(p => $"/api/v1/statuses/{p.ID}/context"))
|
|
||||||
.Distinct()
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var answered = 0;
|
|
||||||
var failures = new List<string>();
|
|
||||||
foreach (var path in paths)
|
|
||||||
{
|
|
||||||
var fetched = await client.Fetch(path, "application/json");
|
|
||||||
if ((int)fetched.Status >= 500)
|
|
||||||
failures.Add($"{path} answered {(int)fetched.Status}");
|
|
||||||
if (fetched.Status == HttpStatusCode.OK)
|
|
||||||
answered++;
|
|
||||||
foreach (var secret in Forbidden())
|
|
||||||
if (fetched.Text.Contains(secret, StringComparison.OrdinalIgnoreCase) || fetched.Response.Headers.ToString().Contains(secret, StringComparison.OrdinalIgnoreCase))
|
|
||||||
failures.Add($"{path} names {secret}: {Short(fetched.Text)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.True(failures.Count == 0, string.Join("\n", failures));
|
|
||||||
Assert.True(answered >= 40, $"only {answered} of {paths.Count} answers were 200");
|
|
||||||
var me = await client.Fetch("/api/v1/accounts/verify_credentials", "application/json");
|
|
||||||
Assert.Contains(_alpha.Id, me.Text);
|
|
||||||
Assert.Contains(_shown.ID, (await client.Fetch("/api/v1/timelines/home?limit=40", "application/json")).Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Nothing_published_about_a_persona_names_its_sibling_or_its_login()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
var seeds = new[]
|
|
||||||
{
|
|
||||||
$"/peasants/{_alpha.UserName}",
|
|
||||||
$"/users/{_alpha.UserName}",
|
|
||||||
$"/peasants/{_alpha.UserName}/anus?page=true",
|
|
||||||
$"/peasants/{_alpha.UserName}/scribbles/{_shown.ID}",
|
|
||||||
$"/peasants/{_alpha.UserName}/grunts/create-{_shown.ID}",
|
|
||||||
$"/.well-known/webfinger?resource=acct:{_alpha.UserName}@{PrivaPubHost.Host}",
|
|
||||||
"/.well-known/nodeinfo",
|
|
||||||
$"/@{_alpha.UserName}",
|
|
||||||
$"/@{_alpha.UserName}/{_shown.ID}"
|
|
||||||
};
|
|
||||||
var queue = new Queue<string>(seeds);
|
|
||||||
var seen = new HashSet<string>(seeds);
|
|
||||||
var failures = new List<string>();
|
|
||||||
var fetchedOk = 0;
|
|
||||||
|
|
||||||
while (queue.Count > 0 && seen.Count <= MaxDocuments)
|
|
||||||
{
|
|
||||||
var path = queue.Dequeue();
|
|
||||||
var html = path.StartsWith("/@", StringComparison.Ordinal);
|
|
||||||
var fetched = await client.Fetch(path, html ? Browser : path.StartsWith("/peasants/", StringComparison.Ordinal) ? ActivityJson : "application/json");
|
|
||||||
if ((int)fetched.Status >= 500)
|
|
||||||
failures.Add($"{path} answered {(int)fetched.Status}");
|
|
||||||
if (fetched.Status == HttpStatusCode.OK)
|
|
||||||
fetchedOk++;
|
|
||||||
foreach (var secret in Forbidden())
|
|
||||||
if (fetched.Text.Contains(secret, StringComparison.OrdinalIgnoreCase))
|
|
||||||
failures.Add($"{path} names {secret}: {Short(fetched.Text)}");
|
|
||||||
|
|
||||||
var links = Links(fetched.Text).ToList();
|
|
||||||
if (fetched.Location != default)
|
|
||||||
links.Add(fetched.Location.StartsWith('/') ? Base + fetched.Location : fetched.Location);
|
|
||||||
foreach (var link in links)
|
|
||||||
{
|
|
||||||
if (!link.StartsWith(Base + "/", StringComparison.Ordinal))
|
|
||||||
continue;
|
|
||||||
var next = PathOf(link.Split('#')[0]);
|
|
||||||
if (Followed(next) && seen.Add(next))
|
|
||||||
queue.Enqueue(next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.True(failures.Count == 0, string.Join("\n", failures));
|
|
||||||
Assert.Contains($"/peasants/{_alpha.UserName}/groupies", seen);
|
|
||||||
Assert.Contains($"/peasants/{_alpha.UserName}/trophies", seen);
|
|
||||||
Assert.Contains("/nodeinfo/2.1", seen);
|
|
||||||
Assert.True(fetchedOk >= 15, $"only {fetchedOk} of {seen.Count} documents were served");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Followed(string path) =>
|
|
||||||
path.StartsWith($"/peasants/{_alpha.UserName}", StringComparison.Ordinal)
|
|
||||||
|| path.StartsWith($"/@{_alpha.UserName}", StringComparison.Ordinal)
|
|
||||||
|| path.StartsWith("/.well-known/", StringComparison.Ordinal)
|
|
||||||
|| path.StartsWith("/nodeinfo/", StringComparison.Ordinal);
|
|
||||||
|
|
||||||
static IEnumerable<string> Links(string text)
|
|
||||||
{
|
|
||||||
JsonNode json = default;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
json = JsonNode.Parse(text);
|
|
||||||
}
|
|
||||||
catch (System.Text.Json.JsonException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
if (json != default)
|
|
||||||
return Strings(json);
|
|
||||||
return Href().Matches(text).Select(m => WebUtility.HtmlDecode(m.Groups[1].Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<string> Routes()
|
|
||||||
{
|
|
||||||
var endpoints = _host.Services.GetRequiredService<EndpointDataSource>().Endpoints.OfType<RouteEndpoint>();
|
|
||||||
foreach (var endpoint in endpoints)
|
|
||||||
{
|
|
||||||
var methods = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods;
|
|
||||||
var template = "/" + endpoint.RoutePattern.RawText?.TrimStart('/');
|
|
||||||
if (template.StartsWith("/api/", StringComparison.Ordinal) && methods is { } verbs && verbs.Contains("GET"))
|
|
||||||
yield return template;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string Fill(string template)
|
|
||||||
{
|
|
||||||
var builder = new StringBuilder();
|
|
||||||
foreach (var segment in RoutePatternFactory.Parse(template).PathSegments)
|
|
||||||
{
|
|
||||||
builder.Append('/');
|
|
||||||
foreach (var part in segment.Parts)
|
|
||||||
builder.Append(part switch
|
|
||||||
{
|
|
||||||
RoutePatternLiteralPart literal => literal.Content,
|
|
||||||
RoutePatternSeparatorPart separator => separator.Content,
|
|
||||||
RoutePatternParameterPart parameter => Value(template, parameter.Name),
|
|
||||||
_ => string.Empty
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
string Value(string template, string parameter) => parameter switch
|
|
||||||
{
|
|
||||||
"hashtag" => _tag,
|
|
||||||
"host" => PrivaPubHost.Host,
|
|
||||||
_ when template.StartsWith("/api/v1/statuses/", StringComparison.Ordinal)
|
|
||||||
|| template.Contains("/statuses/{id}", StringComparison.Ordinal) => _shown.ID,
|
|
||||||
_ when template.StartsWith("/api/v1/polls/", StringComparison.Ordinal) => _poll.ID,
|
|
||||||
_ => _alpha.Id
|
|
||||||
};
|
|
||||||
|
|
||||||
static string Short(string text) => text.Length > 400 ? text[..400] + "…" : text;
|
|
||||||
|
|
||||||
[GeneratedRegex("(?:href|src)=\"([^\"]+)\"")]
|
|
||||||
private static partial Regex Href();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.Models.Jobs;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class ProvenanceAndReactionsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
Peer _peer;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_peer = await Peer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
if (_peer != default)
|
|
||||||
await _peer.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CancellationToken Token => TestContext.Current.CancellationToken;
|
|
||||||
|
|
||||||
static string Provenance(string id) => $"/api/privapub/v1/statuses/{id}/provenance";
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_local_post_has_a_local_provenance()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var status = await alice.Status("made here");
|
|
||||||
|
|
||||||
var provenance = (await _host.Client().Get(Provenance(status.Text("id")))).Ok();
|
|
||||||
|
|
||||||
Assert.Equal("local", provenance.Body.Text("path"));
|
|
||||||
Assert.Equal(status.Text("uri"), provenance.Body.Text("object_uri"));
|
|
||||||
Assert.Equal(status.Text("url"), provenance.Body.Text("url"));
|
|
||||||
Assert.Null(provenance.Body["signature"]);
|
|
||||||
Assert.Null(provenance.Body["raw"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_delivered_post_shows_its_signature_and_raw_form_and_reading_it_asks_nobody()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var create = bob.Create("<p>signed and sealed</p>", new[] { MastodonHelpers.Public }, new[] { alice.Uri },
|
|
||||||
note => note["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@" + alice.UserName }));
|
|
||||||
await _host.Deliver(bob, alice.Mouth, create);
|
|
||||||
var noteId = create["object"].Text("id");
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteFirstAsync(Token);
|
|
||||||
var asked = _peer.Requests.Count;
|
|
||||||
|
|
||||||
var provenance = (await alice.Client.Get(Provenance(post.ID))).Ok().Body;
|
|
||||||
var anonymous = (await _host.Client().Get(Provenance(post.ID))).Ok().Body;
|
|
||||||
|
|
||||||
Assert.Equal("delivered", provenance.Text("path"));
|
|
||||||
Assert.Equal(noteId, provenance.Text("object_uri"));
|
|
||||||
Assert.Equal("Note", provenance.Text("object_type"));
|
|
||||||
Assert.Null(provenance["fetched_by"]);
|
|
||||||
Assert.Equal((create.Text("id"), "Create", bob.Id), (provenance["activity"].Text("id"), provenance["activity"].Text("type"), provenance["activity"].Text("actor")));
|
|
||||||
Assert.Equal(bob.KeyId, provenance["signature"].Text("key_id"));
|
|
||||||
Assert.Equal("rsa-sha256", provenance["signature"].Text("algorithm"));
|
|
||||||
Assert.Contains("digest", provenance["signature"]!["headers"]!.AsArray().Select(h => h!.GetValue<string>()));
|
|
||||||
Assert.Equal(noteId, provenance["raw"].Text("id"));
|
|
||||||
Assert.False(string.IsNullOrEmpty(provenance.Text("raw_hash")));
|
|
||||||
Assert.True(provenance.Number("raw_bytes") > 0);
|
|
||||||
Assert.NotNull(provenance.Text("received_at"));
|
|
||||||
Assert.Equal(provenance.ToJsonString(), anonymous.ToJsonString());
|
|
||||||
Assert.Equal(asked, _peer.Requests.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_fetched_parent_shows_no_signature_and_was_fetched_by_the_instance_actor()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var parentPath = $"/notes/{Guid.NewGuid():N}";
|
|
||||||
var parentId = _peer.A + parentPath;
|
|
||||||
_peer.Serve(parentPath, new JsonObject
|
|
||||||
{
|
|
||||||
["id"] = parentId,
|
|
||||||
["type"] = "Note",
|
|
||||||
["attributedTo"] = bob.Id,
|
|
||||||
["to"] = new JsonArray(MastodonHelpers.Public),
|
|
||||||
["content"] = "<p>the start of it</p>",
|
|
||||||
["published"] = DateTime.UtcNow.AddMinutes(-5).ToString("O")
|
|
||||||
}.ToJsonString());
|
|
||||||
var reply = bob.Create("<p>and a reply</p>", new[] { MastodonHelpers.Public }, new[] { alice.Uri }, note =>
|
|
||||||
{
|
|
||||||
note["inReplyTo"] = parentId;
|
|
||||||
note["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@" + alice.UserName });
|
|
||||||
});
|
|
||||||
await _host.Deliver(bob, alice.Mouth, reply);
|
|
||||||
var parent = await DB.Default.Find<Post>().Match(p => p.ObjectURI == parentId).ExecuteFirstAsync(Token);
|
|
||||||
Assert.NotNull(parent);
|
|
||||||
var asked = _peer.Requests.Count;
|
|
||||||
|
|
||||||
var provenance = (await alice.Client.Get(Provenance(parent.ID))).Ok().Body;
|
|
||||||
|
|
||||||
Assert.Equal("fetched", provenance.Text("path"));
|
|
||||||
Assert.Equal("instance-actor", provenance.Text("fetched_by"));
|
|
||||||
Assert.Null(provenance["signature"]);
|
|
||||||
Assert.Equal((reply.Text("id"), "Create"), (provenance["activity"].Text("id"), provenance["activity"].Text("type")));
|
|
||||||
Assert.Null(provenance["inbox"]);
|
|
||||||
Assert.Equal(parentId, provenance["raw"].Text("id"));
|
|
||||||
Assert.Contains(_peer.Requests, r => r.Path == parentPath && r.Signature.Contains("/peasants/privapub#main-key"));
|
|
||||||
Assert.Equal(asked, _peer.Requests.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Provenance_follows_who_may_see_the_post()
|
|
||||||
{
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var other = await _host.Mastodon("other");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var direct = bob.Create("<p>between us</p>", new[] { alice.Uri }, shape: note =>
|
|
||||||
note["tag"] = new JsonArray(new JsonObject { ["type"] = "Mention", ["href"] = alice.Uri, ["name"] = "@" + alice.UserName }));
|
|
||||||
await _host.Deliver(bob, alice.Mouth, direct);
|
|
||||||
var noteId = direct["object"].Text("id");
|
|
||||||
var post = await DB.Default.Find<Post>().Match(p => p.ObjectURI == noteId).ExecuteFirstAsync(Token);
|
|
||||||
|
|
||||||
Assert.Equal("delivered", (await alice.Client.Get(Provenance(post.ID))).Ok().Body.Text("path"));
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await other.Client.Get(Provenance(post.ID))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _host.Client().Get(Provenance(post.ID))).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _host.Client().Get(Provenance("000000000000000000000000"))).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_instance_is_described_from_what_was_stored_and_reading_it_asks_nobody()
|
|
||||||
{
|
|
||||||
var host = $"described{Guid.NewGuid():N}.example";
|
|
||||||
await DB.Default.SaveAsync(new RemoteInstance
|
|
||||||
{
|
|
||||||
Host = host,
|
|
||||||
Software = "gotosocial",
|
|
||||||
SoftwareVersion = "0.20.0",
|
|
||||||
NodeName = "a test pasture",
|
|
||||||
Protocols = new List<string> { "activitypub" },
|
|
||||||
OpenRegistrations = false,
|
|
||||||
DescribedAt = DateTime.UtcNow.AddDays(-1),
|
|
||||||
NodeInfo = "{\"software\":{\"name\":\"gotosocial\",\"version\":\"0.20.0\"}}",
|
|
||||||
ConsecutiveFailures = 2,
|
|
||||||
LastFailureAt = DateTime.UtcNow.AddHours(-1)
|
|
||||||
}, Token);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
|
|
||||||
var described = (await alice.Client.Get($"/api/privapub/v1/instances/{host.ToUpperInvariant()}")).Ok().Body;
|
|
||||||
|
|
||||||
Assert.Equal(host, described.Text("host"));
|
|
||||||
Assert.Equal(("gotosocial", "0.20.0", "a test pasture"), (described.Text("software"), described.Text("version"), described.Text("node_name")));
|
|
||||||
Assert.Equal("activitypub", Assert.Single(described["protocols"]!.AsArray())!.GetValue<string>());
|
|
||||||
Assert.False(described.Flag("open_registrations"));
|
|
||||||
Assert.Equal("gotosocial", described["node_info"]!["software"].Text("name"));
|
|
||||||
Assert.Equal(2, described["delivery"].Number("consecutive_failures"));
|
|
||||||
Assert.NotNull(described["delivery"].Text("last_failure_at"));
|
|
||||||
Assert.Null(described["delivery"]["last_success_at"]);
|
|
||||||
Assert.Equal(described.ToJsonString(), (await _host.Client().Get($"/api/privapub/v1/instances/{host}")).Ok().Body.ToJsonString());
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await _host.Client().Get($"/api/privapub/v1/instances/unknown{Guid.NewGuid():N}.example")).Status);
|
|
||||||
Assert.Empty(_peer.Requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Reacting_to_a_remote_post_federates_an_emoji_react_and_its_undo()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
var post = await _host.PublicPostFrom(bob, alice);
|
|
||||||
var path = $"/api/v1/pleroma/statuses/{post.ID}/reactions";
|
|
||||||
|
|
||||||
var reacted = (await alice.Client.Put(path + "/%F0%9F%91%8D")).Ok();
|
|
||||||
|
|
||||||
var reaction = Assert.Single(reacted.Body["emoji_reactions"]!.AsArray());
|
|
||||||
Assert.Equal(("👍", 1, true), (reaction.Text("name"), reaction.Number("count"), reaction.Flag("me")));
|
|
||||||
Assert.Equal("👍", Assert.Single(reacted.Body["pleroma"]!["emoji_reactions"]!.AsArray()).Text("name"));
|
|
||||||
(await carol.Client.Put(path + "/%F0%9F%91%8D")).Ok();
|
|
||||||
var listed = Assert.Single((await _host.Client().Get(path)).Ok().Array);
|
|
||||||
Assert.Equal(("👍", 2, false), (listed.Text("name"), listed.Number("count"), listed.Flag("me")));
|
|
||||||
Assert.Equal(new[] { alice.Id, carol.Id }.Order(), listed!["accounts"]!.AsArray().Select(a => a.Text("id")).Order());
|
|
||||||
Assert.True(Assert.Single((await alice.Client.Get(path)).Ok().Array).Flag("me"));
|
|
||||||
var react = Assert.Single(await bob.Delivered(since), d => d.Type() == "EmojiReact" && d.Text("actor") == alice.Uri);
|
|
||||||
Assert.Equal(("👍", post.ObjectURI), (react.Text("content"), react.Text("object")));
|
|
||||||
|
|
||||||
var withdrawn = (await alice.Client.Delete(path + "/%F0%9F%91%8D")).Ok();
|
|
||||||
|
|
||||||
Assert.Equal(1, Assert.Single(withdrawn.Body["emoji_reactions"]!.AsArray()).Number("count"));
|
|
||||||
var undo = Assert.Single(await bob.Delivered(since), d => d.Type() == "Undo" && d.Text("actor") == alice.Uri);
|
|
||||||
Assert.Equal(react.Text("id"), undo["object"].Text("id"));
|
|
||||||
Assert.Equal("EmojiReact", undo["object"].Text("type"));
|
|
||||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, (await alice.Client.Put(path + "/abc")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await alice.Client.Put("/api/v1/pleroma/statuses/000000000000000000000000/reactions/%F0%9F%91%8D")).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Reacting_to_a_local_post_notifies_its_author_and_federates_nothing()
|
|
||||||
{
|
|
||||||
var since = DateTime.UtcNow.AddSeconds(-1);
|
|
||||||
var alice = await _host.Mastodon("alice");
|
|
||||||
var carol = await _host.Mastodon("carol");
|
|
||||||
var bob = new RemoteActor(_peer, "bob");
|
|
||||||
await _host.FollowedBy(carol, bob);
|
|
||||||
var post = await carol.Status("react to me");
|
|
||||||
|
|
||||||
(await alice.Client.Put($"/api/v1/pleroma/statuses/{post.Text("id")}/reactions/%F0%9F%8E%89")).Ok();
|
|
||||||
|
|
||||||
var notification = Assert.Single((await carol.Client.Get("/api/v1/notifications?types[]=pleroma:emoji_reaction")).Ok().Array);
|
|
||||||
Assert.Equal(("🎉", alice.Id, post.Text("id")), (notification.Text("emoji"), notification["account"].Text("id"), notification["status"].Text("id")));
|
|
||||||
Assert.DoesNotContain(await bob.Delivered(since), d => d.Type() is "EmojiReact" or "Like");
|
|
||||||
(await alice.Client.Delete($"/api/v1/pleroma/statuses/{post.Text("id")}/reactions/%F0%9F%8E%89")).Ok();
|
|
||||||
Assert.Empty((await carol.Client.Get($"/api/v1/pleroma/statuses/{post.Text("id")}/reactions")).Ok().Array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,206 +0,0 @@
|
|||||||
using PrivaPub.Domain.Statuses;
|
|
||||||
using PrivaPub.Models.Post;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
using static PrivaPub.Tests.Support.Host.FederationHelpers;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Http
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class WellKnownTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const string Base = PrivaPubHost.Base;
|
|
||||||
const string Domain = PrivaPubHost.Host;
|
|
||||||
|
|
||||||
PrivaPubHost _host;
|
|
||||||
HttpClient _client;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
_client = _host.Client();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync()
|
|
||||||
{
|
|
||||||
_client?.Dispose();
|
|
||||||
return ValueTask.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
Task<Fetched> WebFinger(string resource) =>
|
|
||||||
_client.Fetch("/.well-known/webfinger" + (resource == default ? string.Empty : "?resource=" + Uri.EscapeDataString(resource)), "application/jrd+json");
|
|
||||||
|
|
||||||
static string Link(JsonObject document, string rel) =>
|
|
||||||
document["links"]!.AsArray().Single(l => l!["rel"]!.GetValue<string>() == rel)!["href"]!.GetValue<string>();
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task WebFinger_finds_a_persona_by_acct_and_by_actor_uri()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "finger");
|
|
||||||
var resources = new[]
|
|
||||||
{
|
|
||||||
$"acct:{persona.UserName}@{Domain}",
|
|
||||||
$"acct:@{persona.UserName}@{Domain}",
|
|
||||||
$"acct:{persona.UserName.ToUpperInvariant()}@{Domain.ToUpperInvariant()}",
|
|
||||||
$"{persona.UserName}@{Domain}",
|
|
||||||
$"@{persona.UserName}@{Domain}",
|
|
||||||
persona.ActorUri()
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var resource in resources)
|
|
||||||
{
|
|
||||||
var found = await WebFinger(resource);
|
|
||||||
Assert.True(found.Status == HttpStatusCode.OK, $"{resource} answered {(int)found.Status}");
|
|
||||||
Assert.Equal("application/jrd+json", found.MediaType);
|
|
||||||
var document = found.Json;
|
|
||||||
Assert.Equal($"acct:{persona.UserName}@{Domain}", document["subject"]!.GetValue<string>());
|
|
||||||
Assert.Equal(new[] { $"{Base}/@{persona.UserName}", persona.ActorUri() }, Strings(document["aliases"]));
|
|
||||||
Assert.Equal(persona.ActorUri(), Link(document, "self"));
|
|
||||||
Assert.Equal("application/activity+json", document["links"]!.AsArray().Single(l => l!["rel"]!.GetValue<string>() == "self")!["type"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{Base}/@{persona.UserName}", Link(document, "http://webfinger.net/rel/profile-page"));
|
|
||||||
Assert.DoesNotContain(persona.Root.Id, found.Text);
|
|
||||||
Assert.DoesNotContain(persona.Root.UserName, found.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task WebFinger_refuses_other_domains_unknown_names_and_a_missing_resource()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "nofinger");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await WebFinger($"acct:{persona.UserName}@elsewhere.example")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await WebFinger($"acct:{persona.UserName}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await WebFinger($"acct:nobody{Guid.NewGuid():N}"[..20] + "@" + Domain)).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await WebFinger($"https://elsewhere.example/peasants/{persona.UserName}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.NotFound, (await WebFinger($"acct:{persona.Root.UserName}@{Domain}")).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await WebFinger(default)).Status);
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, (await WebFinger(string.Empty)).Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task WebFinger_finds_the_instance_actor_and_a_community()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp(), "fingerowner");
|
|
||||||
var community = await _host.FederatedGroup(owner, community: true);
|
|
||||||
|
|
||||||
var instance = await WebFinger($"acct:privapub@{Domain}");
|
|
||||||
var group = await WebFinger($"acct:{community.UserName}@{Domain}");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, instance.Status);
|
|
||||||
Assert.Equal($"acct:privapub@{Domain}", instance.Json["subject"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{Base}/peasants/privapub", Link(instance.Json, "self"));
|
|
||||||
Assert.Single(instance.Json["links"]!.AsArray());
|
|
||||||
Assert.Equal(HttpStatusCode.OK, group.Status);
|
|
||||||
Assert.Equal($"acct:{community.UserName}@{Domain}", group.Json["subject"]!.GetValue<string>());
|
|
||||||
Assert.Equal(community.Uri, Link(group.Json, "self"));
|
|
||||||
Assert.DoesNotContain(owner.UserName, group.Text);
|
|
||||||
Assert.DoesNotContain(owner.Id, group.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Current behaviour, for the owner to decide: WebFinger answers for a circle, because Mastodon resolves a handle
|
|
||||||
// through WebFinger before it can send the Follow a circle takes members through, while /api/v1/accounts/lookup,
|
|
||||||
// search and the profile page do not show circles at all.
|
|
||||||
[Fact]
|
|
||||||
public async Task WebFinger_answers_for_a_circle()
|
|
||||||
{
|
|
||||||
var owner = await _host.Persona(await _host.SignUp(), "circlefinger");
|
|
||||||
var circle = await _host.FederatedGroup(owner, community: false);
|
|
||||||
|
|
||||||
var found = await WebFinger($"acct:{circle.UserName}@{Domain}");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, found.Status);
|
|
||||||
Assert.Equal(circle.Uri, Link(found.Json, "self"));
|
|
||||||
Assert.DoesNotContain(owner.UserName, found.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task NodeInfo_is_linked_and_served_in_both_versions_without_naming_anyone()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp();
|
|
||||||
var persona = await _host.Persona(root, "nodeinfo");
|
|
||||||
await _host.Publish(persona, "counted");
|
|
||||||
|
|
||||||
var links = await _client.Fetch("/.well-known/nodeinfo", "application/json");
|
|
||||||
|
|
||||||
Assert.Equal(HttpStatusCode.OK, links.Status);
|
|
||||||
Assert.Equal("application/json", links.MediaType);
|
|
||||||
var hrefs = links.Json["links"]!.AsArray().ToDictionary(l => l!["rel"]!.GetValue<string>(), l => l!["href"]!.GetValue<string>());
|
|
||||||
Assert.Equal($"{Base}/nodeinfo/2.1", hrefs["http://nodeinfo.diaspora.software/ns/schema/2.1"]);
|
|
||||||
Assert.Equal($"{Base}/nodeinfo/2.0", hrefs["http://nodeinfo.diaspora.software/ns/schema/2.0"]);
|
|
||||||
foreach (var version in new[] { "2.0", "2.1" })
|
|
||||||
{
|
|
||||||
var info = await _client.Fetch(PathOf(hrefs[$"http://nodeinfo.diaspora.software/ns/schema/{version}"]), "application/json");
|
|
||||||
Assert.Equal(HttpStatusCode.OK, info.Status);
|
|
||||||
Assert.Equal("application/json", info.MediaType);
|
|
||||||
Assert.Contains($"profile=\"http://nodeinfo.diaspora.software/ns/schema/{version}#\"", info.Response.Content.Headers.ContentType!.ToString());
|
|
||||||
var document = info.Json;
|
|
||||||
Assert.Equal(version, document["version"]!.GetValue<string>());
|
|
||||||
Assert.Equal("privapub", document["software"]!["name"]!.GetValue<string>());
|
|
||||||
Assert.Equal(version == "2.1", document["software"]!["repository"] != default);
|
|
||||||
Assert.Equal(new[] { "activitypub" }, Strings(document["protocols"]));
|
|
||||||
Assert.True(document["usage"]!["users"]!["total"]!.GetValue<long>() >= 1);
|
|
||||||
Assert.True(document["usage"]!["localPosts"]!.GetValue<long>() >= 1);
|
|
||||||
Assert.DoesNotContain(root.Id, info.Text);
|
|
||||||
Assert.DoesNotContain(root.UserName, info.Text);
|
|
||||||
Assert.DoesNotContain(persona.UserName, info.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Unknown_nodeinfo_versions_are_404()
|
|
||||||
{
|
|
||||||
foreach (var version in new[] { "1.0", "2.2", "3.0", "2.0.json", "2" })
|
|
||||||
Assert.True((await _client.Fetch($"/nodeinfo/{version}", "application/json")).Status == HttpStatusCode.NotFound, $"/nodeinfo/{version} was served");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
[Collection(nameof(Exclusive))]
|
|
||||||
public sealed class NodeInfoUsageTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
async Task<long> LocalPosts()
|
|
||||||
{
|
|
||||||
using var client = _host.Client();
|
|
||||||
return (await client.Fetch("/nodeinfo/2.1", "application/json")).Json["usage"]!["localPosts"]!.GetValue<long>();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Local_posts_count_only_what_anyone_may_see()
|
|
||||||
{
|
|
||||||
var persona = await _host.Persona(await _host.SignUp(), "usage");
|
|
||||||
var friend = await _host.Persona(await _host.SignUp(), "usagefriend");
|
|
||||||
var start = await LocalPosts();
|
|
||||||
|
|
||||||
var shown = await _host.Publish(persona, "counted");
|
|
||||||
await _host.Publish(persona, "counted too", PostVisibility.Unlisted);
|
|
||||||
Assert.Equal(start + 2, await LocalPosts());
|
|
||||||
|
|
||||||
await _host.Publish(persona, "for followers", PostVisibility.FollowersOnly);
|
|
||||||
await _host.Publish(persona, $"@{friend.UserName} between us", PostVisibility.Direct);
|
|
||||||
await _host.PublishLocated(persona, "around here");
|
|
||||||
await _host.FederatedCopy(persona);
|
|
||||||
await _host.Reblog(friend, shown);
|
|
||||||
var circle = await _host.FederatedGroup(persona, community: false);
|
|
||||||
await _host.Publish(persona, new StatusDraft { Text = "circle only", PlainText = true, GroupId = circle.Id });
|
|
||||||
Assert.Equal(start + 2, await LocalPosts());
|
|
||||||
|
|
||||||
await _host.Remove(persona, shown);
|
|
||||||
Assert.Equal(start + 1, await LocalPosts());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
using MongoDB.Entities;
|
|
||||||
|
|
||||||
using PrivaPub.ClientModels;
|
|
||||||
using PrivaPub.Infrastructure.Cli;
|
|
||||||
using PrivaPub.Models.User;
|
|
||||||
using PrivaPub.Tests.Support;
|
|
||||||
using PrivaPub.Tests.Support.Host;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace PrivaPub.Tests.Infrastructure
|
|
||||||
{
|
|
||||||
[Trait("Category", "Integration")]
|
|
||||||
public sealed class AdminCommandsTests : IAsyncLifetime
|
|
||||||
{
|
|
||||||
PrivaPubHost _host;
|
|
||||||
|
|
||||||
public async ValueTask InitializeAsync()
|
|
||||||
{
|
|
||||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
|
||||||
_host = await PrivaPubHost.Shared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
|
||||||
|
|
||||||
static async Task<List<string>> StoredPolicies(Root root) =>
|
|
||||||
(await DB.Default.Find<RootUser>().MatchID(root.Id).ExecuteFirstAsync(TestContext.Current.CancellationToken)).Policies.Order().ToList();
|
|
||||||
|
|
||||||
async Task<HttpStatusCode> AdminRoute(Root root)
|
|
||||||
{
|
|
||||||
using var client = _host.As(root.Jwt);
|
|
||||||
return (await client.GetAsync("/clientapi/admin/domainblocks/list", TestContext.Current.CancellationToken)).StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Promote_makes_an_admin_and_a_moderator()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("promote");
|
|
||||||
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "promote", root.UserName.ToUpperInvariant() }));
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "promote", root.UserName }));
|
|
||||||
|
|
||||||
Assert.Equal(new[] { Policies.IsAdmin, Policies.IsModerator, Policies.IsUser }.Order(), await StoredPolicies(root));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Demote_leaves_a_plain_user()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("demote");
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "promote", root.UserName }));
|
|
||||||
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "demote", root.UserName }));
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "demote", root.UserName }));
|
|
||||||
|
|
||||||
Assert.Equal(new[] { Policies.IsUser }, await StoredPolicies(root));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task An_unknown_root_exits_1()
|
|
||||||
{
|
|
||||||
Assert.Equal(1, await AdminCommands.Run(new[] { "promote", $"nobody{Guid.NewGuid():N}" }));
|
|
||||||
Assert.Equal(1, await AdminCommands.Run(new[] { "demote", $"nobody{Guid.NewGuid():N}" }));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TheoryData<string[]> Misuses() => new()
|
|
||||||
{
|
|
||||||
Array.Empty<string>(),
|
|
||||||
new[] { "promote" },
|
|
||||||
new[] { "promote", "a", "b" },
|
|
||||||
new[] { "delete", "a" },
|
|
||||||
new[] { "PROMOTE", "a" }
|
|
||||||
};
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Misuses))]
|
|
||||||
public async Task Misuse_exits_2(string[] args)
|
|
||||||
{
|
|
||||||
Assert.Equal(2, await AdminCommands.Run(args));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task A_token_follows_its_roots_policies_at_once()
|
|
||||||
{
|
|
||||||
var root = await _host.SignUp("policies");
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, await AdminRoute(root));
|
|
||||||
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "promote", root.UserName }));
|
|
||||||
Assert.Equal(HttpStatusCode.OK, await AdminRoute(root));
|
|
||||||
using (var client = _host.As(root.Jwt))
|
|
||||||
{
|
|
||||||
var refreshed = await (await client.GetAsync("/clientapi/user/sniff/again", TestContext.Current.CancellationToken)).JsonBody();
|
|
||||||
Assert.Contains(Policies.IsAdmin, refreshed["policies"]!.AsArray().Select(p => p!.GetValue<string>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.Equal(0, await AdminCommands.Run(new[] { "demote", root.UserName }));
|
|
||||||
Assert.Equal(HttpStatusCode.Forbidden, await AdminRoute(root));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loaded 100 of 524 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user