Skip to content

Commit

Permalink
Refactor code to fix default value typo in userConfig model
Browse files Browse the repository at this point in the history
  • Loading branch information
tako0614 committed Jul 30, 2024
1 parent 50dde21 commit d2d25b0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Binary file removed backgroundImages/nya.png
Binary file not shown.
2 changes: 1 addition & 1 deletion routes/api/v2/client/friends/accept/friend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export const handler = {
status: true,
}));
},
};
};
4 changes: 2 additions & 2 deletions routes/api/v2/client/friends/request/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const handler = {
}
const friendData = await Promise.all(result.friendRequester.map(async (data: any) => {
const friendData = await users.findOne({ uuid: data.userID });
if(friendData === null) {
return
if (friendData === null) {
return;
}
return {
userName: friendData.userName + "@" + data.domain,
Expand Down
12 changes: 6 additions & 6 deletions routes/api/v2/client/friends/request/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const handler = {
}
const userDomain = takos.splitUserName(userName).domain;
if (userDomain !== env["DOMAIN"]) {
console.log("imakoko")
console.log("imakoko");
//friendのuuidを取得
const response = await fetch(`https://${userDomain}/api/v2/server/information/users/uuid`, {
method: "POST",
Expand Down Expand Up @@ -102,7 +102,7 @@ export const handler = {
host: env["DOMAIN"],
body: JSON.stringify({ userid, friendid: friendId }),
signature: takos.signData(JSON.stringify({ userid, friendid: friendId }), await takos.getPrivateKey()),
}),
}),
});
const resData = await res.json();
if (resData.status === false) {
Expand All @@ -124,23 +124,23 @@ export const handler = {
status: 404,
});
}
console.log("imakoko")
console.log("imakoko");
const friendData = await friends.findOne({ user: userid });
if (friendData == null) {
return new Response(JSON.stringify({ status: false, message: "User not found" }), {
headers: { "Content-Type": "application/json" },
status: 404,
});
}
console.log("imakoko")
console.log("imakoko");
const isFriend = friendData.friends.find((friend) => friend.userid === friendInfo.uuid);
if (isFriend) {
return new Response(JSON.stringify({ status: false, message: "Already friend" }), {
headers: { "Content-Type": "application/json" },
status: 400,
});
}
console.log("imakoko")
console.log("imakoko");
if (friendData === null) {
return new Response(JSON.stringify({ status: false, message: "User not found" }), {
headers: { "Content-Type": "application/json" },
Expand Down Expand Up @@ -170,4 +170,4 @@ export const handler = {
}
},
};
//{ host: string, body: string, signature: string }
//{ host: string, body: string, signature: string }
2 changes: 1 addition & 1 deletion static/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/logo2.webp
Binary file not shown.

0 comments on commit d2d25b0

Please sign in to comment.