Skip to content

Commit

Permalink
Merge branch 'LemmyNet:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Oct 26, 2023
2 parents 7fc4d59 + 08739e2 commit ef64eaa
Show file tree
Hide file tree
Showing 45 changed files with 1,794 additions and 1,408 deletions.
2,303 changes: 1,219 additions & 1,084 deletions Cargo.lock

Large diffs are not rendered by default.

61 changes: 30 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ console = [
"reqwest-tracing/opentelemetry_0_16",
]
json-log = ["tracing-subscriber/json"]
prometheus-metrics = ["prometheus", "actix-web-prom"]
default = []

[workspace]
Expand Down Expand Up @@ -70,53 +69,53 @@ lemmy_routes = { version = "=0.19.0-rc.3", path = "./crates/routes" }
lemmy_db_views = { version = "=0.19.0-rc.3", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.0-rc.3", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.0-rc.3", path = "./crates/db_views_moderator" }
activitypub_federation = { version = "0.5.0-beta.3", default-features = false, features = [
activitypub_federation = { version = "0.5.0-beta.4", default-features = false, features = [
"actix-web",
] }
diesel = "2.1.0"
diesel = "2.1.3"
diesel_migrations = "2.1.0"
diesel-async = "0.3.1"
serde = { version = "1.0.167", features = ["derive"] }
serde_with = "3.0.0"
actix-web = { version = "4.3.1", default-features = false, features = [
diesel-async = "0.3.2"
serde = { version = "1.0.189", features = ["derive"] }
serde_with = "3.4.0"
actix-web = { version = "4.4.0", default-features = false, features = [
"macros",
"rustls",
"compress-brotli",
"compress-gzip",
"compress-zstd",
"cookies",
] }
tracing = "0.1.37"
tracing-actix-web = { version = "0.7.5", default-features = false }
tracing = "0.1.40"
tracing-actix-web = { version = "0.7.8", default-features = false }
tracing-error = "0.2.0"
tracing-log = "0.1.3"
tracing-log = "0.1.4"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
url = { version = "2.4.0", features = ["serde"] }
reqwest = { version = "0.11.18", features = ["json", "blocking", "gzip"] }
reqwest-middleware = "0.2.2"
reqwest-tracing = "0.4.5"
url = { version = "2.4.1", features = ["serde"] }
reqwest = { version = "0.11.22", features = ["json", "blocking", "gzip"] }
reqwest-middleware = "0.2.4"
reqwest-tracing = "0.4.6"
clokwerk = "0.4.0"
doku = { version = "0.21.1", features = ["url-2"] }
bcrypt = "0.15.0"
chrono = { version = "0.4.26", features = ["serde"], default-features = false }
serde_json = { version = "1.0.100", features = ["preserve_order"] }
base64 = "0.21.2"
uuid = { version = "1.4.0", features = ["serde", "v4"] }
async-trait = "0.1.71"
chrono = { version = "0.4.31", features = ["serde"], default-features = false }
serde_json = { version = "1.0.107", features = ["preserve_order"] }
base64 = "0.21.5"
uuid = { version = "1.5.0", features = ["serde", "v4"] }
async-trait = "0.1.74"
captcha = "0.0.9"
anyhow = { version = "1.0.71", features = [
anyhow = { version = "1.0.75", features = [
"backtrace",
] } # backtrace is on by default on nightly, but not stable rust
diesel_ltree = "0.3.0"
typed-builder = "0.15.0"
typed-builder = "0.15.2"
serial_test = "2.0.0"
tokio = { version = "1.29.1", features = ["full"] }
regex = "1.9.0"
tokio = { version = "1.33.0", features = ["full"] }
regex = "1.10.2"
once_cell = "1.18.0"
diesel-derive-newtype = "2.1.0"
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
strum = "0.25.0"
strum_macros = "0.25.1"
strum_macros = "0.25.3"
itertools = "0.11.0"
futures = "0.3.28"
http = "0.2.9"
Expand All @@ -125,11 +124,11 @@ rosetta-i18n = "0.1.3"
opentelemetry = { version = "0.19.0", features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.19.0" }
ts-rs = { version = "7.0.0", features = ["serde-compat", "chrono-impl"] }
rustls = { version = "0.21.3", features = ["dangerous_configuration"] }
rustls = { version = "0.21.8", features = ["dangerous_configuration"] }
futures-util = "0.3.28"
tokio-postgres = "0.7.8"
tokio-postgres = "0.7.10"
tokio-postgres-rustls = "0.10.0"
enum-map = "2.6"
enum-map = "2.7"

[dependencies]
lemmy_api = { workspace = true }
Expand Down Expand Up @@ -161,16 +160,16 @@ tracing-opentelemetry = { workspace = true, optional = true }
opentelemetry = { workspace = true, optional = true }
console-subscriber = { version = "0.1.10", optional = true }
opentelemetry-otlp = { version = "0.12.0", optional = true }
pict-rs = { version = "0.4.0-rc.12", optional = true }
pict-rs = { version = "0.4.5", optional = true }
tokio.workspace = true
actix-cors = "0.6.4"
rustls = { workspace = true }
futures-util = { workspace = true }
tokio-postgres = { workspace = true }
tokio-postgres-rustls = { workspace = true }
chrono = { workspace = true }
prometheus = { version = "0.13.3", features = ["process"], optional = true }
actix-web-prom = { version = "0.6.0", optional = true }
prometheus = { version = "0.13.3", features = ["process"] }
actix-web-prom = { version = "0.6.0" }
serial_test = { workspace = true }
clap = { version = "4.3.19", features = ["derive"] }
clap = { version = "4.4.7", features = ["derive"] }
actix-web-httpauth = "0.8.1"
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Message contact at join-lemmy.org for any security-related issues.
Use [Github's security advisory issue system](https://github.com/LemmyNet/lemmy/security/advisories/new).
10 changes: 5 additions & 5 deletions api_tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"api-test": "jest -i follow.spec.ts && jest -i post.spec.ts && jest -i comment.spec.ts && jest -i private_message.spec.ts && jest -i user.spec.ts && jest -i community.spec.ts"
},
"devDependencies": {
"@types/jest": "^29.5.1",
"@types/node": "^20.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.7",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.52.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.5.0",
"lemmy-js-client": "0.19.0-rc.12",
Expand Down
1 change: 0 additions & 1 deletion api_tests/src/community.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
getCommunityByName,
blockInstance,
waitUntil,
delay,
alphaUrl,
delta,
betaAllowedInstances,
Expand Down
25 changes: 24 additions & 1 deletion api_tests/src/post.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
loginUser,
} from "./shared";
import { PostView } from "lemmy-js-client/dist/types/PostView";
import { LemmyHttp } from "lemmy-js-client";
import { LemmyHttp, ResolveObject } from "lemmy-js-client";

let betaCommunity: CommunityView | undefined;

Expand Down Expand Up @@ -556,3 +556,26 @@ test("Report a post", async () => {
expect(betaReport.original_post_body).toBe(alphaReport.original_post_body);
expect(betaReport.reason).toBe(alphaReport.reason);
});

test("Fetch post via redirect", async () => {
let alphaPost = await createPost(alpha, betaCommunity!.community.id);
expect(alphaPost.post_view.post).toBeDefined();
// Make sure that post is liked on beta
const betaPost = await waitForPost(
beta,
alphaPost.post_view.post,
res => res?.counts.score === 1,
);

expect(betaPost).toBeDefined();
expect(betaPost.post?.ap_id).toBe(alphaPost.post_view.post.ap_id);

// Fetch post from url on beta instance instead of ap_id
let q = `http://lemmy-beta:8551/post/${betaPost.post.id}`;
let form: ResolveObject = {
q,
};
let gammaPost = await gamma.resolveObject(form);
expect(gammaPost).toBeDefined();
expect(gammaPost.post?.post.ap_id).toBe(alphaPost.post_view.post.ap_id);
});
30 changes: 29 additions & 1 deletion api_tests/src/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import {
saveUserSettingsFederated,
setupLogins,
alphaUrl,
saveUserSettings,
} from "./shared";
import { LemmyHttp } from "lemmy-js-client";
import { LemmyHttp, SaveUserSettings } from "lemmy-js-client";
import { GetPosts } from "lemmy-js-client/dist/types/GetPosts";

beforeAll(async () => {
Expand Down Expand Up @@ -57,6 +58,15 @@ test("Set some user settings, check that they are federated", async () => {
let alphaPerson = (await resolvePerson(alpha, apShortname)).person;
let betaPerson = (await resolvePerson(beta, apShortname)).person;
assertUserFederation(alphaPerson, betaPerson);

// Catches a bug where when only the person or local_user changed
let form: SaveUserSettings = {
theme: "test",
};
await saveUserSettings(beta, form);

let site = await getSite(beta);
expect(site.my_user?.local_user_view.local_user.theme).toBe("test");
});

test("Delete user", async () => {
Expand Down Expand Up @@ -119,3 +129,21 @@ test("Requests with invalid auth should be treated as unauthenticated", async ()
let posts = invalid_auth.getPosts(form);
expect((await posts).posts).toBeDefined();
});

test("Create user with Arabic name", async () => {
let userRes = await registerUser(alpha, "تجريب");
expect(userRes.jwt).toBeDefined();
let user = new LemmyHttp(alphaUrl, {
headers: { Authorization: `Bearer ${userRes.jwt ?? ""}` },
});

let site = await getSite(user);
expect(site.my_user).toBeDefined();
if (!site.my_user) {
throw "Missing site user";
}
apShortname = `@${site.my_user.local_user_view.person.name}@lemmy-alpha:8541`;

let alphaPerson = (await resolvePerson(alpha, apShortname)).person;
expect(alphaPerson).toBeDefined();
});
Loading

0 comments on commit ef64eaa

Please sign in to comment.