Address PR feedback

This commit is contained in:
SleeplessOne1917 2023-09-25 06:37:45 -04:00
parent ed8dae99f1
commit 13b20b0502
9 changed files with 16 additions and 19 deletions

1
Cargo.lock generated
View file

@ -2687,7 +2687,6 @@ version = "0.18.4"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
"actix-web-httpauth",
"async-trait", "async-trait",
"bcrypt", "bcrypt",
"chrono", "chrono",

View file

@ -83,7 +83,6 @@ actix-web = { version = "4.3.1", default-features = false, features = [
"compress-gzip", "compress-gzip",
"compress-zstd", "compress-zstd",
] } ] }
actix-web-httpauth = "0.8.1"
tracing = "0.1.37" tracing = "0.1.37"
tracing-actix-web = { version = "0.7.5", default-features = false } tracing-actix-web = { version = "0.7.5", default-features = false }
tracing-error = "0.2.0" tracing-error = "0.2.0"
@ -169,5 +168,5 @@ prometheus = { version = "0.13.3", features = ["process"], optional = true }
actix-web-prom = { version = "0.6.0", optional = true } actix-web-prom = { version = "0.6.0", optional = true }
serial_test = { workspace = true } serial_test = { workspace = true }
clap = { version = "4.3.19", features = ["derive"] } clap = { version = "4.3.19", features = ["derive"] }
actix-web-httpauth = { workspace = true } actix-web-httpauth = "0.8.1"
lemmy_federate = { version = "0.18.4", path = "crates/federate" } lemmy_federate = { version = "0.18.4", path = "crates/federate" }

View file

@ -229,7 +229,7 @@ test.skip("Remove a comment from admin and community on the same instance", asyn
test("Remove a comment from admin and community on different instance", async () => { test("Remove a comment from admin and community on different instance", async () => {
let alpha_user = await registerUser(alpha); let alpha_user = await registerUser(alpha);
let newAlphaApi = new LemmyHttp(alphaUrl, { let newAlphaApi = new LemmyHttp(alphaUrl, {
headers: { auth: alpha_user.jwt ?? "" }, headers: { Authorization: `Bearer ${alpha_user.jwt ?? ""}` },
}); });
// New alpha user creates a community, post, and comment. // New alpha user creates a community, post, and comment.

View file

@ -252,7 +252,7 @@ test("moderator view", async () => {
// register a new user with their own community on alpha and post to it // register a new user with their own community on alpha and post to it
let registerUserRes = await registerUser(alpha); let registerUserRes = await registerUser(alpha);
let otherUser = new LemmyHttp(alphaUrl, { let otherUser = new LemmyHttp(alphaUrl, {
headers: { auth: registerUserRes.jwt ?? "" }, headers: { Authorization: `Bearer ${registerUserRes.jwt ?? ""}` },
}); });
let otherCommunity = (await createCommunity(otherUser)).community_view; let otherCommunity = (await createCommunity(otherUser)).community_view;

View file

@ -382,7 +382,7 @@ test("Enforce site ban for federated user", async () => {
let alphaUserJwt = await registerUser(alpha); let alphaUserJwt = await registerUser(alpha);
expect(alphaUserJwt).toBeDefined(); expect(alphaUserJwt).toBeDefined();
let alpha_user = new LemmyHttp(alphaUrl, { let alpha_user = new LemmyHttp(alphaUrl, {
headers: { auth: alphaUserJwt.jwt ?? "" }, headers: { Authorization: `Bearer ${alphaUserJwt.jwt ?? ""}` },
}); });
let alphaUserActorId = (await getSite(alpha_user)).my_user?.local_user_view let alphaUserActorId = (await getSite(alpha_user)).my_user?.local_user_view
.person.actor_id; .person.actor_id;

View file

@ -124,11 +124,11 @@ export async function setupLogins() {
resDelta, resDelta,
resEpsilon, resEpsilon,
]); ]);
alpha.setHeaders({ auth: res[0].jwt ?? "" }); alpha.setHeaders({ Authorization: `Bearer ${res[0].jwt ?? ""}` });
beta.setHeaders({ auth: res[1].jwt ?? "" }); beta.setHeaders({ Authorization: `Bearer ${res[1].jwt ?? ""}` });
gamma.setHeaders({ auth: res[2].jwt ?? "" }); gamma.setHeaders({ Authoirzation: `Bearer ${res[2].jwt ?? ""}` });
delta.setHeaders({ auth: res[3].jwt ?? "" }); delta.setHeaders({ Authorization: `Bearer ${res[3].jwt ?? ""}` });
epsilon.setHeaders({ auth: res[4].jwt ?? "" }); epsilon.setHeaders({ Authorization: `Bearer ${res[4].jwt ?? ""}` });
// Registration applications are now enabled by default, need to disable them // Registration applications are now enabled by default, need to disable them
let editSiteForm: EditSite = { let editSiteForm: EditSite = {

View file

@ -41,7 +41,7 @@ test("Create user", async () => {
let userRes = await registerUser(alpha); let userRes = await registerUser(alpha);
expect(userRes.jwt).toBeDefined(); expect(userRes.jwt).toBeDefined();
let user = new LemmyHttp(alphaUrl, { let user = new LemmyHttp(alphaUrl, {
headers: { auth: userRes.jwt ?? "" }, headers: { Authorization: `Bearer ${userRes.jwt ?? ""}` },
}); });
let site = await getSite(user); let site = await getSite(user);
@ -63,7 +63,7 @@ test("Delete user", async () => {
let userRes = await registerUser(alpha); let userRes = await registerUser(alpha);
expect(userRes.jwt).toBeDefined(); expect(userRes.jwt).toBeDefined();
let user = new LemmyHttp(alphaUrl, { let user = new LemmyHttp(alphaUrl, {
headers: { auth: userRes.jwt ?? "" }, headers: { Authorization: `Bearer ${userRes.jwt ?? ""}` },
}); });
// make a local post and comment // make a local post and comment
@ -109,7 +109,7 @@ test("Delete user", async () => {
test("Requests with invalid auth should be treated as unauthenticated", async () => { test("Requests with invalid auth should be treated as unauthenticated", async () => {
let invalid_auth = new LemmyHttp(alphaUrl, { let invalid_auth = new LemmyHttp(alphaUrl, {
headers: { auth: "" }, headers: { Authorization: "Bearer foobar" },
}); });
let site = await getSite(invalid_auth); let site = await getSite(invalid_auth);
expect(site.my_user).toBeUndefined(); expect(site.my_user).toBeUndefined();

View file

@ -18,7 +18,6 @@ activitypub_federation = { workspace = true }
bcrypt = { workspace = true } bcrypt = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
actix-web = { workspace = true } actix-web = { workspace = true }
actix-web-httpauth = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
url = { workspace = true } url = { workspace = true }
async-trait = { workspace = true } async-trait = { workspace = true }

View file

@ -2,11 +2,11 @@ version: "3.7"
x-ui-default: &ui-default x-ui-default: &ui-default
init: true init: true
# image: dessalines/lemmy-ui:0.18.4 image: dessalines/lemmy-ui:0.18.4
# assuming lemmy-ui is cloned besides lemmy directory # assuming lemmy-ui is cloned besides lemmy directory
build: # build:
context: ../../../lemmy-ui # context: ../../../lemmy-ui
dockerfile: dev.dockerfile # dockerfile: dev.dockerfile
environment: environment:
- LEMMY_UI_HTTPS=false - LEMMY_UI_HTTPS=false